Public Member Functions | Private Attributes | List of all members
WireCell::Img::BlobSetSync Class Reference

#include <BlobSetSync.h>

Inheritance diagram for WireCell::Img::BlobSetSync:
WireCell::IBlobSetFanin WireCell::IConfigurable WireCell::IFaninNode< IBlobSet, IBlobSet, 0 > WireCell::IComponent< IConfigurable > WireCell::IFaninNodeBase WireCell::Interface WireCell::INode WireCell::IComponent< INode > WireCell::Interface

Public Member Functions

 BlobSetSync ()
 
virtual ~BlobSetSync ()
 
virtual void configure (const WireCell::Configuration &cfg)
 Accept a configuration. More...
 
virtual WireCell::Configuration default_configuration () const
 Optional, override to return a hard-coded default configuration. More...
 
virtual std::vector< std::stringinput_types ()
 
virtual bool operator() (const input_vector &invec, output_pointer &out)
 
- Public Member Functions inherited from WireCell::IBlobSetFanin
virtual ~IBlobSetFanin ()
 
virtual std::string signature ()
 
- Public Member Functions inherited from WireCell::IFaninNode< IBlobSet, IBlobSet, 0 >
virtual ~IFaninNode ()
 
virtual bool operator() (const any_vector &anyv, boost::any &anyout)
 The calling signature: More...
 
virtual std::vector< std::stringoutput_types ()
 
- Public Member Functions inherited from WireCell::IFaninNodeBase
virtual ~IFaninNodeBase ()
 
virtual NodeCategory category ()
 Return the behavior category type. More...
 
virtual int concurrency ()
 Fanin nodes can usually do their thing stateless. More...
 
- Public Member Functions inherited from WireCell::INode
virtual ~INode ()
 
virtual void reset ()
 
- Public Member Functions inherited from WireCell::IComponent< INode >
virtual ~IComponent ()
 
- Public Member Functions inherited from WireCell::Interface
virtual ~Interface ()
 
- Public Member Functions inherited from WireCell::IConfigurable
virtual ~IConfigurable ()
 
- Public Member Functions inherited from WireCell::IComponent< IConfigurable >
virtual ~IComponent ()
 

Private Attributes

size_t m_multiplicity
 
Log::logptr_t l
 

Additional Inherited Members

- Public Types inherited from WireCell::IFaninNode< IBlobSet, IBlobSet, 0 >
typedef IBlobSet input_type
 
typedef IBlobSet output_type
 
typedef std::shared_ptr< const IBlobSetinput_pointer
 
typedef std::shared_ptr< const IBlobSetoutput_pointer
 
typedef std::vector< input_pointerinput_vector
 
- Public Types inherited from WireCell::IFaninNodeBase
typedef std::shared_ptr< IFaninNodeBasepointer
 
typedef std::vector< boost::any > any_vector
 
- Public Types inherited from WireCell::INode
enum  NodeCategory {
  unknown, sourceNode, sinkNode, functionNode,
  queuedoutNode, joinNode, splitNode, faninNode,
  fanoutNode, multioutNode, hydraNode
}
 
- Public Types inherited from WireCell::IComponent< INode >
typedef std::shared_ptr< INodepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 
- Public Types inherited from WireCell::Interface
typedef std::shared_ptr< Interfacepointer
 
- Public Types inherited from WireCell::IComponent< IConfigurable >
typedef std::shared_ptr< IConfigurablepointer
 Access subclass facet by pointer. More...
 
typedef std::vector< pointervector
 Vector of shared pointers. More...
 

Detailed Description

Definition at line 14 of file BlobSetSync.h.

Constructor & Destructor Documentation

Img::BlobSetSync::BlobSetSync ( )

Definition at line 10 of file BlobSetSync.cxx.

11  : m_multiplicity(0)
12  , l(Log::logger("glue"))
13 {
14 }
logptr_t logger(std::string name)
Definition: Logging.cxx:71
Img::BlobSetSync::~BlobSetSync ( )
virtual

Definition at line 16 of file BlobSetSync.cxx.

17 {
18 }

Member Function Documentation

void Img::BlobSetSync::configure ( const WireCell::Configuration config)
virtual

Accept a configuration.

Implements WireCell::IConfigurable.

Definition at line 28 of file BlobSetSync.cxx.

29 {
30  int m = get<int>(cfg, "multiplicity", (int)m_multiplicity);
31  if (m<=0) {
32  THROW(ValueError() << errmsg{"BlobSync multiplicity must be positive"});
33  }
34  m_multiplicity = m;
35 }
static const double m
Definition: Units.h:79
boost::error_info< struct tag_errmsg, std::string > errmsg
Definition: Exceptions.h:54
cfg
Definition: dbjson.py:29
#define THROW(e)
Definition: Exceptions.h:25
WireCell::Configuration Img::BlobSetSync::default_configuration ( ) const
virtual

Optional, override to return a hard-coded default configuration.

Reimplemented from WireCell::IConfigurable.

Definition at line 21 of file BlobSetSync.cxx.

22 {
24  cfg["multiplicity"] = (int)m_multiplicity;
25  return cfg;
26 }
cfg
Definition: dbjson.py:29
Json::Value Configuration
Definition: Configuration.h:50
std::vector< std::string > Img::BlobSetSync::input_types ( )
virtual

Implements WireCell::IBlobSetFanin.

Definition at line 37 of file BlobSetSync.cxx.

38 {
39  const std::string tname = std::string(typeid(input_type).name());
40  std::vector<std::string> ret(m_multiplicity, tname);
41  return ret;
42 
43 }
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
bool Img::BlobSetSync::operator() ( const input_vector invec,
output_pointer out 
)
virtual

Implements WireCell::IFaninNode< IBlobSet, IBlobSet, 0 >.

Definition at line 45 of file BlobSetSync.cxx.

46 {
47  SimpleBlobSet* sbs = new SimpleBlobSet(0,nullptr);
48  out = IBlobSet::pointer(sbs);
49 
50  int neos = 0;
51  for (const auto& ibs : invec) {
52  if (!ibs) {
53  ++neos;
54  break;
55  }
56  ISlice::pointer newslice = ibs->slice();
57  if (!sbs->slice() or sbs->slice()->start() > newslice->start()) {
58  sbs->m_slice = newslice;
59  sbs->m_ident = newslice->ident();
60  }
61  for (const auto& iblob : ibs->blobs()) {
62  sbs->m_blobs.push_back(iblob);
63  }
64  }
65  if (neos) {
66  out = nullptr;
67  SPDLOG_LOGGER_TRACE(l,"BlobSetSink: EOS");
68  return true;
69  }
70  SPDLOG_LOGGER_TRACE(l,"BlobSetSink: sync'ed {} blobs", sbs->m_blobs.size());
71  return true;
72 }
std::shared_ptr< const IBlobSet > pointer
Definition: IData.h:19
#define SPDLOG_LOGGER_TRACE(logger,...)
Definition: spdlog.h:319

Member Data Documentation

Log::logptr_t WireCell::Img::BlobSetSync::l
private

Definition at line 28 of file BlobSetSync.h.

size_t WireCell::Img::BlobSetSync::m_multiplicity
private

Definition at line 27 of file BlobSetSync.h.


The documentation for this class was generated from the following files: