blob: c8b14ee8b533267de83e981e6d395fb807f49bdb [file] [log] [blame]
tom0eb04ca2014-08-25 14:34:51 -07001// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2// Copyright (c) 2011, 2012 Open Networking Foundation
3// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4// This library was generated by the LoxiGen Compiler.
5// See the file LICENSE.txt which should have been included in the source distribution
6
7// Automatically generated by LOXI from template of_class.java
8// Do not modify
9
10package org.projectfloodlight.openflow.protocol.ver13;
11
12import org.projectfloodlight.openflow.protocol.*;
13import org.projectfloodlight.openflow.protocol.action.*;
14import org.projectfloodlight.openflow.protocol.actionid.*;
15import org.projectfloodlight.openflow.protocol.bsntlv.*;
16import org.projectfloodlight.openflow.protocol.errormsg.*;
17import org.projectfloodlight.openflow.protocol.meterband.*;
18import org.projectfloodlight.openflow.protocol.instruction.*;
19import org.projectfloodlight.openflow.protocol.instructionid.*;
20import org.projectfloodlight.openflow.protocol.match.*;
21import org.projectfloodlight.openflow.protocol.oxm.*;
22import org.projectfloodlight.openflow.protocol.queueprop.*;
23import org.projectfloodlight.openflow.types.*;
24import org.projectfloodlight.openflow.util.*;
25import org.projectfloodlight.openflow.exceptions.*;
26import org.slf4j.Logger;
27import org.slf4j.LoggerFactory;
28import java.util.Set;
29import org.jboss.netty.buffer.ChannelBuffer;
30import com.google.common.hash.PrimitiveSink;
31import com.google.common.hash.Funnel;
32
33class OFUint64Ver13 implements OFUint64 {
34 private static final Logger logger = LoggerFactory.getLogger(OFUint64Ver13.class);
35 // version: 1.3
36 final static byte WIRE_VERSION = 4;
37 final static int LENGTH = 8;
38
39 private final static U64 DEFAULT_VALUE = U64.ZERO;
40
41 // OF message fields
42 private final U64 value;
43//
44 // Immutable default instance
45 final static OFUint64Ver13 DEFAULT = new OFUint64Ver13(
46 DEFAULT_VALUE
47 );
48
49 // package private constructor - used by readers, builders, and factory
50 OFUint64Ver13(U64 value) {
51 this.value = value;
52 }
53
54 // Accessors for OF message fields
55 @Override
56 public U64 getValue() {
57 return value;
58 }
59
60 @Override
61 public OFVersion getVersion() {
62 return OFVersion.OF_13;
63 }
64
65
66
67 public OFUint64.Builder createBuilder() {
68 return new BuilderWithParent(this);
69 }
70
71 static class BuilderWithParent implements OFUint64.Builder {
72 final OFUint64Ver13 parentMessage;
73
74 // OF message fields
75 private boolean valueSet;
76 private U64 value;
77
78 BuilderWithParent(OFUint64Ver13 parentMessage) {
79 this.parentMessage = parentMessage;
80 }
81
82 @Override
83 public U64 getValue() {
84 return value;
85 }
86
87 @Override
88 public OFUint64.Builder setValue(U64 value) {
89 this.value = value;
90 this.valueSet = true;
91 return this;
92 }
93 @Override
94 public OFVersion getVersion() {
95 return OFVersion.OF_13;
96 }
97
98
99
100 @Override
101 public OFUint64 build() {
102 U64 value = this.valueSet ? this.value : parentMessage.value;
103 if(value == null)
104 throw new NullPointerException("Property value must not be null");
105
106 //
107 return new OFUint64Ver13(
108 value
109 );
110 }
111
112 }
113
114 static class Builder implements OFUint64.Builder {
115 // OF message fields
116 private boolean valueSet;
117 private U64 value;
118
119 @Override
120 public U64 getValue() {
121 return value;
122 }
123
124 @Override
125 public OFUint64.Builder setValue(U64 value) {
126 this.value = value;
127 this.valueSet = true;
128 return this;
129 }
130 @Override
131 public OFVersion getVersion() {
132 return OFVersion.OF_13;
133 }
134
135//
136 @Override
137 public OFUint64 build() {
138 U64 value = this.valueSet ? this.value : DEFAULT_VALUE;
139 if(value == null)
140 throw new NullPointerException("Property value must not be null");
141
142
143 return new OFUint64Ver13(
144 value
145 );
146 }
147
148 }
149
150
151 final static Reader READER = new Reader();
152 static class Reader implements OFMessageReader<OFUint64> {
153 @Override
154 public OFUint64 readFrom(ChannelBuffer bb) throws OFParseError {
155 U64 value = U64.ofRaw(bb.readLong());
156
157 OFUint64Ver13 uint64Ver13 = new OFUint64Ver13(
158 value
159 );
160 if(logger.isTraceEnabled())
161 logger.trace("readFrom - read={}", uint64Ver13);
162 return uint64Ver13;
163 }
164 }
165
166 public void putTo(PrimitiveSink sink) {
167 FUNNEL.funnel(this, sink);
168 }
169
170 final static OFUint64Ver13Funnel FUNNEL = new OFUint64Ver13Funnel();
171 static class OFUint64Ver13Funnel implements Funnel<OFUint64Ver13> {
172 private static final long serialVersionUID = 1L;
173 @Override
174 public void funnel(OFUint64Ver13 message, PrimitiveSink sink) {
175 message.value.putTo(sink);
176 }
177 }
178
179
180 public void writeTo(ChannelBuffer bb) {
181 WRITER.write(bb, this);
182 }
183
184 final static Writer WRITER = new Writer();
185 static class Writer implements OFMessageWriter<OFUint64Ver13> {
186 @Override
187 public void write(ChannelBuffer bb, OFUint64Ver13 message) {
188 bb.writeLong(message.value.getValue());
189
190
191 }
192 }
193
194 @Override
195 public String toString() {
196 StringBuilder b = new StringBuilder("OFUint64Ver13(");
197 b.append("value=").append(value);
198 b.append(")");
199 return b.toString();
200 }
201
202 @Override
203 public boolean equals(Object obj) {
204 if (this == obj)
205 return true;
206 if (obj == null)
207 return false;
208 if (getClass() != obj.getClass())
209 return false;
210 OFUint64Ver13 other = (OFUint64Ver13) obj;
211
212 if (value == null) {
213 if (other.value != null)
214 return false;
215 } else if (!value.equals(other.value))
216 return false;
217 return true;
218 }
219
220 @Override
221 public int hashCode() {
222 final int prime = 31;
223 int result = 1;
224
225 result = prime * result + ((value == null) ? 0 : value.hashCode());
226 return result;
227 }
228
229}