Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Friends | List of all members
JLANG::JComparable< JFirst_t, JSecond_t > Struct Template Reference

Template definition of auxiliary base class for comparison of data structures. More...

#include <JComparable.hh>

Inheritance diagram for JLANG::JComparable< JFirst_t, JSecond_t >:
JDETECTOR::JDetectorParameters JDETECTOR::JModuleLocation JDETECTOR::JPMTAddress JDETECTOR::JPMTPhysicalAddress JMATH::JNumber< T > JPARSER::JCounter JSUPPORT::JLimit JTOOLS::JTuple< T > JTOOLS::JTuple< JTypeList< JHead_t, JTail_t > > JTOOLS::JTuple< JTypeList< JHead_t, JTypeList< JTail_t, JNullType > > > JTOOLS::JTuple< JHead_t > JTOOLS::JTuple< JTail_t >

Friends

bool operator< (const JFirst_t &first, typename JClass< JSecond_t >::argument_type second)
 Less than operator. More...
 
bool operator< (typename JClass< JSecond_t >::argument_type first, const JFirst_t &second)
 Less than operator. More...
 
bool operator> (const JFirst_t &first, typename JClass< JSecond_t >::argument_type second)
 Greater than operator. More...
 
bool operator> (typename JClass< JSecond_t >::argument_type first, const JFirst_t &second)
 Greater than operator. More...
 
bool operator<= (const JFirst_t &first, typename JClass< JSecond_t >::argument_type second)
 Less than or equal operator. More...
 
bool operator<= (typename JClass< JSecond_t >::argument_type first, const JFirst_t &second)
 Less than or equal operator. More...
 
bool operator>= (const JFirst_t &first, typename JClass< JSecond_t >::argument_type second)
 Greater than or equal operator. More...
 
bool operator>= (typename JClass< JSecond_t >::argument_type first, const JFirst_t &second)
 Greater than or equal operator. More...
 
bool operator== (const JFirst_t &first, typename JClass< JSecond_t >::argument_type second)
 Equal operator. More...
 
bool operator== (typename JClass< JSecond_t >::argument_type first, const JFirst_t &second)
 Equal operator. More...
 
bool operator!= (const JFirst_t &first, typename JClass< JSecond_t >::argument_type second)
 Not equal operator. More...
 
bool operator!= (typename JClass< JSecond_t >::argument_type first, const JFirst_t &second)
 Not equal operator. More...
 

Detailed Description

template<class JFirst_t, class JSecond_t = JNullType>
struct JLANG::JComparable< JFirst_t, JSecond_t >

Template definition of auxiliary base class for comparison of data structures.

Specialisation of class JComparable for two data types.

The various specialisations of this class implement the operators < > <= >= == != .

The first template parameter should have the corresponding member methods:

      bool less(const JFirst_t&) const;
      bool less(const JSecond_t&) const;
      bool more(const JSecond_t&) const;

where JFirst_t andd JSecond_t refers to the first and second template parameter, respectively. The second template parameter may be a primitive data type. This class uses in-class friend operators (see Barton-Nackman trick).

Definition at line 24 of file JComparable.hh.

Friends And Related Function Documentation

template<class JFirst_t, class JSecond_t = JNullType>
bool operator< ( const JFirst_t &  first,
typename JClass< JSecond_t >::argument_type  second 
)
friend

Less than operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is less than second object; else false

Definition at line 149 of file JComparable.hh.

151  {
152  return first.less(second);
153  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator< ( typename JClass< JSecond_t >::argument_type  first,
const JFirst_t &  second 
)
friend

Less than operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is less than second object; else false

Definition at line 163 of file JComparable.hh.

165  {
166  return second.more(first);
167  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator> ( const JFirst_t &  first,
typename JClass< JSecond_t >::argument_type  second 
)
friend

Greater than operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is greater than second object; else false

Definition at line 177 of file JComparable.hh.

179  {
180  return first.more(second);
181  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator> ( typename JClass< JSecond_t >::argument_type  first,
const JFirst_t &  second 
)
friend

Greater than operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is greater than second object; else false

Definition at line 191 of file JComparable.hh.

193  {
194  return second.less(first);
195  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator<= ( const JFirst_t &  first,
typename JClass< JSecond_t >::argument_type  second 
)
friend

Less than or equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is less than or equal to second object; else false

Definition at line 205 of file JComparable.hh.

207  {
208  return !first.more(second);
209  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator<= ( typename JClass< JSecond_t >::argument_type  first,
const JFirst_t &  second 
)
friend

Less than or equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is less than or equal to second object; else false

Definition at line 219 of file JComparable.hh.

221  {
222  return second.more(first);
223  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator>= ( const JFirst_t &  first,
typename JClass< JSecond_t >::argument_type  second 
)
friend

Greater than or equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is greater than or equal to second object; else false

Definition at line 233 of file JComparable.hh.

235  {
236  return !first.less(second);
237  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator>= ( typename JClass< JSecond_t >::argument_type  first,
const JFirst_t &  second 
)
friend

Greater than or equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if first object is greater than or equal to second object; else false

Definition at line 247 of file JComparable.hh.

250  {
251  return second.less(first);
252  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator== ( const JFirst_t &  first,
typename JClass< JSecond_t >::argument_type  second 
)
friend

Equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if two objects are equal; else false

Definition at line 262 of file JComparable.hh.

264  {
265  return !first.less(second) && !first.more(second);
266  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator== ( typename JClass< JSecond_t >::argument_type  first,
const JFirst_t &  second 
)
friend

Equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if two objects are equal; else false

Definition at line 276 of file JComparable.hh.

279  {
280  return !second.less(first) && !second.more(first);
281  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator!= ( const JFirst_t &  first,
typename JClass< JSecond_t >::argument_type  second 
)
friend

Not equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if two objects are not equal; else false

Definition at line 291 of file JComparable.hh.

293  {
294  return first.less(second) || first.more(second);
295  }
template<class JFirst_t, class JSecond_t = JNullType>
bool operator!= ( typename JClass< JSecond_t >::argument_type  first,
const JFirst_t &  second 
)
friend

Not equal operator.

Parameters
firstfirst object
secondsecond object
Returns
true if two objects are not equal; else false

Definition at line 305 of file JComparable.hh.

307  {
308  return second.less(first) || second.more(first);
309  }

The documentation for this struct was generated from the following file: