Jpp  master_rocky-37-gf0c5bc59d
the software that should make you happy
JObjectSelector.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JOBJECTSELECTOR__
2 #define __JLANG__JOBJECTSELECTOR__
3 
4 #include "JLang/JDefault.hh"
5 #include "JLang/JTypeList.hh"
6 #include "JLang/JClass.hh"
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JLANG {}
13 namespace JPP { using namespace JLANG; }
14 
15 namespace JLANG {
16 
17  /**
18  * Interface for selection of objects.
19  */
20  template<class T>
22  public JDefault< JObjectSelector<T> >
23  {
24  public:
25  /**
26  * Type definition of argument of interface method.
27  */
29 
30 
31  /**
32  * Virtual destructor.
33  */
34  virtual ~JObjectSelector()
35  {}
36 
37 
38  /**
39  * Accept object.
40  *
41  * \param object object
42  * \return true if accepted; else false
43  */
44  virtual bool accept(argument_type object) const
45  {
46  return true;
47  }
48  };
49 
50 
51  /**
52  * Interface for multiple selection of objects.
53  *
54  * This class recursively defines the JLANG::JObjectSelector interface
55  * for all data types by deriving from:
56  * - JObjectSelector<JHead_t>; and
57  * - JObjectSelector<JTail_t>.
58  */
59  template<class JHead_t, class JTail_t>
60  class JObjectSelector< JTypeList<JHead_t, JTail_t> > :
61  public JDefault< JObjectSelector< JTypeList<JHead_t, JTail_t> > >,
62  public virtual JObjectSelector<JHead_t>,
63  public virtual JObjectSelector<JTail_t>
64  {
65  public:
67  };
68 
69 
70  /**
71  * Terminator class of recursive JObjectSelector class.
72  */
73  template<class JHead_t>
74  class JObjectSelector< JTypeList<JHead_t, JNullType> > :
75  public virtual JObjectSelector<JHead_t>
76  {};
77 }
78 
79 #endif
Interface for selection of objects.
virtual ~JObjectSelector()
Virtual destructor.
JClass< T >::argument_type argument_type
Type definition of argument of interface method.
virtual bool accept(argument_type object) const
Accept object.
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
JArgument< T >::argument_type argument_type
Definition: JClass.hh:82
Simple default class.
Definition: JDefault.hh:18
static const JObjectSelector< T > & getDefault()
Get default value of template class.
Definition: JDefault.hh:24
Auxiliary class for no type definition.
Definition: JNullType.hh:19
Type list.
Definition: JTypeList.hh:23