Go to the documentation of this file.
31 #ifndef GENAPI_FLOATT_H
32 #define GENAPI_FLOATT_H
35 #include "../NodeCallback.h"
38 #include "../Counter.h"
40 #include "GenApi/impl/Log.h"
49 # pragma warning( disable : 4706 ) // assignment within conditional expression
75 std::list<CNodeCallback*> CallbacksToFire;
80 Base::m_ValueCacheValid =
false;
82 GCLOGINFOPUSH( Base::m_pValueLog,
"SetValue( %f )...", Value );
95 typename Base::PostSetValueFinalizer PostSetValueCaller(
this, CallbacksToFire);
101 Base::InternalSetValue(Value,
Verify);
103 #if ! defined( DISABLE_VALUE_CACHING ) || (DISABLE_VALUE_CACHING == 0)
108 Base::m_ValueCacheValid =
true;
109 Base::m_DontDeleteThisCache =
true;
115 Base::InternalCheckError();
120 std::list<CNodeCallback*>::iterator ptrCallback;
121 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
128 std::list<CNodeCallback*>::iterator ptrCallback;
129 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
171 while( isspace(c = *s) )
175 if ((sign = (c ==
'-')))
183 v = 10.0 * v + (*s++ -
'0');
194 v += (*s++ -
'0') / fr;
202 if (tolower(*s) ==
'e')
221 std::stringstream Buffer;
225 switch( Base::InternalGetDisplayNotation() )
231 Buffer.setf(std::ios::fixed, std::ios::floatfield);
232 CorrectedBuffer.setf(std::ios::fixed, std::ios::floatfield);
235 Buffer.setf(std::ios::scientific, std::ios::floatfield);
236 CorrectedBuffer.setf(std::ios::scientific, std::ios::floatfield);
238 #pragma BullseyeCoverage off
241 #pragma BullseyeCoverage on
246 Buffer.precision( Precision );
247 CorrectedBuffer.precision( Precision );
258 Buffer >> VerifyValue;
260 double CorrectedValue = Value;
261 bool LimitsExceeded =
false;
264 if( VerifyValue > Base::InternalGetMax() )
266 CorrectedValue = Value -
Correction( Buffer.str().c_str() );
267 LimitsExceeded =
true;
269 else if( VerifyValue < Base::InternalGetMin() )
271 CorrectedValue = Value +
Correction( Buffer.str().c_str() );
272 LimitsExceeded =
true;
278 CorrectedBuffer << CorrectedValue;
279 valueString = CorrectedBuffer.
str().c_str();
283 valueString = Buffer.str().
c_str();
298 #if ! defined( DISABLE_VALUE_CACHING ) || (DISABLE_VALUE_CACHING == 0)
300 if (!IgnoreCache && Base::m_ValueCacheValid && !
Verify)
310 const double Value( Base::InternalGetValue(
Verify, IgnoreCache) );
312 GCLOGINFOPOP( Base::m_pValueLog,
"...GetValue = %f", Value );
317 Base::InternalCheckError();
320 #if ! defined( DISABLE_VALUE_CACHING ) || (DISABLE_VALUE_CACHING == 0)
327 Base::m_ValueCacheValid =
true;
362 typename Base::EntryMethodFinalizer E(
this,
meGetMin );
370 double Minimum = Base::InternalGetMin();
373 GCLOGINFOPOP( Base::m_pRangeLog,
"...GetMin = %f", Minimum );
383 typename Base::EntryMethodFinalizer E(
this,
meGetMax );
391 double Maximum(Base::InternalGetMax());
394 GCLOGINFOPOP( Base::m_pRangeLog,
"...GetMax = %f", Maximum );
407 bool HasInc( Base::InternalHasInc() );
408 #pragma BullseyeCoverage off
410 #pragma BullseyeCoverage on
419 typename Base::EntryMethodFinalizer E(
this,
meGetIncMode );
423 if( ! Base::m_ListOfValidValuesCacheValid )
426 Base::m_ListOfValidValuesCacheValid =
true;
440 typename Base::EntryMethodFinalizer E(
this,
meGetInc );
442 if( !Base::InternalHasInc() )
451 double Inc( Base::InternalGetInc() );
453 GCLOGINFOPOP( Base::m_pRangeLog,
"...GetInc = %f", Inc );
464 GCLOGINFOPUSH( Base::m_pRangeLog,
"GetListOfValidValues...");
465 if( ! Base::m_ListOfValidValuesCacheValid )
468 Base::m_ListOfValidValuesCacheValid =
true;
474 GCLOGINFOPOP( Base::m_pRangeLog,
"...GetListOfValidValues" );
485 return Base::InternalGetRepresentation();
492 return Base::InternalGetUnit();
499 return Base::InternalGetDisplayNotation();
507 int64_t Precision = Base::InternalGetDisplayPrecision();
509 if( Precision == -1 )
512 std::stringstream Buffer;
513 switch( Base::InternalGetDisplayNotation() )
516 Buffer.setf(std::ios::fixed, std::ios::floatfield);
519 Buffer.setf(std::ios::scientific, std::ios::floatfield);
524 #pragma BullseyeCoverage off
527 #pragma BullseyeCoverage on
530 Precision = Buffer.precision();
565 #endif // GENAPI_FLOATT_H
Lexical analyzer for CIntSwissKnife.
virtual GENICAM_NAMESPACE::gcstring InternalToString(bool Verify=false, bool IgnoreCache=false)
Get value of the node as string.
virtual double GetMax()
Implementation of IFloat::GetMax()
#define CHECK_RANGE_FLT_NODE(_Value, _Min, _Max)
Range check for float.
virtual double GetMin()
Implementation of IFloat::GetMin()
virtual double operator*()
Implementation of IFloat::operator*()
@ fnAutomatic
the notation if either scientific or fixed depending on what is shorter
@ cbPostOutsideLock
callback is fired on leaving the tree inside the lock-guarded area
virtual int64_t GetDisplayPrecision() const
Get the DisplayPrecision to be used when converting the float to a string.
virtual IFloat & operator=(double Value)
Implementation of IFloat::operator=()
Vector of doubles with reference counting.
virtual ECachingMode GetCachingMode() const =0
Get Caching Mode.
double m_ValueCache
The cache for the float value.
@ WriteThrough
Write to cache and register.
enum GENAPI_NAMESPACE::_EDisplayNotation EDisplayNotation
typedef for float notation
virtual void SetValue(double Value, bool Verify=true)
Implementation of IFloat::SetValue()
A string class which is a clone of std::string.
const _autovector_impl duplicate(T min, T max)
virtual CLock & GetLock() const =0
Returns the lock which guards the node map.
#define INVALID_ARGUMENT_EXCEPTION_NODE
Fires an invalid argument exception, e.g. throw INVALID_ARGUMENT("%ld too large", Value);.
virtual EIncMode GetIncMode()
virtual GENICAM_NAMESPACE::gcstring GetUnit() const
Implementation of IFloat::GetUnit()
enum GENAPI_NAMESPACE::_EIncMode EIncMode
typedef for increment mode
virtual bool EntryIsStremable()=0
enum GENAPI_NAMESPACE::_ERepresentation ERepresentation
recommended representation of a node value
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT bool Verify
@ fnFixed
the notation is fixed, e.g. 123.4
#define GCLOGINFOPOP(cat,...)
Implementation of the IFloat Interface.
double m_ImposedMin
a Value imposed to the minimum
virtual double_autovector_t GetListOfValidValues(bool bounded=true)
Get list of valid value.
bool IsAvailable(EAccessMode AccessMode)
Tests if available.
virtual bool CanBeWritten(bool Verify)=0
virtual ERepresentation GetRepresentation()
Implementation of IFloat::GetRepresentation()
#define ACCESS_EXCEPTION_NODE
Fires a access error exception, e.g. throw ACCESS_ERROR_EXCEPTION("Not everybody")
double Correction(const char *s)
#define RUNTIME_EXCEPTION_NODE
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
bool IsReadable(EAccessMode AccessMode)
Tests if readable.
Definition of interface INodePrivate.
virtual EDisplayNotation GetDisplayNotation() const
Get the way the float should be converted to a string.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
GENICAM_INTERFACE INode
Interface common to all nodes.
double m_ImposedMax
a Value imposed to the maximum
bool String2Value(const GENICAM_NAMESPACE::gcstring &ValueStr, T *Value)
Converts a string to an T property.
virtual double GetInc()
Get the constant increment if there is any.
virtual double operator()()
Implementation of IFloat::operator()()
virtual bool IsStreamable() const =0
True if the node is streamable.
virtual const char * c_str(void) const
This file contains the internal implementation of the autovector.
virtual bool HasInc()
True if the float has a constant increment.
Definition of value2string and string2value functions.
@ fnScientific
the notation is scientific, e.g. 1.234e2
enum GENAPI_NAMESPACE::_ECachingMode ECachingMode
caching mode of a register
virtual void ImposeMin(double Value)
Restrict minimum value.
virtual void InternalFromString(const GENICAM_NAMESPACE::gcstring &ValueStr, bool Verify=true)
Set value of the node as string.
@ simAll
Invalidate the node and all of its dependents.
double_autovector_impl m_CurentValidValueSet
The cached list of valie value for the integer.
#define GCLOGINFO(cat,...)
@ WriteAround
Write to register, write to cache on read.
#define GCLOGINFOPUSH(cat,...)
virtual double GetValue(bool Verify=false, bool IgnoreCache=false)
Implementation of IFloat::GetValue()
virtual void ImposeMax(double Value)
Restrict maximum value.
virtual void SetInvalid(ESetInvalidMode simMode)=0
Invalidate the node resp. the node and all of its dependents.
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11