00001 /* 00002 * 00003 * 00004 * Distributed under the OpenDDS License. 00005 * See: http://www.opendds.org/license.html 00006 */ 00007 00008 #ifndef UPDATE_MANAGER_H 00009 #define UPDATE_MANAGER_H 00010 00011 #include "inforepo_export.h" 00012 #include "UpdateDataTypes.h" 00013 #include "Updater.h" 00014 00015 #include "dds/DdsDcpsInfrastructureC.h" 00016 #include "dds/DdsDcpsInfoUtilsC.h" 00017 00018 #include "tao/CDR.h" 00019 00020 #include "ace/Service_Object.h" 00021 #include "ace/Service_Config.h" 00022 00023 #include <set> 00024 00025 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 // forward declarations 00028 class TAO_DDS_DCPSInfo_i; 00029 00030 namespace Update { 00031 00032 class OpenDDS_InfoRepoLib_Export Manager : public ACE_Service_Object { 00033 public: 00034 Manager(); 00035 00036 virtual ~Manager(); 00037 00038 /// Shared object initializer 00039 virtual int init(int argc, ACE_TCHAR *argv[]); 00040 00041 /// Shared object finalizer 00042 virtual int fini(); 00043 00044 // mechanism for InfoRepo object to be registered. 00045 void add(TAO_DDS_DCPSInfo_i* info); 00046 void add(Updater* updater); 00047 00048 // Mechanism to unregister Updaters/InfoRepo 00049 void remove(); 00050 void remove(const Updater* updater); 00051 00052 /// Force a clean shutdown. 00053 // void shutdown (void); 00054 00055 /// Upstream request for a fresh image 00056 /// Currently handled synchronously via 'pushImage' 00057 /// TBD: Replace with an asynchronous model. 00058 void requestImage(); 00059 00060 /// Downstream request to push image 00061 void pushImage(const DImage& image); 00062 00063 // Propagate creation of entities. 00064 template<class UType> 00065 void create(const UType& info); 00066 00067 // Propagate QoS updates. 00068 template<class QosType> 00069 void update(const IdPath& id, const QosType& qos); 00070 00071 // Propagate destruction of entities. 00072 void destroy(const IdPath& id, ItemType type, ActorType actor = DataWriter); 00073 00074 // Downstream request to push persisted data 00075 void add(const DTopic& topic); 00076 void add(const DParticipant& participant); 00077 void add(const DActor& actor); 00078 00079 /// Update Last Participant Id for the repo 00080 virtual void updateLastPartId(PartIdType partId); 00081 00082 private: 00083 typedef std::set <Updater*> Updaters; 00084 00085 // required to break an include dependency loop 00086 //void add (Updater* updater, const DActor& actor); 00087 00088 TAO_DDS_DCPSInfo_i* info_; 00089 Updaters updaters_; 00090 }; 00091 00092 } // End of namespace Update 00093 00094 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00095 00096 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00097 #include "UpdateManager_T.cpp" 00098 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00099 00100 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00101 #pragma message ("UpdateManager_T.cpp template inst") 00102 #pragma implementation ("UpdateManager_T.cpp") 00103 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00104 00105 OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL 00106 00107 typedef Update::Manager UpdateManagerSvc; 00108 00109 ACE_STATIC_SVC_DECLARE(UpdateManagerSvc) 00110 00111 ACE_FACTORY_DECLARE(ACE_Local_Service, UpdateManagerSvc) 00112 00113 class OpenDDS_InfoRepoLib_Export UpdateManagerSvc_Loader { 00114 public: 00115 static int init(); 00116 }; 00117 00118 #if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) 00119 00120 typedef int (*UpdateManagerSvc_Loader)(); 00121 00122 static UpdateManagerSvc_Loader ldr = 00123 &UpdateManagerSvc_Loader::init; 00124 00125 #else 00126 00127 static int ldr = 00128 UpdateManagerSvc_Loader::init(); 00129 00130 #endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */ 00131 00132 OPENDDS_END_VERSIONED_NAMESPACE_DECL 00133 00134 #endif /* UPDATE_MANAGER_H */