Nymph
v1.5.2
Flow-Based Data Processing Framework
|
Base class for a cut that gets applied to data objects. More...
#include <KTCut.hh>
Public Member Functions | |
KTCut (const std::string &name="default-cut-name") | |
virtual | ~KTCut () |
virtual bool | Apply (KTDataPtr)=0 |
![]() | |
KTConfigurable (const std::string &name="default-name") | |
virtual | ~KTConfigurable () |
virtual bool | Configure (const scarab::param_node &node)=0 |
Should perform parameter store and command-line configurations. More... | |
bool | Configure (const std::string &config) |
Implement the option for calling Configure without passing a parameter store node. More... | |
const std::string & | GetConfigName () const |
void | SetConfigName (const std::string &name) |
Additional Inherited Members | |
![]() | |
KTCommandLineHandler * | fCLHandler |
std::string | fConfigName |
Base class for a cut that gets applied to data objects.
A fully implemented cut MUST have the following: - Public nested class called Result, inheriting from KTExtensibleCutResult< Result >, and containing a public static std::string name sName. - Cut registration using the macro KT_REGISTER_CUT([class name]) - Implementation of bool Configure(const scarab::param_node&) - Implementation of bool Apply(KTData&, <DataType(s)>) Your cut class should inherit from KTCutOneArg or KTCutTwoArgs, depending on the number of data types involved in your cut. The existence of [class name]::Result and [class name]::Result::sName are enforces at compile time by the KT_REGISTER_CUT macro. The functions bool Configure(const scarab::param_node&) and void Apply(KTData&, <DataType(s)>) are abstract in the base classes, and therefore must be implemented. Boolean return value interpretation: - TRUE means the cut was failed - FALSE means the cut was passed -------------------------------------- ------- Example Cut Definition ------- -------------------------------------- class KTSomeData;
Data must be at least as awesome as fAwesomenessThreshold to pass this cut class KTAwesomenessCut : public KTCutOneArg< KTSomeData > { public: struct Result : KTExtensibleCutResult< Result > { static const std::string sName; };
public: KTAwesomenessCut(const std::string& name = "default-example-cut"); virtual ~KTAwesomenessCut();
bool Configure(const scarab::param_node* node);
MEMBERVARIABLE(double, AwesomenessThreshold);
public: bool Apply(KTData& data, KTSomeData& data);
};
const std::string KTExampleCut::Result::sName = "awesomeness-cut";
KT_REGISTER_CUT(KTExampleCut);
KTAwesomenessCut::KTAwesomenessCut(const std::string& name) : KTCutOneArg(name), fAwesomenessThreshold(1000000.) {}
KTAwesomenessCut::~KTExampleCut() {}
bool KTAwesomenessCut::Configure(const scarab::param_node* node) { if (node == NULL) return true; SetAwesomenessThreshold(node->get_value("awesomeness", GetAwesomenessThreshold())); return true; }
bool KTAwesomenessCut::Apply(KTData& data, KTSomeData& someData) { bool isCut = someData.Awesomeness() < fAwesomenessThreshold; data.GetCutStatus().AddCutResult< KTAwesomenessCut::Result >(isCut); return isCut; }
|
pure virtual |
Implemented in KTCutTwoArgs< XDataType1, XDataType2 >, KTCutOneArg< XDataType >, and KTCutOneArg< KTTestData >.