diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-14 19:56:21 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-14 19:56:21 +0000 |
commit | 88b68226ace5d69fd9982c8a6dc2d735d7117b00 (patch) | |
tree | e8cbec1009fc0942b178da617dbe31bec85c8778 | |
parent | e6941c8ca3a81f21bb5469882c2047e3fc9f9f60 (diff) | |
download | ATCD-88b68226ace5d69fd9982c8a6dc2d735d7117b00.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp | 48 | ||||
-rw-r--r-- | TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt | 5 |
2 files changed, 33 insertions, 20 deletions
diff --git a/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp index cb2de1a3839..ce7f86548d5 100644 --- a/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp +++ b/TAO/CIAO/examples/handcrafted/Display/RateGen/controller.cpp @@ -5,16 +5,25 @@ char *rategen_ior_ = 0; int rate = 2; +int turn_on = 1; int parse_args (int argc, char *argv[]) { - ACE_Get_Opt get_opts (argc, argv, "k:r:"); + ACE_Get_Opt get_opts (argc, argv, "k:r:of"); int c; while ((c = get_opts ()) != -1) switch (c) { + case 'o': + turn_on = 1; + break; + + case 'f': + turn_on = 0; + break; + case 'k': rategen_ior_ = get_opts.opt_arg (); break; @@ -26,9 +35,11 @@ parse_args (int argc, char *argv[]) case '?': // display help for use of the server. default: ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s" - "-k <RateGen IOR> (default is file://rategen.ior)" - "-r <rate in hertz> (default is 3)" + "usage: %s\n" + "-o (Turn on the rate generator)\n" + "-f (Turn off the rate generator)\n" + "-k <RateGen IOR> (default is file://rategen.ior)\n" + "-r <rate in hertz> (default is 3)\n" "\n", argv [0]), -1); @@ -67,23 +78,24 @@ main (int argc, char *argv[]) if (CORBA::is_nil (pulser.in ())) ACE_ERROR_RETURN ((LM_ERROR, "Unable to acquire 'RateGen' objref\n"), -1); - pulser->hertz (rate - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + if (turn_on) + { + pulser->hertz (rate + ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Start up the Rate Generator\n")); + ACE_DEBUG ((LM_DEBUG, "Start up the Rate Generator\n")); - pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - ACE_DEBUG ((LM_DEBUG, "Press <enter> to stop the pulse generator\n")); - char dummy [256]; - cin.getline (dummy, 256); - - pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; + pulser->start (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + else + { + pulser->stop (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; - ACE_DEBUG ((LM_DEBUG, "Rate Generator stopped\n")); + ACE_DEBUG ((LM_DEBUG, "Rate Generator stopped\n")); + } orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; diff --git a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt index da8cb73d512..dc45830a324 100644 --- a/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt +++ b/TAO/CIAO/examples/handcrafted/Display/descriptors/NOTE.txt @@ -104,8 +104,9 @@ Step 4: All the .cad files instruct the Assembly_Manager to write the IOR of the RateGen component to a file called "rategen.ior" in this directory. You will then need to use a controller program in a - separate shell window to start up the Rate Generator. Start the - controller with: + separate shell window to switch on/off the Rate Generator. + + Start the controller with: ../RateGen/controller |