00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef COH_PRIMITIVE_HPP
00017 #define COH_PRIMITIVE_HPP
00018
00019 #include "coherence/lang/compatibility.hpp"
00020
00021 #include "coherence/lang/abstract_spec.hpp"
00022 #include "coherence/lang/Comparable.hpp"
00023 #include "coherence/lang/Object.hpp"
00024 #include "coherence/lang/String.hpp"
00025
00026 #include <ostream>
00027
00028 COH_OPEN_NAMESPACE2(coherence,lang)
00029
00030
00031
00032
00033
00034
00035
00036
00037 template<class T>
00038 class COH_EXPORT Primitive
00039 : public abstract_spec<Primitive<T>,
00040 extends<Object>,
00041 implements<Comparable> >
00042 {
00043
00044
00045 public:
00046
00047
00048
00049 typedef T BoxedType;
00050
00051
00052
00053
00054 protected:
00055
00056
00057
00058 Primitive(const T& value = 0);
00059
00060
00061
00062
00063 Primitive(const Primitive<T>& that);
00064
00065
00066
00067
00068 public:
00069
00070
00071
00072
00073
00074 virtual T getValue() const;
00075
00076
00077
00078
00079
00080
00081 operator T() const;
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 static T parse(String::View vs);
00096
00097
00098
00099
00100 public:
00101
00102
00103
00104 virtual int32_t compareTo(Object::View v) const;
00105
00106
00107
00108
00109 public:
00110
00111
00112
00113 virtual bool equals(Object::View v) const;
00114
00115
00116
00117
00118 virtual size32_t hashCode() const;
00119
00120
00121
00122
00123 virtual bool isImmutable() const;
00124
00125
00126
00127
00128 virtual void toStream(std::ostream& out) const;
00129
00130
00131
00132
00133 protected:
00134
00135
00136
00137 T m_value;
00138 };
00139
00140 COH_CLOSE_NAMESPACE2
00141
00142 #endif // COH_PRIMITIVE_HPP
Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.