You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2010/04/09 05:53:31 UTC

svn commit: r932236 - in /qpid/trunk/qpid/cpp: include/qpid/amqp_0_10/ include/qpid/framing/ include/qpid/management/ managementgen/qmfgen/ managementgen/qmfgen/templates/ src/ src/qpid/amqp_0_10/ src/qpid/management/

Author: tross
Date: Fri Apr  9 03:53:30 2010
New Revision: 932236

URL: http://svn.apache.org/viewvc?rev=932236&view=rev
Log:
QPID-2489 - Remove references to boost:: and qpid::framing:: from QMF-generated cpp files

Added a wrapper class for framing::Buffer in the qpid::management namespace.  This wrapper class
has no reference to framing or boost and is now used in the generated C++ code to encode
QMFv1 content.

Added:
    qpid/trunk/qpid/cpp/include/qpid/management/Buffer.h
    qpid/trunk/qpid/cpp/src/qpid/management/Buffer.cpp
Modified:
    qpid/trunk/qpid/cpp/include/qpid/amqp_0_10/Codecs.h
    qpid/trunk/qpid/cpp/include/qpid/framing/Buffer.h
    qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml
    qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py
    qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Args.h
    qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Class.cpp
    qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Event.cpp
    qpid/trunk/qpid/cpp/src/Makefile.am
    qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp

Modified: qpid/trunk/qpid/cpp/include/qpid/amqp_0_10/Codecs.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/amqp_0_10/Codecs.h?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/amqp_0_10/Codecs.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/amqp_0_10/Codecs.h Fri Apr  9 03:53:30 2010
@@ -40,6 +40,7 @@ class QPID_COMMON_EXTERN MapCodec
     typedef qpid::types::Variant::Map ObjectType;
     static void encode(const ObjectType&, std::string&);
     static void decode(const std::string&, ObjectType&);
+    static size_t encodedSize(const ObjectType&);
     static const std::string contentType;
   private:
 };
@@ -54,6 +55,7 @@ class QPID_COMMON_EXTERN ListCodec
     typedef qpid::types::Variant::List ObjectType;
     static void encode(const ObjectType&, std::string&);
     static void decode(const std::string&, ObjectType&);
+    static size_t encodedSize(const ObjectType&);
     static const std::string contentType;
   private:
 };

Modified: qpid/trunk/qpid/cpp/include/qpid/framing/Buffer.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/framing/Buffer.h?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/framing/Buffer.h (original)
+++ qpid/trunk/qpid/cpp/include/qpid/framing/Buffer.h Fri Apr  9 03:53:30 2010
@@ -75,6 +75,7 @@ class Buffer
     QPID_COMMON_EXTERN uint32_t available() { return size - position; }
     QPID_COMMON_EXTERN uint32_t getSize() { return size; }
     QPID_COMMON_EXTERN uint32_t getPosition() { return position; }
+    QPID_COMMON_EXTERN void setPosition(uint32_t p) { position = p; }
     QPID_COMMON_EXTERN Iterator getIterator() { return Iterator(*this); }
     QPID_COMMON_EXTERN char* getPointer() { return data; }
 

