Go to the documentation of this file.00001
00007 #pragma once
00008
00009 #include "global.hpp"
00010
00011 class IMngBase;
00012
00017 class agls_API IBase
00018 {
00019 public:
00020 friend IMngBase;
00021
00022 public:
00026 virtual ~IBase(void) { ; }
00027
00028 public:
00033 inline virtual bool GetID(void) const = 0;
00034
00039 inline virtual bool GetID(agls_ID& riID) const = 0;
00040
00044 inline virtual bool IsAvailable(void) = 0;
00045
00046 protected:
00051 inline virtual bool SetID(const agls_ID& iID) = 0;
00052 };
00053
00058 template<typename TN>
00059 class agls_API TBase
00060 : public TN
00061 {
00062 public:
00066 TBase(void)
00067 {
00068 this->Create();
00069 }
00070
00074 virtual ~TBase(void)
00075 {
00076 this->Destory();
00077 }
00078
00079 public:
00083 inline virtual bool GetID(void) const
00084 {
00085 return this->m_bHaveID;
00086 }
00087
00091 inline virtual bool GetID(agls_ID& riID) const
00092 {
00093 riID = this->m_iID;
00094
00096 return this->GetID();
00097 }
00098
00102 inline virtual bool IsAvailable(void)
00103 {
00105 if (!this->GetID())
00106 {
00107 return false;
00108 }
00109 return true;
00110 }
00111
00112 protected:
00116 inline virtual bool SetID(const agls_ID& riID)
00117 {
00119 if (this->GetID())
00120 {
00121 return false;
00122 }
00124 this->m_iID = riID;
00126 this->m_bHaveID = true;
00127 return true;
00128 }
00129
00130 private:
00135 inline void Create(void)
00136 {
00137 this->ClearUp();
00138 }
00139
00144 inline void Destory(void)
00145 {
00146 this->ClearUp();
00147 }
00148
00154 inline void ClearUp(void)
00155 {
00157 this->m_iID = AGLS_ID_INVALID;
00158
00160 this->m_bHaveID = false;
00161 }
00162
00163 private:
00167 agls_ID m_iID;
00168
00172 bool m_bHaveID;
00173 };
00174
00179 class agls_API CBase
00180 : public TBase<IBase>
00181 {
00182 public:
00186 CBase(void);
00187
00189
00190
00191
00192
00196 virtual ~CBase(void);
00197 };