SIBCNode.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Crosswalk team
00004 //
00005 // Copyright 2008 Autodesk, Inc.  All rights reserved.  
00006 // Use of this software is subject to the terms of the Autodesk license agreement 
00007 // provided at the time of installation or download, or which otherwise accompanies 
00008 // this software in either electronic or hard copy form.
00009 //
00010 //***************************************************************************************
00011 
00012 //***************************************************************************************
00013 // Defines
00014 //***************************************************************************************
00015 #ifndef __CSIBCNode_H__
00016 #define __CSIBCNode_H__
00017 
00018 //***************************************************************************************
00019 // Includes
00020 //***************************************************************************************
00021 
00022 #include <SIBCUtil.h>
00023 #include <SIBCArray.h>
00024 #include <SIBCString.h>
00025 #include <SIBCMatrix.h>
00026 
00031 typedef void (*SI_ReleaseMethod) (void *in_pObjectToDelete);
00032 
00033 
00034 //***************************************************************************************
00035 // CSIBCUserData | Base Class
00036 //***************************************************************************************
00037 
00039 
00045 class XSICOREEXPORT CSIBCUserData
00046 {
00047 public:
00048         
00052     CSIBCUserData() 
00053     {
00054         m_pData = NULL;
00055         m_pReleaseMethod = (SI_ReleaseMethod)NULL;
00056         m_pUnused = NULL;
00057     };
00058 
00067     CSIBCUserData
00068     (
00069         SI_Char             *in_pName,
00070         SI_Void             *in_pData,      
00071         SI_ReleaseMethod    in_pReleaseMethod
00072     )
00073     {
00074         m_Name.SetText(in_pName);
00075         m_pData = in_pData;
00076         m_pReleaseMethod = in_pReleaseMethod;
00077         m_pUnused = NULL;
00078     };
00079 
00080     ~CSIBCUserData() 
00081     {
00082         if(m_pReleaseMethod != NULL)
00083             m_pReleaseMethod(m_pData);
00084     };
00085 
00089     CSIBCString     &Name() { return m_Name; };
00090 
00094     virtual void    *GetData() { return m_pData; }; 
00095 
00099     virtual void    SetData(void *in_pData)
00100                     {m_pData = in_pData;};
00101 
00106     virtual SI_ReleaseMethod    GetReleaseMethod() 
00107                     { return m_pReleaseMethod; };
00108 
00113     virtual SI_Void SetReleaseMethod(SI_ReleaseMethod in_pReleaseMethod) 
00114                     { m_pReleaseMethod = in_pReleaseMethod; };
00115 
00116 private:        
00117     CSIBCString         m_Name;
00118     SI_Void             *m_pData;       
00119     SI_ReleaseMethod    m_pReleaseMethod;
00120     SI_Void             *m_pUnused;
00121 };
00122 
00123 
00124 
00125 //***************************************************************************************
00126 // CSIBCNode | Base Class
00127 //***************************************************************************************
00128 
00130 
00134 class XSICOREEXPORT CSIBCNode
00135 {
00136 public:
00137 
00138     //***************************************************************************************
00139     // constructor/destructor
00140     //***************************************************************************************
00141 
00145     CSIBCNode();
00146 
00147     virtual ~CSIBCNode();
00148 
00149     //***************************************************************************************
00150     // debug and profiling functions
00151     //***************************************************************************************
00152 
00157     virtual void Dump();
00158 
00166     virtual SI_UInt UsedMemory();
00167 
00175     virtual SI_UInt AllocatedMemory();
00176 
00180     virtual SI_UInt LocalSize();
00181 
00182     //***************************************************************************************
00183     // properties
00184     //***************************************************************************************   
00185 
00189     CSIBCString &Name() { return m_Name; }
00190 
00194     SI_UInt GetFlags() { return m_Flags; }
00195 
00202     SI_Void SetFlags(SI_UInt in_lFlags)
00203         { m_Flags = in_lFlags; }
00204 
00208     CSIBCArray < CSIBCUserData* > &UserDataList()
00209         { return m_UserDataArray;}
00210 
00217     CSIBCUserData *FindUserData(SI_Char *in_pTag);
00218 
00223     CSIBCUserData *GetUserData(SI_Int in_iIndex);
00224 
00234     SI_Error       AttachUserData(SI_Char *in_pTag, SI_Void *in_pData);
00235 
00241     SI_Error    RemoveUserData(SI_Char *in_pTag);
00242     
00243     //***************************************************************************************
00244     // methods
00245     //***************************************************************************************   
00246 
00256     virtual CSIBCNode *Duplicate(CSIBCNode * i_pNode);
00257         
00258     
00259 protected:
00260 
00261 
00262 private:
00263     CSIBCString                     m_Name;
00264     CSIBCArray < CSIBCUserData* >   m_UserDataArray;
00265     SI_UInt                         m_Flags;
00266     SI_Void                         *m_pUnused;
00267 };
00268 
00269 #endif // CSIBCNode