blob: 8fecd3ec3e545853deddca4145ce30f93bc66646 [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 OFBsnDebugCounterStatsEntryVer13 implements OFBsnDebugCounterStatsEntry {
34 private static final Logger logger = LoggerFactory.getLogger(OFBsnDebugCounterStatsEntryVer13.class);
35 // version: 1.3
36 final static byte WIRE_VERSION = 4;
37 final static int LENGTH = 16;
38
39 private final static U64 DEFAULT_COUNTER_ID = U64.ZERO;
40 private final static U64 DEFAULT_VALUE = U64.ZERO;
41
42 // OF message fields
43 private final U64 counterId;
44 private final U64 value;
45//
46 // Immutable default instance
47 final static OFBsnDebugCounterStatsEntryVer13 DEFAULT = new OFBsnDebugCounterStatsEntryVer13(
48 DEFAULT_COUNTER_ID, DEFAULT_VALUE
49 );
50
51 // package private constructor - used by readers, builders, and factory
52 OFBsnDebugCounterStatsEntryVer13(U64 counterId, U64 value) {
53 this.counterId = counterId;
54 this.value = value;
55 }
56
57 // Accessors for OF message fields
58 @Override
59 public U64 getCounterId() {
60 return counterId;
61 }
62
63 @Override
64 public U64 getValue() {
65 return value;
66 }
67
68 @Override
69 public OFVersion getVersion() {
70 return OFVersion.OF_13;
71 }
72
73
74
75 public OFBsnDebugCounterStatsEntry.Builder createBuilder() {
76 return new BuilderWithParent(this);
77 }
78
79 static class BuilderWithParent implements OFBsnDebugCounterStatsEntry.Builder {
80 final OFBsnDebugCounterStatsEntryVer13 parentMessage;
81
82 // OF message fields
83 private boolean counterIdSet;
84 private U64 counterId;
85 private boolean valueSet;
86 private U64 value;
87
88 BuilderWithParent(OFBsnDebugCounterStatsEntryVer13 parentMessage) {
89 this.parentMessage = parentMessage;
90 }
91
92 @Override
93 public U64 getCounterId() {
94 return counterId;
95 }
96
97 @Override
98 public OFBsnDebugCounterStatsEntry.Builder setCounterId(U64 counterId) {
99 this.counterId = counterId;
100 this.counterIdSet = true;
101 return this;
102 }
103 @Override
104 public U64 getValue() {
105 return value;
106 }
107
108 @Override
109 public OFBsnDebugCounterStatsEntry.Builder setValue(U64 value) {
110 this.value = value;
111 this.valueSet = true;
112 return this;
113 }
114 @Override
115 public OFVersion getVersion() {
116 return OFVersion.OF_13;
117 }
118
119
120
121 @Override
122 public OFBsnDebugCounterStatsEntry build() {
123 U64 counterId = this.counterIdSet ? this.counterId : parentMessage.counterId;
124 if(counterId == null)
125 throw new NullPointerException("Property counterId must not be null");
126 U64 value = this.valueSet ? this.value : parentMessage.value;
127 if(value == null)
128 throw new NullPointerException("Property value must not be null");
129
130 //
131 return new OFBsnDebugCounterStatsEntryVer13(
132 counterId,
133 value
134 );
135 }
136
137 }
138
139 static class Builder implements OFBsnDebugCounterStatsEntry.Builder {
140 // OF message fields
141 private boolean counterIdSet;
142 private U64 counterId;
143 private boolean valueSet;
144 private U64 value;
145
146 @Override
147 public U64 getCounterId() {
148 return counterId;
149 }
150
151 @Override
152 public OFBsnDebugCounterStatsEntry.Builder setCounterId(U64 counterId) {
153 this.counterId = counterId;
154 this.counterIdSet = true;
155 return this;
156 }
157 @Override
158 public U64 getValue() {
159 return value;
160 }
161
162 @Override
163 public OFBsnDebugCounterStatsEntry.Builder setValue(U64 value) {
164 this.value = value;
165 this.valueSet = true;
166 return this;
167 }
168 @Override
169 public OFVersion getVersion() {
170 return OFVersion.OF_13;
171 }
172
173//
174 @Override
175 public OFBsnDebugCounterStatsEntry build() {
176 U64 counterId = this.counterIdSet ? this.counterId : DEFAULT_COUNTER_ID;
177 if(counterId == null)
178 throw new NullPointerException("Property counterId must not be null");
179 U64 value = this.valueSet ? this.value : DEFAULT_VALUE;
180 if(value == null)
181 throw new NullPointerException("Property value must not be null");
182
183
184 return new OFBsnDebugCounterStatsEntryVer13(
185 counterId,
186 value
187 );
188 }
189
190 }
191
192
193 final static Reader READER = new Reader();
194 static class Reader implements OFMessageReader<OFBsnDebugCounterStatsEntry> {
195 @Override
196 public OFBsnDebugCounterStatsEntry readFrom(ChannelBuffer bb) throws OFParseError {
197 U64 counterId = U64.ofRaw(bb.readLong());
198 U64 value = U64.ofRaw(bb.readLong());
199
200 OFBsnDebugCounterStatsEntryVer13 bsnDebugCounterStatsEntryVer13 = new OFBsnDebugCounterStatsEntryVer13(
201 counterId,
202 value
203 );
204 if(logger.isTraceEnabled())
205 logger.trace("readFrom - read={}", bsnDebugCounterStatsEntryVer13);
206 return bsnDebugCounterStatsEntryVer13;
207 }
208 }
209
210 public void putTo(PrimitiveSink sink) {
211 FUNNEL.funnel(this, sink);
212 }
213
214 final static OFBsnDebugCounterStatsEntryVer13Funnel FUNNEL = new OFBsnDebugCounterStatsEntryVer13Funnel();
215 static class OFBsnDebugCounterStatsEntryVer13Funnel implements Funnel<OFBsnDebugCounterStatsEntryVer13> {
216 private static final long serialVersionUID = 1L;
217 @Override
218 public void funnel(OFBsnDebugCounterStatsEntryVer13 message, PrimitiveSink sink) {
219 message.counterId.putTo(sink);
220 message.value.putTo(sink);
221 }
222 }
223
224
225 public void writeTo(ChannelBuffer bb) {
226 WRITER.write(bb, this);
227 }
228
229 final static Writer WRITER = new Writer();
230 static class Writer implements OFMessageWriter<OFBsnDebugCounterStatsEntryVer13> {
231 @Override
232 public void write(ChannelBuffer bb, OFBsnDebugCounterStatsEntryVer13 message) {
233 bb.writeLong(message.counterId.getValue());
234 bb.writeLong(message.value.getValue());
235
236
237 }
238 }
239
240 @Override
241 public String toString() {
242 StringBuilder b = new StringBuilder("OFBsnDebugCounterStatsEntryVer13(");
243 b.append("counterId=").append(counterId);
244 b.append(", ");
245 b.append("value=").append(value);
246 b.append(")");
247 return b.toString();
248 }
249
250 @Override
251 public boolean equals(Object obj) {
252 if (this == obj)
253 return true;
254 if (obj == null)
255 return false;
256 if (getClass() != obj.getClass())
257 return false;
258 OFBsnDebugCounterStatsEntryVer13 other = (OFBsnDebugCounterStatsEntryVer13) obj;
259
260 if (counterId == null) {
261 if (other.counterId != null)
262 return false;
263 } else if (!counterId.equals(other.counterId))
264 return false;
265 if (value == null) {
266 if (other.value != null)
267 return false;
268 } else if (!value.equals(other.value))
269 return false;
270 return true;
271 }
272
273 @Override
274 public int hashCode() {
275 final int prime = 31;
276 int result = 1;
277
278 result = prime * result + ((counterId == null) ? 0 : counterId.hashCode());
279 result = prime * result + ((value == null) ? 0 : value.hashCode());
280 return result;
281 }
282
283}