All Classes Functions Variables Typedefs Friends Pages
Long.h
1 //------------------------------------------------------------------------------
2 //
3 // Copyright (c) 2012 Glympse Inc. All rights reserved.
4 //
5 //------------------------------------------------------------------------------
6 
7 #ifndef LONG_H__GLYMPSE__
8 #define LONG_H__GLYMPSE__
9 
10 namespace Glympse
11 {
12 
18 /*S*public**/ class Long : public Common< ILong >
19 {
20  public: static const int64 MAX_VALUE/*S* = Int64.MaxValue**/;
21 
22  private: int64 _value;
23 
24  public: static inline GLong valueOf(int64 value)
25  {
26  return new Long(value);
27  }
28 
29  public: Long()
30  /*C*/: _value(0)
31  {
32  /*O*/_value = 0;
33  }
34 
35  public: Long(int64 value)
36  /*C*/: _value(value)
37  {
38  /*O*/_value = value;
39  }
40 
41  public: virtual int64 longValue()
42  {
43  return _value;
44  }
45 
51  public: virtual /*S*override**/ int32 hashCode()
52  {
53  return (int32)(_value ^ (_value>>32));
54  }
55 
60  public: virtual /*S*override**/ bool equals(const GCommonObj& o)
61  {
62  O<Long> l = (O<Long>)o;
63  return ( ( l != NULL ) && ( l->_value == _value ) );
64  }
65 };
66 
67 }
68 
69 #endif // !LONG_H__GLYMPSE__