Author: tross
Date: Mon Sep 22 12:35:54 2008
New Revision: 697961

URL: http://svn.apache.org/viewvc?rev=697961&view=rev
Log:
Add initialization for properties not in the constructor arguments

Modified:
    incubator/qpid/trunk/qpid/cpp/managementgen/qmf/management-types.xml
    incubator/qpid/trunk/qpid/cpp/managementgen/qmf/schema.py

Modified: incubator/qpid/trunk/qpid/cpp/managementgen/qmf/management-types.xml
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/managementgen/qmf/management-types.xml?rev=697961&r1=697960&r2=697961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/managementgen/qmf/management-types.xml 
(original)
+++ incubator/qpid/trunk/qpid/cpp/managementgen/qmf/management-types.xml Mon 
Sep 22 12:35:54 2008
@@ -19,7 +19,7 @@
   under the License.
 -->
 
-<type name="objId"     base="REF"       cpp="::qpid::management::ObjectId"  
encode="#.encode(@)" decode="#.decode(@)"  accessor="direct" init="0" 
byRef="y"/>
+<type name="objId"     base="REF"       cpp="::qpid::management::ObjectId"  
encode="#.encode(@)" decode="#.decode(@)"  accessor="direct" 
init="::qpid::management::ObjectId()" byRef="y"/>
 <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"/>
@@ -35,8 +35,8 @@
 <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="::qpid::framing::Uuid" 
encode="#.encode(@)"       decode="#.decode(@)"    accessor="direct" byRef="y"/>
-<type name="map"       base="FTABLE"    cpp="::qpid::framing::FieldTable" 
encode="#.encode(@)" decode="#.decode(@)"    accessor="direct" byRef="y"/>
+<type name="uuid"      base="UUID"      cpp="::qpid::framing::Uuid" 
encode="#.encode(@)"       decode="#.decode(@)"    accessor="direct" 
init="::qpid::framing::Uuid()" byRef="y"/>
+<type name="map"       base="FTABLE"    cpp="::qpid::framing::FieldTable" 
encode="#.encode(@)" decode="#.decode(@)"    accessor="direct" 
init="::qpid::framing::FieldTable()" byRef="y"/>
 
 <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"/>

Modified: incubator/qpid/trunk/qpid/cpp/managementgen/qmf/schema.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/managementgen/qmf/schema.py?rev=697961&r1=697960&r2=697961&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/managementgen/qmf/schema.py (original)
+++ incubator/qpid/trunk/qpid/cpp/managementgen/qmf/schema.py Mon Sep 22 
12:35:54 2008
@@ -332,6 +332,10 @@
   def genAccessor (self, stream):
     self.type.type.genAccessor (stream, self.name, "configChanged", 
self.isOptional == 1)
 
+  def genInitialize (self, stream, prefix="", indent="    "):
+    val = self.type.type.init
+    stream.write (indent + prefix + self.name + " = " + val + ";\n")
+
   def genSchema (self, stream):
     stream.write ("    ft = FieldTable ();\n")
     stream.write ("    ft.setString (NAME, \"" + self.name + "\");\n")
@@ -966,6 +970,9 @@
         inst.genPerThreadHiLoStatResets (stream)
 
   def genInitializeElements (self, stream, variables):
+    for prop in self.properties:
+      if not prop.isConstructorArg() and not prop.isParentRef:
+        prop.genInitialize(stream)
     for inst in self.statistics:
       if not inst.type.type.perThread:
         inst.genInitialize (stream)


Reply via email to