#include "moan.hpp" #include "Merger.hpp" #include "PhysicsObject.hpp" ClassImp(moan::Merger) using namespace std; namespace moan { Merger::Merger(const char *name,ObjectProcessor *source1, ObjectProcessor *source2) : ObjectProcessor(name,false) { setChild(source1->name(),source1); // Set the data source child processor setChild(source2->name(),source2); // Set the data source child processor _sources.push_back(source1); _sources.push_back(source2); } void Merger::addSource(ObjectProcessor *source) { setChild(source->name(),source); // Set the data source child processor _sources.push_back(source); } void Merger::processData(void) { // Loop over all the input processors for(std::list::const_iterator i=_sources.begin(); i!=_sources.end();++i) { // Get the list of objects from the processor const list &input=(*i)->objects(); // Loop over all the objects from the processor for(std::list::const_iterator j=input.begin(); j!=input.end();++j) { addObject(*j); // Add each object to the output list } // Loop over objects } // Loop over processors } }