# dotXSITemplate.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 __DOTXSITEMPLATE_H
    00016 #define __DOTXSITEMPLATE_H
    00017
    00018 //***************************************************************************************
    00019 // Includes
    00020 //***************************************************************************************
    00021 #include "SIBCArray.h"
    00022 #include "SIBCNode.h"
    00023 #include "SIBCString.h"
    00024 #include "dotXSIParams.h"
    00025
    00026 //***************************************************************************************
    00027 // Typedefs
    00028 //***************************************************************************************
    00029 class CdotXSITemplate;
    00030 class CXSIParser;
    00031
    00032 // @type DOTXSICALLBACK | dotXSI Native Templates callback function.
    00033 typedef SI_Error ( *DOTXSIREADCALLBACK ) ( CXSIParser *in_pParser, CdotXSITemplate *i_pCurrentTemplate, CdotXSITemplate *i_pNewTemplate );
    00034 typedef SI_Error ( *DOTXSIWRITECALLBACK ) ( CXSIParser *in_pParser, CdotXSITemplate *i_pCurrentTemplate, CdotXSITemplate *i_pNewTemplate, SI_Int i_nLevel );
    00035
    00036 //***************************************************************************************
    00037 // @class CdotXSITemplates | container for an array of CdotXSITemplate
    00038 //***************************************************************************************
    00039
    00041
    00044 class XSIEXPORT CdotXSITemplates
    00045 {
    00046 public:
    00047
    00051     CdotXSITemplates();
    00052
    00057     CdotXSITemplates( SI_Bool in_bDeleteOnExit);
    00058
    00061     virtual ~CdotXSITemplates();
    00062
    00063
    00067     SI_Int GetCount();
    00068
    00072     SI_Int GetTotalCount();
    00073
    00078     SI_Void Add( CdotXSITemplate *i_Template, SI_Int i_nPosition = -1 );
    00079
    00089     SI_Void Item( SI_Int i_nPosition, CdotXSITemplate **o_Template );
    00090
    00098     CdotXSITemplate *Item( SI_Int i_nPosition );
    00099
    00105     SI_Void Remove( SI_Int i_nPosition );
    00106
    00110     SI_Void Clear();
    00111
    00118     SI_Bool IsSupported( CSIBCString *i_sName, SI_Int &o_nInd );
    00119
    00129     SI_Bool Find( CSIBCString *i_sTemplateName, CSIBCString *i_sInstanceName, CdotXSITemplate **o_pTemplate );  // Find an element by template and instance name
    00130
    00137     CdotXSITemplate * FindByType( CSIBCString in_name );
    00138
    00145     CdotXSITemplates *ChildrenOfType( CSIBCString in_type );
    00146
    00147     CdotXSITemplate**   ArrayPtr() { return m_Templates.ArrayPtr();} ;
    00148
    00149
    00152     SI_Void         MoveChild ( int in_iTemplate, int in_iNewPos );
    00153
    00154 private:
    00155     SI_Int                          m_nCount;
    00156     SI_Bool                         m_bDeleteMembers;
    00157     CSIBCArray< CdotXSITemplate * > m_Templates;
    00158 };
    00159
    00160 //***************************************************************************************
    00161 // @class CdotXSITemplate | a template
    00162 // @base public | CSIBCNode
    00163 //***************************************************************************************
    00164
    00166
    00180 class XSIEXPORT CdotXSITemplate : public CSIBCNode
    00181 {
    00182 public:
    00183
    00184     enum eCOLLADATemplateType
    00185     {
    00186         NORMAL = 0,
    00187         LIBRARY,
    00188         NODE,
    00189         URL
    00190     };
    00191
    00197     CdotXSITemplate();
    00198
    00204     CdotXSITemplate( CSIBCString *i_sName );
    00205
    00220     CdotXSITemplate( CSIBCString i_sName,                                   // Constructor
    00221                      DOTXSIREADCALLBACK i_ReadCallback,
    00222                      DOTXSIWRITECALLBACK i_WriteCallback,
    00223                      SI_Int i_lVersionMajor, SI_Int i_lVersionMinor,
    00224                      SI_Int i_nNbParams,
    00225                      CdotXSIParam *i_Param1, ... );
    00226
    00242     CdotXSITemplate( CSIBCString i_sName,
    00243                      DOTXSIREADCALLBACK i_ReadCallback,
    00244                      DOTXSIWRITECALLBACK i_WriteCallback,
    00245                      SI_Int i_nNbParams,
    00246                      CdotXSIParam *i_Param1, ... );
    00247
    00248
    00251     virtual ~CdotXSITemplate();
    00252
    00257     virtual SI_Void SetInstanceName( CSIBCString i_sInstanceName );
    00258
    00262     CSIBCString &InstanceName() { return m_sInstanceName; }
    00263
    00269     SI_Void SetUserDataType( CSIBCString i_sUserDataType );
    00270
    00274     CSIBCString &UserDataType() { return m_sUserDataType; }
    00275
    00279     CdotXSITemplates &Children() { return m_ChildrenCol; }
    00280
    00285     SI_Void SetParent( CdotXSITemplate *i_Parent );
    00286
    00291     SI_Void Reparent(  CdotXSITemplate *i_Parent );
    00292
    00296     CdotXSITemplate *Parent() { return m_Parent; }
    00297
    00306     SI_Void SetSystemFlags( SI_Int i_nSystemFlags );
    00307
    00308
    00316     SI_Void GetSystemFlags( SI_Int *o_nSystemFlags );
    00317
    00326     SI_Void SetUserFlags( SI_Int i_nUserFlags );
    00327
    00334     SI_Void GetUserFlags( SI_Int *o_nUserFlags );
    00335
    00340     CdotXSIParams &Params() { return m_ParamsCol; }
    00341
    00347     virtual SI_Void InitializeFromName( SI_Char *i_pChar, CXSIParser *in_pParser );
    00348
    00356     CdotXSITemplates *ChildrenOfType( CSIBCString in_type );
    00357
    00365     CdotXSITemplate *ChildrenOfTypeNamed( CSIBCString in_type, CSIBCString in_name );
    00366
    00367     virtual CdotXSITemplate *Clone();
    00368
    00372     eCOLLADATemplateType    GetTemplateType() { return m_eType; };
    00373
    00376     SI_Void                 SetTemplateType (eCOLLADATemplateType in_etype) { m_eType = in_etype; };
    00377
    00378
    00379 private:
    00380     CSIBCString        m_sInstanceName;
    00381     CSIBCString        m_sUserDataType;
    00382     CdotXSITemplates   m_ChildrenCol;
    00383     CdotXSITemplate   *m_Parent;
    00384     SI_Int             m_nSystemFlags;
    00385     SI_Int             m_nUserFlags;
    00386     CdotXSIParams      m_ParamsCol;
    00387     SI_Int             m_nVersionMajor, m_nVersionMinor;
    00388     eCOLLADATemplateType    m_eType;
    00389
    00390 public:
    00392     DOTXSIREADCALLBACK        m_ReadCallback;
    00393
    00395     DOTXSIWRITECALLBACK       m_WriteCallback;
    00396
    00398     DOTXSIWRITECALLBACK m_WritePostCallback;
    00399
    00400 };
    00401
    00402 //***************************************************************************************
    00403 // Functions
    00404 //***************************************************************************************
    00405
    00413 XSIEXPORT CdotXSITemplate* CreatedotXSITemplate();                          //
    00414
    00418 XSIEXPORT CdotXSITemplates* CreatedotXSITemplates();                        // Allocate a CdotXSITemplates
    00419
    00420 /* @} */
    00421
    00422 //***************************************************************************************
    00423 // Function prototype to create templates....
    00424 //***************************************************************************************
    00425
    00426 typedef CdotXSITemplate* (*TemplateCreation)();
    00427
    00428 #endif // __DOTXSITEMPLATE_H