Added: qpid/trunk/qpid/cpp/include/qpid/management/Buffer.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/include/qpid/management/Buffer.h?rev=932236&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/include/qpid/management/Buffer.h (added)
+++ qpid/trunk/qpid/cpp/include/qpid/management/Buffer.h Fri Apr  9 03:53:30 2010
@@ -0,0 +1,106 @@
+#ifndef _Management_Buffer_
+#define _Management_Buffer_
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+#include "qpid/Exception.h"
+#include "qpid/CommonImportExport.h"
+#include "qpid/types/Variant.h"
+#include <string>
+
+namespace qpid {
+namespace framing {
+    class Buffer;
+}
+
+namespace management {
+
+struct OutOfBounds : qpid::Exception {
+    OutOfBounds() : qpid::Exception(std::string("Out of Bounds")) {}
+};
+
+
+/**
+ * This class is a wrapper around qpid::framing::Buffer that does not include any dependencies
+ * from boost or from qpid::framing.
+ */
+class Buffer
+{
+public:
+    QPID_COMMON_EXTERN Buffer(char* data=0, uint32_t size=0);
+    QPID_COMMON_EXTERN ~Buffer();
+
+    QPID_COMMON_EXTERN void record();
+    QPID_COMMON_EXTERN void restore(bool reRecord = false);
+    QPID_COMMON_EXTERN void reset();
+
+    QPID_COMMON_EXTERN uint32_t available();
+    QPID_COMMON_EXTERN uint32_t getSize();
+    QPID_COMMON_EXTERN uint32_t getPosition();
+    QPID_COMMON_EXTERN char* getPointer();
+
+    QPID_COMMON_EXTERN void putOctet(uint8_t i);
+    QPID_COMMON_EXTERN void putShort(uint16_t i);
+    QPID_COMMON_EXTERN void putLong(uint32_t i);
+    QPID_COMMON_EXTERN void putLongLong(uint64_t i);
+    QPID_COMMON_EXTERN void putInt8(int8_t i);
+    QPID_COMMON_EXTERN void putInt16(int16_t i);
+    QPID_COMMON_EXTERN void putInt32(int32_t i);
+    QPID_COMMON_EXTERN void putInt64(int64_t i);
+    QPID_COMMON_EXTERN void putFloat(float f);
+    QPID_COMMON_EXTERN void putDouble(double f);
+    QPID_COMMON_EXTERN void putBin128(const uint8_t* b);
+
+    QPID_COMMON_EXTERN uint8_t  getOctet();
+    QPID_COMMON_EXTERN uint16_t getShort();
+    QPID_COMMON_EXTERN uint32_t getLong();
+    QPID_COMMON_EXTERN uint64_t getLongLong();
+    QPID_COMMON_EXTERN int8_t   getInt8();
+    QPID_COMMON_EXTERN int16_t  getInt16();
+    QPID_COMMON_EXTERN int32_t  getInt32();
+    QPID_COMMON_EXTERN int64_t  getInt64();
+    QPID_COMMON_EXTERN float    getFloat();
+    QPID_COMMON_EXTERN double   getDouble();
+
+    QPID_COMMON_EXTERN void putShortString(const std::string& s);
+    QPID_COMMON_EXTERN void putMediumString(const std::string& s);
+    QPID_COMMON_EXTERN void putLongString(const std::string& s);
+    QPID_COMMON_EXTERN void getShortString(std::string& s);
+    QPID_COMMON_EXTERN void getMediumString(std::string& s);
+    QPID_COMMON_EXTERN void getLongString(std::string& s);
+    QPID_COMMON_EXTERN void getBin128(uint8_t* b);
+
+    QPID_COMMON_EXTERN void putMap(const types::Variant::Map& map);
+    QPID_COMMON_EXTERN void putList(const types::Variant::List& list);
+    QPID_COMMON_EXTERN void getMap(types::Variant::Map& map);
+    QPID_COMMON_EXTERN void getList(types::Variant::List& list);
+
+    QPID_COMMON_EXTERN void putRawData(const std::string& s);
+    QPID_COMMON_EXTERN void getRawData(std::string& s, uint32_t size);
+
+    QPID_COMMON_EXTERN void putRawData(const uint8_t* data, size_t size);
+    QPID_COMMON_EXTERN void getRawData(uint8_t* data, size_t size);
+
+private:
+    framing::Buffer* impl;
+};
+
+}} // namespace qpid::management
+
+#endif

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/management-types.xml Fri Apr  9 03:53:30 2010
@@ -24,9 +24,9 @@
 -->
 
 <type name="objId"     base="REF"       cpp="::qpid::management::ObjectId"  
