You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by ve...@apache.org on 2012/10/17 08:50:25 UTC

svn commit: r1399115 - in /incubator/etch/trunk/binding-cpp: compiler/src/main/java/org/apache/etch/bindings/cpp/compiler/ compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/ runtime/include/serialization/ runtime/include/support/ runtim...

Author: veithm
Date: Wed Oct 17 06:50:24 2012
New Revision: 1399115

URL: http://svn.apache.org/viewvc?rev=1399115&view=rev
Log:
ETCH-244 Adding runtime and logging to code generation templates

- added Logging
- refactored runtime usage

Change-Id: I3b9e3b6faf76ca0b1089fa509933b68afebe2482

Modified:
    incubator/etch/trunk/binding-cpp/compiler/src/main/java/org/apache/etch/bindings/cpp/compiler/Compiler.java
    incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_cpp.vm
    incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm
    incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm
    incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
    incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchAuthenticationExceptionSerializer.h
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchDateSerializer.h
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchImportExportHelper.h
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchListSerializer.h
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchRuntimeExceptionSerializer.h
    incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchSetSerializer.h
    incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubBase.h
    incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubHelper.h
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchAuthenticationExceptionSerializer.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchDateSerializer.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchListSerializer.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchRuntimeExceptionSerializer.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchSetSerializer.cpp
    incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp

Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/java/org/apache/etch/bindings/cpp/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/java/org/apache/etch/bindings/cpp/compiler/Compiler.java?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/java/org/apache/etch/bindings/cpp/compiler/Compiler.java (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/java/org/apache/etch/bindings/cpp/compiler/Compiler.java Wed Oct 17 06:50:24 2012
@@ -1302,7 +1302,7 @@ public class Compiler extends Backend {
         if (n.efqname(this).equals("EtchHashTable")) return b.className()+"<EtchObjectPtr, EtchObjectPtr> ";
         if (n.efqname(this).equals("EtchHashSet")) return b.className()+"<EtchObjectPtr> ";
         throw new IllegalArgumentException(String.format(
-                "unable to find correct Etch data type for type at line %d: %s", t.beginLine, n.efqname(this)));
+            "unable to find correct Etch data type for type at line %d: %s", t.beginLine, n.efqname(this)));
       }
       if (n.isEnumx()) {
         return n.efqname(this);
@@ -1492,7 +1492,7 @@ public class Compiler extends Backend {
       TypeRef type = param.type();
 
       if (type.isBuiltin())
-        return String.format("EtchValidator%s::Get(%d, tmpValue)",
+        return String.format("EtchValidator%s::Get(runtime, %d, tmpValue)",
             this.getValidatorStringForParam(param), type.dim());
 
       Named<?> n = type.getNamed(type.intf());
@@ -1513,7 +1513,7 @@ public class Compiler extends Backend {
          * int i = cn.indexOf( '<' ); if (i >= 0) cn = cn.substring( 0, i );
          */
         return String.format(
-            "EtchValidatorCustom::Get(%d, %s::TYPE(), %s, tmpValue);",
+            "EtchValidatorCustom::Get(runtime, %d, %s::TYPE(), %s, tmpValue);",
             type.dim(), cn, b.allowSubclass());
       }
 
@@ -1523,13 +1523,13 @@ public class Compiler extends Backend {
         if (n.isStruct()) {
           Struct s = (Struct) n;
           return String.format(
-              "EtchValidatorCustom::Get( %d, %s::TYPE(), true, tmpValue);",
+              "EtchValidatorCustom::Get(runtime, %d, %s::TYPE(), true, tmpValue);",
               type.dim(), s
               .service().name() + "::" + n.efqname(this));
         }
         Except e = (Except) n;
         return String.format(
-            "EtchValidatorCustom::Get( %d, %s::TYPE(), true, tmpValue);", type.dim(), e
+            "EtchValidatorCustom::Get(runtime, %d, %s::TYPE(), true, tmpValue);", type.dim(), e
             .service().name() + "::" + n.efqname(this));
       }
       // Don't allow subclassing for externs or etch defined enums.
@@ -1538,7 +1538,7 @@ public class Compiler extends Backend {
             "n.isExtern() || n.isEnumx(): " + n);
       Enumx e = (Enumx) n;
       return String.format(
-          "EtchValidatorCustom::Get( %d, %s::TYPE(), false, tmpValue);",
+          "EtchValidatorCustom::Get(runtime, %d, %s::TYPE(), false, tmpValue);",
           type.dim(), n.efqname(this));
     }
 
@@ -1548,11 +1548,11 @@ public class Compiler extends Backend {
       String efgName = this.getExcept(thrown).service().name() + "::"
           + e.efqname(this);
       return String.format(
-          "EtchValidatorCustom::Get(0, %s::TYPE(), true, tmpValue);"
+          "EtchValidatorCustom::Get(runtime, 0, %s::TYPE(), true, tmpValue);"
           , efgName);
     }
     if (named instanceof Item)
-      return "EtchValidatorBoolean::Get(0, tmpValue)";
+      return "EtchValidatorBoolean::Get(runtime, 0, tmpValue)";
     return "NULL";
   }
 

Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_cpp.vm?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_cpp.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_cpp.vm Wed Oct 17 06:50:24 2012
@@ -67,9 +67,9 @@ status_t $clname::Listener${i}Server::ne
   EtchValueFactory* vf = (EtchValueFactory*) obj;
   
   //create stack layers
-  EtchMailboxManager* mbm = new EtchPlainMailboxManager(transport, uri, resources);
+  EtchMailboxManager* mbm = new EtchPlainMailboxManager(runtime, transport, uri, resources);
   stack->setMailboxManager(mbm);
-  EtchDeliveryService* dvs = new EtchDefaultDeliveryService(mbm, uri);
+  EtchDeliveryService* dvs = new EtchDefaultDeliveryService(runtime, mbm, uri);
   stack->setDeliveryService(dvs);
   Remote${i}Client* client = new Remote${i}Client(runtime, dvs, vf, stack);
   stack->setRemote(client);
@@ -126,7 +126,7 @@ status_t $clname::newListener(EtchRuntim
 
   //init resources
   EtchResources *res;
-  status = EtchTransportHelper::InitResources(resources, res);
+  status = EtchTransportHelper::InitResources(runtime, resources, res);
   if (status != ETCH_OK) {
     return status;
   }
@@ -164,14 +164,14 @@ status_t $clname::newListener(EtchRuntim
   {
     status_t status = ETCH_OK;
 
-    EtchStackClient* stack = new EtchStackClient();
+    EtchStackClient* stack = new EtchStackClient(runtime);
 
     //static initialization of value factory
     ValueFactory${i}::InitValueFactory(runtime);
 
     //init resources
     EtchResources* res;
-    status = InitResources(resources, res);
+    status = InitResources(runtime, resources, res);
     if (status != ETCH_OK) {
       return status;
     }
@@ -191,9 +191,9 @@ status_t $clname::newListener(EtchRuntim
     //init stack layers
     EtchTransportMessage* m;
     EtchTransportFactory::getTransport(runtime, uri, res, m);
-    EtchMailboxManager* mbm = new EtchPlainMailboxManager(m, uri, res);
+    EtchMailboxManager* mbm = new EtchPlainMailboxManager(runtime, m, uri, res);
     stack->setMailboxManager(mbm);
-    EtchDeliveryService* dvs = new EtchDefaultDeliveryService(mbm, uri);
+    EtchDeliveryService* dvs = new EtchDefaultDeliveryService(runtime, mbm, uri);
     stack->setDeliveryService(dvs);
     Remote${i}Server* _server = new Remote${i}Server(runtime, dvs, vf, stack);
     ${i}Client* client = implFactory.new${i}Client( server );

Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm Wed Oct 17 06:50:24 2012
@@ -119,7 +119,7 @@ $clname::$clname(EtchRuntime* runtime, E
   : Remote${i}(runtime, svc, vf, stack) {
 #else
 $clname::$clname(EtchRuntime* runtime, EtchDeliveryService* svc, EtchValueFactory* vf, EtchStack* stack )
-  : EtchRemoteBase(svc, vf, stack), mRuntime(runtime) {
+  : EtchRemoteBase(runtime, svc, vf, stack), mRuntime(runtime) {
 #end
 }
 

Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm Wed Oct 17 06:50:24 2012
@@ -38,6 +38,7 @@
 #end
 \#include "ValueFactory${i}.h"
 \#include "support/EtchStubHelper.h"
+\#include "support/EtchRuntime.h"
 
 using namespace $namespace;
 
@@ -49,15 +50,22 @@ class Run${mthd.vname($helper)}
   : public EtchStubHelper<$i$suffix>
 {
 public:
+  Run${mthd.vname($helper)}(EtchRuntime* runtime)
+  : EtchStubHelper(runtime) {
+  }
+  
+  ~Run${mthd.vname($helper)}() {
+  }
+
   status_t run(EtchStubBase<$i$suffix>* _ref, EtchDeliveryService *_svc, $i$suffix *_obj, capu::SmartPointer<EtchWho> _sender, capu::SmartPointer<EtchMessage> _msg )
   {
     status_t status = ETCH_OK;
-
+    CAPU_LOG_TRACE(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: Called ${mthd.vname($helper)} Run-Method.");
 #if (!$mthd.isOneway())
     capu::SmartPointer<EtchMessage> _rmsg;
     status = _msg->createReplyMessage(_rmsg);
     if(status != ETCH_OK) {
-      // TODO log error
+      CAPU_LOG_ERROR(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: Coudn't create reply-message.");
       // TODO set exception
       return ETCH_ERROR;
     }
@@ -75,15 +83,18 @@ public:
     $intfname::$mthd.name()AsyncResultPtr ar;
 #set($sep = "")
 #set($count = 0)
+    CAPU_LOG_TRACE(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: Calling implementation of \"$mthd.name()\" function.");
     ar = _obj->$mthd.name()(#foreach($param in $mthd.iterator())#if($mthd.hasAuth())${sep}$param.name()#else#set($count = $count + 1)${sep}val$count#end#set($sep = ", ")#end);
 
     // create result message
 #if($mthd.hasReturn())
     if(ar->hasResult()) {
+    CAPU_LOG_TRACE(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: $mthd.name() - returned an Result, generating Answer Message.");
         _rmsg->put(ValueFactory$i::_mf_result(), ar->getResult());
     } else
 #end
     if(ar->hasException()) {
+         CAPU_LOG_DEBUG(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: $mthd.name()  - returned an Exception - notify Session.");
         _ref->sessionNotify(ar->getException());
 #if ($mthd.isOneway())
         EtchMessagePtr _rmsg;
@@ -92,12 +103,14 @@ public:
         _rmsg->put( ValueFactory$i::_mf_result(), ar->getException() );
 #if ($mthd.isOneway())
         // transport result message
+        CAPU_LOG_TRACE(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: $mthd.name() - (One-Way) Transport Message back! Because an Exception occurred!.");
         status = _svc->transportMessage( _sender, _rmsg);
 #end
     }
 
 #if (!$mthd.isOneway())
     // transport result message
+    CAPU_LOG_TRACE(mRuntime->getLogger(), "Stub$i$suffix", "${namespace}: $mthd.name() - Transport answer-message back!.");
     status = _svc->transportMessage( _sender, _rmsg);
 #end
     return status;
@@ -153,23 +166,22 @@ namespace $namespace {
     /**
      * Static Initialization-Helper
      */
-    static status_t Init()
+    static status_t Init(EtchRuntime* runtime)
     {
-      #foreach( $mthd in $intf.iterator() )
-      #if ($mthd.isMsgDir($mc))
-      #if (!$mthd.isHidden())
-          ValueFactory$i::${mthd.vname( $helper )}->setStubHelper(new Run${mthd.vname($helper)}());
-      #end
-      #end
-      #if( $n.isMixin() )
-      #set( $m = $n.getModule() )
-      #set( $z = $m.iterator().next() )
-          ${m.name()}::Stub${z.name()}${suffix}::Init();
-      #end
-      #end
+#foreach( $mthd in $intf.iterator() )
+#if ($mthd.isMsgDir($mc))
+#if (!$mthd.isHidden())
+      ValueFactory$i::${mthd.vname( $helper )}->setStubHelper(new Run${mthd.vname($helper)}(runtime));
+#end
+#end
+#if( $n.isMixin() )
+#set( $m = $n.getModule() )
+#set( $z = $m.iterator().next() )
+      ${m.name()}::Stub${z.name()}${suffix}::Init(runtime);
+#end
+#end
       return ETCH_OK;
     }
-
 ##end
   };
 }

Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm Wed Oct 17 06:50:24 2012
@@ -34,6 +34,7 @@
 \#include "serialization/EtchAsyncMode.h"
 \#include "serialization/EtchDirection.h"
 \#include "serialization/EtchValidators.h"
+\#include "serialization/EtchImportExportHelper.h"
 
 using namespace $namespace;
 
@@ -62,6 +63,13 @@ $vf::Etch${intf.name()}RuntimeListener $
 class ImportExportHelper$n.vname($helper)
   : public EtchImportExportHelper {
 public:
+  ImportExportHelper$n.vname($helper)(EtchRuntime* runtime) 
+  : EtchImportExportHelper(runtime) {
+  }
+
+  virtual ~ImportExportHelper$n.vname($helper)() {
+  }
+  
   status_t exportValue(EtchValueFactory* vf, EtchObjectPtr value, EtchStructValue *&result)
   {
     EtchStructValue* _struct = new EtchStructValue( $vf::${n.vname( $helper )}, vf );
@@ -73,6 +81,7 @@ public:
     _struct->put($vf::$p.vname($helper)(), val$CountParams );
 #end
     result = _struct;
+    CAPU_LOG_TRACE(mRuntime->getLogger(), "$vf", "${namespace}: exported $n.vname($helper) Value.");
     return ETCH_OK;
   }
   status_t importValue(EtchStructValue* value, EtchObjectPtr &result)
@@ -88,6 +97,7 @@ public:
     v->$helper.getSetterName($p.name())(tmp$CountParams);
 #end
     result = v;
+    CAPU_LOG_TRACE(mRuntime->getLogger(), "$vf", "${namespace}: imported $n.vname($helper) Value.");
     return ETCH_OK;
   }
 };
@@ -224,7 +234,7 @@ status_t ${vf}::InitResults()
 }
 
 ## ----------------------------- import / export -----------------------------
-status_t ${vf}::InitImportExport()
+status_t ${vf}::InitImportExport(EtchRuntime* runtime)
 {
 #foreach ( $n in $intf.iterator() )
 #if ($n.isStruct() || $n.isExcept())
@@ -234,14 +244,14 @@ status_t ${vf}::InitImportExport()
 #if ($n.hasExtends())
   $vf::${n.vname($helper)}->setSuperType($n.getExtends().vname($helper));
 #end
-  $vf::${n.vname($helper)}->setImportExportHelper(new ImportExportHelper$n.vname($helper)());
+  $vf::${n.vname($helper)}->setImportExportHelper(new ImportExportHelper$n.vname($helper)(runtime));
 #elseif ($n.isExtern())
 #set( $tname = $n.efqname( $helper ) )
 #elseif ($n.isEnumx())
 #set( $tname = $n.efqname( $helper ) )
   $vf::class2type()->put(${tname}::TYPE(), $vf::${n.vname($helper)});
   $vf::${n.vname( $helper )}->setComponentType(${tname}::TYPE());
-  $vf::${n.vname( $helper )}->setImportExportHelper(new ImportExportHelper$n.vname($helper)());
+  $vf::${n.vname( $helper )}->setImportExportHelper(new ImportExportHelper$n.vname($helper)(runtime));
 #end
 #end
 
@@ -271,7 +281,7 @@ status_t ${vf}::InitFields()
 
 
 #set( $ctr = 0 )
-status_t $vf::InitParams()
+status_t $vf::InitParams(EtchRuntime* runtime)
 {
   capu::SmartPointer<EtchValidator> tmpValue;
 #foreach( $n in $intf.iterator() )
@@ -293,7 +303,7 @@ status_t $vf::InitParams()
 #end ## -- foreach --
 #end ## -- else --
 #if ($n.isMessage())
-  EtchValidatorLong::Get(0, tmpValue);
+  EtchValidatorLong::Get(runtime, 0, tmpValue);
   ${n.vname( $helper )}->putValidator($vf::_mf__messageId(), tmpValue);
 
 #if ($n.isHidden())
@@ -304,9 +314,9 @@ status_t $vf::InitParams()
   $vf::${n.vname( $helper )}->putValidator($vf::$param.vname($helper)(), tmpValue); // thrown $t.name()
 
 #end ## -- foreach --
-  EtchValidatorRuntimeException::Get(tmpValue);
+  EtchValidatorRuntimeException::Get(runtime, tmpValue);
   $vf::${n.vname( $helper )}->putValidator($vf::$param.vname($helper)(), tmpValue); // thrown RuntimeException
-  EtchValidatorLong::Get(0, tmpValue);
+  EtchValidatorLong::Get(runtime, 0, tmpValue);
   $vf::${n.vname( $helper )}->putValidator($vf::_mf__inReplyTo(), tmpValue);
 #end ## -- isHidden --
 #end ## -- isMessage --
@@ -338,7 +348,7 @@ status_t $vf::InitValueFactory(EtchRunti
   }
   SRuntimesMutex.unlock();
   
-  status = $vf::Init( types(), class2type() );
+  status = $vf::Init(runtime, types(), class2type());
   if (status != ETCH_OK) {
     return status;
   }
@@ -359,33 +369,33 @@ status_t $vf::InitValueFactory(EtchRunti
   }
 #foreach( $n in $intf.iterator() )
 #if ($n.isExtern())
-    status = ${n.sname( $helper )}.Init( ${n.vname($helper)}(), class2type );
+    status = ${n.sname( $helper )}.Init(runtime, ${n.vname($helper)}(), class2type);
     if (status != ETCH_OK) {
       return status;
     }
 #end
 #end
-  status = $vf::InitParams();
+  status = $vf::InitParams(runtime);
   if (status != ETCH_OK) {
     return status;
   }
   
-  status = $vf::InitImportExport();
+  status = $vf::InitImportExport(runtime);
   if (status != ETCH_OK) {
     return status;
   }
 
-  status = Stub${i}<void>::Init();
+  status = Stub${i}<void>::Init(runtime);
   if (status != ETCH_OK) {
     return status;
   }
   
-  status = Stub${i}Server::Init();
+  status = Stub${i}Server::Init(runtime);
   if (status != ETCH_OK) {
     return status;
   }
   
-  status = Stub${i}Client::Init();
+  status = Stub${i}Client::Init(runtime);
   if (status != ETCH_OK) {
     return status;
   }

Modified: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm (original)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm Wed Oct 17 06:50:24 2012
@@ -79,7 +79,7 @@ namespace $namespace {
     static status_t InitTypes();
     static status_t InitResults();
     static status_t InitFields();
-    static status_t InitParams();
+    static status_t InitParams(EtchRuntime* runtime);
 #set( $ctr = 0 )
 #foreach( $n in $intf.iterator() )
 #if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
@@ -89,7 +89,7 @@ namespace $namespace {
 #set( $ctr = $ctr + 1 )
 #end
 #end
-    static status_t InitImportExport();
+    static status_t InitImportExport(EtchRuntime* runtime);
 
     /**
      * Static Initialization-Helper

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchAuthenticationExceptionSerializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchAuthenticationExceptionSerializer.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchAuthenticationExceptionSerializer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchAuthenticationExceptionSerializer.h Wed Oct 17 06:50:24 2012
@@ -56,7 +56,6 @@ public:
   static status_t Init(EtchRuntime* runtime, EtchType* type, EtchClass2TypeMap* class2type);
 
 private:
-  EtchRuntime* mRuntime;
   EtchField mField;
   EtchType* mType;
   const static EtchString& FIELD_NAME();

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchDateSerializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchDateSerializer.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchDateSerializer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchDateSerializer.h Wed Oct 17 06:50:24 2012
@@ -61,7 +61,6 @@ public:
   static status_t Init(EtchRuntime* runtime, EtchType* type, EtchClass2TypeMap* class2type);
 
 private:
-  EtchRuntime* mRuntime;
   EtchField mField;
   EtchType* mType;
   const static EtchString& FIELD_NAME();

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchHashTableSerializer.h Wed Oct 17 06:50:24 2012
@@ -62,7 +62,6 @@ public:
   static status_t Init(EtchRuntime* runtime, EtchType* type, EtchClass2TypeMap* class2type);
 
 private:
-  EtchRuntime* mRuntime;
   EtchField mField;
   EtchType* mType;
   const static EtchString& FIELD_NAME();

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchImportExportHelper.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchImportExportHelper.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchImportExportHelper.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchImportExportHelper.h Wed Oct 17 06:50:24 2012
@@ -19,6 +19,7 @@
 #ifndef __ETCHIMPORTEXPORTHELPER_H__
 #define __ETCHIMPORTEXPORTHELPER_H__
 #include "serialization/EtchValueFactory.h"
+#include "support/EtchRuntime.h"
 
 class EtchStructValue;
 
@@ -30,6 +31,12 @@ class EtchImportExportHelper {
 public:
 
   /**
+   * Constructor
+   */
+  EtchImportExportHelper(EtchRuntime* runtime) : mRuntime(runtime) {
+  }
+
+  /**
    * Destructor
    */
   virtual ~EtchImportExportHelper() {
@@ -56,6 +63,8 @@ public:
    */
   virtual status_t importValue(EtchStructValue* value, capu::SmartPointer<EtchObject> &result) = 0;
 
+protected:
+  EtchRuntime* mRuntime;
 };
 
 #endif /* ETCHIMPORTEXPORTHELPER_H */

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchListSerializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchListSerializer.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchListSerializer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchListSerializer.h Wed Oct 17 06:50:24 2012
@@ -61,7 +61,6 @@ public:
   static status_t Init(EtchRuntime* runtime, EtchType* type, EtchClass2TypeMap* class2type);
 
 private:
-  EtchRuntime* mRuntime;
   EtchField mField;
   EtchType* mType;
   const static EtchString& FIELD_NAME();

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchRuntimeExceptionSerializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchRuntimeExceptionSerializer.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchRuntimeExceptionSerializer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchRuntimeExceptionSerializer.h Wed Oct 17 06:50:24 2012
@@ -62,7 +62,6 @@ public:
   static status_t Init(EtchRuntime* runtime, EtchType* type, EtchClass2TypeMap* class2type);
 
 private:
-  EtchRuntime* mRuntime;
   EtchField mField;
   EtchType* mType;
   const static EtchString& FIELD_NAME();

Modified: incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchSetSerializer.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchSetSerializer.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchSetSerializer.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/serialization/EtchSetSerializer.h Wed Oct 17 06:50:24 2012
@@ -56,7 +56,6 @@ public:
   static status_t Init(EtchRuntime* runtime, EtchType* type, EtchClass2TypeMap* class2type);
 
 private:
-  EtchRuntime* mRuntime;
   EtchField mField;
   EtchType* mType;
   const static EtchString& FIELD_NAME();

Modified: incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubBase.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubBase.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubBase.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubBase.h Wed Oct 17 06:50:24 2012
@@ -75,8 +75,8 @@ protected:
    * The message source.
    */
   EtchDeliveryService* mSvc;
-  EtchFreePool* mFreePool;
   EtchQueuedPool* mQueuedPool;
+  EtchFreePool* mFreePool;
 
   /**
    * The object used to implement stub.
@@ -126,7 +126,7 @@ private:
 
 template<typename T>
 EtchStubBase<T>::EtchStubBase(EtchDeliveryService* svc, T* obj, EtchQueuedPool* queued, EtchFreePool* free)
-: mSvc(svc), mObj(obj), mQueuedPool(queued), mFreePool(free) {
+: mSvc(svc), mQueuedPool(queued), mFreePool(free), mObj(obj) {
   mSvc->setSession(this);
 }
 

Modified: incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubHelper.h
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubHelper.h?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubHelper.h (original)
+++ incubator/etch/trunk/binding-cpp/runtime/include/support/EtchStubHelper.h Wed Oct 17 06:50:24 2012
@@ -22,6 +22,7 @@
 
 #include "capu/util/SmartPointer.h"
 #include "support/EtchDeliveryService.h"
+#include "support/EtchRuntime.h"
 
 template<typename T>
 class EtchStubBase;
@@ -44,13 +45,13 @@ public:
    * Constructs a StubHelper which uses synchronous mode to dispatch
    * method from message.
    */
-  EtchStubHelper() {
+  EtchStubHelper(EtchRuntime* runtime)
+  : mRuntime(runtime) {
     addObjectType(TYPE());
-    // nothing to do.
   }
 
   EtchStubHelper(const EtchStubHelper& other)
-  : EtchObject(other) {
+  : EtchObject(other), mRuntime(other.mRuntime) {
   }
 
   /**
@@ -61,6 +62,11 @@ public:
    * @param msg
    */
   virtual status_t run(EtchStubBase<T>* ref, EtchDeliveryService* svc, T* obj, capu::SmartPointer<EtchWho> sender, capu::SmartPointer<EtchMessage> msg ) = 0;
+
+
+protected:
+  EtchRuntime* mRuntime;
+
 };
 
 template<typename T>

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchAuthenticationExceptionSerializer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchAuthenticationExceptionSerializer.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchAuthenticationExceptionSerializer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchAuthenticationExceptionSerializer.cpp Wed Oct 17 06:50:24 2012
@@ -27,7 +27,7 @@ const EtchString& EtchAuthenticationExce
 }
 
 EtchAuthenticationExceptionSerializer::EtchAuthenticationExceptionSerializer(EtchRuntime* runtime, EtchType* type, EtchField* field)
-: mRuntime(runtime), mField(*field), mType(type) {
+: EtchImportExportHelper(runtime), mField(*field), mType(type) {
 }
 
 EtchAuthenticationExceptionSerializer::~EtchAuthenticationExceptionSerializer() {

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchDateSerializer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchDateSerializer.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchDateSerializer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchDateSerializer.cpp Wed Oct 17 06:50:24 2012
@@ -27,7 +27,7 @@ const EtchString& EtchDateSerializer::FI
 }
 
 EtchDateSerializer::EtchDateSerializer(EtchRuntime* runtime, EtchType* type, EtchField* field)
-: mRuntime(runtime), mField(*field), mType(type) {
+: EtchImportExportHelper(runtime), mField(*field), mType(type) {
 }
 
 EtchDateSerializer::~EtchDateSerializer() {

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchHashTableSerializer.cpp Wed Oct 17 06:50:24 2012
@@ -28,7 +28,7 @@ const EtchString& EtchHashTableSerialize
 }
 
 EtchHashTableSerializer::EtchHashTableSerializer(EtchRuntime* runtime, EtchType* type, EtchField& field)
-: mRuntime(runtime), mField(field), mType(type) {
+: EtchImportExportHelper(runtime), mField(field), mType(type) {
 }
 
 EtchHashTableSerializer::~EtchHashTableSerializer() {

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchListSerializer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchListSerializer.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchListSerializer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchListSerializer.cpp Wed Oct 17 06:50:24 2012
@@ -29,7 +29,7 @@ const EtchString& EtchListSerializer::FI
 // TODO: check signature regarding by value copy
 
 EtchListSerializer::EtchListSerializer(EtchRuntime* runtime, EtchType* type, EtchField* field)
-: mRuntime(runtime), mField(*field), mType(type) {
+: EtchImportExportHelper(runtime), mField(*field), mType(type) {
 }
 
 EtchListSerializer::~EtchListSerializer() {

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchRuntimeExceptionSerializer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchRuntimeExceptionSerializer.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchRuntimeExceptionSerializer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchRuntimeExceptionSerializer.cpp Wed Oct 17 06:50:24 2012
@@ -29,7 +29,7 @@ const EtchString& EtchRuntimeExceptionSe
 // TODO: check signature regarding by value copy
 
 EtchRuntimeExceptionSerializer::EtchRuntimeExceptionSerializer(EtchRuntime* runtime, EtchType* type, EtchField* field)
-: mRuntime(runtime), mField(*field), mType(type) {
+: EtchImportExportHelper(runtime), mField(*field), mType(type) {
 }
 
 EtchRuntimeExceptionSerializer::~EtchRuntimeExceptionSerializer() {

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchSetSerializer.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchSetSerializer.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchSetSerializer.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchSetSerializer.cpp Wed Oct 17 06:50:24 2012
@@ -27,7 +27,7 @@ const EtchString& EtchSetSerializer::FIE
 }
 
 EtchSetSerializer::EtchSetSerializer(EtchRuntime* runtime, EtchType* type, EtchField* field)
-: mRuntime(runtime), mField(*field), mType(type) {
+: EtchImportExportHelper(runtime), mField(*field), mType(type) {
 }
 
 EtchSetSerializer::~EtchSetSerializer() {

Modified: incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp?rev=1399115&r1=1399114&r2=1399115&view=diff
==============================================================================
--- incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp (original)
+++ incubator/etch/trunk/binding-cpp/runtime/src/main/serialization/EtchValidatorCustom.cpp Wed Oct 17 06:50:24 2012
@@ -27,6 +27,7 @@ public:
    * Validator cache
    */
   struct ValidatorCache {
+    ValidatorCache() : id(0), validators(100) {}
     capu::uint64_t id;
     EtchHashTable<EtchValidatorCustomKey, capu::SmartPointer<EtchValidator> > validators;
   };