/** * @file IExtension.h * @brief The base class for all extensions and plugins in P.A.I. * @date 2011-06-01 */ #ifndef PAI_FRAME_CRYSTAL_IEXTENSION_H #define PAI_FRAME_CRYSTAL_IEXTENSION_H #include #include #include "Turtle.h" namespace pai { /** * @class IExtension * @brief The base class for all extensions and plugins in P.A.I. */ class PAI_CRYSTAL_EXPORT IExtension { public: /** * @brief destructor */ virtual ~IExtension() { } /** * @brief Get the string format of the extension ID. * @return The id of the extension. */ virtual std::string GetStringID() const = 0; }; /** * @class PtrExtension * @brief for all pointer extensions and plugins in P.A.I. */ template< typename PtrType > class PtrExtension : public IExtension { public: /** * @brief 构造函数 * @param[in] pPonter 模板对象 */ PtrExtension(PtrType *pPonter) : m_ptr(pPonter) { } /** * @brief 获取String型ID * @return String型ID */ virtual std::string GetStringID() const { std::stringstream ss; ss << reinterpret_cast< long long > (m_ptr); return ss.str(); } public: PtrType *m_ptr; ///< 对象指针 }; /** * @class ILocation * @brief The base class for the location of a Service that a Extension want to register. */ class ILocation { public: /** * @brief 析构函数 */ virtual ~ILocation() { } }; /** * @class ValueLocation * @brief A common locaton with a value to indicate the index location a extension want to register to. */ template< typename T > class ValueLocation : public ILocation { public: /** * @brief 构造函数 */ ValueLocation() { } /** * @brief 构造函数 * @param[in] value */ ValueLocation(const T & value) : m_value(value) { } public: T m_value; ///< 管理对象 }; } #endif ///< PAI_FRAME_CRYSTAL_IEXTENSION_H