summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornshankar <nshankar@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-02-28 20:05:48 +0000
committernshankar <nshankar@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2008-02-28 20:05:48 +0000
commitbaff0cab4f515146c14f1ae413782ff3c1b92d59 (patch)
tree16c31bdeb93c1fe10a7852eea1ba5231d121fb44
parent40cbdf4a5bdbc44258956de2b109e0d123fbcfe6 (diff)
downloadATCD-baff0cab4f515146c14f1ae413782ff3c1b92d59.tar.gz
Thu Feb 28 20:05:06 UTC 2008 Nishanth Shankaran <nshankar@nospam.com>
-rw-r--r--ChangeLog8
-rw-r--r--examples/E2E_Task/Workload/load.cpp92
-rw-r--r--examples/E2E_Task/Workload/loader.mpc11
3 files changed, 111 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fc3fd4d84db..8fc8e57f563 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Thu Feb 28 20:05:06 UTC 2008 Nishanth Shankaran <nshankar@nospam.com>
+
+ * examples/E2E_Task/Workload:
+ * examples/E2E_Task/Workload/load.cpp:
+ * examples/E2E_Task/Workload/loader.mpc:
+
+ Checking in these files.
+
Wed Feb 27 23:08:43 UTC 2008 Nishanth Shankaran <nshankar@nospam.com>
* examples/E2E_Task/Model:
diff --git a/examples/E2E_Task/Workload/load.cpp b/examples/E2E_Task/Workload/load.cpp
new file mode 100644
index 00000000000..235d86ec6a0
--- /dev/null
+++ b/examples/E2E_Task/Workload/load.cpp
@@ -0,0 +1,92 @@
+#include "orbsvcs/CosNamingC.h"
+#include "ace/Get_Opt.h"
+#include "TriggerC.h"
+
+const char *id = 0;
+double load = 1.0;
+
+int
+parse_args (int argc, char *argv[])
+{
+ ACE_Get_Opt get_opts (argc, argv, "i:l:");
+ int c;
+
+ while ((c = get_opts ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ id = get_opts.opt_arg ();
+ break;
+ case 'l':
+ load = strtod (get_opts.opt_arg (), 0);
+ break;
+
+ case '?':
+ default:
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "usage:%s "
+ "-i <id>"
+ "-l <load>"
+ "\n",
+ argv [0]),
+ -1);
+ }
+ if (!id)
+ {
+ return -1;
+ }
+ // Indicates sucessful parsing of the command line
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ try
+ {
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc, argv, "");
+
+
+ if (parse_args (argc, argv) != 0)
+ return 1;
+
+ CORBA::Object_var naming_obj =
+ orb->resolve_initial_references ("NameService");
+
+ if (CORBA::is_nil (naming_obj.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to resolve the Name Service.\n"),
+ -1);
+ }
+
+ CosNaming::NamingContext_var namingContext =
+ CosNaming::NamingContext::_narrow (naming_obj.in ());
+
+ CosNaming::Name name (1);
+ name.length (1);
+ name[0].id = CORBA::string_dup (id);
+
+ CORBA::Object_var tmp = namingContext->resolve (name);
+
+ ::CIAO::RACE::Trigger_var trigger =
+ ::CIAO::RACE::Trigger::_narrow (tmp.in ());
+
+ if (CORBA::is_nil (trigger.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "Obj reference of %s "
+ "is nil!\n", id) , -1);
+ }
+ trigger->load (load);
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+
+ }
+ catch (::CORBA::Exception &ex)
+ {
+ ACE_PRINT_EXCEPTION (ex, "Exception caught:");
+ return 1;
+ }
+ return 0;
+}
diff --git a/examples/E2E_Task/Workload/loader.mpc b/examples/E2E_Task/Workload/loader.mpc
new file mode 100644
index 00000000000..fc5ddf40756
--- /dev/null
+++ b/examples/E2E_Task/Workload/loader.mpc
@@ -0,0 +1,11 @@
+project(load): taoserver, ciao_client_dnc, naming {
+ exename = load
+ after += Trigger_stub
+ libs += Trigger_stub \
+ Event_Types_stub
+ includes += ../Trigger \
+ ../Base
+ Source_Files {
+ load.cpp
+ }
+}