ReadHelper.ih
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief ReadHelper internal header */
16 
17 #ifndef IH_SENF_Scheduler_ReadHelper_
18 #define IH_SENF_Scheduler_ReadHelper_ 1
19 
20 // Custom includes
21 
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 
24 namespace senf {
25 
26 
27  /** \brief Abstract predicate interface
28  \internal
29  */
30  template <class Handle>
31  struct ReadHelper<Handle>::InternalPredicate
32  {
33  virtual ~InternalPredicate() {}
34 
35  /** \brief template to runtime polymorphic barrier for the predicate interface
36  \internal
37 
38  \implementation This class will provide a polymorphic
39  wrapper around the non-polymorphic ReadHelper
40  predicate. This is used, so the predicate can be
41  specified as an arbitrary callable object (even a
42  boost::function or a Boost.Lambda expression) without
43  imposing any inheritance relationship on the predicate
44  */
45  template <class Predicate>
46  struct Dispatcher;
47 
48  virtual std::string::size_type operator()(std::string const & data) = 0;
49  };
50 
51  template <class Handle>
52  template <class Predicate>
53  struct ReadHelper<Handle>::InternalPredicate::Dispatcher
54  : public ReadHelper<Handle>::InternalPredicate
55  {
56  Dispatcher(Predicate p) : predicate(p) {}
57  virtual std::string::size_type operator()(std::string const & data);
58  Predicate predicate;
59  };
60 
61 }
62 
63 //-/////////////////////////////////////////////////////////////////////////////////////////////////
64 #endif
65 
66 
67 // Local Variables:
68 // mode: c++
69 // fill-column: 100
70 // c-file-style: "senf"
71 // indent-tabs-mode: nil
72 // ispell-local-dictionary: "american"
73 // compile-command: "scons -u test"
74 // comment-column: 40
75 // End: