Nymph  v1.5.2
Flow-Based Data Processing Framework
Public Member Functions | List of all members
KTCut Class Referenceabstract

Base class for a cut that gets applied to data objects. More...

#include <KTCut.hh>

Inheritance diagram for KTCut:
Inheritance graph

Public Member Functions

 KTCut (const std::string &name="default-cut-name")
 
virtual ~KTCut ()
 
virtual bool Apply (KTDataPtr)=0
 
- Public Member Functions inherited from KTConfigurable
 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

- Protected Attributes inherited from KTConfigurable
KTCommandLineHandlerfCLHandler
 
std::string fConfigName
 

Detailed Description

Base class for a cut that gets applied to data objects.

Author
N. S. Oblath
 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);

};


----— Example Implementation ----—

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; }

Definition at line 112 of file KTCut.hh.

Constructor & Destructor Documentation

◆ KTCut()

KTCut ( const std::string &  name = "default-cut-name")

Definition at line 12 of file KTCut.cc.

◆ ~KTCut()

~KTCut ( )
virtual

Definition at line 17 of file KTCut.cc.

Member Function Documentation

◆ Apply()

virtual bool Apply ( KTDataPtr  )
pure virtual

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