UpdateManager.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 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 // forward declarations
00026 class TAO_DDS_DCPSInfo_i;
00027 
00028 namespace Update {
00029 
00030 class OpenDDS_InfoRepoLib_Export Manager : public ACE_Service_Object {
00031 public:
00032   Manager();
00033 
00034   virtual ~Manager();
00035 
00036   /// Shared object initializer
00037   virtual int init(int argc, ACE_TCHAR *argv[]);
00038 
00039   /// Shared object finalizer
00040   virtual int fini();
00041 
00042   // mechanism for InfoRepo object to be registered.
00043   void add(TAO_DDS_DCPSInfo_i* info);
00044   void add(Updater* updater);
00045 
00046   // Mechanism to unregister Updaters/InfoRepo
00047   void remove();
00048   void remove(const Updater* updater);
00049 
00050   /// Force a clean shutdown.
00051   // void shutdown (void);
00052 
00053   /// Upstream request for a fresh image
00054   /// Currently handled synchronously via 'pushImage'
00055   /// TBD: Replace with an asynchronous model.
00056   void requestImage();
00057 
00058   /// Downstream request to push image
00059   void pushImage(const DImage& image);
00060 
00061   // Propagate creation of entities.
00062   template<class UType>
00063   void create(const UType& info);
00064 
00065   // Propagate QoS updates.
00066   template<class QosType>
00067   void update(const IdPath& id, const QosType& qos);
00068 
00069   // Propagate destruction of entities.
00070   void destroy(const IdPath& id, ItemType type, ActorType actor = DataWriter);
00071 
00072   // Downstream request to push persisted data
00073   void add(const DTopic& topic);
00074   void add(const DParticipant& participant);
00075   void add(const DActor& actor);
00076 
00077 private:
00078   typedef std::set <Updater*> Updaters;
00079 
00080   // required to break an include dependency loop
00081   //void add (Updater* updater, const DActor& actor);
00082 
00083   TAO_DDS_DCPSInfo_i* info_;
00084   Updaters updaters_;
00085 };
00086 
00087 } // End of namespace Update
00088 
00089 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
00090 #include "UpdateManager_T.cpp"
00091 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
00092 
00093 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
00094 #pragma message ("UpdateManager_T.cpp template inst")
00095 #pragma implementation ("UpdateManager_T.cpp")
00096 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
00097 
00098 typedef Update::Manager UpdateManagerSvc;
00099 
00100 ACE_STATIC_SVC_DECLARE(UpdateManagerSvc)
00101 
00102 ACE_FACTORY_DECLARE(ACE_Local_Service, UpdateManagerSvc)
00103 
00104 class OpenDDS_InfoRepoLib_Export UpdateManagerSvc_Loader {
00105 public:
00106   static int init();
00107 };
00108 
00109 #if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS)
00110 
00111 typedef int (*UpdateManagerSvc_Loader)();
00112 
00113 static UpdateManagerSvc_Loader ldr =
00114   &UpdateManagerSvc_Loader::init;
00115 
00116 #else
00117 
00118 static int ldr =
00119   UpdateManagerSvc_Loader::init();
00120 
00121 #endif /* ACE_HAS_BROKEN_STATIC_CONSTRUCTORS */
00122 
00123 #endif /* UPDATE_MANAGER_H */

Generated on Fri Feb 12 20:05:29 2016 for OpenDDS by  doxygen 1.4.7