dotXSITemplate.h

00001 //***************************************************************************************
00002 //
00003 // File supervisor: Softimage 3D Games & 3D Bridge team
00004 //
00005 // (c) Copyright 2001-2002 Avid Technology, Inc. . All rights reserved.
00006 //
00007 //***************************************************************************************
00008 
00009 /****************************************************************************************
00010 THIS CODE IS PUBLISHED AS A SAMPLE ONLY AND IS PROVIDED "AS IS".
00011 IN NO EVENT SHALL SOFTIMAGE, AVID TECHNOLOGY, INC. AND/OR THEIR RESPECTIVE
00012 SUPPLIERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
00013 DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00014 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
00015 CONNECTION WITH THE USE OR PERFORMANCE OF THIS CODE .
00016 
00017 COPYRIGHT NOTICE. Copyright © 1999-2002 Avid Technology Inc. . All rights reserved. 
00018 
00019 SOFTIMAGE is a registered trademark of Avid Technology Inc. or its subsidiaries 
00020 or divisions. Windows NT is a registered trademark of Microsoft Corp. All other
00021 trademarks contained herein are the property of their respective owners. 
00022 ****************************************************************************************/
00023 
00024 //***************************************************************************************
00025 // Defines
00026 //***************************************************************************************
00027 #ifndef __DOTXSITEMPLATE_H
00028 #define __DOTXSITEMPLATE_H
00029 
00030 //***************************************************************************************
00031 // Includes
00032 //***************************************************************************************
00033 #include "SIBCArray.h"
00034 #include "SIBCNode.h"
00035 #include "SIBCString.h"
00036 #include "dotXSIParams.h"
00037 
00038 //***************************************************************************************
00039 // Typedefs
00040 //***************************************************************************************
00041 class CdotXSITemplate;
00042 class CXSIParser;
00043 
00044 // @type DOTXSICALLBACK | dotXSI Native Templates callback function.
00045 typedef SI_Error ( *DOTXSIREADCALLBACK ) ( CXSIParser *in_pParser, CdotXSITemplate *i_pCurrentTemplate, CdotXSITemplate *i_pNewTemplate );
00046 typedef SI_Error ( *DOTXSIWRITECALLBACK ) ( CXSIParser *in_pParser, CdotXSITemplate *i_pCurrentTemplate, CdotXSITemplate *i_pNewTemplate, SI_Int i_nLevel );
00047 
00048 //***************************************************************************************
00049 // @class CdotXSITemplates | container for an array of CdotXSITemplate
00050 //***************************************************************************************
00051 
00053 
00056 class XSIEXPORT CdotXSITemplates  
00057 {
00058 public:
00059 
00063     CdotXSITemplates();
00064 
00069     CdotXSITemplates( SI_Bool in_bDeleteOnExit);
00070 
00073     virtual ~CdotXSITemplates();
00074 
00075 
00079     SI_Int GetCount();
00080 
00084     SI_Int GetTotalCount(); 
00085 
00090     SI_Void Add( CdotXSITemplate *i_Template, SI_Int i_nPosition = -1 );
00091 
00101     SI_Void Item( SI_Int i_nPosition, CdotXSITemplate **o_Template );
00102 
00110     CdotXSITemplate *Item( SI_Int i_nPosition );
00111 
00117     SI_Void Remove( SI_Int i_nPosition );
00118 
00122     SI_Void Clear();
00123 
00130     SI_Bool IsSupported( CSIBCString *i_sName, SI_Int &o_nInd );            
00131 
00141     SI_Bool Find( CSIBCString *i_sTemplateName, CSIBCString *i_sInstanceName, CdotXSITemplate **o_pTemplate );  // Find an element by template and instance name
00142 
00149     CdotXSITemplate * FindByType( CSIBCString in_name );
00150 
00157     CdotXSITemplates *ChildrenOfType( CSIBCString in_type );
00158 
00159     CdotXSITemplate**   ArrayPtr() { return m_Templates.ArrayPtr();} ;
00160 
00161     
00164     SI_Void         MoveChild ( int in_iTemplate, int in_iNewPos );
00165 
00166 private:
00167     SI_Int                          m_nCount;
00168     SI_Bool                         m_bDeleteMembers;
00169     CSIBCArray< CdotXSITemplate * > m_Templates;
00170 };
00171 
00172 //***************************************************************************************
00173 // @class CdotXSITemplate | a template
00174 // @base public | CSIBCNode
00175 //***************************************************************************************
00176 
00178 
00192 class XSIEXPORT CdotXSITemplate : public CSIBCNode
00193 {
00194 public:
00195 
00196     enum eCOLLADATemplateType
00197     {
00198         NORMAL = 0,
00199         LIBRARY,
00200         NODE,
00201         URL
00202     };
00203 
00209     CdotXSITemplate();  
00210     
00216     CdotXSITemplate( CSIBCString *i_sName );
00217 
00232     CdotXSITemplate( CSIBCString i_sName,                                   // Constructor
00233                      DOTXSIREADCALLBACK i_ReadCallback,
00234                      DOTXSIWRITECALLBACK i_WriteCallback,
00235                      SI_Int i_lVersionMajor, SI_Int i_lVersionMinor,
00236                      SI_Int i_nNbParams, 
00237                      CdotXSIParam *i_Param1, ... );
00238 
00254     CdotXSITemplate( CSIBCString i_sName,
00255                      DOTXSIREADCALLBACK i_ReadCallback,
00256                      DOTXSIWRITECALLBACK i_WriteCallback,
00257                      SI_Int i_nNbParams, 
00258                      CdotXSIParam *i_Param1, ... );
00259 
00260 
00263     virtual ~CdotXSITemplate();
00264 
00269     virtual SI_Void SetInstanceName( CSIBCString i_sInstanceName );
00270 
00274     CSIBCString &InstanceName() { return m_sInstanceName; }
00275 
00281     SI_Void SetUserDataType( CSIBCString i_sUserDataType );
00282 
00286     CSIBCString &UserDataType() { return m_sUserDataType; }
00287 
00291     CdotXSITemplates &Children() { return m_ChildrenCol; }
00292 
00297     SI_Void SetParent( CdotXSITemplate *i_Parent );
00298 
00303     SI_Void Reparent(  CdotXSITemplate *i_Parent );
00304 
00308     CdotXSITemplate *Parent() { return m_Parent; }
00309 
00318     SI_Void SetSystemFlags( SI_Int i_nSystemFlags );
00319 
00320 
00328     SI_Void GetSystemFlags( SI_Int *o_nSystemFlags );
00329 
00338     SI_Void SetUserFlags( SI_Int i_nUserFlags );
00339 
00346     SI_Void GetUserFlags( SI_Int *o_nUserFlags );
00347 
00352     CdotXSIParams &Params() { return m_ParamsCol; }
00353 
00359     virtual SI_Void InitializeFromName( SI_Char *i_pChar, CXSIParser *in_pParser );
00360 
00368     CdotXSITemplates *ChildrenOfType( CSIBCString in_type );
00369 
00377     CdotXSITemplate *ChildrenOfTypeNamed( CSIBCString in_type, CSIBCString in_name );
00378 
00379     virtual CdotXSITemplate *Clone();
00380 
00384     eCOLLADATemplateType    GetTemplateType() { return m_eType; };
00385 
00388     SI_Void                 SetTemplateType (eCOLLADATemplateType in_etype) { m_eType = in_etype; };
00389 
00390 
00391 private:
00392     CSIBCString        m_sInstanceName;
00393     CSIBCString        m_sUserDataType;
00394     CdotXSITemplates   m_ChildrenCol;
00395     CdotXSITemplate   *m_Parent;
00396     SI_Int             m_nSystemFlags;
00397     SI_Int             m_nUserFlags;
00398     CdotXSIParams      m_ParamsCol;
00399     SI_Int             m_nVersionMajor, m_nVersionMinor;
00400     eCOLLADATemplateType    m_eType;
00401 
00402 public:
00404     DOTXSIREADCALLBACK        m_ReadCallback;
00405 
00407     DOTXSIWRITECALLBACK       m_WriteCallback;
00408 
00410     DOTXSIWRITECALLBACK m_WritePostCallback;
00411 
00412 };
00413 
00414 //***************************************************************************************
00415 // Functions
00416 //***************************************************************************************
00417 
00425 XSIEXPORT CdotXSITemplate* CreatedotXSITemplate();                          // 
00426 
00430 XSIEXPORT CdotXSITemplates* CreatedotXSITemplates();                        // Allocate a CdotXSITemplates
00431 
00432 /* @} */
00433 
00434 //***************************************************************************************
00435 // Function prototype to create templates....
00436 //***************************************************************************************
00437 
00438 typedef CdotXSITemplate* (*TemplateCreation)();
00439 
00440 #endif // __DOTXSITEMPLATE_H