Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / Logging / Logging_Test_i.h
blob4ea1d598921ed147d39057460209516132c0417d
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Logging_Test_i.h
7 * This class implements a simple logger CORBA client for the Logger
8 * example using stubs generated by the TAO ORB IDL compiler
10 * @author Sergio Flores-Gaitan <sergio@cs.wustl.edu> Matt Braun <mjb2@cec.wustl.edu>
12 //=============================================================================
15 #ifndef _LOG_CLIENT_H
16 #define _LOG_CLIENT_H
18 #include "ace/Get_Opt.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "orbsvcs/CosNamingC.h"
25 #include "LoggerC.h"
26 #include "orbsvcs/Naming/Naming_Client.h"
28 /**
29 * @class Logger_Client
31 * @brief Defines a class that encapsulates behaviour of the Logger
32 * client example. Provides a better understanding of the logic
33 * in an object oriented way.
35 * This class declares an interface to run the example client for
36 * Logger CORBA server. All the complexity for initializing the
37 * server is hidden in the class. Just the <run> interface is
38 * needed.
40 class Logger_Client
42 public:
43 /// Constructor.
44 Logger_Client (void);
46 /// Destructor.
47 ~Logger_Client (void);
49 /// Initialize the client communication endpoint with server.
50 int init (int argc, ACE_TCHAR **argv);
52 /// Execute client example code.
53 int run (void);
55 private:
56 /// Parses the arguments passed on the command line.
57 int parse_args (void);
59 /// Prepares the <Log_Record> for logging.
60 void init_record (Logger::Log_Record &newrec,
61 Logger::Log_Priority lp,
62 const char *msg);
64 /// Initialises the name server and resolves the logger_factory
65 int init_naming_service (void);
67 /// Instantiates the 2 logger member variables
68 int init_loggers (void);
70 /// Shows contents of the record (for debugging purposes).
71 void show_record (Logger::Log_Record &newrec);
73 /// Keep a pointer to the ORB for easy access
74 CORBA::ORB_var orb_;
76 /// An instance of the name client used for resolving the factory
77 /// objects.
78 TAO_Naming_Client my_name_client_;
80 /// # of arguments on the command line.
81 int argc_;
83 /// arguments from command line.
84 ACE_TCHAR **argv_;
86 /// A pointer to the Logger_Factory; used in init_loggers
87 Logger_Factory_var factory_;
89 /// Logger obj ref.
90 Logger_var logger_1_;
92 /// Logger obj ref.
93 Logger_var logger_2_;
96 #endif /* _LOG_CLIENT_H */