- encode="{std::string _s; #.encode(_s); @.putRawData(_s);}"
- decode="{std::string _s; @.getRawData(_s, #.encodedSize()); #.decode(_s);}"
-stream="#.getV2Key()" size="16" accessor="direct" init="::qpid::management::ObjectId()" byRef="y"/>
+      encode="{std::string _s; #.encode(_s); @.putRawData(_s);}"
+      decode="{std::string _s; @.getRawData(_s, #.encodedSize()); #.decode(_s);}"
+      stream="#.getV2Key()" size="16" accessor="direct" init="::qpid::management::ObjectId()" byRef="y"/>
 <type name="uint8"     base="U8"        cpp="uint8_t"       encode="@.putOctet(#)"       decode="# = @.getOctet()"     stream="#" size="1" accessor="direct" init="0"/>
 <type name="uint16"    base="U16"       cpp="uint16_t"      encode="@.putShort(#)"       decode="# = @.getShort()"     stream="#" size="2" accessor="direct" init="0"/>
 <type name="uint32"    base="U32"       cpp="uint32_t"      encode="@.putLong(#)"        decode="# = @.getLong()"      stream="#" size="4" accessor="direct" init="0"/>
@@ -43,18 +43,21 @@ stream="#.getV2Key()" size="16" accessor
 <type name="float"     base="FLOAT"     cpp="float"         encode="@.putFloat(#)"       decode="# = @.getFloat()"     stream="#" size="4" accessor="direct" init="0."/>
 <type name="double"    base="DOUBLE"    cpp="double"        encode="@.putDouble(#)"      decode="# = @.getDouble()"    stream="#" size="8" accessor="direct" init="0."/>
 <type name="uuid"      base="UUID"      cpp="::qpid::types::Uuid"
- encode="{::qpid::framing::Uuid _u(#.data()); _u.encode(@); }"
- decode="{::qpid::framing::Uuid _u; _u.decode(@); # = ::qpid::types::Uuid(_u.data());}"
- stream="#" size="16" accessor="direct" init="::qpid::types::Uuid()" byRef="y" unmap="(#).asUuid().data()" map="::qpid::types::Uuid((#).data())" />
+      encode="@.putRawData(#.data(), 16)"
+      decode="{ unsigned char d[16]; @.getRawData(d, 16); # = ::qpid::types::Uuid(d); }"
+      stream="#" size="16" accessor="direct" init="::qpid::types::Uuid()" byRef="y"
+      unmap="(#).asUuid().data()"
+      map="::qpid::types::Uuid((#).data())" />
 <type name="map"       base="FTABLE"    cpp="::qpid::types::Variant::Map" 
- encode="{::qpid::framing::FieldTable _f = ManagementAgent::fromMap(#); _f.encode(@);}"
- decode="{::qpid::framing::FieldTable _f; _f.decode(@); # = ManagementAgent::toMap(_f);}"
- size="::qpid::framing::FieldTable(ManagementAgent::fromMap(#)).encodedSize()"
-stream="#" accessor="direct" init="::qpid::types::Variant::Map()" byRef="y" unmap="::qpid::types::Variant::Map(); assert(false); /*TBD*/"/>
+      encode="@.putMap(#)"
+      decode="@.getMap(#)"
+      size="::qpid::amqp_0_10::MapCodec::encodedSize(#)"
+      stream="#" accessor="direct" init="::qpid::types::Variant::Map()" byRef="y" unmap="::qpid::types::Variant::Map(); assert(false); /*TBD*/"/>
 <type name="list"      base="LIST"      cpp="::qpid::types::Variant::List" 
