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 2008/07/31 23:58:40 UTC

svn commit: r681512 - in /incubator/qpid/trunk/qpid: cpp/src/qpid/framing/ cpp/src/qpid/management/ python/qpid/ specs/

Author: tross
Date: Thu Jul 31 14:58:39 2008
New Revision: 681512

URL: http://svn.apache.org/viewvc?rev=681512&view=rev
Log:
Added signed integer datatypes for use in management schemas

Modified:
    incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.cpp
    incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.h
    incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h
    incubator/qpid/trunk/qpid/python/qpid/management.py
    incubator/qpid/trunk/qpid/python/qpid/managementdata.py
    incubator/qpid/trunk/qpid/specs/management-schema.xml
    incubator/qpid/trunk/qpid/specs/management-types.xml

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.cpp?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.cpp Thu Jul 31 14:58:39 2008
@@ -74,6 +74,22 @@
     putLong(lo);
 }
 
+void Buffer::putInt8(int8_t i){
+    data[position++] = (uint8_t) i;
+}
+
+void Buffer::putInt16(int16_t i){
+    putShort((uint16_t) i);
+}
+
+void Buffer::putInt32(int32_t i){
+    putLong((uint32_t) i);
+}
+
+void Buffer::putInt64(int64_t i){
+    putLongLong((uint64_t) i);
+}
+
 void Buffer::putFloat(float f){
     union {
         uint32_t i;
@@ -129,6 +145,22 @@
     return hi | lo;
 }
 
+int8_t Buffer::getInt8(){
+    return (int8_t) data[position++];
+}
+
+int16_t Buffer::getInt16(){
+    return (int16_t) getShort();
+}
+
+int32_t Buffer::getInt32(){
+    return (int32_t) getLong();
+}
+
+int64_t Buffer::getInt64(){
+    return (int64_t) getLongLong();
+}
+
 float Buffer::getFloat(){
     union {
         uint32_t i;

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.h?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/framing/Buffer.h Thu Jul 31 14:58:39 2008
@@ -79,6 +79,10 @@
     void putShort(uint16_t i);
     void putLong(uint32_t i);
     void putLongLong(uint64_t i);
+    void putInt8(int8_t i);
+    void putInt16(int16_t i);
+    void putInt32(int32_t i);
+    void putInt64(int64_t i);
     void putFloat(float f);
     void putDouble(double f);
     void putBin128(uint8_t* b);
@@ -87,6 +91,10 @@
     uint16_t getShort(); 
     uint32_t getLong();
     uint64_t getLongLong();
+    int8_t   getInt8();
+    int16_t  getInt16();
+    int32_t  getInt32();
+    int64_t  getInt64();
     float    getFloat();
     double   getDouble();
     

Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementObject.h Thu Jul 31 14:58:39 2008
@@ -62,6 +62,10 @@
     static const uint8_t TYPE_DOUBLE    = 13;
     static const uint8_t TYPE_UUID      = 14;
     static const uint8_t TYPE_FTABLE    = 15;
+    static const uint8_t TYPE_S8        = 16;
+    static const uint8_t TYPE_S16       = 17;
+    static const uint8_t TYPE_S32       = 18;
+    static const uint8_t TYPE_S64       = 19;
 
     static const uint8_t ACCESS_RC = 1;
     static const uint8_t ACCESS_RW = 2;

Modified: incubator/qpid/trunk/qpid/python/qpid/management.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/management.py?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/management.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/management.py Thu Jul 31 14:58:39 2008
@@ -397,6 +397,14 @@
       codec.write_uuid   (value)
     elif typecode == 15: # FTABLE
       codec.write_map    (value)
+    elif typecode == 16:
+      codec.write_int8 (int(value))
+    elif typecode == 17:
+      codec.write_int16 (int(value))
+    elif typecode == 18:
+      codec.write_int32 (int(value))
+    elif typecode == 19:
+      codec.write_int64 (int(value))
     else:
       raise ValueError ("Invalid type code: %d" % typecode)
 
@@ -432,6 +440,14 @@
       data = codec.read_uuid ()
     elif typecode == 15: # FTABLE
       data = codec.read_map ()
+    elif typecode == 16:
+      data = codec.read_int8 ()
+    elif typecode == 17:
+      data = codec.read_int16 ()
+    elif typecode == 18:
+      data = codec.read_int32 ()
+    elif typecode == 19:
+      data = codec.read_int64 ()
     else:
       raise ValueError ("Invalid type code: %d" % typecode)
     return data

Modified: incubator/qpid/trunk/qpid/python/qpid/managementdata.py
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/managementdata.py?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/python/qpid/managementdata.py (original)
+++ incubator/qpid/trunk/qpid/python/qpid/managementdata.py Thu Jul 31 14:58:39 2008
@@ -222,7 +222,8 @@
         if item[0] == key:
           typecode = item[1]
           unit     = item[2]
-          if (typecode >= 1 and typecode <= 5) or typecode == 12 or typecode == 13:  # numerics
+          if (typecode >= 1 and typecode <= 5) or typecode == 12 or typecode == 13 or \
+                (typecode >= 16 and typecode <= 19):
             if unit == None or unit == self.lastUnit:
               return str (value)
             else:
@@ -329,6 +330,14 @@
       return "uuid"
     elif typecode == 15:
       return "field-table"
+    elif typecode == 16:
+      return "int8"
+    elif typecode == 17:
+      return "int16"
+    elif typecode == 18:
+      return "int32"
+    elif typecode == 19:
+      return "int64"
     else:
       raise ValueError ("Invalid type code: %d" % typecode)
 

Modified: incubator/qpid/trunk/qpid/specs/management-schema.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/management-schema.xml?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/specs/management-schema.xml (original)
+++ incubator/qpid/trunk/qpid/specs/management-schema.xml Thu Jul 31 14:58:39 2008
@@ -80,7 +80,7 @@
 
     <method name="leaveCluster"/>
 
-    <method name="echo" desc="Request a response to test the path to the management agent">
+    <method name="echo" desc="Request a response to test the path to the management broker">
       <arg name="sequence" dir="IO" type="uint32" default="0"/>
       <arg name="body"     dir="IO" type="lstr"   default=""/>
     </method>

Modified: incubator/qpid/trunk/qpid/specs/management-types.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/specs/management-types.xml?rev=681512&r1=681511&r2=681512&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/specs/management-types.xml (original)
+++ incubator/qpid/trunk/qpid/specs/management-types.xml Thu Jul 31 14:58:39 2008
@@ -19,34 +19,38 @@
   under the License.
 -->
 
-<type name="objId"     base="REF"       cpp="uint64_t"      encode="@.putLongLong (#)"    decode="# = @.getLongLong ()"  accessor="direct" init="0"/>
-<type name="uint8"     base="U8"        cpp="uint8_t"       encode="@.putOctet (#)"       decode="# = @.getOctet ()"     accessor="direct" init="0"/>
-<type name="uint16"    base="U16"       cpp="uint16_t"      encode="@.putShort (#)"       decode="# = @.getShort ()"     accessor="direct" init="0"/>
-<type name="uint32"    base="U32"       cpp="uint32_t"      encode="@.putLong (#)"        decode="# = @.getLong ()"      accessor="direct" init="0"/>
-<type name="uint64"    base="U64"       cpp="uint64_t"      encode="@.putLongLong (#)"    decode="# = @.getLongLong ()"  accessor="direct" init="0"/>
-<type name="bool"      base="BOOL"      cpp="uint8_t"       encode="@.putOctet (#?1:0)"   decode="# = @.getOctet ()==1"  accessor="direct" init="0"/>
-<type name="sstr"      base="SSTR"      cpp="std::string"   encode="@.putShortString (#)" decode="@.getShortString (#)"  accessor="direct" init='""'/>
-<type name="lstr"      base="LSTR"      cpp="std::string"   encode="@.putLongString (#)"  decode="@.getLongString (#)"   accessor="direct" init='""'/>
-<type name="absTime"   base="ABSTIME"   cpp="uint64_t"      encode="@.putLongLong (#)"    decode="# = @.getLongLong ()"  accessor="direct" init="0"/>
-<type name="deltaTime" base="DELTATIME" cpp="uint64_t"      encode="@.putLongLong (#)"    decode="# = @.getLongLong ()"  accessor="direct" init="0"/>
-<type name="float"     base="FLOAT"     cpp="float"         encode="@.putFloat (#)"       decode="# = @.getFloat ()"     accessor="direct" init="0."/>
-<type name="double"    base="DOUBLE"    cpp="double"        encode="@.putDouble (#)"      decode="# = @.getDouble ()"    accessor="direct" init="0."/>
-<type name="uuid"      base="UUID"      cpp="framing::Uuid" encode="#.encode (@)"         decode="#.decode (@)"          accessor="direct"/>
-<type name="map"       base="FTABLE"    cpp="framing::FieldTable" encode="#.encode (@)"   decode="#.decode (@)"          accessor="direct"/>
+<type name="objId"     base="REF"       cpp="uint64_t"      encode="@.putLongLong(#)"    decode="# = @.getLongLong()"  accessor="direct" init="0"/>
+<type name="uint8"     base="U8"        cpp="uint8_t"       encode="@.putOctet(#)"       decode="# = @.getOctet()"     accessor="direct" init="0"/>
+<type name="uint16"    base="U16"       cpp="uint16_t"      encode="@.putShort(#)"       decode="# = @.getShort()"     accessor="direct" init="0"/>
+<type name="uint32"    base="U32"       cpp="uint32_t"      encode="@.putLong(#)"        decode="# = @.getLong()"      accessor="direct" init="0"/>
+<type name="uint64"    base="U64"       cpp="uint64_t"      encode="@.putLongLong(#)"    decode="# = @.getLongLong()"  accessor="direct" init="0"/>
+<type name="int8"      base="S8"        cpp="int8_t"        encode="@.putInt8(#)"        decode="# = @.getInt8()"      accessor="direct" init="0"/>
+<type name="int16"     base="S16"       cpp="int16_t"       encode="@.putInt16(#)"       decode="# = @.getInt16()"     accessor="direct" init="0"/>
+<type name="int32"     base="S32"       cpp="int32_t"       encode="@.putInt32(#)"       decode="# = @.getInt32()"     accessor="direct" init="0"/>
+<type name="int64"     base="S46"       cpp="int64_t"       encode="@.putInt64(#)"       decode="# = @.getInt64()"     accessor="direct" init="0"/>
+<type name="bool"      base="BOOL"      cpp="uint8_t"       encode="@.putOctet(#?1:0)"   decode="# = @.getOctet()==1"  accessor="direct" init="0"/>
+<type name="sstr"      base="SSTR"      cpp="std::string"   encode="@.putShortString(#)" decode="@.getShortString(#)"  accessor="direct" init='""'/>
+<type name="lstr"      base="LSTR"      cpp="std::string"   encode="@.putLongString(#)"  decode="@.getLongString(#)"   accessor="direct" init='""'/>
+<type name="absTime"   base="ABSTIME"   cpp="uint64_t"      encode="@.putLongLong(#)"    decode="# = @.getLongLong()"  accessor="direct" init="0"/>
+<type name="deltaTime" base="DELTATIME" cpp="uint64_t"      encode="@.putLongLong(#)"    decode="# = @.getLongLong()"  accessor="direct" init="0"/>
+<type name="float"     base="FLOAT"     cpp="float"         encode="@.putFloat(#)"       decode="# = @.getFloat()"     accessor="direct" init="0."/>
+<type name="double"    base="DOUBLE"    cpp="double"        encode="@.putDouble(#)"      decode="# = @.getDouble()"    accessor="direct" init="0."/>
+<type name="uuid"      base="UUID"      cpp="framing::Uuid" encode="#.encode(@)"         decode="#.decode(@)"          accessor="direct"/>
+<type name="map"       base="FTABLE"    cpp="framing::FieldTable" encode="#.encode(@)"   decode="#.decode(@)"          accessor="direct"/>
 
-<type name="hilo8"   base="U8"   cpp="uint8_t"  encode="@.putOctet (#)"    decode="# = @.getOctet ()"    style="wm" accessor="counter" init="0"/>
-<type name="hilo16"  base="U16"  cpp="uint16_t" encode="@.putShort (#)"    decode="# = @.getShort ()"    style="wm" accessor="counter" init="0"/>
-<type name="hilo32"  base="U32"  cpp="uint32_t" encode="@.putLong (#)"     decode="# = @.getLong ()"     style="wm" accessor="counter" init="0"/>
-<type name="hilo64"  base="U64"  cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" style="wm" accessor="counter" init="0"/>
+<type name="hilo8"   base="U8"   cpp="uint8_t"  encode="@.putOctet(#)"    decode="# = @.getOctet()"    style="wm" accessor="counter" init="0"/>
+<type name="hilo16"  base="U16"  cpp="uint16_t" encode="@.putShort(#)"    decode="# = @.getShort()"    style="wm" accessor="counter" init="0"/>
+<type name="hilo32"  base="U32"  cpp="uint32_t" encode="@.putLong(#)"     decode="# = @.getLong()"     style="wm" accessor="counter" init="0"/>
+<type name="hilo64"  base="U64"  cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="wm" accessor="counter" init="0"/>
 
-<type name="count8"  base="U8"   cpp="uint8_t"  encode="@.putOctet (#)"    decode="# = @.getOctet ()"    accessor="counter" init="0" perThread="y"/>
-<type name="count16" base="U16"  cpp="uint16_t" encode="@.putShort (#)"    decode="# = @.getShort ()"    accessor="counter" init="0" perThread="y"/>
-<type name="count32" base="U32"  cpp="uint32_t" encode="@.putLong (#)"     decode="# = @.getLong ()"     accessor="counter" init="0" perThread="y"/>
-<type name="count64" base="U64"  cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" accessor="counter" init="0" perThread="y"/>
+<type name="count8"  base="U8"   cpp="uint8_t"  encode="@.putOctet(#)"    decode="# = @.getOctet()"    accessor="counter" init="0" perThread="y"/>
+<type name="count16" base="U16"  cpp="uint16_t" encode="@.putShort(#)"    decode="# = @.getShort()"    accessor="counter" init="0" perThread="y"/>
+<type name="count32" base="U32"  cpp="uint32_t" encode="@.putLong(#)"     decode="# = @.getLong()"     accessor="counter" init="0" perThread="y"/>
+<type name="count64" base="U64"  cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" accessor="counter" init="0" perThread="y"/>
 
 <!-- Min/Max/Average statistics -->
-<type name="mma32"   base="U32"       cpp="uint32_t" encode="@.putLong (#)"     decode="# = @.getLong ()"     style="mma" accessor="direct" init="0" perThread="y"/>
-<type name="mma64"   base="U64"       cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" style="mma" accessor="direct" init="0" perThread="y"/>
-<type name="mmaTime" base="DELTATIME" cpp="uint64_t" encode="@.putLongLong (#)" decode="# = @.getLongLong ()" style="mma" accessor="direct" init="0" perThread="y"/>
+<type name="mma32"   base="U32"       cpp="uint32_t" encode="@.putLong(#)"     decode="# = @.getLong()"     style="mma" accessor="direct" init="0" perThread="y"/>
+<type name="mma64"   base="U64"       cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="mma" accessor="direct" init="0" perThread="y"/>
+<type name="mmaTime" base="DELTATIME" cpp="uint64_t" encode="@.putLongLong(#)" decode="# = @.getLongLong()" style="mma" accessor="direct" init="0" perThread="y"/>
 
 </schema-types>