FDO API Reference Feature Data Objects
Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

DecimalValue.h

Go to the documentation of this file.
00001 #ifndef _DECIMALVALUE_H_
00002 #define _DECIMALVALUE_H_
00003 // 
00004 
00005 //
00006 // Copyright (C) 2004-2006  Autodesk, Inc.
00007 // 
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of version 2.1 of the GNU Lesser
00010 // General Public License as published by the Free Software Foundation.
00011 // 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // Lesser General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020 //
00021 
00022 #ifdef _WIN32
00023 #pragma once
00024 #endif
00025 
00026 #include <FdoStd.h>
00027 #include <Fdo/Expression/DataValue.h>
00028 #include <Fdo/Schema/DataType.h>
00029 
00030 /// \brief
00031 /// The FdoDecimalValue class derives from FdoDataValue and represents a decimal value.
00032 class FdoDecimalValue : public FdoDataValue
00033 {
00034 /// \cond DOXYGEN-IGNORE
00035     friend class FdoByteValue;
00036     friend class FdoInt16Value;
00037     friend class FdoInt32Value;
00038     friend class FdoInt64Value;
00039     friend class FdoSingleValue;
00040 protected:
00041     /// \brief
00042     /// Constructs a default instance of an FdoDecimalValue with a
00043     /// value of null.
00044     /// \return
00045     /// Returns nothing
00046     /// 
00047     FdoDecimalValue();
00048 
00049     /// \brief
00050     /// Constructs a default instance of an FdoDecimalValue using the specified arguments.
00051     /// \param value 
00052     /// Input a double
00053     /// 
00054     /// \return
00055     /// Returns nothing
00056     /// 
00057     FdoDecimalValue(double value);
00058 
00059     /// \brief
00060     /// Default destructor for FdoDecimalValue.
00061     /// \return
00062     /// Returns nothing
00063     /// 
00064     virtual ~FdoDecimalValue();
00065 
00066     virtual void Dispose();
00067 /// \endcond
00068 
00069 public:
00070 
00071     /// \brief
00072     /// Constructs a default instance of an FdoDecimalValue with a value of null.
00073     /// 
00074     /// \return
00075     /// Returns nothing
00076     /// 
00077     FDO_API static FdoDecimalValue* Create();
00078 
00079     /// \brief
00080     /// Constructs an instance of an FdoDecimalValue using the specified arguments.
00081     /// 
00082     /// \param value 
00083     /// Input a double
00084     /// 
00085     /// \return
00086     /// Returns nothing
00087     /// 
00088     FDO_API static FdoDecimalValue* Create(double value);
00089 
00090     /// \brief
00091     /// Gets the data type of the FdoDecimalValue.
00092     /// 
00093     /// \return
00094     /// Returns an FdoDataType
00095     /// 
00096     FDO_API FdoDataType GetDataType();
00097 
00098     /// \brief
00099     /// Gets the decimal value.
00100     /// 
00101     /// \return
00102     /// Returns a double
00103     /// 
00104     FDO_API double GetDecimal();
00105 
00106     /// \brief
00107     /// Sets the decimal value.
00108     /// 
00109     /// \param value 
00110     /// Input a double
00111     /// 
00112     /// \return
00113     /// Returns nothing
00114     /// 
00115     FDO_API void SetDecimal(double value);
00116 
00117     /// \brief
00118     /// Overrides FdoExpression.Process to pass the FdoDecimalValue to the appropriate
00119     /// expression processor operation.
00120     /// 
00121     /// \param p 
00122     /// Input an FdoIExpressionProcessor
00123     /// 
00124     /// \return
00125     /// Returns nothing
00126     /// 
00127     FDO_API void Process(FdoIExpressionProcessor* p);
00128 
00129     /// \brief
00130     /// Returns the well defined text representation of this expression.
00131     /// 
00132     /// \return
00133     /// Returns a character string
00134     /// 
00135     FDO_API FdoString* ToString();
00136 
00137     /// \brief
00138     /// A cast operator to get the decimal value.
00139     /// 
00140     /// \return
00141     /// Returns a double
00142     /// 
00143     FDO_API operator double()
00144     {
00145         return m_data;
00146     }
00147 
00148 /// \cond DOXYGEN-IGNORE
00149 protected:
00150     /// \brief
00151     /// Constructs an instance of an FdoDecimalValue from another FdoDataValue.
00152     /// 
00153     /// \param src 
00154     /// Input the other FdoDataValue. Must be of one of the following types:
00155     ///     FdoDataType_Byte
00156     ///     FdoDataType_Decimal
00157     ///     FdoDataType_Int16
00158     ///     FdoDataType_Int32
00159     ///     FdoDataType_Single
00160     /// \param truncate 
00161     /// Input in the future, will determine what to do if source value does not fit in the decimal 
00162     /// number range:
00163     ///     true - truncate the value to fit.
00164     ///     false - throw an exception
00165     /// \param nullIfIncompatible 
00166     /// Input in the future, will determine what to do if source value type is not compatible with the 
00167     /// FDO decimal type:
00168     ///     true - return NULL.
00169     ///     false - throw an exception
00170     /// 
00171     /// \return
00172     /// Returns an FdoDecimalValue
00173     /// 
00174     static FdoDecimalValue* Create(
00175         FdoDataValue* src, 
00176         FdoBoolean truncate = false, 
00177         FdoBoolean nullIfIncompatible = false
00178     );
00179 
00180     // See FdoDataValue::DoCompare()
00181     virtual FdoCompareType DoCompare( FdoDataValue* other );
00182 
00183     double  m_data;
00184 /// \endcond
00185 };
00186 #endif
00187 
00188 

Comments or suggestions? Send us feedback.