Author: veithm
Date: Wed Aug 28 15:06:20 2013
New Revision: 1518245

URL: http://svn.apache.org/r1518245
Log:
ETCH-267 Using session events in CPP Hello World example

This patch demonstrates how session event handlers can be registered
in user code.

Change-Id: I4260d875893d37141ab61fc4d4432eb3f9f3259c

Modified:
    etch/trunk/examples/helloworld/cpp/src/main/include/ImplHelloWorldClient.h
    etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp
    etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp

Modified: 
etch/trunk/examples/helloworld/cpp/src/main/include/ImplHelloWorldClient.h
URL: 
http://svn.apache.org/viewvc/etch/trunk/examples/helloworld/cpp/src/main/include/ImplHelloWorldClient.h?rev=1518245&r1=1518244&r2=1518245&view=diff
==============================================================================
--- etch/trunk/examples/helloworld/cpp/src/main/include/ImplHelloWorldClient.h 
(original)
+++ etch/trunk/examples/helloworld/cpp/src/main/include/ImplHelloWorldClient.h 
Wed Aug 28 15:06:20 2013
@@ -35,6 +35,9 @@ namespace org_apache_etch_examples_hello
     ImplHelloWorldClient( RemoteHelloWorldServer* mServer );
     virtual ~ImplHelloWorldClient() {}
 
+
+    virtual status_t _sessionNotify(capu::SmartPointer<EtchObject> event );
+
     // TODO insert methods here to provide declarations of HelloWorldClient
     // messages from the mServer.
   };

Modified: 
etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp
URL: 
http://svn.apache.org/viewvc/etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp?rev=1518245&r1=1518244&r2=1518245&view=diff
==============================================================================
--- etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp 
(original)
+++ etch/trunk/examples/helloworld/cpp/src/main/src/ImplHelloWorldClient.cpp 
Wed Aug 28 15:06:20 2013
@@ -19,5 +19,12 @@ using namespace org_apache_etch_examples
     this->mServer = mServer;
   }
 
+  status_t ImplHelloWorldClient::_sessionNotify(capu::SmartPointer<EtchObject> 
event ) {
+    EtchStringPtr eventName = capu::smartpointer_cast<EtchString>(event);
+    printf("Got sessionNotifyEvent %s\n",eventName->c_str());
+    
+    return ETCH_OK;
+  }
+
   // TODO insert methods here to provide implementations of HelloWorldClient
   // messages from the mServer.

Modified: 
etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp
URL: 
http://svn.apache.org/viewvc/etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp?rev=1518245&r1=1518244&r2=1518245&view=diff
==============================================================================
--- etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp 
(original)
+++ etch/trunk/examples/helloworld/cpp/src/main/src/MainHelloWorldClient.cpp 
Wed Aug 28 15:06:20 2013
@@ -64,6 +64,10 @@ capu::int32_t main(int argc, const char*
   // Disconnect from the service
   remote->transportControl(new 
EtchString(EtchTransportData::STOP_AND_WAIT_DOWN()), new EtchInt32(4000));
 
+  //waiting
+  printf("\n\npress any key to close client\n");
+  getchar();
+
   //delete remote
   delete remote;
 


Reply via email to