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/08/02 18:17:04 UTC

svn commit: r1368572 [2/2] - in /incubator/etch/trunk/binding-cpp/compiler/src/main: java/org/apache/etch/bindings/cpp/compiler/ resources/org/apache/etch/bindings/cpp/compiler/

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_h.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/helper_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,155 @@
+## 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.
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+#ifndef __$helper.getHelperName($intf).toUpperCase()_H__
+\#define __$helper.getHelperName($intf).toUpperCase()_H__
+
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($clname = "${i}Helper")
+
+\#include "${i}Server.h"
+\#include "ValueFactory${i}.h"
+#if($helper.isClient($mc) || $helper.isBoth($mc))
+\#include "Remote${i}Server.h"
+#end
+#if($helper.isServer($mc) || $helper.isBoth($mc))
+\#include "Remote${i}Client.h"
+#end
+
+#if($helper.isClient($mc) || $helper.isBoth($mc))
+class ${i}ClientFactory;
+#end
+
+\#include "support/EtchDefaultServerFactory.h"
+\#include "support/EtchTransportHelper.h"
+\#include "support/EtchRuntime.h"
+\#include "transport/EtchTransportFactory.h"
+\#include "util/EtchResources.h"
+
+
+
+namespace $namespace {
+  /**
+   * Transport helper for ${i}. All methods are static.
+   */
+  class $clname : public EtchTransportHelper {
+  public:
+#if($helper.isServer($mc) || $helper.isBoth($mc))
+    /**
+     * Factory used by
+     * {@link ${i}Helper#newListener(String, Resources, ${i}ServerFactory)}
+     * to construct a new instance implementing {@link ${i}Server}. The new
+     * instance will receive and process messages from the client session.
+     */
+    class ${i}ServerFactory
+    {
+    public:
+      /**
+       * Constructs a new instance implementing ${i}Server. The new
+       * instance will receive and process messages from the client session.
+       *
+       * @param client an instance of Remote${i}Client which may be used to
+       * send messages to the client session.
+       * @return a new instance implementing ${i}Server (typically
+       * Impl${i}Server).
+       * @throws Exception
+       */
+      virtual ${i}Server* new${i}Server(Remote${i}Client* client) = 0;
+    };
+#end
+#if($helper.isClient($mc) || $helper.isBoth($mc))
+
+    /**
+     * {@link ${i}Helper#newServer(String, Resources, ${i}ClientFactory)}
+     * to cinterfaceonstruct a new instance implementing {@link ${i}Client}. The new
+     * instance will receive and process messages from the server session.
+     */
+    class ${i}ClientFactory {
+    public:
+      /**
+       * Constructs a new instance implementing ${i}Client. The new
+       * instance will receive and process messages from the server session.
+       *
+       * @param server an instance of Remote${i}Server which may be used to
+       * send messages to the server session.
+       * @return a new instance implementing ${i}Client (typically
+       * Impl${i}Client).
+       * @throws Exception
+       */
+      virtual ${i}Client* new${i}Client(Remote${i}Server* server) = 0;
+    };
+#end
+
+private:
+    /**
+     * Helper class for the creation of the server side factory
+     */
+    class Listener${i}Server : public EtchDefaultServerFactory {
+      
+    public:
+     /**
+      * Constructor
+      * @param listener
+      * @param implFactory implementation of the factory
+      */
+      Listener${i}Server(EtchTransport<EtchServerFactory>* listener, ${i}ServerFactory* implFactory);
+      
+      /**
+       * Destructor
+       */
+      virtual ~Listener${i}Server();
+      
+      /**
+       * Creates a new server stack instance
+       * @param runtime the runtime the new stack instance is bound to
+       * @param transport the transport layer
+       * @param uri
+       * @param resources
+       * @return status code
+       */
+      status_t newServer(EtchRuntime* runtime, EtchTransportMessage* transport, const EtchString& uri, EtchResources* resources);
+      
+      /**
+       * Creates a new valuefactury
+       * @param uri
+       * @param vf an existing valuefactory
+       */
+      status_t newValueFactory(const EtchString& uri, EtchValueFactory *&vf);
+      
+    private:
+      ${i}ServerFactory* mFactory;
+      EtchResources *mRes;
+    };
+ 
+   public:
+#if($helper.isServer($mc) || $helper.isBoth($mc)) 
+    static status_t newListener(EtchRuntime* runtime, EtchString uri, EtchResources* resources, ${i}ServerFactory* implFactory, EtchServerFactory*& serverFactory);
+#end
+
+#if($helper.isClient($mc) || $helper.isBoth($mc))
+    static status_t newServer(EtchRuntime* runtime, EtchString uri, EtchResources* resources, ${i}ClientFactory& implFactory, RemoteHelloWorldServer*& server);
+#end
+  };
+}
+
+#endif /* __$helper.getHelperName($intf).toUpperCase()_H__ */
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_cpp.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_cpp.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_cpp.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,50 @@
+## 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($baseclname = "Base$intfname")
+#set($clname = "Impl$intfname")
+#if ($helper.isServer($mc))
+#set($peer = "mClient")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "mServer")
+#set($peerclass = "Remote${i}Server")
+#end
+
+\#include "${clname}.h"
+
+using namespace $namespace;
+
+/**
+ * Your custom implementation of $baseclname. Add methods here to provide
+ * implementations of messages from the $peer.
+ */
+
+  $clname::$clname( $peerclass* $peer )
+  {
+    this->$peer = $peer;
+  }
+
+  // TODO insert methods here to provide implementations of $intfname
+  // messages from the $peer.

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_h.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/impl_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,70 @@
+## 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($baseclname = "Base$intfname")
+#set($clname = "Impl$intfname")
+#if ($helper.isServer($mc))
+#set($peer = "mClient")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "mServer")
+#set($peerclass = "Remote${i}Server")
+#end
+
+#ifndef __${intf.name().toString().toUpperCase()}${suffix.toUpperCase()}_H__
+\#define __${intf.name().toString().toUpperCase()}${suffix.toUpperCase()}_H__
+
+\#include "${baseclname}.h"
+\#include "${i}Helper.h"
+
+namespace $namespace {
+  /**
+   * Your custom implementation of $baseclname. Add methods here to provide
+   * implementations of messages from the $peer.
+   */
+  class $clname : public $baseclname
+  {
+    /**
+     * A connection to the $peer session. Use this to send a
+     * message to the $peer.
+     */
+  private:
+    $peerclass* $peer;
+
+  public:
+    /**
+     * Constructs the $clname.
+     *
+     * @param $peer a connection to the $peer session. Use this to send a
+     * message to the $peer.
+     */
+    $clname( $peerclass* $peer );
+    virtual ~$clname() {}
+
+    // TODO insert methods here to provide declarations of $intfname
+    // messages from the $peer.
+  };
+}
+
+#endif /* __$intf.name().toString().toUpperCase()${suffix.toUpperCase()}_H__ */
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_cpp.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,146 @@
+##
+## 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.
+##
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+\#include "$inc"
+\#include "common/EtchRuntimeException.h"
+
+using namespace $namespace;
+
+#set($class = ($intf.name())+$suffix)
+
+#foreach( $n in $intf.iterator() )
+#if($n.isConstant() && !$hasBaseClass)
+#set($initConstruct = true)
+#end
+#end
+#if($initConstruct)
+#set($sep = "")
+$class::$intf.name()() :#foreach( $n in $intf.iterator() )#if($n.isConstant())#if(!$hasBaseClass)$sep $n.name()($helper.getTypeValue( $n.type(), $n.value() ) #set($sep = ","))#end#end#end{}
+#end
+#foreach( $n in $intf.iterator() )
+#if($n.isEnumx())
+#if (!$hasBaseClass)
+/*
+ * Init Type ID of $n.name()
+ */
+const EtchObjectType* $n.name()::TYPE() {
+  const static EtchObjectType TYPE(${n.vname($helper)}ID, NULL);
+  return &TYPE;
+}
+
+#end
+#elseif ($n.isStruct() || $n.isExcept())
+#if (!$hasBaseClass)
+/*
+ * Init Type ID of $class::$n.name()
+ */
+const EtchObjectType* $class::$n.name()::TYPE() {
+  const static EtchObjectType TYPE(${n.vname($helper)}ID, NULL);
+  return &TYPE;
+}
+
+/**
+ * Constructs the $n.name().
+ */
+$class::$n.name()::$n.name()()
+#if(!$n.isExcept())
+  : EtchObject($class::$n.name()::TYPE())
+#else
+  : EtchException("${n.name()}", ETCH_ERROR, EXCPTYPE_USERDEFINED, $class::$n.name()::TYPE())
+#end
+{
+  //nothing to do!
+}
+#if ($n.hasAnyParameters())
+/**
+ * Constructs the $n.name().
+#foreach( $i in $n.getAllParameters() )
+#set( $sep = "@param " )
+#foreach( $s in $i.descr() )
+ * $sep$i.name() $s
+#set( $sep = "" )
+#end
+#end
+ */
+$class::$n.name()::$n.name()(#set($sep = "")#foreach($i in $n.getAllParameters())$sep$helper.getEtchTypeName($i.type(), true) $i.name() #set( $sep = ", " )#end)
+#if($n.hasExtends())
+  : $n.name()(#set($sep = "")#foreach($i in $n.getExtends().getAllParameters())$sep$i.name()#set( $sep = ", " ))#end#if(!$n.isExcept()),
+  EtchObject($class::$n.name()::TYPE())#end
+#else
+#if(!$n.isExcept())
+  : EtchObject($class::$n.name()::TYPE())
+#else
+  : EtchException("${n.name()}", ETCH_ERROR, EXCPTYPE_USERDEFINED, $class::$n.name()::TYPE())
+#end
+#end
+{
+#foreach( $i in $n.getParameters() )
+  this->$i.name() = $i.name();
+#end
+}
+
+#if(! $n.isExcept() )
+
+EtchStringPtr $class::$n.name()::toString()
+{
+  //TODO: $helper.formatString( $n, false );
+  return NULL;
+}
+
+#end
+
+#foreach( $i in $n.iterator() )
+
+/**
+ * Gets the value.
+ *
+#foreach( $s in $i.descr() )
+ * $s
+#end
+ *
+ * @return the value.
+ */
+$helper.getEtchTypeName($i.type(), true) $class::$n.name()::$helper.getGetterName($i.name())()
+{
+  return $i.name();
+}
+
+/**
+ * Sets the value.
+ *
+#foreach( $s in $i.descr() )
+ * $s
+#end
+ *
+ * @param value the value.
+ */
+void $class::$n.name()::$helper.getSetterName($i.name())( $helper.getEtchTypeName($i.type(), true) value )
+{
+  this->$i.name() = value;
+}
+#end
+#end
+#end
+#end
+#end
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/intf_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,320 @@
+##
+## 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.
+##
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+#ifndef __$helper.getIntfName($intf, $mc)_H__
+\#define __$helper.getIntfName($intf, $mc)_H__
+
+
+#set($includedException = 0)
+#foreach( $n in $intf.iterator() )
+#if($n.isExcept() && ($includedException != 1))
+\#include "common/EtchException.h"
+#set($includedException = 1)
+#end
+#end
+#if($hasBaseClass)
+\#include "$inc"
+#else
+\#include "common/EtchTypes.h"
+#end
+\#include "support/EtchAsyncResult.h"
+
+#if ($intf.hasDescr())
+/**
+#foreach( $s in $intf.descr() )
+ * $s
+#end
+ */
+#end
+
+namespace $namespace {
+#if($suffix == "")
+#set($firstCustomID = true)
+  enum EtchObjectCustomTypeIds {
+#set($count = 0)
+#foreach( $n in $intf.iterator() )
+#if ($n.isStruct() || $n.isExcept() || $n.isEnumx())
+#set($count = $count +1)
+#end
+#end
+#set($enumHelper = 0)
+#foreach( $n in $intf.iterator() )
+#if ($n.isStruct() || $n.isExcept() || $n.isEnumx())
+#set($enumHelper = $enumHelper + 1)
+#if($firstCustomID)
+    ${n.vname( $helper )}ID = EOTID_DYNAMIC_START#set($firstCustomID = false),
+#else
+    ${n.vname( $helper )}ID#if($enumHelper < $count),#end
+
+#end
+#end
+#end
+  };
+#end
+#foreach( $n in $intf.iterator() )
+#if($n.isEnumx())
+#if (!$hasBaseClass)
+#if ($n.hasDescr())
+
+  /**
+#foreach( $s in $n.descr() )
+   * $s
+#end
+   */
+#end
+  class $n.name() :
+    public EtchObject
+  {
+  public:
+    static const EtchObjectType* TYPE();
+    enum _eval{
+#set($count = 0)#foreach($i in $n.iterator())#set($count = $count +1)#end
+#set($enumHelper=0) 
+#foreach( $i in $n.iterator() )
+#set($enumHelper = $enumHelper+1)
+      /**
+#foreach( $s in $i.descr() )
+      * $s
+#end
+      */
+      $i.name()#if($enumHelper < $count),#end
+
+#end
+
+    } Value;
+
+    $n.name()() : EtchObject($n.name()::TYPE()) { }
+    $n.name()(_eval eval) : EtchObject($n.name()::TYPE()) { Value = eval; }
+  };
+  typedef capu::SmartPointer<$n.name()> $n.name()Ptr;
+#end
+#end
+#end
+
+#if ($hasBaseClass)
+  class $intf.name()$suffix : public virtual $intf.name()
+#else
+  class $intf.name()$suffix
+#end
+#foreach( $n in $intf.iterator() )
+#if($n.isConstant() && !$hasBaseClass)
+#set($initConstruct = true)
+#end
+#if ($n.isMixin())
+    $sep public $n.name()$suffix
+#set ($sep = ",")
+#end
+#end
+  {
+#if (!$intf.hasMessageDirection($mc))
+    // no $mc direction items defined.
+#end
+
+  public:
+#if($initConstruct)
+    $intf.name()();
+#end
+    virtual ~$intf.name()$suffix() {}
+
+#foreach( $n in $intf.iterator() )
+#if ($n.isMessage())
+#if ($n.isMsgDir($mc))
+#if (!$n.isHidden())
+
+#if(!($helper.getEtchTypeName($n.type(), true) == "void"))
+    typedef capu::SmartPointer<EtchAsyncResult<$helper.getEtchTypeName($n.type(), false)> > $n.name()AsyncResultPtr;
+    ## typedef EtchAsyncResult<$helper.getEtchTypeName($n.type(), false)> $n.name()AsyncResult;
+#else
+    typedef EtchAsyncResultNonePtr $n.name()AsyncResultPtr;
+#end
+
+    /**
+#foreach( $s in $n.descr() )
+     * $s
+#end
+#foreach( $p in $n.iterator() )
+#set($first = true)
+#foreach( $s in $p.descr() )
+#if ($first)
+#set($first = false)
+     * @param $p.name() $s
+#else
+     * $s
+#end
+#end
+#end
+#if ($n.hasReturn())
+#set($first = true)
+#foreach( $s in $n.returnDescr() )
+#if ($first)
+#set($first = false)
+     * @return $s
+#else
+     * $s
+#end
+#end
+#end
+#foreach($t in $n.thrown().iterator())
+#set($first = true)
+#foreach( $s in $t.descr() )
+#if ($first)
+#set($first = false)
+     * @throws $t.name() $s
+#else
+     * $s
+#end
+#end
+#end
+     */
+    virtual $n.name()AsyncResultPtr $n.name()(#set( $sep = "" )#foreach($p in $n.iterator())$sep$helper.getEtchTypeName($p.type(), true) $p.name() #set( $sep = ", " )#end) = 0;
+
+#end
+#end
+#elseif ($n.isConstant())
+#if (!$hasBaseClass)
+#if ($n.hasDescr())
+    /**
+#foreach($s in $n.descr())
+     * $s
+#end
+     */
+#end
+  public:
+    $helper.getEtchTypeName($n.type(), false) $n.name();
+#end
+#elseif ($n.isExtern())
+## ignore extern
+#elseif ($n.isMixin())
+## ignore mixin
+#elseif ($n.isStruct() || $n.isExcept())
+#if (!$hasBaseClass)
+#if ($n.hasDescr())
+    /**
+#foreach( $s in $n.descr() )
+     * $s
+#end
+     */
+#end
+    class $n.name()
+#if($n.hasExtends())
+      : public $n.getExtends().name(), public EtchObject
+#elseif($n.isExcept())
+      : public EtchException
+#else
+      : public EtchObject
+#end
+    {
+    public:
+      static const EtchObjectType* TYPE();
+
+      /**
+       * Constructs the $n.name().
+       */
+      $n.name()();
+
+#if ($n.hasAnyParameters())
+
+      /**
+       * Constructs the $n.name().
+#foreach( $i in $n.getAllParameters() )
+#set( $sep = "@param " )
+#foreach( $s in $i.descr() )
+       * $sep$i.name() $s
+#set( $sep = "" )
+#end
+#end
+       */
+      $n.name()(#set($sep = "")#foreach($i in $n.getAllParameters())$sep$helper.getEtchTypeName($i.type(), true) $i.name() #set( $sep = ", " )#end)#if(!$n.hasExtends());
+#else
+        : $n.name();#end
+#end
+
+      virtual ~$n.name()() {}
+
+#if(! $n.isExcept() )
+      EtchStringPtr toString();
+#end
+#foreach($i in $n.iterator())
+
+#if( $i.hasDescr())
+      /**
+#foreach($s in $i.descr())
+       * $s
+#end
+       */
+#end
+    private:
+      $helper.getEtchTypeName($i.type(), true) $i.name();
+
+      /**
+       * Gets the value.
+       *
+#foreach($s in $i.descr())
+       * $s
+#end
+       *
+       * @return the value.
+       */
+    public:
+      $helper.getEtchTypeName($i.type(), true) $helper.getGetterName($i.name())();
+
+      /**
+       * Sets the value.
+       *
+#foreach($s in $i.descr())
+       * $s
+#end
+       *
+       * @param value the value.
+       */
+    public:
+      void $helper.getSetterName($i.name())($helper.getEtchTypeName( $i.type(), true) value);
+#end
+    };
+    typedef capu::SmartPointer<${n.name()}> $n.name()Ptr;
+
+#end
+#elseif ($n.isBuiltin())
+## nothing to do.
+#elseif ($n.isEnumx())
+    typedef capu::SmartPointer<${n.name()}> $n.name()Ptr;
+
+#else
+    *** intf.vm: don't know what to do with $n ***
+#end
+#end
+#foreach($n in $intf.iterator())
+#if ($n.hasAnyParameters())
+#foreach( $i in $n.getAllParameters() )
+#if($i.type().dim() > 0)
+    typedef capu::SmartPointer<EtchNativeArray<${n.name()}Ptr> > EtchNativeArray$n.name()Ptr;
+    ##typedef EtchNativeArray<${n.name()}Ptr> EtchNativeArray$n.name()Obj;
+#end
+#end
+#end  
+#end
+  };
+}
+
+#endif
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_cpp.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_cpp.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_cpp.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,172 @@
+##
+## 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.
+##
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($baseclname = "Base$intfname")
+#set($clname = "Impl$intfname")
+#if ($helper.isServer($mc))
+#set($peer = "client")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "server")
+#set($peerclass = "Remote${i}Server")
+#end
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+
+\#include "${peerclass}.h"
+#if ($helper.isServer($mc))
+\#include "Main${i}Listener.h"
+\#include "Impl${i}Server.h"
+#else
+\#include "Main${i}Client.h"
+\#include "Impl${i}Client.h"
+#end
+
+\#include "capu/os/Thread.h"
+\#include "common/EtchTypes.h"
+\#include "support/EtchRuntime.h"
+\#include "transport/EtchTransportData.h"
+
+
+using namespace $namespace;
+
+#if ($helper.isServer($mc))
+${i}Server* Main${i}Listener::new${i}Server(Remote${i}Client* client)
+{
+  return new Impl${i}Server(client);
+}
+
+/**
+ * Main program for ${i}Server.
+ *
+ * @param args command line arguments.
+ * @throws Exception
+ */
+int main(int argc, const char* argv[])
+{
+  status_t status;
+
+  EtchRuntime* runtime = new EtchRuntime();
+  status = runtime->start();
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+  
+  //TODO Change to correct URI
+  EtchString uri("tcp://0.0.0.0:4001");
+
+  Main${i}Listener main${i}listener;
+
+  EtchServerFactory *listener;
+  status = ${i}Helper::newListener(runtime, uri, NULL, &main${i}listener, listener);
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+  
+  // Start the Listener
+  status = listener->transportControl(new EtchString(EtchTransportData::START_AND_WAIT_UP()), new EtchInt32(4000));
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+  
+  //Wait for finish...
+  capu::Thread::Sleep(20000);
+
+  //Stop the Listener
+  status = listener->transportControl(new EtchString(EtchTransportData::STOP_AND_WAIT_DOWN()), new EtchInt32(4000));
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+  
+  delete listener;
+
+  
+  status = runtime->shutdown();
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+  
+  delete runtime;
+  return 0;
+}
+
+#else
+${i}Client* Main${i}Client::new${i}Client(Remote${i}Server* server)
+{
+  return new Impl${i}Client(server);
+}
+
+/**
+ * Main program for ${i}Client.
+ *
+ * @param args command line arguments.
+ * @throws Exception
+ */
+capu::int32_t main(int argc, const char* argv[])
+{
+  status_t status;
+  
+  EtchRuntime* runtime = new EtchRuntime();
+  status = runtime->start();
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+
+  // TODO Change to correct URI
+  EtchString uri("tcp://127.0.0.1:4001");
+
+  Main${i}Client mc;
+
+  Remote${i}Server *remote = NULL;
+  status = ${i}Helper::newServer(runtime, uri, NULL, mc, remote);
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+
+ 
+  // Connect to the service
+  status = remote->transportControl(new EtchString(EtchTransportData::START_AND_WAIT_UP()), new EtchInt32(4000));
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+  
+  HelloWorld::userPtr myUser = new HelloWorld::user(new EtchInt32(1),new EtchString("World"));
+  remote->say_hello_server(myUser);
+  
+  // Disconnect from the service
+  status = remote->transportControl(new EtchString(EtchTransportData::STOP_AND_WAIT_DOWN()), new EtchInt32(4000));
+  if (status != ETCH_OK) {
+    //TODO Handle error
+  }
+
+  delete remote;
+  
+  result = runtime->shutdown();
+  
+  delete runtime;
+  return 0;
+}
+
+#end
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_h.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/main_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,86 @@
+##
+## 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.
+##
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created for your convenience and will not be
+// overwritten once it exists! Please edit this file as necessary to implement
+// your service logic.
+
+
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($baseclname = "Base$intfname")
+#set($clname = "Impl$intfname")
+#if ($helper.isServer($mc))
+#set($peer = "client")
+#set($peerclass = "Remote${i}Client")
+#else
+#set($peer = "server")
+#set($peerclass = "Remote${i}Server")
+#end
+
+#if ($helper.isServer($mc))
+#ifndef __MAIN${intf.name().toString().toUpperCase()}LISTENER_H__
+\#define __MAIN${intf.name().toString().toUpperCase()}LISTENER_H__
+#else
+#ifndef __MAIN${intf.name().toString().toUpperCase()}CLIENT_H__
+\#define __MAIN${intf.name().toString().toUpperCase()}CLIENT_H__
+#end
+ 
+
+\#include "capu/Config.h"
+\#include "${i}Helper.h"
+
+namespace $namespace {
+#if ($helper.isServer($mc))
+  /**
+   * Main program for ${i}Server. This program makes a listener to accept
+   * connections from Main${i}Client.
+   */
+  class Main${i}Listener
+   : public ${i}Helper::${i}ServerFactory
+  {
+  public:
+    virtual ~Main${i}Listener() {}
+    ${i}Server* new${i}Server(Remote${i}Client* client);
+  };
+#else
+
+  /**
+   * Main program for ${i}Client. This program makes a connection to the
+   * listener created by Main${i}Listener.
+   */
+  class Main${i}Client
+   : public ${i}Helper::${i}ClientFactory
+  {
+  public:
+    virtual ~Main${i}Client() {}
+    ${i}Client* new${i}Client(Remote${i}Server* server);
+  };
+#end
+}
+
+#if ($helper.isServer($mc))
+#endif /* __MAIN${intf.name().toString().toUpperCase()}LISTENER_H__ */
+#else
+#endif /* __MAIN${intf.name().toString().toUpperCase()}CLIENT_H__ */
+#end
+ 
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/readme.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/readme.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/readme.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/readme.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,138 @@
+## 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.
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+
+This is a description of the etch-generated files for your service.
+
+----------------
+- How To Build -
+----------------
+
+In the directory where the etch file is located, execute the following command:
+
+etch -q -d . -I . -b java -w all Blah.etch
+
+This would compile the service description Blah.etch, generating all java files,
+into java packages rooted in the current directory (-d .), resolving includes
+and mixins from the current directory (-I .) and being quiet about it (-q).
+
+Assuming the Blah.etch specified a module of "demo" and a service of Blah,
+the java files would be generated into a sub-directory demo of the current
+directory. you may now change to that directory and compile the resulting files:
+
+cd demo
+javac -cp %ETCH_HOME%\lib\etch-java-runtime.jar *.java
+
+(Assuming windows; for unix, you only need to change the slash direction and
+change %ETCH_HOME% into \$ETCH_HOME.)
+
+To run the service (which initially won't do anything but make a connection and
+then close it, use the following two commands in separate shells (again, from
+the demo directory):
+
+java -cp %ETCH_HOME%\lib\etch-java-runtime.jar;.. demo.MainBlahListener
+
+java -cp %ETCH_HOME%\lib\etch-java-runtime.jar;.. demo.MainBlahClient
+
+(Again, assuming windows; for unix, make the changes detailed above and also
+change the semi-colon in the -cp spec to a colon.)
+
+The first command (java ... demo.MainBlahListener) starts the service listener
+which accepts connections. The second command runs a sample client, which makes
+a connection to the running listener and then closes it again.
+
+Once you've compiled the service and tested the result, you may implement your
+service by adding content to the etch file, adding implementation details to the
+Impl*.java and Main*.java files, and recompiling using the above steps. You may
+also load these files into an IDE such as eclipse or intellij, or use a build
+management system such as maven or ant. Remember, whenever you change the etch
+file, you must re-etch the service description and then re-javac all the java
+files.
+
+-------------------
+- Generated Files -
+-------------------
+
+Here is a description of the generated files for a service named Blah.
+
+Blah.java
+BlahClient.java
+BlahServer.java
+
+These three files are the generated interface classes. Service defined constants
+and types are in Blah.java, as well as direction "both" messages, which are
+messages which are shared between client and server. BlahClient.java and
+BlahServer.java are respectively the messages for just the direction client or
+server. You should not edit these files.
+
+RemoteBlah.java
+RemoteBlahClient.java
+RemoteBlahServer.java
+
+RemoteBlah*.java are the generated classes which implement the interfaces,
+with message implementations which encode the message type and arguments for
+transport to the connection peer and then receive and decode any response. You
+should not edit these files.
+
+StubBlah.java
+StubBlahClient.java
+StubBlahServer.java
+
+StubBlah*.java are the generated classes which receive messages encoded by
+RemoteBlah*.java and decode them, calling the appropriate message implementation
+and then encoding and sending any result. You should not edit these files.
+
+ValueFactoryBlah.java
+
+ValueFactoryBlah.java is a generated class which contains helper code to
+serialize service defined types and also the meta data which describes the
+messages and fields, field types, timeouts, etc. You should not edit this file.
+
+BaseBlah.java
+BaseBlahClient.java
+BaseBlahServer.java
+
+BaseBlah*.java are generated classes which implement the interfaces, with
+message implementations which do nothing but throw UnsupportedOperationException.
+They can be used to supply an implementation when you don't want to immediately
+implement all the messages. You should not edit these files.
+
+ImplBlahClient.java
+ImplBlahServer.java
+
+ImplBlah*.java are the generated sample client and server implementation
+classes. They extend the generated base classes. These are used by the sample
+main programs to provide implementations of the client or server messages. Edit
+these files as you wish to implement your service (overriding the default
+implementations from the generated base classes).
+
+BlahHelper.java
+
+BlahHelper.java is a generated class which includes static methods to help
+construct transports for client and listener. You should not edit this file.
+
+MainBlahClient.java
+MainBlahListener.java
+
+MainBlah*.java are the generated sample client and server main programs.
+They show how to setup a transport and start it and how to create a session.
+Edit these files as you wish to implement your service, or just copy the code
+into your own application.

Added: 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=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_cpp.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,129 @@
+##
+## 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.
+##
+
+#set($i = $intf.name())
+#set($vfname = "ValueFactory$i")
+#set($intfname = "$i$suffix")
+#set($clname = "Remote$intfname")
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+\#include "${vfname}.h"
+\#include "$inc"
+
+using namespace $namespace;
+
+#foreach($n in $intf.iterator())
+#if($n.isMsgDir($mc))
+#if(!$n.isHidden())
+$clname::$n.name()AsyncResultRemote::$n.name()AsyncResultRemote(EtchRuntime* runtime, EtchMailbox* mailbox) 
+  : #if($n.hasReturn())EtchAsyncResult<$helper.getEtchTypeName($n.type(), false)>(runtime, mailbox)#{else}EtchAsyncResultNone(runtime, mailbox)#end {
+}
+
+$clname::$n.name()AsyncResultRemote::~$n.name()AsyncResultRemote() {
+}
+
+
+status_t $clname::$n.name()AsyncResultRemote::mailboxStatus(EtchMailbox* mb, EtchObject* state, capu::bool_t closed) {
+  //TODO implemented callback
+  return ETCH_OK;
+}
+
+$intfname::$n.name()AsyncResultPtr $clname::$n.name()AsyncResultRemote::Begin($clname* base, #set($sep = "")#foreach($p in $n.iterator())$sep$helper.getEtchTypeName($p.type(), true) $p.name()#set($sep = ", ")#end) {
+  status_t status;
+
+  capu::SmartPointer<EtchMessage> msg;
+  status = base->newMessage($vfname::$n.vname( $helper ), &msg); 
+  if(status != ETCH_OK) {
+    // TODO log error
+  }
+
+#set($ObjCount = 0)
+#foreach( $p in $n.iterator() )
+#set($ObjCount = $ObjCount + 1)
+  EtchObjectPtr obj$ObjCount = ${p.name()};
+  msg->put($vfname::$p.vname($helper)(), obj$ObjCount);
+#end
+
+  EtchMailbox* mb = NULL; 
+  status = base->begincall(msg, mb);
+  if(status != ETCH_OK) {
+    // TODO log error
+  }
+
+  $n.name()AsyncResultRemote* result = new $n.name()AsyncResultRemote(base->mRuntime, mb); 
+  return result;
+}
+
+#end
+#end
+#end
+
+
+/**
+ * Constructs the $clname.
+ *
+ * @param svc
+ * @param vf
+ */
+#if($hasBaseClass)
+$clname::$clname(EtchRuntime* runtime, EtchDeliveryService* svc, EtchValueFactory* vf )
+  : Remote${i}(runtime, svc, vf) {
+#else
+$clname::$clname(EtchRuntime* runtime, EtchDeliveryService* svc, EtchValueFactory* vf )
+  : EtchRemoteBase(svc, vf), mRuntime(runtime) {
+#end
+}
+
+$clname::~$clname() {
+}
+
+#foreach($n in $intf.iterator())
+#if($n.isMsgDir($mc) || $n.isMsgDirBoth())
+#if(!$n.isHidden())
+#if(!$methodList.contains($n.name().name()))
+#set ( $addMethodListStatus = $methodList.add($n.name().name()))
+
+#if(!$n.isMsgDirBoth())
+#if($n.isOneway())
+$intfname::$n.name()AsyncResultPtr $clname::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName( $p.type(), true ) $p.name() #set( $sep = ", " )#end) {
+  $n.name()AsyncResultPtr result = $clname::$n.name()AsyncResultRemote::Begin(this, #set($sep = "")#foreach($p in $n.iterator())$p.name() #set( $sep = ", ")#end);
+  return result;
+}
+
+#else
+$intfname::$n.name()AsyncResultPtr $clname::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName( $p.type(), true ) $p.name() #set( $sep = ", " )#end) {
+  $n.name()AsyncResultPtr result = $clname::$n.name()AsyncResultRemote::Begin(this, #set($sep = "")#foreach($p in $n.iterator())$p.name() #set( $sep = ", ")#end);
+  return result;
+}
+
+#end
+#else
+$intfname::$n.name()AsyncResultPtr $clname::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName( $p.type(), true ) $p.name() #set( $sep = ", " )#end) {
+  return Remote$i::$n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$p.name() #set( $sep = ", " )#end);
+}
+#end
+
+#end
+#end
+#end
+#end
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/remote_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,193 @@
+##
+## 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.
+##
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+#set($i = $intf.name())
+#set($vfname = "ValueFactory$i")
+#set($intfname = "$i$suffix")
+#set($clname = "Remote$intfname")
+
+#ifndef __$helper.getRemoteName($intf, $mc).toUpperCase()_H__
+\#define __$helper.getRemoteName($intf, $mc).toUpperCase()_H__
+
+#if(!$hasBaseClass)
+\#include "support/EtchRemoteBase.h"
+#else
+\#include "ValueFactoryHelloWorld.h"
+\#include "$inc"
+\#include "Remote${i}.h"
+#end
+\#include "${intfname}.h"
+\#include "support/EtchAsyncResult.h"
+
+namespace $namespace {
+  /**
+   * Call to message translator for $intfname.
+   */
+#if($hasBaseClass)
+  class $clname : public Remote$i, public $intfname
+#else
+  class $clname : public EtchRemoteBase, public $intfname
+#end
+  {
+  private:
+
+    /**
+     * Async result implementations of service methods.
+     */
+
+#foreach($n in $intf.iterator())
+#if($n.isMsgDir($mc))
+#if(!$n.isHidden())
+    class $n.name()AsyncResultRemote : public #if($n.hasReturn())EtchAsyncResult<$helper.getEtchTypeName($n.type(), false)>#{else}EtchAsyncResultNone#end {
+    public:
+      /**
+       * Create a new instance from $clname class
+       */
+      $n.name()AsyncResultRemote(EtchRuntime* runtime, EtchMailbox* mailbox);
+
+      /**
+       * Destructor
+       */
+      virtual ~$n.name()AsyncResultRemote();
+
+      /**
+       * @see EtchNotify
+       */
+      status_t mailboxStatus(EtchMailbox* mb, EtchObject* state, capu::bool_t closed);
+
+      /**
+       * Create a new instance from $clname class
+       */
+       static $n.name()AsyncResultPtr Begin($clname* base, #set($sep = "")#foreach($p in $n.iterator())$sep$helper.getEtchTypeName($p.type(), true) $p.name()#set($sep = ", ")#end);
+    };
+
+#end
+#end
+#end
+  public:
+    /**
+     * Constructs the $clname.
+     *
+     * @param svc
+     * @param vf
+     */
+    $clname(EtchRuntime* runtime, EtchDeliveryService* svc, EtchValueFactory* vf );
+    
+    /**
+     * Destructor
+     */
+    virtual ~$clname();
+  protected:
+#if(!$hasBaseClass)
+     EtchRuntime* mRuntime;
+#end
+
+  public:
+#foreach($n in $intf.iterator())
+#if($n.isMsgDir($mc) || $n.isMsgDirBoth())
+#if(!$n.isHidden())
+#if(!$methodList.contains($n.name().name()))
+#set ( $addMethodListStatus = $methodList.add($n.name().name()))
+    $n.name()AsyncResultPtr $n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName($p.type(), true) $p.name()#set( $sep = ", " )#end);
+## TODO Implement delegate
+## $n.name()AsyncResultPtr $n.name()(#set( $sep = "" )#foreach( $p in $n.iterator() )$sep$helper.getEtchTypeName($p.type(), true) $p.name()#set( $sep = ", " )#end${sep}EtchDelegate<$intfname::$n.name()AsyncResultPtr>* delegate);
+#end
+#end
+#end
+#end
+##    //TODO: MIXIN generation!
+###set( $k = 0 )
+###foreach( $x in $intf.iterator() )
+###if( $x.isMixin() )
+##
+##  // ----- mixin $x.name() ----- //
+###set( $k = $k + 1 )
+###set( $v = "_mixin$k" )
+###set( $m = $x.getModule() )
+###set( $z = $m.iterator().next() )
+##
+##  private final ${m.name()}.Remote$z.name()$suffix $v;
+###foreach( $n in $z.messages( true ) )
+###if($n.isMsgDir($mc))
+###if(!$n.isHidden())
+###if(!$methodList.contains($n.name().name()))
+###set ( $addMethodListStatus = $methodList.add($n.name().name()) )
+##  // --- generated methods for $n.name() --- //
+
+###if($n.isOneway())
+##  public final $helper.getTypeName( $n.type() ) $n.name()(
+###set( $sep = "" )
+###foreach( $p in $n.iterator() )
+##    $sep$helper.getTypeName( $p.type() ) $p.name()
+###set( $sep = ", " )
+###end
+##  )
+##  {
+##    ${v}.$n.name()(
+###set( $sep = "" )
+###foreach( $p in $n.iterator() )
+##      $sep$p.name()
+###set( $sep = ", " )
+###end
+##    );
+##  }
+###else
+##  public final $helper.getTypeName( $n.type() ) $n.name()(
+###set( $sep = "" )
+###foreach( $p in $n.iterator() )
+##    $sep$helper.getTypeName( $p.type() ) $p.name()
+###set( $sep = ", " )
+###end
+##  )
+###if($n.thrown().iterator().hasNext())
+##  throws
+###set( $sep = "" )
+###foreach($t in $n.thrown().iterator())
+##    $sep$t.getNamed().fqname()
+###set( $sep = ", " )
+###end
+###end
+##  {
+###if($n.hasReturn())
+##    return
+###end
+##    ${v}.$n.name()(
+###set( $sep = "" )
+###foreach( $p in $n.iterator() )
+##      $sep$p.name()
+###set( $sep = ", " )
+###end
+##    );
+##  }
+###end
+###end
+###end
+###end
+###end
+###end
+###end
+  };
+  typedef capu::SmartPointer<$clname> ${clname}Ptr;
+}
+#endif /* __$helper.getRemoteName($intf, $mc).toUpperCase()_H__ */
\ No newline at end of file

Added: incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_cpp.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_cpp.vm?rev=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_cpp.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_cpp.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,35 @@
+##
+## 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.
+##
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($clname = "Stub$intfname")
+#if ($hasBaseClass)
+#set( $T = "$i$suffix" )
+#else
+#set( $T = "T")
+#end
+
+\#include "$inc"
+
+using namespace $namespace;
+

Added: 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=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/stub_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,179 @@
+##
+## 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.
+##
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+#set($i = $intf.name())
+#set($intfname = "$i$suffix")
+#set($clname = "Stub$intfname")
+
+#ifndef __$helper.getStubName($intf, $mc).toUpperCase()_H__
+\#define __$helper.getStubName($intf, $mc).toUpperCase()_H__
+
+\#include "$inc"
+#if($hasBaseClass)
+\#include "Stub${i}.h"
+#end
+\#include "support/EtchDeliveryService.h"
+#if(!$hasBaseClass)
+\#include "support/EtchStubBase.h"
+#end
+\#include "ValueFactory${i}.h"
+\#include "support/EtchStubHelper.h"
+
+using namespace $namespace;
+
+#foreach( $mthd in $intf.iterator() )
+#if ($mthd.isMsgDir($mc))
+#if (!$mthd.isHidden())
+#set( $notEmpty = true)
+class Run${mthd.vname($helper)}
+  : public EtchStubHelper<$i$suffix>
+{
+public:
+  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;
+
+#if (!$mthd.isOneway())
+    capu::SmartPointer<EtchMessage> _rmsg;
+    status = _msg->createReplyMessage(_rmsg);
+    if(status != ETCH_OK) {
+      // TODO log error
+      // TODO set exception
+      return ETCH_ERROR;
+    }
+
+#end
+    // do stub call
+#set($count = 0)
+#foreach($param in $mthd.iterator())
+#set($count = $count + 1)
+    EtchObjectPtr obj$count;
+    _msg->get(ValueFactory$i::$param.vname($helper)(), &obj$count);
+    $helper.getEtchTypeName($param.type(), true) val$count = capu::smartpointer_cast<$helper.getEtchTypeName($param.type(), false)>(obj$count);
+
+#end
+    $intfname::$mthd.name()AsyncResultPtr ar;
+#set($sep = "")
+#set($count = 0)
+    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::SmartPointer<$helper.getEtchTypeName($mthd.type(), false)> result;
+        ar->getResult(result);
+        _rmsg->put(ValueFactory$i::_mf_result(), result);
+    } else
+#end
+    if(ar->hasException()) {
+        _ref->sessionNotify(ar->getException());
+#if ($mthd.isOneway())
+        EtchMessagePtr _rmsg;
+        _msg->createReplyMessage( _msg->getValueFactory()->get_mt__exception(), _rmsg );
+#end
+        _rmsg->put( ValueFactory$i::_mf_result(), ar->getException() );
+#if ($mthd.isOneway())
+        // transport result message
+        status = _svc->transportMessage( _sender, _rmsg);
+#end
+    }
+
+#if (!$mthd.isOneway())
+    // transport result message
+    status = _svc->transportMessage( _sender, _rmsg);
+#end
+    return status;
+  }
+};
+#end
+#end
+#end
+
+namespace $namespace {
+#if ($hasBaseClass)
+
+  /**
+   * Message to call translator for $i$suffix.
+   */
+  class Stub$i$suffix : public Stub$i<$i$suffix>
+#set( $T = "$i$suffix" )
+#else
+  /**
+   * Message to call translator for $i$suffix.
+   * @param <T> $i$suffix or a subclass thereof.
+   */
+  template<typename T>
+  class Stub$i$suffix : public EtchStubBase<T>
+#set( $T = "T" )
+#end
+  {
+    /**
+    * Stub for $i$suffix.
+    * @param svc the delivery service.
+    * @param obj the implementation of $i$suffix responsive to requests.
+    * @param free thread pool used to run AsyncMode.FREE methods.
+    * @param queued thread pool used to run AsyncMode.QUEUED methods.
+    */
+  public:
+#if(!$hasBaseClass)
+    Stub$i$suffix( EtchDeliveryService *svc, $T *obj, EtchQueuedPool* queued, EtchFreePool* free)
+      : EtchStubBase<T>(svc, obj, queued, free)
+#else
+    Stub$i$suffix( EtchDeliveryService *svc, $T *obj, EtchQueuedPool* queued, EtchFreePool* free)
+      : Stub$i<$i$suffix>(svc, obj, queued, free)
+#end
+    {
+    }
+    virtual ~Stub$i$suffix() {}
+    static void init()
+    {
+    // nothing to do.
+    }
+
+
+##if($notEmpty)
+   /*
+    * Static Initialization-Helper
+    */
+  private:
+    friend class ValueFactory${i};
+    static void __INIT()
+    {
+#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
+    }
+##end
+  };
+}
+
+#endif /* __$helper.getStubName($intf, $mc).toUpperCase()_H__ */

Added: 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=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_cpp.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,340 @@
+##
+## 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.
+##
+
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+
+#set($i = $intf.name())
+#set( $vf = "ValueFactory$intf.name()" )
+
+\#include "$inc"
+\#include "common/EtchError.h"
+\#include "serialization/EtchField.h"
+\#include "serialization/EtchAsyncMode.h"
+\#include "serialization/EtchDirection.h"
+\#include "${intf.name()}.h"
+\#include "serialization/EtchValidators.h"
+\#include "Stub${i}Server.h"
+\#include "Stub${i}Client.h"
+
+using namespace $namespace;
+
+##--------------------------------------------------------------
+## Classes that represent anonym creation in java
+##--------------------------------------------------------------
+#foreach ( $n in $intf.iterator() )
+#if ($n.isStruct() || $n.isExcept())
+#set( $tname = $n.efqname( $helper ) )
+class ImportExportHelper$n.vname($helper)
+  : public EtchImportExportHelper {
+public:
+  status_t exportValue(EtchValueFactory* vf, EtchObjectPtr value, EtchStructValue *&result)
+  {
+    EtchStructValue* _struct = new EtchStructValue( $vf::${n.vname( $helper )}, vf );
+    $i::${tname}Ptr v = capu::smartpointer_cast<$i::$tname>(value);
+#set($CountParams = 0)
+#foreach( $p in $n.getAllParameters() )
+#set($CountParams = $CountParams + 1)
+    EtchObjectPtr val$CountParams = v->$helper.getGetterName($p.name())();
+    _struct->put($vf::$p.vname($helper)(), val$CountParams );
+#end
+    result = _struct;
+    return ETCH_OK;
+  }
+  status_t importValue(EtchStructValue* value, EtchObjectPtr &result)
+  {
+    $i::$tname* v = new $i::${tname}();
+#set($CountParams = 0)
+#foreach ($p in $n.getAllParameters())
+#set($CountParams = $CountParams + 1)
+    $helper.getEtchTypeName($p.type(), true) tmp$CountParams;
+    EtchObjectPtr val$CountParams;
+    value->get($vf::$p.vname($helper)(), &val$CountParams);
+    tmp$CountParams = capu::smartpointer_cast<$helper.getEtchTypeName($p.type(), false)>(val$CountParams);
+    v->$helper.getSetterName($p.name())(tmp$CountParams);
+#end
+    result = v;
+    return ETCH_OK;
+  }
+};
+#elseif ($n.isExtern())
+#set( $tname = $n.efqname( $helper ) )
+#elseif ($n.isEnumx())
+#set( $tname = $n.efqname( $helper ) )
+    
+class ImportExportHelper$n.vname( $helper )
+  : public EtchImportExportHelper {
+  public:
+  status_t exportValue(EtchValueFactory* vf, EtchObjectPtr value, EtchStructValue *&result)
+  {
+     EtchStructValue* _struct = new EtchStructValue( $vf::${n.vname( $helper )}, vf );
+     ${tname}Ptr v = capu::smartpointer_cast<${tname}>(value);
+     switch (v->Value)
+     {
+#foreach ($p in $n.iterator())
+       case $tname::$p.name(): _struct->put($vf::$p.vname($helper)(), new EtchBool(true) ); break;
+#end
+     }
+     result = _struct;
+     return ETCH_OK;
+   }
+
+   status_t importValue(EtchStructValue* value, EtchObjectPtr &result)
+   {
+     // if empty, it likely means that a null value was sent
+     // or an unknown key (from a different rev of the service).
+     if (value->isEmpty())
+       return ETCH_EINVAL;
+
+     // there should only be a single key, so take the first one
+     EtchField key = value->getFirstField();
+#foreach ($p in $n.iterator())
+     if (key.equals(&$vf::$p.vname($helper)()))
+     {
+       result = new ${tname}(${tname}::$p.name());
+       return ETCH_OK;
+     }
+#end
+
+     // a known key was sent, but it did not match any defined
+     // key for this type.
+     return ETCH_ENOT_EXIST;
+   }
+};
+#end
+#end
+
+
+//Static Variable Initialization
+EtchTypeMap* $vf::types() {
+static EtchTypeMap* ret = new EtchTypeMap();
+return ret;
+}
+
+EtchClass2TypeMap* $vf::class2type() {
+static EtchClass2TypeMap* ret = new EtchClass2TypeMap();
+return ret;
+}
+
+#foreach ( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExtern() || $n.isExcept() || $n.isMessage())
+EtchType* $vf::$n.vname( $helper );
+#end
+#end
+
+#set( $x = $params.clear() )
+## standard params from DefaultValueFactory
+#set( $x = $params.add( "msg" ) )
+#set( $x = $params.add( "result" ) )
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#foreach( $param in $n.iterator() )
+#if (!$params.contains($param.name().name()))
+#set( $x = $params.add($param.name().name()) )
+
+EtchField& $vf::$param.vname( $helper )() {
+  static EtchField ret("$param.name().name()");
+  return ret;
+}
+#end
+#end
+#end
+#end
+
+${vf}::${vf}( EtchString uri ) : EtchDefaultValueFactory(uri, types(), class2type())
+{
+#foreach ( $n in $intf.iterator() )
+#if ($n.isMixin())
+#set( $m = $n.getModule() )
+#set( $s = $m.iterator().next() )
+  addMixin( new ${m.name()}.ValueFactory${s.name()}( uri ) );
+#end
+#end
+}
+
+void ${vf}::initTypes()
+{
+#foreach ( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExtern() || $n.isExcept() || $n.isMessage())
+  types()->get(EtchString("$n.fqname()"), ${vf}::${n.vname( $helper )});
+#end
+#end
+}
+
+void ${vf}::initResults()
+{
+//AF: TO-REVIEW: finde die Verwendung von Anonymer Enum bei EchtDirection und bei EtchAsyncMode unschoen
+
+#foreach ( $n in $intf.iterator() )
+#if ($n.isMessage())
+  ${vf}::${n.vname( $helper )}->setDirection((EtchDirection)$n.msgDir());
+#if (!$n.isHidden())
+#if ($n.isQueuedAsyncReceiver())
+  ${vf}::${n.vname( $helper )}->setAsyncMode((EtchAsyncMode)QUEUED);
+#elseif ($n.isFreeAsyncReceiver())
+  ${vf}::${n.vname( $helper )}->setAsyncMode((EtchAsyncMode)FREE);
+#else
+  ${vf}::${n.vname( $helper )}->setAsyncMode((EtchAsyncMode)NONE);
+#end
+#if (!$n.isOneway())
+#set( $r = $n.getResultMessage() )
+  ${vf}::${n.vname( $helper )}->setResult(${vf}::$r.vname( $helper ));
+  ${vf}::${r.vname( $helper )}->setTimeout($n.getTimeout());
+#end
+#end
+#end
+#end
+}
+
+## ----------------------------- import / export -----------------------------
+void ${vf}::initImportExport()
+{
+#foreach ( $n in $intf.iterator() )
+#if ($n.isStruct() || $n.isExcept())
+#set( $tname = $n.efqname( $helper ) )
+  $vf::class2type()->put($intf.name()::${tname}::TYPE(), $vf::${n.vname($helper)});
+  $vf::${n.vname( $helper )}->setComponentType($i::${tname}::TYPE());
+#if ($n.hasExtends())
+  $vf::${n.vname($helper)}->setSuperType($n.getExtends().vname($helper));
+#end
+  $vf::${n.vname($helper)}->setImportExportHelper(new ImportExportHelper$n.vname($helper)());
+#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)());
+#end
+#end
+}
+
+## ----------------------------- fields -----------------------------
+
+void ${vf}::initFields()
+{
+#set( $x = $params.clear() )
+## standard params from DefaultValueFactory
+#set( $x = $params.add( "msg" ) )
+#set( $x = $params.add( "result" ) )
+#foreach ( $n in $intf.iterator() )
+#if ($n.isMessage())
+#if (!$n.isHidden())
+#if (!$n.isOneway())
+#set( $r = $n.getResultMessage() )
+  $vf::${r.vname( $helper )}->setResponseField( $vf::_mf_result() );
+#end
+#end
+#end
+#end
+}
+
+
+#set( $ctr = 0 )
+void $vf::initParams()
+{
+  capu::SmartPointer<EtchValidator> tmpValue;
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#if ($ctr > 0 && $ctr % 100 == 0)
+
+  initParams${ctr}();
+}
+
+void $vf::initParams${ctr}()
+{
+  capu::SmartPointer<EtchValidator> tmpValue;
+#end
+#set( $ctr = $ctr + 1 )
+  // params for $n.name()
+#if ($n.isStruct() || $n.isExcept())
+#foreach( $param in $n.getAllParameters() )
+  $helper.getValidator($param);
+  $vf::${n.vname( $helper )}->putValidator($vf::$param.vname($helper)(), tmpValue);
+
+#end
+#else
+#foreach( $param in $n.iterator() )
+  $helper.getValidator($param);
+  $vf::${n.vname( $helper )}->putValidator($vf::$param.vname($helper)(), tmpValue);
+
+#end
+#end
+#if ($n.isMessage())
+  EtchValidatorLong::Get(0, tmpValue);
+  ${n.vname( $helper )}->putValidator($vf::_mf__messageId(), tmpValue);
+
+#if ($n.isHidden())
+#set( $param = $n.getResultParam() )
+#set( $reqMsg = $n.getRequestMessage() )
+#foreach( $t in $reqMsg.thrown().iterator() )
+  $helper.getValidator($t)
+  $vf::${n.vname( $helper )}->putValidator($vf::$param.vname($helper)(), tmpValue); // thrown $t.name()
+
+#end
+  EtchValidatorRuntimeException::Get(tmpValue);
+  $vf::${n.vname( $helper )}->putValidator($vf::$param.vname($helper)(), tmpValue); // thrown RuntimeException
+  EtchValidatorLong::Get(0, tmpValue);
+  $vf::${n.vname( $helper )}->putValidator($vf::_mf__inReplyTo(), tmpValue);
+
+#end
+#end
+#end
+#end
+}
+
+void $vf::__ShutDown()
+{
+  $vf::types()->clear();
+  delete $vf::types();
+  delete $vf::class2type();
+}
+
+/**
+ * Static Initialization-Helper
+ */
+bool $vf::INIT = false;
+void $vf::__INIT(EtchRuntime* runtime)
+{
+  if(INIT)
+    return;
+  INIT = true;
+  $vf::Init( types(), class2type() );
+  $vf::initTypes();
+  $vf::initResults();
+  $vf::initFields();
+#foreach( $n in $intf.iterator() )
+#if ($n.isExtern())
+    ${n.sname( $helper )}.init( ${n.vname($helper)}(), class2type );
+#end
+#end
+  $vf::initParams();
+  $vf::initImportExport();
+
+  Stub${i}<void>::__INIT();
+  Stub${i}Server::__INIT();
+  Stub${i}Client::__INIT();
+
+  // done updating types, and class2type: lock them.
+  types()->lock();
+  class2type()->lock();
+
+}
\ No newline at end of file

Added: 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=1368572&view=auto
==============================================================================
--- incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm (added)
+++ incubator/etch/trunk/binding-cpp/compiler/src/main/resources/org/apache/etch/bindings/cpp/compiler/vf_h.vm Thu Aug  2 16:17:03 2012
@@ -0,0 +1,102 @@
+##
+## 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.
+##
+// This file automatically generated by:
+//   $version
+//   $now
+// This file is automatically created and should not be edited!
+#set($i = $intf.name())
+#set( $vf = "ValueFactory$intf.name()" )
+
+#ifndef __$helper.getVfName($intf).toUpperCase()_H__
+\#define __$helper.getVfName($intf).toUpperCase()_H__
+
+\#include "common/EtchTypes.h"
+\#include "serialization/EtchDefaultValueFactory.h"
+\#include "support/EtchRuntime.h"
+
+
+namespace $namespace {
+  /**
+   * ValueFactory for $intf.name().
+   */
+  class $vf : public EtchDefaultValueFactory
+  {
+
+    /**
+    * Constructs ${vf}.
+    * @param uri the uri used to configure the session.
+    */
+  public:
+    ${vf}( EtchString uri );
+#foreach ( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExtern() || $n.isExcept() || $n.isMessage())
+
+    /** Type for $n.fqname() */
+    static EtchType* ${n.vname( $helper )};
+#end
+#end
+
+#set( $x = $params.clear() )
+## standard params from DefaultValueFactory
+#set( $x = $params.add( "msg" ) )
+#set( $x = $params.add( "result" ) )
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#foreach( $param in $n.iterator() )
+#if (!$params.contains($param.name().name()))
+#set( $x = $params.add($param.name().name()) )
+
+    /** Field for $param.name().name() */
+    static EtchField& $param.vname($helper)();
+#end
+#end
+#end
+#end
+
+
+  private:
+    static EtchTypeMap* types();
+    static EtchClass2TypeMap* class2type();
+
+    static void initTypes();
+    static void initResults();
+    static void initFields();
+    static void initParams();
+#set( $ctr = 0 )
+#foreach( $n in $intf.iterator() )
+#if ($n.isEnumx() || $n.isStruct() || $n.isExcept() || $n.isMessage())
+#if ($ctr > 0 && $ctr % 100 == 0)
+    static void initParams${ctr}();
+#end
+#set( $ctr = $ctr + 1 )
+#end
+#end
+    static void initImportExport();
+
+    /**
+     * Static Initialization-Helper
+     */
+  private:
+    friend class ${i}Helper;
+    static void __ShutDown();
+    static bool INIT;
+    static void __INIT(EtchRuntime* runtime);
+  };
+}
+#endif