Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_predicate.h
Go to the documentation of this file.
1 #ifndef DATATOOLS_I_PREDICATE_H
3 #define DATATOOLS_I_PREDICATE_H
4 
5 // Standard Library:
6 #include<functional>
7 
8 namespace datatools {
9 
11  template <class T>
13  : public std::unary_function<const T&, bool>
14  {
15  public:
16  virtual bool operator()(const T & obj_) const = 0;
17  };
18 
19 
21  template<class Mother, class Daughter>
23  : public i_predicate<Daughter>
24  {
25  public:
26 
28  {
29  _mother_predicate_ = &mother_predicate_;
30  return;
31  }
32 
33  virtual bool operator()(const Daughter& obj) const
34  {
35  return (*_mother_predicate_)(obj);
36  }
37 
38  private:
39 
40  i_predicate<Mother> * _mother_predicate_;
41 
42  };
43 
44 } // end of namespace datatools
45 
46 #endif // DATATOOLS_I_PREDICATE_H
47 
48 // Local Variables: --
49 // mode: c++ --
50 // c-file-style: "gnu" --
51 // tab-width: 2 --
52 // End: --
A template mother-to-daughter caster predicate class.
Definition: i_predicate.h:22
mother_to_daughter_predicate(i_predicate< Mother > &mother_predicate_)
Definition: i_predicate.h:27
virtual bool operator()(const T &obj_) const =0
virtual bool operator()(const Daughter &obj) const
Definition: i_predicate.h:33
A template predicate abstract class.
Definition: i_predicate.h:12
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13