xsi_ref.h
Go to the documentation of this file.
00001 //*****************************************************************************
00011 //*****************************************************************************
00012 
00013 #if (_MSC_VER > 1000) || defined(SGI_COMPILER)
00014 #pragma once
00015 #endif
00016 
00017 #ifndef __XSIREF_H__
00018 #define __XSIREF_H__
00019 
00020 
00021 #include "sicppsdk.h"
00022 #include "xsi_string.h"
00023 #include "xsi_decl.h"
00024 
00044 namespace XSI {
00045 
00046 class CStatus;
00047 class CValueArray;
00048 
00049 //*****************************************************************************
00140 //*****************************************************************************
00141 
00142 class SICPPSDKDECL CRef
00143 {
00144 public:
00146     CRef();
00147 
00151     CRef(const CRef& in_xsiRef);
00152 
00154     ~CRef();
00155 
00159     siClassID GetClassID() const;
00160 
00166     bool IsA(siClassID in_classID) const;
00167 
00171     CString GetClassIDName() const;
00172 
00176     bool IsValid() const;
00177 
00183     operator bool() const;
00184 
00189     bool operator == (const CRef& in_ref) const;
00190 
00195     bool operator != (const CRef& in_ref ) const;
00196 
00201     CRef& operator = (const CRef& in_ref );
00202 
00211     CStatus Set(const CString& in_str);
00212 
00216     CString GetAsText() const;
00217 
00225     bool operator < ( const CRef& in_ref ) const;
00226 
00233     bool operator > ( const CRef& in_ref ) const;
00234 
00235 protected:
00236     void* GetPtr() const;
00237 
00238 private:
00239     void* m_ptr;
00240 };
00241 
00242 //*************************************************************************
00332 //*************************************************************************
00333 class SICPPSDKDECL CRefArray
00334 {
00335     public:
00336 
00341     CRefArray(LONG in_lSize=0);
00342 
00346     CRefArray(const CRefArray& in_refArray);
00347 
00349     virtual ~CRefArray();
00350 
00355     CRefArray& operator=( const CRefArray& in_refArray );
00356 
00361     CRefArray& operator+=( const CRefArray& in_refArray );
00362 
00368     const CRef& operator[]( LONG in_index ) const;
00369 
00374     CRef& operator[]( LONG in_index );
00375 
00380     virtual CRef GetItem( LONG in_index ) const;
00381 
00386     virtual CRef GetItem( const CString& in_name ) const;
00387 
00391     virtual void Add( const CRef& in_item );
00392 
00396     virtual LONG GetCount() const;
00397 
00403     bool IsA(siClassID in_classID) const;
00404 
00408     siClassID GetClassID() const;
00409 
00413     CString GetClassIDName() const;
00414 
00418     virtual bool IsValid() const;
00419 
00425     operator bool() const;
00426 
00438     CStatus Filter( const CString& in_strType, const CStringArray& in_strFam,
00439         const CString& in_strObjName, CRefArray& io_array ) const;
00440 
00449     CStatus Find( const CString& in_strType, CRef& io_obj ) const;
00450 
00456     LONG Set(const CValueArray& in_valarray);
00457 
00464     LONG Set(const CString& in_strarray, const CString& in_sep = L"," );
00465 
00470     LONG Remove(const CRef& in_ref );
00471 
00474     void Clear(void);
00475 
00479     CString GetAsText() const;
00480 
00487     CStatus Resize( LONG in_size );
00488 
00489     protected:
00490     void SetPtr( void* p=NULL, LONG id=siUnknownClassID );
00491     void* GetPtr() const;
00492     LONG GetID()const;
00493 
00494     private:
00495     LONG    m_id;
00496     mutable void*   m_ptr;
00497 };
00498 
00508 SICPPSDKDECL CRef ConvertObject( void* in_pAuto );
00509 
00522 SICPPSDKDECL void* ConvertObject( const CRef& in_obj );
00523 
00524 SICPPSDKDECL bool HasClassID( CRef&, LONG );
00525 SICPPSDKDECL bool CanSubClass( CRef&, LONG );
00526 
00527 };
00528 
00529 #endif // __XSIREF_H__