- encode="{::qpid::framing::List _l = ManagementAgent::fromList(#); _l.encode(@);}"
- decode="{::qpid::framing::List _l; _l.decode(@); # = ManagementAgent::toList(_l);}"
-stream="#" size="#.encodedSize()" accessor="direct" init="::qpid::types::Variant::List()" byRef="y" unmap="::qpid::types::Variant::List(); assert(false); /*TBD*/"/>
+      encode="@.putList(#)"
+      decode="@.getList(#)"
+      size="::qpid::amqp_0_10::ListCodec::encodedSize(#)"
+      stream="#" accessor="direct" init="::qpid::types::Variant::List()" byRef="y" unmap="::qpid::types::Variant::List(); assert(false); /*TBD*/"/>
 
 <type name="hilo8"   base="U8"   cpp="uint8_t"  encode="@.putOctet(#)"    decode="# = @.getOctet()"    style="wm" stream="#" size="1" accessor="counter" init="0"/>
 <type name="hilo16"  base="U16"  cpp="uint16_t" encode="@.putShort(#)"    decode="# = @.getShort()"    style="wm" stream="#" size="2" accessor="counter" init="0"/>

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/schema.py Fri Apr  9 03:53:30 2010
@@ -425,22 +425,22 @@ class SchemaProperty:
 
   def genSchema (self, stream):
     stream.write ("    ft.clear();\n")
-    stream.write ("    ft.setString (NAME, \"" + self.name + "\");\n")
-    stream.write ("    ft.setInt    (TYPE, TYPE_" + self.type.type.base +");\n")
-    stream.write ("    ft.setInt    (ACCESS, ACCESS_" + self.access + ");\n")
-    stream.write ("    ft.setInt    (IS_INDEX, " + str (self.isIndex) + ");\n")
-    stream.write ("    ft.setInt    (IS_OPTIONAL, " + str (self.isOptional) + ");\n")
+    stream.write ("    ft[NAME] = \"" + self.name + "\";\n")
+    stream.write ("    ft[TYPE] = TYPE_" + self.type.type.base +";\n")
+    stream.write ("    ft[ACCESS] = ACCESS_" + self.access + ";\n")
+    stream.write ("    ft[IS_INDEX] = " + str (self.isIndex) + ";\n")
+    stream.write ("    ft[IS_OPTIONAL] = " + str (self.isOptional) + ";\n")
     if self.unit != None:
-      stream.write ("    ft.setString (UNIT,   \"" + self.unit   + "\");\n")
+      stream.write ("    ft[UNIT] = \"" + self.unit   + "\";\n")
     if self.min != None:
-      stream.write ("    ft.setInt    (MIN,    " + self.min    + ");\n")
+      stream.write ("    ft[MIN] = " + self.min    + ";\n")
     if self.max != None:
-      stream.write ("    ft.setInt    (MAX,    " + self.max    + ");\n")
+      stream.write ("    ft[MAX] = " + self.max    + ";\n")
     if self.maxLen != None:
-      stream.write ("    ft.setInt    (MAXLEN, " + self.maxLen + ");\n")
+      stream.write ("    ft[MAXLEN] = " + self.maxLen + ";\n")
     if self.desc != None:
-      stream.write ("    ft.setString (DESC,   \"" + self.desc   + "\");\n")
-    stream.write ("    buf.put (ft);\n\n")
+      stream.write ("    ft[DESC] = \"" + self.desc   + "\";\n")
+    stream.write ("    buf.putMap(ft);\n\n")
 
 
   def genSchemaMap(self, stream):
@@ -594,13 +594,13 @@ class SchemaStatistic:
 
   def genSchemaText (self, stream, name, desc):
     stream.write ("    ft.clear();\n")
-    stream.write ("    ft.setString (NAME,   \"" + name + "\");\n")
-    stream.write ("    ft.setInt    (TYPE,   TYPE_" + self.type.type.base +");\n")
+    stream.write ("    ft[NAME] = \"" + name + "\";\n")
+    stream.write ("    ft[TYPE] = TYPE_" + self.type.type.base +";\n")
     if self.unit != None:
-      stream.write ("    ft.setString (UNIT,   \"" + self.unit   + "\");\n")
+      stream.write ("    ft[UNIT] = \"" + self.unit   + "\";\n")
     if desc != None:
