Oracle Coherence for C++ API
Release 3.7.1.0
E22845-01
00001 /* 00002 * Integer16.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_INTEGER16_HPP 00017 #define COH_INTEGER16_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 16-bit integer value. 00030 * 00031 * @author jh 2008.04.01 00032 */ 00033 class COH_EXPORT Integer16 00034 : public cloneable_spec<Integer16, 00035 extends<Primitive<int16_t> >, 00036 implements<Number, Comparable> > 00037 { 00038 friend class factory<Integer16>; 00039 00040 // ----- constructors --------------------------------------------------- 00041 00042 private: 00043 /** 00044 * Create a new Integer16 instance. 00045 * 00046 * @param n the value of the new Integer16 00047 */ 00048 Integer16(int16_t n); 00049 00050 /** 00051 * Copy constructor. 00052 */ 00053 Integer16(const Integer16& 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 // ----- Comparable interface ------------------------------------------- 00086 00087 public: 00088 /** 00089 * {@inheritDoc} 00090 */ 00091 virtual int32_t compareTo(Object::View v) const; 00092 00093 00094 // ----- static methods ------------------------------------------------- 00095 00096 public: 00097 /** 00098 * Factory method to produce Integer16 objects with an optimization 00099 * that uses cached objects for all relatively-low numbers. 00100 * 00101 * @param n an int16_t 00102 * 00103 * @return an Integer16 whose value is the passed int16_t 00104 */ 00105 static Handle valueOf(int16_t n); 00106 00107 00108 // ----- constants ------------------------------------------------------ 00109 00110 public: 00111 /** 00112 * A constant for the minimum representable value. 00113 */ 00114 static const int16_t min_value = (int16_t) 0x8000; 00115 00116 /** 00117 * A constant for the maximum representable value. 00118 */ 00119 static const int16_t max_value = 0x7FFF; 00120 }; 00121 00122 COH_CLOSE_NAMESPACE2 00123 00124 #endif // COH_INTEGER16_HPP