Mirror reflection library 0.5.13
|
00001 00010 #ifndef MIRROR_RAW_PTR_INT_SEQ_CMP_1103080409_HPP 00011 #define MIRROR_RAW_PTR_INT_SEQ_CMP_1103080409_HPP 00012 00013 MIRROR_NAMESPACE_BEGIN 00014 namespace aux { 00015 00016 // @c std::type_info - based type comparator 00017 class int_seq_type_cmp 00018 { 00019 private: 00020 typedef unsigned short id_type; 00021 id_type the_id; 00022 00023 // getter member function 00024 id_type get(void) const 00025 { 00026 return the_id; 00027 } 00028 00029 static id_type next_id(void) 00030 { 00031 static id_type id = 0; 00032 return ++id; 00033 } 00034 00035 template <typename T> 00036 static id_type do_create(void) 00037 { 00038 static id_type id = next_id(); 00039 return id; 00040 } 00041 public: 00042 typedef int_seq_type_cmp type; 00043 00044 template <typename T> 00045 static id_type create(void) 00046 { 00047 return do_create<typename std::remove_cv<T>::type>(); 00048 } 00049 00050 int_seq_type_cmp(id_type an_id) 00051 : the_id(an_id) 00052 { } 00053 00056 00057 friend bool operator == ( 00058 const int_seq_type_cmp& a, 00059 const int_seq_type_cmp& b 00060 ) { return a.get() == b.get(); } 00061 00063 friend bool operator != ( 00064 const int_seq_type_cmp& a, 00065 const int_seq_type_cmp& b 00066 ) { return a.get() != b.get(); } 00067 00069 friend bool operator < ( 00070 const int_seq_type_cmp& a, 00071 const int_seq_type_cmp& b 00072 ) { return a.get() < b.get(); } 00073 00075 friend bool operator > ( 00076 const int_seq_type_cmp& a, 00077 const int_seq_type_cmp& b 00078 ) { return a.get() > b.get(); } 00079 00081 friend bool operator <= ( 00082 const int_seq_type_cmp& a, 00083 const int_seq_type_cmp& b 00084 ) { return a.get() <= b.get(); } 00085 00087 friend bool operator >= ( 00088 const int_seq_type_cmp& a, 00089 const int_seq_type_cmp& b 00090 ) { return a.get() >= b.get(); } 00092 }; 00093 00094 } // namespace aux 00095 MIRROR_NAMESPACE_END 00096 00097 #endif // MIRROR_RAW_PTR_TYPE_INFO_CMP_HPP