Oracle Coherence for C++ API
Release 3.7.1.0
E22845-01
00001 /* 00002 * Integer32.hpp 00003 * 00004 * Copyright (c) 2000, 2011, 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_INTEGER32_HPP 00017 #define COH_INTEGER32_HPP 00018 00019 #include "coherence/lang/compatibility.hpp" 00020 00021 #include "coherence/lang/Number.hpp" 00022 #include "coherence/lang/Primitive.hpp" 00023 #include "coherence/lang/TypedHandle.hpp" 00024 00025 COH_OPEN_NAMESPACE2(coherence,lang) 00026 00027 00028 /** 00029 * An immutable 32-bit integer value. 00030 * 00031 * @author jh 2008.04.01 00032 */ 00033 class COH_EXPORT Integer32 00034 : public cloneable_spec<Integer32, 00035 extends<Primitive<int32_t> >, 00036 implements<Number, Comparable> > 00037 { 00038 friend class factory<Integer32>; 00039 00040 // ----- constructors --------------------------------------------------- 00041 00042 private: 00043 /** 00044 * Create a new Integer32 instance. 00045 * 00046 * @param n the value of the new Integer32 00047 */ 00048 Integer32(int32_t n); 00049 00050 /** 00051 * Copy constructor. 00052 */ 00053 Integer32(const Integer32& that); 00054 00055 00056 // ----- Number interface ----------------------------------------------- 00057 00058 public: 00059 /** 00060 * {@inheritDoc} 00061 */ 00062 virtual int16_t getInt16Value() const; 00063 00064 /** 00065 * {@inheritDoc} 00066 */ 00067 virtual int32_t getInt32Value() const; 00068 00069 /** 00070 * {@inheritDoc} 00071 */ 00072 virtual int64_t getInt64Value() const; 00073 00074 /** 00075 * {@inheritDoc} 00076 */ 00077 virtual float32_t getFloat32Value() const; 00078 00079 /** 00080 * {@inheritDoc} 00081 */ 00082 virtual float64_t getFloat64Value() const; 00083 00084 00085 // ----- static methods ------------------------------------------------- 00086 00087 public: 00088 /** 00089 * Factory method to produce Integer32 objects with an optimization 00090 * that uses cached objects for all relatively-low numbers. 00091 * 00092 * @param n an int32_t 00093 * 00094 * @return an Integer32 whose value is the passed int32_t 00095 */ 00096 static Handle valueOf(int32_t n); 00097 00098 00099 // ----- constants ------------------------------------------------------ 00100 00101 public: 00102 /** 00103 * A constant for the minimum representable value. 00104 */ 00105 static const int32_t min_value = 0x80000000; 00106 00107 /** 00108 * A constant for the maximum representable value. 00109 */ 00110 static const int32_t max_value = 0x7FFFFFFF; 00111 }; 00112 00113 COH_CLOSE_NAMESPACE2 00114 00115 #endif // COH_INTEGER32_HPP