blob: e2497019bd8a6cb195cf461a4897d6a987192cf3 [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 const_set_serializer.java
8// Do not modify
9
10package org.projectfloodlight.openflow.protocol.ver11;
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.projectfloodlight.openflow.protocol.OFStatsRequestFlags;
27import java.util.Set;
28import org.jboss.netty.buffer.ChannelBuffer;
29import com.google.common.hash.PrimitiveSink;
30import java.util.EnumSet;
31import java.util.Collections;
32
33
34public class OFStatsRequestFlagsSerializerVer11 {
35
36
37 public static Set<OFStatsRequestFlags> readFrom(ChannelBuffer bb) throws OFParseError {
38 try {
39 return ofWireValue(bb.readShort());
40 } catch (IllegalArgumentException e) {
41 throw new OFParseError(e);
42 }
43 }
44
45 public static void writeTo(ChannelBuffer bb, Set<OFStatsRequestFlags> set) {
46 bb.writeShort(toWireValue(set));
47 }
48
49 public static void putTo(Set<OFStatsRequestFlags> set, PrimitiveSink sink) {
50 sink.putShort(toWireValue(set));
51 }
52
53
54 public static Set<OFStatsRequestFlags> ofWireValue(short val) {
55 EnumSet<OFStatsRequestFlags> set = EnumSet.noneOf(OFStatsRequestFlags.class);
56
57 return Collections.unmodifiableSet(set);
58 }
59
60 public static short toWireValue(Set<OFStatsRequestFlags> set) {
61 short wireValue = 0;
62
63 for(OFStatsRequestFlags e: set) {
64 switch(e) {
65 default:
66 throw new IllegalArgumentException("Illegal enum value for type OFStatsRequestFlags in version 1.1: " + e);
67 }
68 }
69 return wireValue;
70 }
71
72}