InControlBase.cxx

Go to the documentation of this file.
00001 #include <CLAM/InControlBase.hxx>
00002 #include <CLAM/Processing.hxx>
00003 
00004 namespace CLAM
00005 {
00006         InControlBase::InControlBase(const std::string &name, Processing * proc)
00007                 : mName(name)
00008                 , mProcessing(proc)
00009                 , mUpperBound(1)
00010                 , mLowerBound(0)
00011                 , mBounded(false)
00012                 , mHasDefaultValue(false)
00013                 , _hasBeenRead(true)
00014         {
00015                 if (proc) proc->RegisterInControl(this);
00016         }
00017         
00018         InControlBase::~InControlBase()
00019         {
00020                 while (!mLinks.empty())
00021                         mLinks.front()->RemoveLink(*this);
00022                 if (mProcessing)
00023                         mProcessing->GetInControls().ProcessingInterface_Unregister(this);
00024         }
00025         bool InControlBase::IsConnectedTo(OutControlBase & out)
00026         {
00027                 return out.IsConnectedTo(*this);
00028         }
00029 
00030         bool InControlBase::IsBounded() const
00031         {
00032                 return mBounded;
00033         }
00034         float InControlBase::UpperBound() const
00035         {
00036                 return mUpperBound;
00037         }
00038         float InControlBase::LowerBound() const
00039         {
00040                 return mLowerBound;
00041         }
00042         void InControlBase::SetBounds( float lower, float upper )
00043         {
00044                 mLowerBound = lower;
00045                 mUpperBound = upper;
00046                 mBounded = true;
00047         }
00048         void InControlBase::SetDefaultValue( float val )
00049         {
00050                 mDefaultValue = val;
00051                 mHasDefaultValue = true;
00052         }
00053         float InControlBase::DefaultValue() const
00054         {
00055                 if (mHasDefaultValue) return mDefaultValue;
00056                 return (mUpperBound+mLowerBound)/2.f;
00057         }
00058 }
Generated by  doxygen 1.6.3