CLAM-Development  1.4.0
ControlSum.cxx
Go to the documentation of this file.
1 #include "ControlSum.hxx"
2 #include "ProcessingFactory.hxx"
3 
4 namespace CLAM
5 {
6 namespace Hidden
7 {
8  static const char * metadata[] = {
9  "key", "ControlSum",
10  "category", "Controls",
11  "description", "ControlSum",
12  0
13  };
14  static FactoryRegistrator<ProcessingFactory, ControlSum> reg = metadata;
15 }
16 
17 void ControlSumConfig::DefaultInit()
18 {
19  AddAll();
20  UpdateData();
21  SetRightTerm( 0.0 );
22 }
23 
25  : mInOperator1( "Operator 1", this , &ControlSum::InControlCallback )
26  , mInOperator2( "Operator 2", this , &ControlSum::InControlCallback )
27  , mOutControl( "Sum", this )
28 {
29  Configure( mConfig );
30 }
31 
33  : mInOperator1( "Operator 1", this , &ControlSum::InControlCallback )
34  , mInOperator2( "Operator 2", this , &ControlSum::InControlCallback )
35  , mOutControl( "Sum", this )
36 {
37  Configure( cfg );
38 }
39 
41 {
42  CopyAsConcreteConfig( mConfig, cfg );
43  mInOperator2.DoControl(mConfig.GetRightTerm());
44  return true;
45 }
46 
47 void ControlSum::InControlCallback(const TControlData & value)
48 {
49  TControlData op1 = mInOperator1.GetLastValue();
50  TControlData op2 = mInOperator2.GetLastValue();
51  mOutControl.SendControl(op1+op2);
52 }
53 
55 {
56  return true;
57 }
58 }
59