00001 #pragma once 00002 00003 #include "mngobject.hpp" 00004 #include "attribute.hpp" 00005 00006 class agls_API IMngAttribute 00007 : public IMngObject 00008 { 00009 public: 00010 virtual ~IMngAttribute(void) { ; } 00011 00012 public: 00013 virtual bool CreateItem(IAttribute** ppAttribute, const char acName[STRLEN_OBJECT_NAME] = "") = 0; 00014 }; 00015 00016 template<typename TN, typename TI> 00017 class agls_API TMngAttribute 00018 : public TMngObject<TN, TI> 00019 { 00020 public: 00021 TMngAttribute(void) { ; } 00022 virtual ~TMngAttribute(void) { ; } 00023 00024 public: 00025 virtual bool CreateItem(IAttribute** ppAttribute, const char acName[STRLEN_OBJECT_NAME] = "") 00026 { 00027 if (NULL == ppAttribute || 00028 NULL != *ppAttribute) 00029 { 00030 return false; 00031 } 00032 TI* pNew = new TI; 00033 IObject* pObject = dynamic_cast<IObject*>(pNew); 00034 if (!__super::CreateItem(&pObject, acName)) 00035 { 00036 if (NULL != pNew) 00037 { 00038 delete pNew; 00039 pNew = NULL; 00040 } 00041 return false; 00042 } 00043 (*ppAttribute) = pNew; 00044 return true; 00045 } 00046 }; 00047 00048 class agls_API CMngAttribute 00049 : public TMngAttribute<IMngAttribute, CAttribute> 00050 { 00051 public: 00052 CMngAttribute(void); 00053 virtual ~CMngAttribute(void); 00054 };