DCPSInfoRepoServ.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef DCPSINFOREPOSERV_H
00009 #define DCPSINFOREPOSERV_H
00010 
00011 #include <orbsvcs/Shutdown_Utilities.h>
00012 
00013 #include <string>
00014 
00015 #include "tao/PortableServer/Servant_var.h"
00016 
00017 #include "DCPSInfoRepoServ_Export.h"
00018 #include "FederatorConfig.h"
00019 #include "FederatorManagerImpl.h"
00020 #include "ShutdownInterface.h"
00021 
00022 #include "ace/Event_Handler.h"
00023 #include "ace/Condition_Thread_Mutex.h"
00024 
00025 class OpenDDS_DCPSInfoRepoServ_Export InfoRepo
00026   : public ShutdownInterface, public ACE_Event_Handler {
00027 public:
00028   struct InitError {
00029     InitError(const char* msg)
00030         : msg_(msg) {};
00031     std::string msg_;
00032   };
00033 
00034   InfoRepo(int argc, ACE_TCHAR *argv[]);
00035   ~InfoRepo();
00036   void run();
00037 
00038   /// ShutdownInterface used to schedule a shutdown.
00039   virtual void shutdown();
00040 
00041   /// shutdown() and wait for it to complete: cannot be called from the reactor
00042   /// thread.
00043   void sync_shutdown();
00044 
00045   /// Handler for the reactor to dispatch finalization activity to.
00046   virtual int handle_exception(ACE_HANDLE fd = ACE_INVALID_HANDLE);
00047 
00048 private:
00049   void init();
00050   void usage(const ACE_TCHAR * cmd);
00051   void parse_args(int argc, ACE_TCHAR *argv[]);
00052 
00053   /// Actual finalization of service resources.
00054   void finalize();
00055 
00056   CORBA::ORB_var orb_;
00057 
00058   ACE_TString ior_file_;
00059   std::string listen_address_str_;
00060   int listen_address_given_;
00061   bool use_bits_;
00062   bool resurrect_;
00063   ACE_Time_Value reassociate_delay_;
00064 
00065   /// Flag to indicate that finalization has already occurred.
00066   bool finalized_;
00067   bool servant_finalized_;
00068 
00069   /// Repository Federation behaviors
00070   OpenDDS::Federator::ManagerImpl federator_;
00071   OpenDDS::Federator::Config      federatorConfig_;
00072 
00073   PortableServer::Servant_var<TAO_DDS_DCPSInfo_i> info_servant_;
00074 
00075   ACE_Thread_Mutex lock_;
00076   ACE_Condition_Thread_Mutex cond_;
00077   bool shutdown_complete_;
00078 
00079   ACE_Time_Value dispatch_cleanup_delay_;
00080 };
00081 
00082 class OpenDDS_DCPSInfoRepoServ_Export InfoRepo_Shutdown :
00083       public Shutdown_Functor {
00084 public:
00085   InfoRepo_Shutdown(InfoRepo& ir);
00086 
00087   void operator()(int which_signal);
00088 private:
00089   InfoRepo& ir_;
00090 };
00091 
00092 #endif  /* DCPSINFOREPOSERV_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1