FDO API Reference Feature Data Objects

Compare.h

Go to the documentation of this file.
00001 #ifndef FDO_COMPARE_H_
00002 #define FDO_COMPARE_H_
00003 
00004 //
00005 // Copyright (C) 2004-2006  Autodesk, Inc.
00006 // 
00007 // This library is free software; you can redistribute it and/or
00008 // modify it under the terms of version 2.1 of the GNU Lesser
00009 // General Public License as published by the Free Software Foundation.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 
00021 #ifdef _WIN32
00022 #pragma once
00023 #endif
00024 
00025 /// \cond DOXYGEN-IGNORE
00026 
00027 /// \brief
00028 ///  FdoCompareType is an enumeration of different value comparison results when comparing
00029 ///  value1 and value2
00030 /// 
00031 /// \param FdoCompareType_Undefined 
00032 /// The values cannot be compared, usually due to different nullities or incompatible types.
00033 /// \param FdoCompareType_Less 
00034 /// Value 1 is less than value2
00035 /// \param FdoCompareType_Greater 
00036 /// Value 1 is greater than value2
00037 /// \param FdoCompareType_Equal 
00038 /// The values are equal or both null.
00039 /// 
00040 enum FdoCompareType
00041 {
00042     FdoCompareType_Undefined,
00043     FdoCompareType_Less,
00044     FdoCompareType_Greater,
00045     FdoCompareType_Equal
00046 };
00047 /// \endcond
00048 
00049 /// \cond DOXYGEN-IGNORE
00050 // General function for comparing values of simple types or types that define the comparison operators.
00051 template< class T> FdoCompareType FdoCompare( T val1, T val2 )
00052 {
00053     FdoCompareType compare = FdoCompareType_Undefined;
00054 
00055     if ( val1 < val2 ) 
00056         compare = FdoCompareType_Less;
00057     else if ( val1 > val2 ) 
00058         compare = FdoCompareType_Greater;
00059     else 
00060         compare = FdoCompareType_Equal;
00061 
00062     return compare;
00063 }
00064 /// \endcond
00065 
00066 
00067 #endif

Comments or suggestions? Send us feedback.