// FilterAll.cpp #include "FilterAll.h" #include "objstream/ObjData.hpp" #include "objstream/ObjTable.hpp" #include "trfutil/trfstream.h" #include "trffit/MTrack.h" using std::ostream; using trf::Filter; using trf::FilterAll; //********************************************************************** // Free functions. //********************************************************************** namespace { // Creator. ObjPtr create(const ObjData& data) { assert( data.get_object_type() == "FilterAll" ); bool state = data.get_bool("state"); return ObjPtr( new FilterAll(state) ); } } //********************************************************************** // Member functions. //********************************************************************** // output stream void FilterAll::ostr(ostream& stream) const { stream << begin_object; stream << "Filter "; if ( _state ) stream << "accepting"; else stream << "rejecting"; stream << " all tracks."; stream << end_object; } //********************************************************************** // constructor FilterAll::FilterAll(bool state) : _state(state) { } //********************************************************************** // Return the creator. ObjCreator FilterAll::get_creator() { return create; } //********************************************************************** // Write the object data. ObjData FilterAll::write_data() const { ObjData data( get_type_name() ); data.add_bool( "state", get_state() ); return data; } //********************************************************************** // process a list of tracks Filter::FlagArray FilterAll::process(MTrackArray& trms) const { return FlagArray(trms.size(), _state); } //**********************************************************************