CLAM-Development  1.4.0
OutControlSender.cxx
Go to the documentation of this file.
1 #include "OutControlSender.hxx"
2 #include "ProcessingFactory.hxx"
3 
4 
5 namespace CLAM
6 {
7 namespace Hidden
8 {
9  static const char * metadata[] = {
10  "key", "OutControlSender",
11  "category", "Controls",
12  "description", "OutControlSender",
13  "icon", "hslider.png",
14  "control_sender_type", typeid(TControlData).name(),
15  0
16  };
17  static FactoryRegistrator<ProcessingFactory, OutControlSender> reg = metadata;
18 }
19 
21  {
22  { EControlRepresentation::eUndetermined, "Undetermined" },
23  { EControlRepresentation::eVerticalSlider, "Vertical Slider" },
24  { EControlRepresentation::eHorizontalSlider, "Horizontal Slider" },
25  { EControlRepresentation::eKnot, "Knot" },
26  { EControlRepresentation::eSpinBox, "Spin Box" },
27  { 0, NULL }
28  };
29 
31  {
32  { EMapping::eLinear, "Linear" },
33  { EMapping::eInverted, "Inverted" },
34  { EMapping::eLog, "Log" },
35  { EMapping::eReverseLog, "Reverse Log" },
36  { 0, NULL }
37  };
38 
39 
42 
45 
47 {
48  AddAll();
49  UpdateData();
50  SetMin( 0.0 );
51  SetDefault( 0.0 );
52  SetMax( 1.0 );
53  SetStep(1.0);
54 }
55 
57  : mOutput("out", this)
58  , mFirstDoAfterStart(true)
59 {
61  Configure(cfg);
62 }
63 
65  : mOutput( "out", this )
66  , mFirstDoAfterStart(true)
67 {
68  Configure(cfg);
69 }
70 
71 
73 {
74  mFirstDoAfterStart=true;
75  std::cout << "Start" << std::endl;
76  return true;
77 }
78 
80 {
81  if( !AbleToExecute() ) return true;
82  if (mFirstDoAfterStart)
83  {
84  std::cout << "First do" << std::endl;
85  mFirstDoAfterStart=false;
86  mOutput.SendControl( mLastValue );
87  }
88  return true;
89 }
90 
92 {
93  // TODO: Solve thread boundary here
94  mLastValue=value;
95  mOutput.SendControl( mLastValue );
96 }
97 
99 {
100  CopyAsConcreteConfig(mConfig, c);
101  if(mConfig.GetMin() > mConfig.GetMax() )
102  {
103  AddConfigErrorMessage(" min value greater than max");
104  return false;
105  }
106  if((mConfig.GetDefault() > mConfig.GetMax()) || (mConfig.GetDefault() < mConfig.GetMin()))
107  {
108  AddConfigErrorMessage(" default value out of range");
109  return false;
110  }
111  if(mConfig.GetStep() == 0 )
112  {
113  AddConfigErrorMessage(" step value equal to 0");
114  return false;
115  }
116  mLastValue = mConfig.GetDefault();
117  return true;
118 }
119 
120 } // namespace CLAM
121 
122 
123