Jpp
Static Protected Member Functions | Friends | List of all members
JLANG::JMultiEquals< JClass_t, JTypelist_t > Struct Template Reference

Template definition of auxiliary base class for composite data structures composed of base classes with equality evaluations capabilities. More...

#include <JMultiEquals.hh>

Inheritance diagram for JLANG::JMultiEquals< JClass_t, JTypelist_t >:
JDETECTOR::JDetector JDETECTOR::JPMT JSUPPORT::JMultipleFileScanner< JNullType > JSUPPORT::JSingleFileScanner< JNullType > JTRIGGER::JRunByRun JDETECTOR::JMonteCarloDetector JFIT::JPMTW0

Static Protected Member Functions

template<class JHead_t , class JTail_t >
static bool eq (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
 Equals method for composite data types. More...
 
template<class JHead_t >
static bool eq (const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JNullType > > &type)
 Equals method for composite data types. More...
 

Friends

bool operator== (const JClass_t &first, const JClass_t &second)
 Equal operator. More...
 
bool operator!= (const JClass_t &first, const JClass_t &second)
 Not equal operator. More...
 

Detailed Description

template<class JClass_t, class JTypelist_t>
struct JLANG::JMultiEquals< JClass_t, JTypelist_t >

Template definition of auxiliary base class for composite data structures composed of base classes with equality evaluations capabilities.

Each data type X in the type list should have the corresponding operator:

      bool operator==(const X& first, const X& second);

This class uses in-class friend operators (see Barton-Nackman trick).

This class implements the operators == != .

Definition at line 31 of file JMultiEquals.hh.

Member Function Documentation

◆ eq() [1/2]

template<class JClass_t, class JTypelist_t>
template<class JHead_t , class JTail_t >
static bool JLANG::JMultiEquals< JClass_t, JTypelist_t >::eq ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JTail_t > > &  type 
)
inlinestaticprotected

Equals method for composite data types.

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

Definition at line 42 of file JMultiEquals.hh.

45  {
46  return (static_cast<const JHead_t&>(first) ==
47  static_cast<const JHead_t&>(second) &&
48  eq(first, second, JType<JTail_t>()));
49  }

◆ eq() [2/2]

template<class JClass_t, class JTypelist_t>
template<class JHead_t >
static bool JLANG::JMultiEquals< JClass_t, JTypelist_t >::eq ( const JClass_t &  first,
const JClass_t &  second,
const JType< JTypeList< JHead_t, JNullType > > &  type 
)
inlinestaticprotected

Equals method for composite data types.

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

Definition at line 61 of file JMultiEquals.hh.

64  {
65  return (static_cast<const JHead_t&>(first) ==
66  static_cast<const JHead_t&>(second));
67  }

Friends And Related Function Documentation

◆ operator==

template<class JClass_t, class JTypelist_t>
bool operator== ( const JClass_t &  first,
const JClass_t &  second 
)
friend

Equal operator.

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

Definition at line 77 of file JMultiEquals.hh.

79  {
80  return eq(first, second, JType<JTypelist_t>());
81  }

◆ operator!=

template<class JClass_t, class JTypelist_t>
bool operator!= ( const JClass_t &  first,
const JClass_t &  second 
)
friend

Not equal operator.

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

Definition at line 91 of file JMultiEquals.hh.

93  {
94  return !eq(first, second, JType<JTypelist_t>());
95  }

The documentation for this struct was generated from the following file:
JLANG::JType
Auxiliary class for a type holder.
Definition: JType.hh:19
JLANG::JMultiEquals::eq
static bool eq(const JClass_t &first, const JClass_t &second, const JType< JTypeList< JHead_t, JTail_t > > &type)
Equals method for composite data types.
Definition: JMultiEquals.hh:42