Go to the documentation of this file.00001 #ifndef DDCLessOperators_h
00002 #define DDCLessOperators_h
00003
00004
00005
00010 template <class IndexType>
00011 class LessIndexString1 : public binary_function<bool, const IndexType&, const char&>
00012 {
00013 const vector<char>* m_pBuffer;
00014
00015 public:
00016
00017 LessIndexString1(const vector<char>* pBuffer)
00018 {
00019 m_pBuffer = pBuffer;
00020 }
00022 bool operator()(const IndexType& Ref, const char* S2) const
00023 {
00024 const char* S1 = &((*m_pBuffer)[0]) + Ref.GetIndexItemOffset();
00025 return strcmp(S1, S2) < 0;
00026 }
00027 bool operator()(const char* S1, const IndexType& Ref) const
00028 {
00029 const char* S2 = &((*m_pBuffer)[0]) + Ref.GetIndexItemOffset();
00030 return strcmp(S1, S2) < 0;
00031 }
00032 bool operator()(const IndexType& Ref1, const IndexType& Ref2) const
00033 {
00034 const char* S1 = &((*m_pBuffer)[0]) + Ref1.GetIndexItemOffset();
00035 const char* S2 = &((*m_pBuffer)[0]) + Ref2.GetIndexItemOffset();
00036 return strcmp(S1, S2) < 0;
00037 }
00038
00040 bool are_equal(const IndexType& Ref, const char* S2) const
00041 {
00042 const char* S1 = &((*m_pBuffer)[0]) + Ref.GetIndexItemOffset();
00043 return strcmp(S1, S2) == 0;
00044 };
00045
00046 };
00047
00048
00049
00054 template <class IndexType>
00055 class LessIndexString2 : public binary_function<bool, const IndexType&, const IndexType&>
00056 {
00057 const vector<char>* m_pBuffer1;
00058 const vector<char>* m_pBuffer2;
00059 public:
00060
00061 LessIndexString2(const vector<char>* pBuffer1, const vector<char>* pBuffer2 = 0)
00062 {
00063 m_pBuffer1 = pBuffer1;
00064 m_pBuffer2 = (pBuffer2 != 0) ? pBuffer2 : pBuffer1;
00065 }
00066
00068 bool operator()(const IndexType& W1, const IndexType& W2) const
00069 {
00070 const char* S1 = &((*m_pBuffer1)[0]) + W1.GetIndexItemOffset();
00071 const char* S2 = &((*m_pBuffer2)[0]) + W2.GetIndexItemOffset();
00072 return strcmp(S1, S2) < 0;
00073 }
00074
00076 bool Greater(const IndexType& W1, const IndexType& W2) const
00077 {
00078 const char* S1 = &((*m_pBuffer1)[0]) + W1.GetIndexItemOffset();
00079 const char* S2 = &((*m_pBuffer2)[0]) + W2.GetIndexItemOffset();
00080 return strcmp(S1, S2) > 0;
00081 }
00082 };
00083
00084
00085 #endif
00086