-      stream.write ("    ft.setString (DESC,   \"" + desc   + "\");\n")
-    stream.write ("    buf.put (ft);\n\n")
+      stream.write ("    ft[DESC] = \"" + desc   + "\";\n")
+    stream.write ("    buf.putMap(ft);\n\n")
 
   def genSchemaTextMap(self, stream, name, desc):
     stream.write ("    {\n")
@@ -782,24 +782,24 @@ class SchemaArg:
 
   def genSchema (self, stream, event=False):
     stream.write ("    ft.clear();\n")
-    stream.write ("    ft.setString (NAME,    \"" + self.name + "\");\n")
-    stream.write ("    ft.setInt    (TYPE,    TYPE_" + self.type.type.base +");\n")
+    stream.write ("    ft[NAME] = \"" + self.name + "\";\n")
+    stream.write ("    ft[TYPE] = TYPE_" + self.type.type.base +";\n")
     if (not event):
-      stream.write ("    ft.setString (DIR,     \"" + self.dir + "\");\n")
+      stream.write ("    ft[DIR] = \"" + self.dir + "\";\n")
     if self.unit != None:
-      stream.write ("    ft.setString (UNIT,    \"" + self.unit   + "\");\n")
+      stream.write ("    ft[UNIT] = \"" + self.unit + "\";\n")
     if not event:
       if self.min != None:
-        stream.write ("    ft.setInt    (MIN,     " + self.min    + ");\n")
+        stream.write ("    ft[MIN] = " + self.min + ";\n")
       if self.max != None:
-        stream.write ("    ft.setInt    (MAX,     " + self.max    + ");\n")
+        stream.write ("    ft[MAX] = " + self.max + ";\n")
       if self.maxLen != None:
-        stream.write ("    ft.setInt    (MAXLEN,  " + self.maxLen + ");\n")
+        stream.write ("    ft[MAXLEN] = " + self.maxLen + ";\n")
       if self.default != None:
-        stream.write ("    ft.setString (DEFAULT, \"" + self.default + "\");\n")
+        stream.write ("    ft[DEFAULT] = \"" + self.default + "\";\n")
     if self.desc != None:
-      stream.write ("    ft.setString (DESC,    \"" + self.desc + "\");\n")
-    stream.write ("    buf.put (ft);\n\n")
+      stream.write ("    ft[DESC] = \"" + self.desc + "\";\n")
+    stream.write ("    buf.putMap(ft);\n\n")
 
   def genSchemaMap (self, stream, event=False):
     stream.write ("        {\n")
@@ -896,11 +896,11 @@ class SchemaMethod:
 
   def genSchema (self, stream, variables):
     stream.write ("    ft.clear();\n")
-    stream.write ("    ft.setString (NAME,     \"" + self.name + "\");\n")
-    stream.write ("    ft.setInt    (ARGCOUNT, " + str (len (self.args)) + ");\n")
+    stream.write ("    ft[NAME] =  \"" + self.name + "\";\n")
+    stream.write ("    ft[ARGCOUNT] = " + str (len (self.args)) + ";\n")
     if self.desc != None:
-      stream.write ("    ft.setString (DESC,     \"" + self.desc + "\");\n")
-    stream.write ("    buf.put (ft);\n\n")
+      stream.write ("    ft[DESC] = \"" + self.desc + "\";\n")
+    stream.write ("    buf.putMap(ft);\n\n")
     for arg in self.args:
       arg.genSchema (stream)
 
@@ -1349,7 +1349,7 @@ class SchemaClass:
         stream.write("\n")
         stream.write("    char *_tmpBuf = new char[inStr.length()];\n")
         stream.write("    memcpy(_tmpBuf, inStr.data(), inStr.length());\n")
