3 // =========================================================================
7 * @desc Implements common CORBA server ORB and POA initialisations.
9 * @author Mayur Deshpande <mayur@ics.uci.edu>
11 // =========================================================================
17 #include /**/ "ace/pre.h"
19 #include "tao/PortableServer/PortableServer.h"
20 #include "tao/PortableServer/Servant_Base.h"
24 // Forward declaration of the kind of servant we are willing to handle
29 Class that performs all 'dirty' initialisation work that is common to
30 all the AMH servers and 'hides' all the common ORB functions.
35 Base_Server (int &argc
, ACE_TCHAR
**argv
);
37 // Is there any reason to make the destructor virtual? Will you
38 // ever be destroying a derived class through a pointer to
41 // Mayur: I like to code 'defensively': This class already has
42 // virtual methods (it is a base class after all!). Making the
43 // destructor won't add any additional overhead (other than one more
44 // entry in the vtbl) and if, by chance, someone does delete a
45 // derived-class though this classes ptr, we are still safe. The
46 // short answer to your question is : I don't know. :)
47 virtual ~Base_Server (void);
49 // Just parse the command line for the output-file (-o) option.
50 // return -1 if -o option is not present
51 virtual int parse_args (void);
53 /// try and schedule using FIFO
54 void try_RT_scheduling (void);
56 /// ORB inititalisation stuff
57 int start_orb_and_poa (void);
59 int shutdown_orb_and_poa (void);
61 /// register the servant with the poa
62 virtual void register_servant (AMH_Servant
*servant
);
64 /// orb-perform_work () abstraction
65 virtual void run_event_loop (void);
68 // @@ Mayur, please put inlined methods in a separate `.inl' file,
69 // as detailed in the ACE/TAO coding/style guidelines, and as per
71 // Mayur: A separate file for just one method? AAAGH. OK.
73 /// Accesor method (for servants) to the initialised ORB
74 CORBA::ORB_ptr
orb (void);
79 const ACE_TCHAR
*ior_output_file_
;
81 PortableServer::POA_var root_poa_
;
84 /// Write servant IOR to file specified with the '-o' option
85 int write_ior_to_file (const char * ior
);
88 #if defined (__ACE_INLINE__)
89 # include "Base_Server.inl"
90 #endif /* __ACE_INLINE__ */
92 #include /**/ "ace/post.h"
93 #endif /* BASE_SERVER_H */