addon_manager.h
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 #ifndef __COMMON_ADDONS_MANAGER_H__
00013 #define __COMMON_ADDONS_MANAGER_H__
00014 
00015 #include <opc/common/addons_core/addon_parameters.h>
00016 #include <opc/common/class_pointers.h>
00017 #include <opc/common/interface.h>
00018 #include <string>
00019 #include <vector>
00020 
00021 namespace Common
00022 {
00023   typedef std::string AddonId;
00024 
00025   class Addon;
00026   class AddonFactory;
00027 
00028   struct AddonInformation
00029   {
00030     AddonId Id;
00031     std::shared_ptr<AddonFactory> Factory;
00032     std::vector<AddonId> Dependencies;
00033     AddonParameters Parameters;
00034   };
00035 
00036   class AddonsManager : private Interface
00037   {
00038   public:
00039     DEFINE_CLASS_POINTERS(AddonsManager);
00040 
00041   public:
00046     virtual void Register(const AddonInformation& caddonConfiguration) = 0;
00047 
00052     virtual void Unregister(const AddonId& id) = 0;
00053 
00058 
00059     virtual std::shared_ptr<Addon> GetAddon(const AddonId& id) const = 0;
00060 
00061     virtual std::shared_ptr<Addon> GetAddon(const char id[]) const
00062     {
00063       return GetAddon(AddonId(id));
00064     }
00065  
00069     template <class AddonClass>
00070     typename std::shared_ptr<AddonClass> GetAddon(const AddonId& id) const;
00071 
00072 //    template <class AddonClass>
00073 //    typename std::shared_ptr<AddonClass> GetAddon(const char* id) const;
00074 
00075     template <class AddonClass>
00076     typename std::shared_ptr<AddonClass> GetAddon(const char id[]) const;
00077 
00078 
00082     virtual void Start(/*const AddonsConfiguration& config*/) = 0;
00083 
00084     // @brief Stopping all addons;
00085     virtual void Stop() = 0;
00086   };
00087 
00088 
00093   AddonsManager::UniquePtr CreateAddonsManager();
00094 
00095   template <class AddonClass>
00096   typename std::shared_ptr<AddonClass> AddonsManager::GetAddon(const AddonId& id) const
00097   {
00098     return std::dynamic_pointer_cast<AddonClass>(GetAddon(id));
00099   }
00100 
00101   template <class AddonClass>
00102   typename std::shared_ptr<AddonClass> AddonsManager::GetAddon(const char id[]) const
00103   {
00104     return std::dynamic_pointer_cast<AddonClass>(GetAddon(AddonId(id)));
00105   }
00106 
00107 
00108 } // namespace Common
00109 
00110 #endif // __COMMON_ADDONS_MANAGER_H__
00111 


ros_opcua_impl_freeopcua
Author(s): Denis Štogl
autogenerated on Sat Jun 8 2019 18:24:39