blob: 7d332b7f0ba3f16292da06aa1d7f7fccec527337 [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 OFBsnGentableBucketStatsEntryVer13 implements OFBsnGentableBucketStatsEntry {
34 private static final Logger logger = LoggerFactory.getLogger(OFBsnGentableBucketStatsEntryVer13.class);
35 // version: 1.3
36 final static byte WIRE_VERSION = 4;
37 final static int LENGTH = 16;
38
39 private final static U128 DEFAULT_CHECKSUM = U128.ZERO;
40
41 // OF message fields
42 private final U128 checksum;
43//
44 // Immutable default instance
45 final static OFBsnGentableBucketStatsEntryVer13 DEFAULT = new OFBsnGentableBucketStatsEntryVer13(
46 DEFAULT_CHECKSUM
47 );
48
49 // package private constructor - used by readers, builders, and factory
50 OFBsnGentableBucketStatsEntryVer13(U128 checksum) {
51 this.checksum = checksum;
52 }
53
54 // Accessors for OF message fields
55 @Override
56 public U128 getChecksum() {
57 return checksum;
58 }
59
60 @Override
61 public OFVersion getVersion() {
62 return OFVersion.OF_13;
63 }
64
65
66
67 public OFBsnGentableBucketStatsEntry.Builder createBuilder() {
68 return new BuilderWithParent(this);
69 }
70
71 static class BuilderWithParent implements OFBsnGentableBucketStatsEntry.Builder {
72 final OFBsnGentableBucketStatsEntryVer13 parentMessage;
73
74 // OF message fields
75 private boolean checksumSet;
76 private U128 checksum;
77
78 BuilderWithParent(OFBsnGentableBucketStatsEntryVer13 parentMessage) {
79 this.parentMessage = parentMessage;
80 }
81
82 @Override
83 public U128 getChecksum() {
84 return checksum;
85 }
86
87 @Override
88 public OFBsnGentableBucketStatsEntry.Builder setChecksum(U128 checksum) {
89 this.checksum = checksum;
90 this.checksumSet = true;
91 return this;
92 }
93 @Override
94 public OFVersion getVersion() {
95 return OFVersion.OF_13;
96 }
97
98
99
100 @Override
101 public OFBsnGentableBucketStatsEntry build() {
102 U128 checksum = this.checksumSet ? this.checksum : parentMessage.checksum;
103 if(checksum == null)
104 throw new NullPointerException("Property checksum must not be null");
105
106 //
107 return new OFBsnGentableBucketStatsEntryVer13(
108 checksum
109 );
110 }
111
112 }
113
114 static class Builder implements OFBsnGentableBucketStatsEntry.Builder {
115 // OF message fields
116 private boolean checksumSet;
117 private U128 checksum;
118
119 @Override
120 public U128 getChecksum() {
121 return checksum;
122 }
123
124 @Override
125 public OFBsnGentableBucketStatsEntry.Builder setChecksum(U128 checksum) {
126 this.checksum = checksum;
127 this.checksumSet = true;
128 return this;
129 }
130 @Override
131 public OFVersion getVersion() {
132 return OFVersion.OF_13;
133 }
134
135//
136 @Override
137 public OFBsnGentableBucketStatsEntry build() {
138 U128 checksum = this.checksumSet ? this.checksum : DEFAULT_CHECKSUM;
139 if(checksum == null)
140 throw new NullPointerException("Property checksum must not be null");
141
142
143 return new OFBsnGentableBucketStatsEntryVer13(
144 checksum
145 );
146 }
147
148 }
149
150
151 final static Reader READER = new Reader();
152 static class Reader implements OFMessageReader<OFBsnGentableBucketStatsEntry> {
153 @Override
154 public OFBsnGentableBucketStatsEntry readFrom(ChannelBuffer bb) throws OFParseError {
155 U128 checksum = U128.read16Bytes(bb);
156
157 OFBsnGentableBucketStatsEntryVer13 bsnGentableBucketStatsEntryVer13 = new OFBsnGentableBucketStatsEntryVer13(
158 checksum
159 );
160 if(logger.isTraceEnabled())
161 logger.trace("readFrom - read={}", bsnGentableBucketStatsEntryVer13);
162 return bsnGentableBucketStatsEntryVer13;
163 }
164 }
165
166 public void putTo(PrimitiveSink sink) {
167 FUNNEL.funnel(this, sink);
168 }
169
170 final static OFBsnGentableBucketStatsEntryVer13Funnel FUNNEL = new OFBsnGentableBucketStatsEntryVer13Funnel();
171 static class OFBsnGentableBucketStatsEntryVer13Funnel implements Funnel<OFBsnGentableBucketStatsEntryVer13> {
172 private static final long serialVersionUID = 1L;
173 @Override
174 public void funnel(OFBsnGentableBucketStatsEntryVer13 message, PrimitiveSink sink) {
175 message.checksum.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<OFBsnGentableBucketStatsEntryVer13> {
186 @Override
187 public void write(ChannelBuffer bb, OFBsnGentableBucketStatsEntryVer13 message) {
188 message.checksum.write16Bytes(bb);
189
190
191 }
192 }
193
194 @Override
195 public String toString() {
196 StringBuilder b = new StringBuilder("OFBsnGentableBucketStatsEntryVer13(");
197 b.append("checksum=").append(checksum);
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 OFBsnGentableBucketStatsEntryVer13 other = (OFBsnGentableBucketStatsEntryVer13) obj;
211
212 if (checksum == null) {
213 if (other.checksum != null)
214 return false;
215 } else if (!checksum.equals(other.checksum))
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 + ((checksum == null) ? 0 : checksum.hashCode());
226 return result;
227 }
228
229}