xsi_shape.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 __XSISHAPE_H__
00018 #define __XSISHAPE_H__
00019 
00020 #include "sicppsdk.h"
00021 #include <xsi_decl.h>
00022 
00023 namespace XSI {
00024 
00025 namespace MATH {
00026 
00027 //*****************************************************************************
00238 //*****************************************************************************
00239 class CShape
00240 {
00241 public:
00242 
00246     CShape( XSI::siICEShapeType in_type = XSI::siICEShapePoint ) : m_type( in_type )
00247     {
00248     }
00249 
00253     CShape( const CShape& in_shape )
00254     {
00255         *this = in_shape;
00256     }
00257 
00259     ~CShape() {}
00260 
00265     CShape& operator = ( const CShape& in_shape )
00266     {
00267         m_type = in_shape.m_type;
00268         switch ( m_type )
00269         {
00270             case XSI::siICEShapeInstance:
00271             {
00272                 m_description.m_shapeInstance = in_shape.m_description.m_shapeInstance;
00273             }
00274             break;
00275 
00276             case XSI::siICEShapeReference:
00277             {
00278                 m_description.m_shapeReference = in_shape.m_description.m_shapeReference;
00279             }
00280             break;
00281         };
00282         return *this;
00283     }
00284 
00288     XSI::siICEShapeType GetType()
00289     {
00290         return (XSI::siICEShapeType)m_type;
00291     }
00292 
00297     ULONG GetReferenceID( )
00298     {
00299         if ( m_type == XSI::siICEShapeReference )
00300         {
00301             return m_description.m_shapeReference.m_nObjectID;
00302         }
00303         return UINT_MAX;
00304     }
00305 
00310     bool IsBranchSelected( )
00311     {
00312         if ( m_type == XSI::siICEShapeReference )
00313         {
00314             return m_description.m_shapeReference.m_bBranch;
00315         }
00316         return false;
00317     }
00318 
00323     bool operator == (const CShape & in_shape )const
00324     {
00325         if( m_type != in_shape.m_type )
00326         {
00327             return false;
00328         }
00329 
00330         switch( m_type )
00331         {
00332             case XSI::siICEShapeInstance:
00333             {
00334                 return m_description.m_shapeInstance == in_shape.m_description.m_shapeInstance;
00335             }
00336             break;
00337 
00338             case XSI::siICEShapeReference:
00339             {
00340                 return m_description.m_shapeReference == in_shape.m_description.m_shapeReference;
00341             }
00342             break;
00343         }
00344         return true;
00345     }
00346 
00347     private:
00348     struct ParameterInstance
00349     {
00350         bool operator==( const ParameterInstance& in_rOther ) const
00351         {
00352             return m_nInstanceIndex == in_rOther.m_nInstanceIndex;
00353         }
00354         ULONG m_nInstanceIndex;
00355     };
00356 
00357     struct ParameterReference
00358     {
00359         bool operator==( const ParameterReference& in_rOther ) const
00360         {
00361             return m_nObjectID == in_rOther.m_nObjectID && m_bBranch == in_rOther.m_bBranch;
00362         }
00363         ULONG m_nObjectID;
00364         bool m_bBranch;
00365     };
00366 
00367     union ParameterUnion
00368     {
00369         ParameterInstance   m_shapeInstance;
00370         ParameterReference  m_shapeReference;
00371     };
00372 
00373     unsigned char m_type; // XSI::siICEShapeType m_type;
00374     ParameterUnion m_description;
00375 };
00376 
00377 }; // MATH
00378 }; // XSI
00379 
00380 #endif // __XSISHAPE_H__