Go to the documentation of this file.00001 #pragma once
00002
00003 #include "mngattribute.hpp"
00004 #include "mngnode.hpp"
00005
00006 class agls_API IMng
00007 {
00008 public:
00012 virtual ~IMng(void) { ; }
00013
00014 public:
00015 virtual bool CreateItem(IAttribute** ppAttribute, const char acName[STRLEN_OBJECT_NAME] = "") = 0;
00016 virtual bool DestoryItem(IAttribute* pAttribute) = 0;
00017 virtual bool CreateItem(INode** ppNode, const char acName[STRLEN_OBJECT_NAME] = "") = 0;
00018 virtual bool DestoryItem(INode* pNode) = 0;
00019 virtual bool DestoryAll(void) = 0;
00020 };
00021
00022 template<typename TN>
00023 class agls_API TMng
00024 : public TN
00025 {
00026 public:
00030 TMng(void)
00031 {
00032 this->m_pMngAttribute = new CMngAttribute;
00033 this->m_pMngNode = new CMngNode;
00034 }
00035
00039 virtual ~TMng(void)
00040 {
00041 if (NULL != this->m_pMngAttribute)
00042 {
00043 delete this->m_pMngAttribute;
00044 this->m_pMngAttribute = NULL;
00045 }
00046
00047 if (NULL != this->m_pMngNode)
00048 {
00049 delete this->m_pMngNode;
00050 this->m_pMngNode = NULL;
00051 }
00052 }
00053
00054 public:
00055 virtual bool CreateItem(IAttribute** ppAttribute, const char acName[STRLEN_OBJECT_NAME] = "")
00056 {
00057 if (NULL != this->m_pMngAttribute)
00058 {
00059 return this->m_pMngAttribute->CreateItem(ppAttribute, acName);
00060 }
00061 return false;
00062 }
00063
00064 virtual bool DestoryItem(IAttribute* pAttribute)
00065 {
00066 if (NULL != this->m_pMngAttribute)
00067 {
00068 return this->m_pMngAttribute->DestoryItem(pAttribute);
00069 }
00070 return false;
00071 }
00072
00073 virtual bool CreateItem(INode** ppNode, const char acName[STRLEN_OBJECT_NAME] = "")
00074 {
00075 if (NULL != this->m_pMngNode)
00076 {
00077 return this->m_pMngNode->CreateItem(ppNode, acName);
00078 }
00079 return false;
00080 }
00081
00082 virtual bool DestoryItem(INode* pNode)
00083 {
00084 if (NULL != this->m_pMngNode)
00085 {
00086 return this->m_pMngNode->DestoryItem(pNode);
00087 }
00088 return false;
00089 }
00090
00091 virtual bool DestoryAll(void)
00092 {
00093 bool bRes = true;
00094 if (NULL != this->m_pMngAttribute)
00095 {
00096 bRes &= this->m_pMngAttribute->DestoryAll();
00097 }
00098
00099 if (NULL != this->m_pMngNode)
00100 {
00101 bRes &= this->m_pMngNode->DestoryAll();
00102 }
00103 return bRes;
00104 }
00105
00106 private:
00107 CMngAttribute* m_pMngAttribute;
00108 CMngNode* m_pMngNode;
00109 };
00110
00111 class agls_API CMng
00112 : public TMng<IMng>
00113 {
00114 public:
00118 CMng(void);
00119
00123 virtual ~CMng(void);
00124 };