rvc/element.h

Go to the documentation of this file.
00001 /**
00002  * \file rvc/element.h
00003  * \brief interface for the RVC::ELEMDBASE class.
00004  *
00005  * \if NODOC
00006  * $Id: element.h_v 1.6 2003/09/25 21:56:37 dwilliss Exp $
00007  *
00008  * $Log: element.h_v $
00009  * Revision 1.6  2003/09/25 21:56:37  dwilliss
00010  * doxygen
00011  *
00012  * Revision 1.5  2003/09/15 13:49:45  fileserver!dwilliss
00013  * Doxygen
00014  *
00015  * Revision 1.4  2002/04/19 16:43:02  mju
00016  * Make ctor from elemnum explicit.
00017  *
00018  * Revision 1.3  2002/04/11 19:48:41  mju
00019  * Forgot to inline non-member operators.
00020  *
00021  * Revision 1.2  2002/04/11 17:56:46  mju
00022  * Add comparison operators.
00023  *
00024  * Revision 1.1  2002/04/11 17:46:11  scowan
00025  * Initial revision
00026  * \endif
00027 **/
00028  
00029 #ifndef INC_RVC_ELEMENT_H
00030 #define INC_RVC_ELEMENT_H
00031 
00032 namespace RVC {
00033 
00034 //! Container for spatial element specifying type and number.
00035 class ELEMENT {
00036    public:
00037 
00038       //! Default constructor.   
00039       ELEMENT (
00040          ) : m_ElemNum(-1), m_ElemType(ELEMTYPE_Empty) {}
00041 
00042       //! Construct from element number.
00043       explicit ELEMENT (
00044          INT32 ElemNum
00045          ) : m_ElemNum(ElemNum), m_ElemType(ELEMTYPE_Empty) {}
00046 
00047       //! Construct from element number and type.
00048       ELEMENT (
00049          INT32 ElemNum,
00050          ELEMTYPE ElemType
00051          ) : m_ElemNum(ElemNum), m_ElemType(ElemType) {}
00052 
00053       //! Copy construct from ELEMENT and fallback element type.
00054       ELEMENT (
00055          const ELEMENT& elem,                //!< Element to copy
00056          ELEMTYPE ElemType                   //!< Fallback element type, used if not set in 'elem'
00057          ) : m_ElemNum(elem.m_ElemNum), m_ElemType((elem.m_ElemType == ELEMTYPE_Empty) ? ElemType : elem.m_ElemType) {}
00058 
00059       //! Get the stored element number.
00060       //! @return Element number
00061       INT32 GetNumber (
00062          ) const { return (m_ElemNum); }
00063          
00064       //! Get the stored ELEMTYPE.
00065       //! @return ELEMTYPE       
00066       ELEMTYPE GetType (
00067          ) const { return (m_ElemType); }
00068 
00069       //! Set the element number.
00070       void SetNumber (
00071          INT32 ElemNum
00072          ) { m_ElemNum = ElemNum; }
00073 
00074       //! Set the element type (ELEMTYPE).         
00075       void SetType (
00076          ELEMTYPE ElemType
00077          ) { m_ElemType = ElemType; }
00078          
00079    private:
00080       #ifndef GENERATING_DOXYGEN_OUTPUT
00081       INT32 m_ElemNum;
00082       ELEMTYPE m_ElemType;
00083       #endif // GENERATING_DOXYGEN_OUTPUT
00084       
00085    };
00086 
00087 //! Compare ELEMENTs for equality.
00088 inline bool operator== (
00089    const ELEMENT& lhs,
00090    const ELEMENT& rhs
00091    ) { return (lhs.GetNumber() == rhs.GetNumber() && lhs.GetType() == rhs.GetType()); }
00092    
00093 //! Compare ELEMENTs for inequality.
00094 inline bool operator!= (
00095    const ELEMENT& lhs,
00096    const ELEMENT& rhs
00097    ) { return (!operator==(lhs,rhs)); }
00098    
00099 }     //! End of RVC namespace
00100 
00101 #endif   //!< INC_RVC_ELEMENT_H
00102 

Generated on Thu Aug 12 06:19:40 2004 for TNTsdk by doxygen 1.3.4-20031026