Nymph  v1.5.2
Flow-Based Data Processing Framework
KTTestCuts.cc
Go to the documentation of this file.
1 /*
2  * KTTestCuts.cc
3  *
4  * Created on: Nov 2, 2016
5  * Author: obla999
6  */
7 
8 #include "KTTestCuts.hh"
9 
10 #include "KTLogger.hh"
11 
12 namespace Nymph
13 {
14  KTLOGGER(testlog, "KTTestCuts");
15 
16  const std::string KTTestData::sName = "test-data";
17 
18  const std::string KTAwesomeCut::Result::sName = "awesome-cut";
19  const std::string KTNotAwesomeCut::Result::sName = "not-awesome-cut";
20 
21  KT_REGISTER_CUT(KTAwesomeCut);
22  KT_REGISTER_CUT(KTNotAwesomeCut);
23 
24 
27  fIsAwesome(false)
28  {}
29 
31  {}
32 
33 
34  KTAwesomeCut::KTAwesomeCut(const std::string& name) :
35  KTCutOneArg(name)
36  {}
37 
39  {}
40 
41  bool KTAwesomeCut::Configure(const scarab::param_node&)
42  {
43  return true;
44  }
45 
46  bool KTAwesomeCut::Apply(KTData& data, KTTestData& testData)
47  {
48  bool isCut = ! testData.GetIsAwesome();
49  KTDEBUG(testlog, "Is data awesome? " << testData.GetIsAwesome());
50  KTDEBUG(testlog, "Is data cut? " << isCut);
51  data.GetCutStatus().AddCutResult< KTAwesomeCut::Result >(isCut);
52  return isCut;
53  }
54 
55 
56  KTNotAwesomeCut::KTNotAwesomeCut(const std::string& name) :
57  KTCutOneArg(name)
58  {}
59 
61  {}
62 
63  bool KTNotAwesomeCut::Configure(const scarab::param_node&)
64  {
65  return true;
66  }
67 
68  bool KTNotAwesomeCut::Apply(KTData& data, KTTestData& testData)
69  {
70  bool isCut = testData.GetIsAwesome();
71  KTDEBUG(testlog, "Is data awesome? " << testData.GetIsAwesome());
72  KTDEBUG(testlog, "Is data cut? " << isCut);
73  // use the name-based AddCutResult
74  data.GetCutStatus().AddCutResult("not-awesome-cut", isCut);
75  return isCut;
76  }
77 
78 }
79 
static const std::string sName
Definition: KTTestCuts.hh:56
KTNotAwesomeCut(const std::string &name="default-not-awesome-cut")
Definition: KTTestCuts.cc:56
static const std::string sName
Definition: KTTestCuts.hh:38
static const std::string sName
Definition: KTTestCuts.hh:28
bool Apply(KTData &data, KTTestData &testData)
Definition: KTTestCuts.cc:46
virtual ~KTTestData()
Definition: KTTestCuts.cc:30
#define KTDEBUG(...)
Definition: KTLogger.hh:343
KTAwesomeCut(const std::string &name="default-awesome-cut")
Definition: KTTestCuts.cc:34
KTLOGGER(applog, "KTApplication")
virtual ~KTAwesomeCut()
Definition: KTTestCuts.cc:38
virtual ~KTNotAwesomeCut()
Definition: KTTestCuts.cc:60
KT_REGISTER_CUT(KTAwesomeCut)
bool Configure(const scarab::param_node &node)
Should perform parameter store and command-line configurations.
Definition: KTTestCuts.cc:63
bool Configure(const scarab::param_node &node)
Should perform parameter store and command-line configurations.
Definition: KTTestCuts.cc:41
Contains the logger class and macros, based on Kasper&#39;s KLogger class.
bool Apply(KTData &data, KTTestData &testData)
Definition: KTTestCuts.cc:68