DepoFanout.cxx
Go to the documentation of this file.
2 
5 
6 #include <iostream>
7 
10 
11 
12 using namespace WireCell;
13 using namespace std;
14 
15 
16 Gen::DepoFanout::DepoFanout(size_t multiplicity)
17  : m_multiplicity(multiplicity)
18 {
19 }
20 
21 Gen::DepoFanout::~DepoFanout()
22 {
23 }
24 
25 
26 WireCell::Configuration Gen::DepoFanout::default_configuration() const
27 {
29  cfg["multiplicity"] = (int)m_multiplicity;
30  return cfg;
31 }
32 
34 {
35  int m = get<int>(cfg, "multiplicity", (int)m_multiplicity);
36  if (m<=0) {
37  THROW(ValueError() << errmsg{"DepoFanout multiplicity must be positive"});
38  }
39  m_multiplicity = m;
40 }
41 
42 
43 std::vector<std::string> Gen::DepoFanout::output_types()
44 {
45  const std::string tname = std::string(typeid(output_type).name());
46  std::vector<std::string> ret(m_multiplicity, tname);
47  return ret;
48 }
49 
50 
51 bool Gen::DepoFanout::operator()(const input_pointer& in, output_vector& outv)
52 {
53  // Note: if "in" indicates EOS, just pass it on
54 
55  outv.resize(m_multiplicity);
56  for (size_t ind=0; ind<m_multiplicity; ++ind) {
57  outv[ind] = in;
58  }
59  return true;
60 }
static QCString name
Definition: declinfo.cpp:673
static const double m
Definition: Units.h:79
std::string string
Definition: nybbler.cc:12
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
STL namespace.
cfg
Definition: dbjson.py:29
def configure(cfg)
Definition: cuda.py:34
#define THROW(e)
Definition: Exceptions.h:25
std::vector< output_pointer > output_vector
Definition: IFanoutNode.h:45
Thrown when a wrong value has been encountered.
Definition: Exceptions.h:37
Definition: Main.h:22
std::shared_ptr< const IDepo > input_pointer
Definition: IFanoutNode.h:43
Json::Value Configuration
Definition: Configuration.h:50
WIRECELL_FACTORY(DepoFanout, WireCell::Gen::DepoFanout, WireCell::IDepoFanout, WireCell::IConfigurable) using namespace WireCell