/home/aconway/svn/qpid/cpp/gen/qpid/framing/AccessRequestBody.h

00001 /*
00002  *
00003  * Licensed to the Apache Software Foundation (ASF) under one
00004  * or more contributor license agreements.  See the NOTICE file
00005  * distributed with this work for additional information
00006  * regarding copyright ownership.  The ASF licenses this file
00007  * to you under the Apache License, Version 2.0 (the
00008  * "License"); you may not use this file except in compliance
00009  * with the License.  You may obtain a copy of the License at
00010  * 
00011  *   http://www.apache.org/licenses/LICENSE-2.0
00012  * 
00013  * Unless required by applicable law or agreed to in writing,
00014  * software distributed under the License is distributed on an
00015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00016  * KIND, either express or implied.  See the License for the
00017  * specific language governing permissions and limitations
00018  * under the License.
00019  *
00020  */
00021 
00022 /*
00023  * This file is auto-generated by Qpid Gentools v.0.1 - do not modify.
00024  * Supported AMQP versions:
00025  *   0-9
00026  */
00027 
00028 #ifndef qpid_framing_AccessRequestBody__
00029 #define qpid_framing_AccessRequestBody__
00030 
00031 #include <string>
00032 #include <sstream>
00033 
00034 #include "qpid/framing/amqp_types.h"
00035 #include "qpid/framing/AMQRequestBody.h"
00036 #include "qpid/framing/Buffer.h"
00037 #include "qpid/framing/FieldTable.h"
00038 #include "qpid/framing/FramingContent.h"
00039 
00040 namespace qpid
00041 {
00042 namespace framing
00043 {
00044 
00045  
00046 class AccessRequestBody : public AMQRequestBody
00047 {
00048 
00049         // Method field declarations
00050 
00051     string realm;
00052     bool exclusive;
00053     bool passive;
00054     bool active;
00055     bool write;
00056     bool read;
00057      
00058 
00059 public:
00060     static const ClassId CLASS_ID= 30;
00061     static const MethodId METHOD_ID = 10;
00062 
00063     typedef boost::shared_ptr<AccessRequestBody> shared_ptr;
00064 
00065         // Constructors and destructors
00066 
00067     AccessRequestBody(ProtocolVersion version,
00068         const string& realm,
00069         bool exclusive,
00070         bool passive,
00071         bool active,
00072         bool write,
00073         bool read
00074         ) : AMQRequestBody(version), 
00075         realm(realm),
00076         exclusive(exclusive),
00077         passive(passive),
00078         active(active),
00079         write(write),
00080         read(read)
00081     { }
00082 
00083 
00084     AccessRequestBody(ProtocolVersion version): AMQRequestBody(version) {}
00085     virtual ~AccessRequestBody() {}
00086     
00087     // Attribute get methods
00088 
00089     const string& getRealm() { return realm; }
00090     bool getExclusive() { return exclusive; }
00091     bool getPassive() { return passive; }
00092     bool getActive() { return active; }
00093     bool getWrite() { return write; }
00094     bool getRead() { return read; }
00095 
00096     // Helper methods
00097     
00098     inline void print(std::ostream& out) const
00099     {
00100             printPrefix(out);
00101             out << "AccessRequest: ";
00102         out << "realm=" << realm;
00103         out << "; exclusive=" << exclusive;
00104         out << "; passive=" << passive;
00105         out << "; active=" << active;
00106         out << "; write=" << write;
00107         out << "; read=" << read;
00108     }
00109 
00110     inline ClassId amqpClassId() const { return CLASS_ID; }
00111     inline MethodId amqpMethodId() const { return METHOD_ID; }
00112 
00113     u_int32_t size() const
00114     {
00115         u_int32_t sz = baseSize();
00116         sz += 1 + realm.length(); /* realm: shortstr */
00117         sz += 1; /* Combinded bits: [exclusive, passive, active, write, read] */
00118         return sz;
00119     }
00120 
00121     void encodeContent(Buffer&  buffer) const
00122     {
00123         buffer.putShortString(realm); /* realm: shortstr */
00124         u_int8_t flags_5[1] = {0};
00125         flags_5[0] |= exclusive << 0; /* exclusive: bit */
00126         flags_5[0] |= passive << 1; /* passive: bit */
00127         flags_5[0] |= active << 2; /* active: bit */
00128         flags_5[0] |= write << 3; /* write: bit */
00129         flags_5[0] |= read << 4; /* read: bit */
00130         buffer.putOctet(flags_5[0]);
00131     }
00132 
00133     inline void decodeContent(Buffer&  buffer)
00134     {
00135         buffer.getShortString(realm); /* realm: shortstr */
00136         u_int8_t flags_5[1];
00137         flags_5[0] = buffer.getOctet();
00138         exclusive = (1 << 0) & flags_5[0]; /* exclusive: bit */
00139         passive = (1 << 1) & flags_5[0]; /* passive: bit */
00140         active = (1 << 2) & flags_5[0]; /* active: bit */
00141         write = (1 << 3) & flags_5[0]; /* write: bit */
00142         read = (1 << 4) & flags_5[0]; /* read: bit */
00143     }       
00144 
00145     void invoke(AMQP_ServerOperations& target, const MethodContext& context)
00146     {
00147         target.getAccessHandler()->request(context,
00148                     realm,
00149                     exclusive,
00150                     passive,
00151                     active,
00152                     write,
00153                     read
00154                     );
00155     }
00156 
00157 
00158 }; // class AccessRequestBody
00159 
00160 
00161 } // namespace framing
00162 } // namespace qpid
00163 
00164 #endif
00165 

Generated on Tue Apr 17 14:22:03 2007 for Qpid by  doxygen 1.4.7