summaryrefslogtreecommitdiff
path: root/modules/CIAO/examples/BasicSP/EC/client.cpp
diff options
context:
space:
mode:
authorjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-29 21:10:39 +0000
committerjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2007-01-29 21:10:39 +0000
commite7b830ab561638ed25822054be80ce12e8801d38 (patch)
treea5b9aa16924c541fcb424ee9460b1ac7f5a89352 /modules/CIAO/examples/BasicSP/EC/client.cpp
parent9b720f395833b3ce2f499463e5fed37a0da926f4 (diff)
downloadATCD-DiffServ-Merge.tar.gz
branching/taggingDiffServ-Merge
Diffstat (limited to 'modules/CIAO/examples/BasicSP/EC/client.cpp')
-rw-r--r--modules/CIAO/examples/BasicSP/EC/client.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/CIAO/examples/BasicSP/EC/client.cpp b/modules/CIAO/examples/BasicSP/EC/client.cpp
new file mode 100644
index 00000000000..62354cbe814
--- /dev/null
+++ b/modules/CIAO/examples/BasicSP/EC/client.cpp
@@ -0,0 +1,62 @@
+// $Id$
+
+//==============================================================
+/**
+ * @file client.cpp
+ *
+ * This is a simple client test program that interact with the EC
+ * component implementation. This test uses the explicit factory
+ * operation in the home interface to create a EC component
+ * instance, run it for a while, and destroy the component instance.
+ */
+//==============================================================
+
+#include "ECC.h"
+#include "ace/streams.h"
+#include "ace/OS_NS_unistd.h"
+
+int
+main (int argc, char *argv[])
+{
+ try
+ {
+ // Initialize orb
+ CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "");
+
+ // Resolve HomeFinder interface
+
+ CORBA::Object_var obj
+ = orb->string_to_object ("file://ec.ior");
+
+ BasicSP::ECHome_var home
+ = BasicSP::ECHome::_narrow (obj.in ());
+
+ if (CORBA::is_nil (home.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire ECHome objref\n"), -1);
+
+ BasicSP::EC_var pulser
+ = home->create ();
+
+ // Place to plug in the rate
+ pulser->hertz (5);
+
+ pulser->start ();
+
+ ACE_OS::sleep (45);
+
+ pulser->stop ();
+
+ home->remove_component (pulser.in ());
+
+ orb->destroy ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("Who is the culprit \n");
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Uncaught CORBA exception\n"),
+ 1);
+ }
+
+ return 0;
+}