Go to the documentation of this file.
31 #ifndef GENAPI_POLYREFERENCE_H
32 #define GENAPI_POLYREFERENCE_H
53 return (
int64_t)(x > 0.0 ? x + 0.5 : x - 0.5);
61 inline double abs(
double x)
63 return (x >= 0.0 ? x : -x);
115 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::operator(IBase*) : pointer is neither IInteger*, nor IEnumeration*, nor IBoolean*, nor IFloat*");
155 # pragma BullseyeCoverage off
159 # pragma BullseyeCoverage on
181 return round(ptrEnumEntry->GetNumericValue());
184 return m_Value.pBoolean->GetValue(
Verify, IgnoreCache) ? 1 : 0;
187 double Result =
m_Value.pFloat->GetValue(
Verify, IgnoreCache);
189 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::GetValue(): Float value %f out of integer range", Result);
190 return round(Result);
193 #pragma BullseyeCoverage off
196 #pragma BullseyeCoverage on
214 double OldDistance = -1;
216 m_Value.pEnumeration->GetEntries(EnumEntries);
217 for( NodeList_t::iterator it=EnumEntries.begin(); it!=EnumEntries.end(); ++it )
221 if( !ptrOldEnumEntry.
IsValid() )
223 ptrOldEnumEntry = *it;
224 OldDistance =
abs( (
double)
Value - ptrOldEnumEntry->GetNumericValue() );
229 double NewDistance =
abs( (
double)
Value - ptrNewEnumEntry->GetNumericValue() ) ;
230 if(NewDistance < OldDistance)
232 ptrOldEnumEntry = *it;
233 OldDistance = NewDistance;
238 if( ptrOldEnumEntry.
IsValid() )
239 m_Value.pEnumeration->SetIntValue(ptrOldEnumEntry->GetValue(),
Verify);
241 throw ACCESS_EXCEPTION(
"Failed to write enumeration. None of the entries is writable");
251 #pragma BullseyeCoverage off
254 #pragma BullseyeCoverage on
264 return m_Value.pInteger->GetMin();
271 double Min =
m_Value.pFloat->GetMin();
273 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::GetMin(): Float value %f out of integer range", Min);
277 #pragma BullseyeCoverage off
280 #pragma BullseyeCoverage on
290 return m_Value.pInteger->GetMax();
297 double Max =
m_Value.pFloat->GetMax();
299 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::GetMin(): Float value %f out of integer range", Max);
303 #pragma BullseyeCoverage off
306 #pragma BullseyeCoverage on
316 return m_Value.pInteger->GetInc();
327 #pragma BullseyeCoverage off
330 #pragma BullseyeCoverage on
340 return m_Value.pInteger->GetRepresentation();
347 #pragma BullseyeCoverage off
349 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::GetRepresentation(): uninitialized pointer");
350 #pragma BullseyeCoverage on
360 return m_Value.pInteger->GetUnit();
362 return m_Value.pFloat->GetUnit();
368 #pragma BullseyeCoverage off
372 #pragma BullseyeCoverage on
381 return m_Value.pInteger->IsValueCacheValid();
383 return m_Value.pEnumeration->IsValueCacheValid();
385 return m_Value.pBoolean->IsValueCacheValid();
387 return m_Value.pFloat->IsValueCacheValid();
391 # pragma BullseyeCoverage off
393 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::IsValueCacheValid(): uninitialized pointer");
395 # pragma BullseyeCoverage on
403 return m_Value.pInteger->GetNode()->GetCachingMode();
405 return m_Value.pEnumeration->GetNode()->GetCachingMode();
407 return m_Value.pBoolean->GetNode()->GetCachingMode();
409 return m_Value.pFloat->GetNode()->GetCachingMode();
413 #pragma BullseyeCoverage off
415 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::GetCachingMode(): uninitialized pointer");
416 #pragma BullseyeCoverage on
459 #pragma BullseyeCoverage off
464 return ptrNode->GetName();
468 #pragma BullseyeCoverage on
495 throw RUNTIME_EXCEPTION(
"CIntegerPolyRef::operator(IBase*) : pointer is neither IInteger*, IEnumeration*, nor IBoolean*");
526 #pragma BullseyeCoverage off
531 #pragma BullseyeCoverage on
551 return m_Value.pEnumeration->GetIntValue(
Verify, IgnoreCache) != 0;
555 #pragma BullseyeCoverage off
558 #pragma BullseyeCoverage on
580 #pragma BullseyeCoverage off
583 #pragma BullseyeCoverage on
592 return m_Value.pInteger->GetNode()->GetCachingMode();
594 return m_Value.pEnumeration->GetNode()->GetCachingMode();
596 return m_Value.pBoolean->GetNode()->GetCachingMode();
600 #pragma BullseyeCoverage off
602 throw RUNTIME_EXCEPTION(
"CBooleanPolyRef::GetCachingMode(): uninitialized pointer");
603 #pragma BullseyeCoverage on
675 throw RUNTIME_EXCEPTION(
"CFloatPolyRef::operator(IBase*) : pointer is neither IFloat*, IInteger*, nor IEnumeration*");
712 #pragma BullseyeCoverage off
717 #pragma BullseyeCoverage on
737 return (
double)
m_Value.pInteger->GetValue(
Verify, IgnoreCache);
741 return ptrEnumEntry->GetNumericValue();
744 #pragma BullseyeCoverage off
747 #pragma BullseyeCoverage on
769 TargetValue -= Residuum;
770 if( 2 * Residuum >
m_Value.pInteger->GetInc())
771 TargetValue +=
m_Value.pInteger->GetInc();
778 double OldDistance = -1;
780 m_Value.pEnumeration->GetEntries(EnumEntries);
781 for( NodeList_t::iterator it=EnumEntries.begin(); it!=EnumEntries.end(); ++it )
785 if (!ptrOldEnumEntry.
IsValid())
787 ptrOldEnumEntry = *it;
788 OldDistance =
abs(
Value - ptrOldEnumEntry->GetNumericValue() );
793 double NewDistance =
abs(
Value - ptrNewEnumEntry->GetNumericValue() ) ;
794 if (NewDistance < OldDistance)
796 ptrOldEnumEntry = *it;
797 OldDistance = NewDistance;
803 m_Value.pEnumeration->SetIntValue(ptrOldEnumEntry->GetValue(),
Verify);
805 throw ACCESS_EXCEPTION(
"Failed to write enumeration. None of the entries is writable");
809 #pragma BullseyeCoverage off
812 #pragma BullseyeCoverage on
822 return m_Value.pFloat->GetMin();
824 return (
double)
m_Value.pInteger->GetMin();
827 return -std::numeric_limits<double>::max();
829 #pragma BullseyeCoverage off
832 #pragma BullseyeCoverage on
842 return m_Value.pFloat->GetMax();
844 return (
double)
m_Value.pInteger->GetMax();
847 return std::numeric_limits<double>::max();
849 #pragma BullseyeCoverage off
852 #pragma BullseyeCoverage on
862 return m_Value.pFloat->HasInc();
868 #pragma BullseyeCoverage off
871 #pragma BullseyeCoverage on
881 return m_Value.pFloat->GetInc();
883 return (
double)
m_Value.pInteger->GetInc();
887 #pragma BullseyeCoverage off
890 #pragma BullseyeCoverage on
895 #pragma BullseyeCoverage off
901 return (
double)
m_Value.pInteger->GetInc();
907 #pragma BullseyeCoverage off
910 #pragma BullseyeCoverage on
913 #pragma BullseyeCoverage on
921 return m_Value.pFloat->GetRepresentation();
923 return m_Value.pInteger->GetRepresentation();
928 #pragma BullseyeCoverage off
930 throw RUNTIME_EXCEPTION(
"CFloatPolyRef::GetRepresentation(): uninitialized pointer");
931 #pragma BullseyeCoverage on
941 return m_Value.pFloat->GetUnit();
943 return m_Value.pInteger->GetUnit();
948 #pragma BullseyeCoverage off
951 #pragma BullseyeCoverage on
963 return m_Value.pFloat->IsValueCacheValid();
965 return m_Value.pInteger->IsValueCacheValid();
967 return m_Value.pEnumeration->IsValueCacheValid();
971 #pragma BullseyeCoverage off
973 throw RUNTIME_EXCEPTION(
"CFloatPolyRef::IsValueCacheValid(): uninitialized pointer");
974 #pragma BullseyeCoverage on
985 return m_Value.pFloat->GetDisplayNotation();
991 #pragma BullseyeCoverage off
993 throw RUNTIME_EXCEPTION(
"CFloatPolyRef::GetDisplayNotation(): uninitialized pointer");
994 #pragma BullseyeCoverage on
1004 return m_Value.pFloat->GetDisplayPrecision();
1010 #pragma BullseyeCoverage off
1012 throw RUNTIME_EXCEPTION(
"CFloatPolyRef::GetDisplayPrecision(): uninitialized pointer");
1013 #pragma BullseyeCoverage on
1032 return m_Value.pInteger->GetNode()->GetCachingMode();
1034 return m_Value.pEnumeration->GetNode()->GetCachingMode();
1036 return m_Value.pFloat->GetNode()->GetCachingMode();
1040 #pragma BullseyeCoverage off
1042 throw RUNTIME_EXCEPTION(
"CFloatPolyRef::GetCachingMode(): uninitialized pointer");
1043 #pragma BullseyeCoverage on
1074 #pragma BullseyeCoverage off
1079 return ptrNode->GetName();
1083 #pragma BullseyeCoverage on
1098 throw RUNTIME_EXCEPTION(
"CStringPolyRef::operator(IBase*) : pointer is not IString*");
1131 # pragma BullseyeCoverage off
1136 # pragma BullseyeCoverage on
1156 #pragma BullseyeCoverage off
1159 #pragma BullseyeCoverage on
1175 #pragma BullseyeCoverage off
1178 #pragma BullseyeCoverage on
1188 return m_Value.Value.max_size();
1194 #pragma BullseyeCoverage off
1196 throw RUNTIME_EXCEPTION(
"CStringPolyRef::GetMaxLength(): uninitialized pointer");
1197 #pragma BullseyeCoverage on
1208 return m_Value.pString->IsValueCacheValid();
1212 # pragma BullseyeCoverage off
1214 throw RUNTIME_EXCEPTION(
"CStringPolyRef::IsValueCacheValid(): uninitialized pointer");
1216 # pragma BullseyeCoverage on
1271 #endif // ifndef GENAPI_POLYREFERENCE_H
int64_t GetMax() const
see IInteger interface
GENICAM_INTERFACE IInteger
Interface for integer properties.
Lexical analyzer for CIntSwissKnife.
Definition of template CPointer.
Definition of the IFloat interface.
CBooleanPolyRef & operator=(IBase *pValue)
set pointer
CStringPolyRef & operator=(const GENICAM_NAMESPACE::gcstring &Value)
set string value
EDisplayNotation GetDisplayNotation() const
see IFloat
CBooleanPolyRef & operator=(bool Value)
set integer value
bool IsInitialized() const
True if the object is initilaized.
CFloatPolyRef & operator=(INode *pValue)
set pointer
IString * pString
fixed value
IEnumeration * pEnumeration
Integer node
@ fnAutomatic
the notation if either scientific or fixed depending on what is shorter
bool IsValue() const
True if the object references a pointer.
@ PureNumber
Decimal number in an edit control.
IFloat * pFloat
fixed value
CStringPolyRef()
Constructor.
void SetValue(bool Value, bool Verify=true)
see IBoolean interface
bool HasInc()
True if the float has a constant increment.
Definition of interface IBase.
enum GENAPI_NAMESPACE::CFloatPolyRef::_EType EType
possible types of the internally held pointer
@ WriteThrough
Write to cache and register.
enum GENAPI_NAMESPACE::_EDisplayNotation EDisplayNotation
typedef for float notation
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBoolean
Interface for Boolean properties.
A reference to a float which can be either a double variable, or a pointer to an IFloat,...
Definition of interface IEnumeration.
bool IsInitialized() const
True if the object is initialized.
EType m_Type
the type of the internally held pointer
A string class which is a clone of std::string.
CFloatPolyRef()
Constructor.
enum GENAPI_NAMESPACE::CStringPolyRef::_EType EType
possible types of the internally held pointer
int64_t GetMin() const
see IInteger interface
CIntegerOffsetPolyRef(const CIntegerOffsetPolyRef &Copy)
IInteger * pInteger
fixed value
bool IsInitialized() const
True if the object is initilaized.
union GENAPI_NAMESPACE::CBooleanPolyRef::@3 m_Value
the place to store the value or the pointers to the nodes to get the value from
_EType
possible types of the internally held pointer
A reference to an int64 which can bei either an int64 variable, or a pointer to an IInteger,...
bool IsValue() const
True if the object references a pointer.
IInteger * pInteger
fixed value
#define OUT_OF_RANGE_EXCEPTION
Fires an out of range exception, e.g. throw OUT_OF_RANGE_EXCEPTION("%ld too large",...
GENICAM_NAMESPACE::gcstring Value
CIntegerPolyRef & operator=(IBase *pValue)
set pointer
int64_t GetDisplayPrecision() const
see IFloat
bool IsPointer() const
True if the object references a pointer.
IInteger * pInteger
Float node
bool GetValue(bool Verify=false, bool IgnoreCache=false) const
see IBoolean interface
union GENAPI_NAMESPACE::CFloatPolyRef::@4 m_Value
the place to store the value or the pointers to the nodes to get the value from
enum GENAPI_NAMESPACE::_ERepresentation ERepresentation
recommended representation of a node value
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT bool Verify
CBooleanPolyRef()
Constructor.
ECachingMode GetCachingMode() const
CStringPolyRef & operator=(IBase *pValue)
set pointer
GENICAM_NAMESPACE::gcstring GetUnit() const
see IFloat interface
double GetMin() const
see IFloat interface
bool IsPointer() const
True if the object references a pointer.
CIntegerOffsetPolyRef(INode *_pIndex, int64_t _Offset)
double GetMax() const
see IFloat interface
EType m_Type
the type of the internally held pointer
_EType
possible types of the internally held pointer
IFloat * pFloat
Boolean node
union GENAPI_NAMESPACE::CIntegerPolyRef::@2 m_Value
the place to store the value or the pointers to the nodes to get the value from
bool IsAvailable(EAccessMode AccessMode)
Tests if available.
GENICAM_NAMESPACE::gcstring GetName() const
CFloatPolyRef & operator=(IBase *pValue)
set pointer
bool IsValueCacheValid() const
see IValue interface
CIntegerOffsetPolyRef(INode *_pIndex, INode *_pOffset)
_EType
possible types of the internally held pointer
virtual double GetInc()
Get the constant increment if there is any.
Definition of the interface IInteger.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IEnumeration
Interface for enumeration properties.
GENICAM_NAMESPACE::gcstring GetName() const
int64_t GetInc() const
see IInteger interface
double GetInc() const
extension required for swiss knifes
IEnumeration * pEnumeration
Integer node
bool IsInitialized() const
True if the object is initialized.
Definition of interface INodePrivate.
IBoolean * pBoolean
Enumeration node
struct GENAPI_NAMESPACE::CStringPolyRef::@5 m_Value
the place to store the value or the pointers to the nodes to get the value from
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
GENICAM_INTERFACE INode
Interface common to all nodes.
void SetValue(double Value, bool Verify=true)
see IFloat interface
Common GenICam base include file.
INodePrivate * GetPointer() const
returns the pointer referenced
double GetValue(bool Verify=false, bool IgnoreCache=false) const
see IFloat interface
bool IsValueCacheValid() const
see IValue interface
GENICAM_NAMESPACE::gcstring GetValue(bool Verify=false, bool IgnoreCache=false) const
see IString interface
CIntegerPolyRef & operator=(int64_t Value)
set integer value
Encapsulates a GenApi pointer dealing with the dynamic_cast automatically.
Definition of interface IString.
void SetValue(const GENICAM_NAMESPACE::gcstring &Value, bool Verify=true)
see IString interface
ERepresentation GetRepresentation() const
see IFloat interface
GENICAM_INTERFACE INodePrivate
Interface including the methods for node construction common to all nodes.
ECachingMode GetCachingMode() const
CIntegerPolyRef & operator=(INode *pValue)
set pointer
INodePrivate * GetPointer() const
returns the pointer referenced
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IString
Interface for string properties.
bool IsPointer() const
True if the object references a pointer.
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
EType m_Type
the type of the internally held pointer
IEnumeration * pEnumeration
Integer node
GENICAM_NAMESPACE::gcstring GetUnit() const
see IInteger interface
enum GENAPI_NAMESPACE::CIntegerPolyRef::_EType EType
possible types of the internally held pointer
enum GENAPI_NAMESPACE::_ECachingMode ECachingMode
caching mode of a register
EType m_Type
the type of the internally held pointer
Definition of the interface IValue.
bool IsValid() const
true if the pointer is valid
bool IsValue() const
True if the object references a pointer.
#define RUNTIME_EXCEPTION
Fires a runtime exception, e.g. throw RUNTIME_EXCEPTION("buh!")
bool IsPointer() const
True if the object references a pointer.
virtual bool IsValueCacheValid() const =0
Checks if the value comes from cache or is requested from another node.
void SetValue(int64_t Value, bool Verify=true)
see IInteger interface
ECachingMode GetCachingMode() const
int64_t GetMaxLength(bool Verify=false)
see IString interface
CIntegerPolyRef()
Constructor.
_EType
possible types of the internally held pointer
ERepresentation GetRepresentation() const
see IInteger interface
INodePrivate * GetPointer() const
returns the pointer referenced
CFloatPolyRef & operator=(double Value)
set integer value
A reference to a bool which can bei either an bool variable, or a pointer to an IInteger,...
int64_t GetValue(bool Verify=false, bool IgnoreCache=false) const
see IInteger interface
INodePrivate * GetPointer() const
returns the pointer referenced
Definition of IBoolean interface.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBase
Base interface common to all nodes.
IBoolean * pBoolean
Enumeration node
A reference to a gcstring which can be either a gcstring variable, or a pointer to an IString.
enum GENAPI_NAMESPACE::CBooleanPolyRef::_EType EType
possible types of the internally held pointer
node_vector NodeList_t
a list of node references
rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11