ISinkNode.h
Go to the documentation of this file.
1 #ifndef WIRECELL_ISINKNODE
2 #define WIRECELL_ISINKNODE
3 
4 #include "WireCellIface/INode.h"
5 
6 #include <boost/any.hpp>
7 #include <vector>
8 
9 namespace WireCell {
10 
11  /** A node which acts as a sink.
12  */
13  class ISinkNodeBase : public INode
14  {
15  public:
16  typedef std::shared_ptr<ISinkNodeBase> pointer;
17 
18  virtual ~ISinkNodeBase() ;
19 
20  virtual NodeCategory category() {
21  return sinkNode;
22  }
23 
24  virtual bool operator()(const boost::any& in) = 0;
25  };
26 
27  template <typename InputType>
28  class ISinkNode : public ISinkNodeBase
29  {
30  public:
31  typedef InputType input_type;
32  typedef std::shared_ptr<const InputType> input_pointer;
33 
34  virtual ~ISinkNode() {}
35 
36  virtual bool operator()(const boost::any& anyin) {
37  const input_pointer& in = boost::any_cast<const input_pointer&>(anyin);
38  return (*this)(in);
39  }
40 
41  /// The calling signature:
42  virtual bool operator()(const input_pointer& in) = 0;
43 
44  // Return the names of the types this node takes as input.
45  virtual std::vector<std::string> input_types() {
46  return std::vector<std::string>{typeid(input_type).name()};
47  }
48 
49  };
50 
51 }
52 
53 #endif
static QCString name
Definition: declinfo.cpp:673
virtual ~ISinkNode()
Definition: ISinkNode.h:34
virtual std::vector< std::string > input_types()
Definition: ISinkNode.h:45
virtual bool operator()(const boost::any &anyin)
Definition: ISinkNode.h:36
Definition: Main.h:22
std::shared_ptr< ISinkNodeBase > pointer
Definition: ISinkNode.h:16
virtual bool operator()(const boost::any &in)=0
virtual NodeCategory category()
Return the behavior category type.
Definition: ISinkNode.h:20
std::shared_ptr< const InputType > input_pointer
Definition: ISinkNode.h:32
InputType input_type
Definition: ISinkNode.h:31