00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 #pragma once 00012 00013 00014 #include <opc/common/addons_core/addon.h> 00015 #include <opc/common/addons_core/addon_manager.h> 00016 #include <opc/ua/services/node_management.h> 00017 #include <opc/ua/server/addons/xml_ns.h> 00018 00019 00020 namespace OpcUa 00021 { 00022 namespace Internal 00023 { 00024 00025 class XmlAddressSpaceLoader : private Common::Interface 00026 { 00027 public: 00028 DEFINE_CLASS_POINTERS(XmlAddressSpaceLoader); 00029 00030 public: 00031 explicit XmlAddressSpaceLoader(OpcUa::NodeManagementServices& registry, bool debug = false); 00032 00033 void Load(const char* fileName); 00034 00035 void Load(const std::string& fileName) 00036 { 00037 Load(fileName.c_str()); 00038 } 00039 00040 private: 00041 OpcUa::NodeManagementServices& Registry; 00042 const bool Debug; 00043 }; 00044 00045 00046 class XmlAddressSpaceAddon : public OpcUa::Server::XmlAddressSpace 00047 { 00048 public: 00049 DEFINE_CLASS_POINTERS(XmlAddressSpaceAddon); 00050 00051 public: 00052 virtual void Initialize(Common::AddonsManager& addons, const Common::AddonParameters& params); 00053 virtual void Stop(); 00054 00055 virtual void Load(const char* path); 00056 00057 private: 00058 void Load(const char* file, OpcUa::NodeManagementServices& registry); 00059 00060 private: 00061 NodeManagementServices::SharedPtr Registry; 00062 }; 00063 00064 00065 class XmlAddressSpaceAddonFactory : public Common::AddonFactory 00066 { 00067 public: 00068 DEFINE_CLASS_POINTERS(XmlAddressSpaceAddonFactory); 00069 00070 public: 00071 virtual Common::Addon::UniquePtr CreateAddon() 00072 { 00073 return Common::Addon::UniquePtr(new XmlAddressSpaceAddon()); 00074 } 00075 }; 00076 00077 const char XmlAddressSpaceAddonId[] = "xml_address_space_loader"; 00078 00079 } // namespace Internal 00080 } // namespace OpcUa 00081