FixedChannelGroupService_service.cc
Go to the documentation of this file.
1 // FixedChannelGroupService.cxx
2 
5 #include <sstream>
6 #include <iomanip>
7 
8 using std::cout;
9 using std::ostream;
10 using std::endl;
11 using std::string;
12 using std::ostringstream;
13 using std::setfill;
14 using std::setw;
15 using std::vector;
16 using std::move;
17 
21 
22 //**********************************************************************
23 
26  vector<string> names = pset.get_names();
27  for ( string name : names ) {
28  if ( name == "service_provider" ) continue;
29  if ( name == "service_type" ) continue;
30  ChannelVector chans = pset.get<ChannelVector>(name);
31  m_names.push_back(name);
32  m_chanvecs.emplace_back(move(chans));
33  }
34 }
35 
36 //**********************************************************************
37 
40 : FixedChannelGroupService(pset) { }
41 
42 //**********************************************************************
43 
45  return m_names.size();
46 }
47 
48 //**********************************************************************
49 
51  if ( igrp < m_names.size() ) return m_names[igrp];
52  return "NoSuchGroup";
53 }
54 
55 //**********************************************************************
56 
58  if ( igrp < m_chanvecs.size() ) return m_chanvecs[igrp];
59  static ChannelVector empty;
60  return empty;
61 }
62 
63 //**********************************************************************
64 
65 ostream& FixedChannelGroupService::print(ostream& out, string prefix) const {
66  out << prefix << "FixedChannelGroupService: " << endl;
67  out << prefix << " # group: " << size() << endl;
68  return out;
69 }
70 
71 //**********************************************************************
72 
74 
75 //**********************************************************************
std::string string
Definition: nybbler.cc:12
struct vector vector
ChannelGroupService::Name Name
std::ostream & print(std::ostream &out=std::cout, std::string prefix="") const
def move(depos, offset)
Definition: depos.py:107
T get(std::string const &key) const
Definition: ParameterSet.h:271
const ChannelVector & channels(Index igrp) const
Q_EXPORT QTSManip setw(int w)
Definition: qtextstream.h:331
ChannelGroupService::ChannelVector ChannelVector
std::vector< std::string > get_names() const
static std::vector< std::string > const names
Definition: FragmentType.hh:8
FixedChannelGroupService(fhicl::ParameterSet const &pset)
Q_EXPORT QTSManip setfill(int f)
Definition: qtextstream.h:337
decltype(auto) constexpr empty(T &&obj)
ADL-aware version of std::empty.
Definition: StdUtils.h:97
ChannelGroupService::Index Index
QTextStream & endl(QTextStream &s)
std::vector< Channel > ChannelVector
#define DEFINE_ART_SERVICE_INTERFACE_IMPL(svc, iface)