Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / examples / APG / Naming / Netlocal.cpp
blobe2fd04c661c453d0e985deb702f223a5427a7369
1 #include "Naming_Context.h"
2 #include "Temperature_Monitor2.h"
3 #include "Temperature_Monitor_Options.h"
5 // Listing 1 code/ch21
6 int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
8 Temperature_Monitor_Options opt (argc, argv);
10 Naming_Context process_context;
12 ACE_Name_Options *name_options =
13 process_context.name_options ();
14 name_options->context (ACE_Naming_Context::PROC_LOCAL);
15 ACE_TCHAR *nargv[] = { argv[0] };
16 name_options->parse_args (sizeof(nargv) / sizeof(ACE_TCHAR*),
17 nargv);
18 process_context.open (name_options->context ());
21 Naming_Context shared_context;
23 ACE_Name_Options *name_options =
24 shared_context.name_options ();
25 name_options->process_name (argv[0]);
26 name_options->context (ACE_Naming_Context::NET_LOCAL);
27 shared_context.open (name_options->context ());
30 Temperature_Monitor2 temperature_monitor (opt,
31 process_context,
32 shared_context);
33 temperature_monitor.monitor ();
34 process_context.close ();
35 shared_context.close ();
36 return 0;
38 // Listing 1