-        stream.write("    ::qpid::framing::Buffer inBuf(_tmpBuf, inStr.length());\n")
+        stream.write("    ::qpid::management::Buffer inBuf(_tmpBuf, inStr.length());\n")
 
     for method in self.methods:
       stream.write ("\n    if (methodName == \"" + method.getName () + "\") {\n")

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Args.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Args.h?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Args.h (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Args.h Fri Apr  9 03:53:30 2010
@@ -24,8 +24,6 @@
 /*MGEN:Root.Disclaimer*/
 
 #include "qpid/management/Args.h"
-//#include "qpid/framing/FieldTable.h"
-//#include "qpid/framing/Uuid.h"
 #include <string>
 
 namespace qmf { 

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Class.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Class.cpp?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Class.cpp (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Class.cpp Fri Apr  9 03:53:30 2010
@@ -22,8 +22,9 @@
 
 #include "qpid/log/Statement.h"
 #include "qpid/management/Manageable.h"
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/Buffer.h"
+#include "qpid/management/Buffer.h"
+#include "qpid/types/Variant.h"
+#include "qpid/amqp_0_10/Codecs.h"
 #include "qpid//*MGEN:Class.AgentHeaderLocation*//ManagementAgent.h"
 #include "/*MGEN:Class.NameCap*/.h"
 /*MGEN:Class.MethodArgIncludes*/
@@ -94,8 +95,8 @@ void /*MGEN:Class.NameCap*/::writeSchema
 {
     const int _bufSize=65536;
     char _msgChars[_bufSize];
-    ::qpid::framing::Buffer buf(_msgChars, _bufSize);
-    ::qpid::framing::FieldTable ft;
+    ::qpid::management::Buffer buf(_msgChars, _bufSize);
+    ::qpid::types::Variant::Map ft;
 
     // Schema class header:
     buf.putOctet       (CLASS_KIND_TABLE);
@@ -147,7 +148,7 @@ void /*MGEN:Class.NameCap*/::readPropert
 {
     char *_tmpBuf = new char[_sBuf.length()];
     memcpy(_tmpBuf, _sBuf.data(), _sBuf.length());
-    ::qpid::framing::Buffer buf(_tmpBuf, _sBuf.length());
+    ::qpid::management::Buffer buf(_tmpBuf, _sBuf.length());
     ::qpid::sys::Mutex::ScopedLock mutex(accessLock);
 
     {
@@ -169,7 +170,7 @@ void /*MGEN:Class.NameCap*/::writeProper
 {
     const int _bufSize=65536;
     char _msgChars[_bufSize];
-    ::qpid::framing::Buffer buf(_msgChars, _bufSize);
+    ::qpid::management::Buffer buf(_msgChars, _bufSize);
 
     ::qpid::sys::Mutex::ScopedLock mutex(accessLock);
     configChanged = false;
@@ -197,7 +198,7 @@ void /*MGEN:Class.NameCap*/::writeStatis
 {
     const int _bufSize=65536;
     char _msgChars[_bufSize];
-    ::qpid::framing::Buffer buf(_msgChars, _bufSize);
+    ::qpid::management::Buffer buf(_msgChars, _bufSize);
 
     ::qpid::sys::Mutex::ScopedLock mutex(accessLock);
     instChanged = false;
@@ -248,7 +249,7 @@ void /*MGEN:Class.NameCap*/::doMethod (/
 
     const int _bufSize=65536;
     char _msgChars[_bufSize];
-    ::qpid::framing::Buffer outBuf(_msgChars, _bufSize);
+    ::qpid::management::Buffer outBuf(_msgChars, _bufSize);
 
 /*MGEN:Class.MethodHandlers*/
 

Modified: qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Event.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Event.cpp?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Event.cpp (original)
+++ qpid/trunk/qpid/cpp/managementgen/qmfgen/templates/Event.cpp Fri Apr  9 03:53:30 2010
@@ -22,8 +22,9 @@
 
 #include "qpid/log/Statement.h"
 #include "qpid/management/Manageable.h" 
-#include "qpid/framing/FieldTable.h"
-#include "qpid/framing/Buffer.h"
+#include "qpid/management/Buffer.h"
+#include "qpid/types/Variant.h"
+#include "qpid/amqp_0_10/Codecs.h"
 #include "qpid//*MGEN:Event.AgentHeaderLocation*//ManagementAgent.h"
 #include "Event/*MGEN:Event.NameCap*/.h"
 
@@ -60,8 +61,8 @@ void Event/*MGEN:Event.NameCap*/::writeS
 {
     const int _bufSize = 65536;
     char _msgChars[_bufSize];
-    ::qpid::framing::Buffer buf(_msgChars, _bufSize);
-    ::qpid::framing::FieldTable ft;
+    ::qpid::management::Buffer buf(_msgChars, _bufSize);
+    ::qpid::types::Variant::Map ft;
 
     // Schema class header:
     buf.putOctet       (CLASS_KIND_EVENT);
@@ -83,7 +84,7 @@ void Event/*MGEN:Event.NameCap*/::encode
 {
     const int _bufSize=65536;
     char _msgChars[_bufSize];
-    ::qpid::framing::Buffer buf(_msgChars, _bufSize);
+    ::qpid::management::Buffer buf(_msgChars, _bufSize);
 
 /*MGEN:Event.ArgEncodes*/
 

Modified: qpid/trunk/qpid/cpp/src/Makefile.am
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/Makefile.am?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/Makefile.am (original)
+++ qpid/trunk/qpid/cpp/src/Makefile.am Fri Apr  9 03:53:30 2010
@@ -420,6 +420,7 @@ libqpidcommon_la_SOURCES +=			\
   qpid/log/OstreamOutput.h			\
   qpid/log/Selector.cpp				\
   qpid/log/Statement.cpp			\
+  qpid/management/Buffer.cpp			\
   qpid/management/Manageable.cpp		\
   qpid/management/ManagementObject.cpp		\
   qpid/memory.h					\
@@ -799,6 +800,7 @@ nobase_include_HEADERS +=			\
   ../include/qpid/log/SinkOptions.h		\
   ../include/qpid/log/Statement.h		\
   ../include/qpid/management/Args.h		\
+  ../include/qpid/management/Buffer.h		\
   ../include/qpid/management/Manageable.h	\
   ../include/qpid/management/ManagementEvent.h	\
   ../include/qpid/management/ManagementObject.h	\

Modified: qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp?rev=932236&r1=932235&r2=932236&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp Fri Apr  9 03:53:30 2010
@@ -301,6 +301,13 @@ void MapCodec::decode(const std::string&
     _decode<FieldTable>(data, value, &toVariantMapEntry);
 }
 
+size_t MapCodec::encodedSize(const Variant::Map& value)
+{
+    std::string encoded;
+    encode(value, encoded);
+    return encoded.size();
+}
+
 void ListCodec::encode(const Variant::List& value, std::string& data)
 {
     _encode<List>(value, data, &toFieldValue);
@@ -311,6 +318,13 @@ void ListCodec::decode(const std::string
     _decode<List>(data, value, &toVariant);
 }
 
+size_t ListCodec::encodedSize(const Variant::List& value)
+{
+    std::string encoded;
+    encode(value, encoded);
+    return encoded.size();
+}
+
 void translate(const Variant::Map& from, FieldTable& to)
 {
     convert(from, to, &toFieldTableEntry);

Added: qpid/trunk/qpid/cpp/src/qpid/management/Buffer.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/management/Buffer.cpp?rev=932236&view=auto
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/management/Buffer.cpp (added)
+++ qpid/trunk/qpid/cpp/src/qpid/management/Buffer.cpp Fri Apr  9 03:53:30 2010
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "qpid/management/Buffer.h"
+#include "qpid/framing/Buffer.h"
+#include "qpid/amqp_0_10/Codecs.h"
+
+using namespace std;
+using namespace qpid::management;
+
+Buffer::Buffer(char* data, uint32_t size) : impl(new framing::Buffer(data, size)) {}
+Buffer::~Buffer() { delete impl; }
+void Buffer::record() { impl->record(); }
+void Buffer::restore(bool reRecord) { impl->restore(reRecord); }
+void Buffer::reset() { impl->reset(); }
+uint32_t Buffer::available() { return impl->available(); }
+uint32_t Buffer::getSize() { return impl->getSize(); }
+uint32_t Buffer::getPosition() { return impl->getPosition(); }
+char* Buffer::getPointer() { return impl->getPointer(); }
+void Buffer::putOctet(uint8_t i) { impl->putOctet(i); }
+void Buffer::putShort(uint16_t i) { impl->putShort(i); }
+void Buffer::putLong(uint32_t i) { impl->putLong(i); }
+void Buffer::putLongLong(uint64_t i) { impl->putLongLong(i); }
+void Buffer::putInt8(int8_t i) { impl->putInt8(i); }
+void Buffer::putInt16(int16_t i) { impl->putInt16(i); }
+void Buffer::putInt32(int32_t i) { impl->putInt32(i); }
+void Buffer::putInt64(int64_t i) { impl->putInt64(i); }
+void Buffer::putFloat(float i) { impl->putFloat(i); }
+void Buffer::putDouble(double i) { impl->putDouble(i); }
+void Buffer::putBin128(const uint8_t* i) { impl->putBin128(i); }
+uint8_t Buffer::getOctet() { return impl->getOctet(); }
+uint16_t Buffer::getShort() { return impl->getShort(); }
+uint32_t Buffer::getLong() { return impl->getLong(); }
+uint64_t Buffer::getLongLong() { return impl->getLongLong(); }
+int8_t Buffer:: getInt8() { return impl-> getInt8(); }
+int16_t Buffer::getInt16() { return impl->getInt16(); }
+int32_t Buffer::getInt32() { return impl->getInt32(); }
+int64_t Buffer::getInt64() { return impl->getInt64(); }
+float Buffer::getFloat() { return impl->getFloat(); }
+double Buffer::getDouble() { return impl->getDouble(); }
+void Buffer::putShortString(const string& i) { impl->putShortString(i); }
+void Buffer::putMediumString(const string& i) { impl->putMediumString(i); }
+void Buffer::putLongString(const string& i) { impl->putLongString(i); }
+void Buffer::getShortString(string& i) { impl->getShortString(i); }
+void Buffer::getMediumString(string& i) { impl->getMediumString(i); }
+void Buffer::getLongString(string& i) { impl->getLongString(i); }
+void Buffer::getBin128(uint8_t* i) { impl->getBin128(i); }
+void Buffer::putRawData(const string& i) { impl->putRawData(i); }
+void Buffer::getRawData(string& s, uint32_t size) { impl->getRawData(s, size); }
+void Buffer::putRawData(const uint8_t* data, size_t size) { impl->putRawData(data, size); }
+void Buffer::getRawData(uint8_t* data, size_t size) { impl->getRawData(data, size); }
+
+void Buffer::putMap(const types::Variant::Map& i)
+{
+    string encoded;
+    amqp_0_10::MapCodec::encode(i, encoded);
+    impl->putRawData(encoded);
+}
+
+void Buffer::putList(const types::Variant::List& i)
+{
+    string encoded;
+    amqp_0_10::ListCodec::encode(i, encoded);
+    impl->putRawData(encoded);
+}
+
+void Buffer::getMap(types::Variant::Map& map)
+{
+    string encoded;
+    uint32_t saved = impl->getPosition();
+    uint32_t length = impl->getLong();
+    impl->setPosition(saved);
+    impl->getRawData(encoded, length + sizeof(uint32_t));
+    amqp_0_10::MapCodec::decode(encoded, map);
+}
+
+void Buffer::getList(types::Variant::List& list)
+{
+    string encoded;
+    uint32_t saved = impl->getPosition();
+    uint32_t length = impl->getLong();
+    impl->setPosition(saved);
+    impl->getRawData(encoded, length + sizeof(uint32_t));
+    amqp_0_10::ListCodec::decode(encoded, list);
+}
+



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org