00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __PION_PLATFORMPLUGIN_HEADER__
00021 #define __PION_PLATFORMPLUGIN_HEADER__
00022
00023 #include <string>
00024 #include <libxml/tree.h>
00025 #include <boost/noncopyable.hpp>
00026 #include <pion/PionConfig.hpp>
00027
00028 namespace pion {
00029 namespace server {
00030
00031
00032 class ServiceManager;
00033
00034 }
00035 }
00036
00037 namespace pion {
00038 namespace platform {
00039
00040
00041 class Vocabulary;
00042 class CodecFactory;
00043 class DatabaseManager;
00044 class ReactionEngine;
00045 class ProtocolFactory;
00046
00050 class PION_PLATFORM_API PlatformPlugin
00051 : private boost::noncopyable
00052 {
00053 public:
00054
00056 PlatformPlugin(void) :
00057 m_codec_factory_ptr(NULL), m_database_mgr_ptr(NULL),
00058 m_reaction_engine_ptr(NULL), m_protocol_factory_ptr(NULL), m_service_mgr_ptr(NULL)
00059 {}
00060
00062 virtual ~PlatformPlugin() {}
00063
00071 virtual void setConfig(const Vocabulary& v, const xmlNodePtr config_ptr);
00072
00079 virtual void updateVocabulary(const Vocabulary& v);
00080
00081
00083 inline void setId(const std::string& plugin_id) { m_plugin_id = plugin_id; }
00084
00086 inline const std::string& getId(void) const { return m_plugin_id; }
00087
00089 inline void setName(const std::string& plugin_name) { m_plugin_name = plugin_name; }
00090
00092 inline const std::string& getName(void) const { return m_plugin_name; }
00093
00095 inline void setComment(const std::string& plugin_comment) { m_plugin_comment = plugin_comment; }
00096
00098 inline const std::string& getComment(void) const { return m_plugin_comment; }
00099
00101 inline void setCodecFactory(CodecFactory& factory) { m_codec_factory_ptr = & factory; }
00102
00104 inline void setDatabaseManager(DatabaseManager& mgr) { m_database_mgr_ptr = & mgr; }
00105
00107 inline void setReactionEngine(ReactionEngine& engine) { m_reaction_engine_ptr = & engine; }
00108
00110 inline void setProtocolFactory(ProtocolFactory& factory) { m_protocol_factory_ptr = & factory; }
00111
00113 inline void setServiceManager(pion::server::ServiceManager& mgr) { m_service_mgr_ptr = & mgr; }
00114
00115 protected:
00116
00118 inline void copyPlugin(const PlatformPlugin& pp) {
00119 m_plugin_id = pp.m_plugin_id;
00120 m_plugin_name = pp.m_plugin_name;
00121 m_plugin_comment = pp.m_plugin_comment;
00122 }
00123
00125 inline CodecFactory& getCodecFactory(void) {
00126 PION_ASSERT(m_codec_factory_ptr != NULL);
00127 return *m_codec_factory_ptr;
00128 }
00129
00131 inline DatabaseManager& getDatabaseManager(void) {
00132 PION_ASSERT(m_database_mgr_ptr != NULL);
00133 return *m_database_mgr_ptr;
00134 }
00135
00137 inline ReactionEngine& getReactionEngine(void) {
00138 PION_ASSERT(m_reaction_engine_ptr != NULL);
00139 return *m_reaction_engine_ptr;
00140 }
00141
00143 inline ProtocolFactory& getProtocolFactory(void) {
00144 PION_ASSERT(m_protocol_factory_ptr != NULL);
00145 return *m_protocol_factory_ptr;
00146 }
00147
00149 inline pion::server::ServiceManager& getServiceManager(void) {
00150 PION_ASSERT(m_service_mgr_ptr != NULL);
00151 return *m_service_mgr_ptr;
00152 }
00153
00154 private:
00155
00157 static const std::string NAME_ELEMENT_NAME;
00158
00160 static const std::string COMMENT_ELEMENT_NAME;
00161
00162
00164 std::string m_plugin_id;
00165
00167 std::string m_plugin_name;
00168
00170 std::string m_plugin_comment;
00171
00173 CodecFactory * m_codec_factory_ptr;
00174
00176 DatabaseManager * m_database_mgr_ptr;
00177
00179 ReactionEngine * m_reaction_engine_ptr;
00180
00182 ProtocolFactory * m_protocol_factory_ptr;
00183
00185 pion::server::ServiceManager * m_service_mgr_ptr;
00186 };
00187
00188
00189 }
00190 }
00191
00192 #endif