00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DCPSINFOREPOSERV_H
00009 #define DCPSINFOREPOSERV_H
00010
00011 #include <orbsvcs/Shutdown_Utilities.h>
00012
00013 #include <string>
00014
00015 #include "ace/Event_Handler.h"
00016 #include "ace/Condition_Thread_Mutex.h"
00017
00018 #include "tao/ORB_Core.h"
00019 #include "tao/PortableServer/Servant_var.h"
00020
00021 #include "DCPSInfoRepoServ_Export.h"
00022 #include "FederatorConfig.h"
00023 #include "FederatorManagerImpl.h"
00024 #include "ShutdownInterface.h"
00025
00026 class OpenDDS_DCPSInfoRepoServ_Export InfoRepo
00027 : public ShutdownInterface, public ACE_Event_Handler {
00028 public:
00029 struct InitError {
00030 InitError(const char* msg)
00031 : msg_(msg) {};
00032 std::string msg_;
00033 };
00034
00035 InfoRepo(int argc, ACE_TCHAR *argv[]);
00036 ~InfoRepo();
00037 void run();
00038
00039
00040 virtual void shutdown();
00041
00042
00043
00044 void sync_shutdown();
00045
00046
00047 virtual int handle_exception(ACE_HANDLE fd = ACE_INVALID_HANDLE);
00048
00049 private:
00050 void init();
00051 void usage(const ACE_TCHAR * cmd);
00052 void parse_args(int argc, ACE_TCHAR *argv[]);
00053
00054
00055 void finalize();
00056
00057 CORBA::ORB_var orb_;
00058
00059 ACE_TString ior_file_;
00060 std::string listen_address_str_;
00061 int listen_address_given_;
00062 bool use_bits_;
00063 bool resurrect_;
00064 ACE_Time_Value reassociate_delay_;
00065
00066
00067 bool finalized_;
00068 bool servant_finalized_;
00069
00070
00071 OpenDDS::Federator::ManagerImpl federator_;
00072 OpenDDS::Federator::Config federatorConfig_;
00073
00074 PortableServer::Servant_var<TAO_DDS_DCPSInfo_i> info_servant_;
00075
00076 ACE_Thread_Mutex lock_;
00077 ACE_Condition_Thread_Mutex cond_;
00078 bool shutdown_complete_;
00079
00080 ACE_Time_Value dispatch_cleanup_delay_;
00081 };
00082
00083 class OpenDDS_DCPSInfoRepoServ_Export InfoRepo_Shutdown :
00084 public Shutdown_Functor {
00085 public:
00086 InfoRepo_Shutdown(InfoRepo& ir);
00087
00088 void operator()(int which_signal);
00089 private:
00090 InfoRepo& ir_;
00091 };
00092
00093 #endif