00001 /* 00002 * Number.hpp 00003 * 00004 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_NUMBER_HPP 00017 #define COH_NUMBER_HPP 00018 00019 #include "coherence/lang/compatibility.hpp" 00020 00021 #include "coherence/lang/interface_spec.hpp" 00022 #include "coherence/lang/Object.hpp" 00023 #include "coherence/lang/TypedHandle.hpp" 00024 00025 COH_OPEN_NAMESPACE2(coherence,lang) 00026 00027 00028 /** 00029 * Interface implemented by all managed numeric types. 00030 * 00031 * @author jh 2008.04.21 00032 */ 00033 class COH_EXPORT Number 00034 : public interface_spec<Number> 00035 { 00036 // ----- Number interface ----------------------------------------------- 00037 00038 public: 00039 /** 00040 * Return the numeric value of this object as an int16_t. This may 00041 * involve rounding or truncation. 00042 * 00043 * @return the numeric value of this object as an int16_t 00044 */ 00045 virtual int16_t getInt16Value() const = 0; 00046 00047 /** 00048 * Return the numeric value of this object as an int32_t. This may 00049 * involve rounding or truncation. 00050 * 00051 * @return the numeric value of this object as an int32_t 00052 */ 00053 virtual int32_t getInt32Value() const = 0; 00054 00055 /** 00056 * Return the numeric value of this object as an int64_t. This may 00057 * involve rounding or truncation. 00058 * 00059 * @return the numeric value of this object as an int64_t 00060 */ 00061 virtual int64_t getInt64Value() const = 0; 00062 00063 /** 00064 * Return the numeric value of this object as a float32_t. This may 00065 * involve rounding. 00066 * 00067 * @return the numeric value of this object as a float32_t 00068 */ 00069 virtual float32_t getFloat32Value() const = 0; 00070 00071 /** 00072 * Return the numeric value of this object as a float64_t. This may 00073 * involve rounding. 00074 * 00075 * @return the numeric value of this object as a float64_t 00076 */ 00077 virtual float64_t getFloat64Value() const = 0; 00078 }; 00079 00080 COH_CLOSE_NAMESPACE2 00081 00082 #endif // COH_NUMBER_HPP