Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00031 #ifndef GENAPI_ENUMERATIONT_H
00032 #define GENAPI_ENUMERATIONT_H
00033
00034 #include "GenApi/IEnumeration.h"
00035 #include "GenApi/impl/Internal_Compatibility.h"
00036 #include "GenApi/impl/Log.h"
00037 #include "Exception.h"
00038
00039 namespace GENAPI_NAMESPACE
00040 {
00044 template<class Base>
00045 class EnumerationT : public Base
00046 {
00047 public:
00049 virtual void GetSymbolics(StringList_t & Symbolics)
00050 {
00051 AutoLock l(Base::GetLock());
00052
00053 return Base::InternalGetSymbolics(Symbolics);
00054 }
00055
00057 virtual void GetEntries(NodeList_t & Entries)
00058 {
00059 AutoLock l(Base::GetLock());
00060
00061 return Base::InternalGetEntries(Entries);
00062 }
00063
00065 virtual IEnumeration& operator=(const GENICAM_NAMESPACE::gcstring& ValueStr)
00066 {
00067 static_cast<IValue *>(this)->FromString(ValueStr);
00068 return *this;
00069 }
00070
00072 virtual void SetIntValue(int64_t Value, bool Verify = true)
00073 {
00074
00075 std::list<CNodeCallback*> CallbacksToFire;
00076 {
00077 AutoLock l(Base::GetLock());
00078 typename Base::EntryMethodFinalizer E( this, meSetIntValue );
00079
00080 GCLOGINFOPUSH( Base::m_pValueLog, "SetIntValue( %" FMT_I64 "d )...", Value );
00081
00082 if( Verify && !IsWritable( this ) )
00083 throw ACCESS_EXCEPTION_NODE("Node is not writable.");
00084
00085 {
00086 typename Base::PostSetValueFinalizer PostSetValueCaller(this, CallbacksToFire);
00087
00088 Base::PreSetValue();
00089
00090 Base::InternalSetIntValue(Value, Verify);
00091
00092 if( Verify )
00093 Base::InternalCheckError();
00094
00095 }
00096
00097 GCLOGINFOPOP( Base::m_pValueLog, "...SetIntValue" );
00098
00099
00100 std::list<CNodeCallback*>::iterator ptrCallback;
00101 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00102 {
00103 (*ptrCallback)->operator ()(cbPostInsideLock);
00104 }
00105 }
00106
00107
00108 std::list<CNodeCallback*>::iterator ptrCallback;
00109 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00110 {
00111 (*ptrCallback)->operator ()(cbPostOutsideLock);
00112 }
00113 }
00114
00116 virtual GENICAM_NAMESPACE::gcstring operator*()
00117 {
00118 return static_cast<IValue *>(this)->ToString();
00119 }
00120
00122 virtual int64_t GetIntValue(bool Verify = false, bool IgnoreCache = false)
00123 {
00124 AutoLock l(Base::GetLock());
00125 typename Base::EntryMethodFinalizer E( this, meGetIntValue, IgnoreCache );
00126
00127 GCLOGINFOPUSH( Base::m_pValueLog, "GetIntValue...");
00128
00129
00130 if( !IsReadable( this ) )
00131 throw ACCESS_EXCEPTION_NODE("Node is not readable.");
00132
00133 int64_t IntValue = Base::InternalGetIntValue(Verify, IgnoreCache);
00134
00135 if( Verify )
00136 Base::InternalCheckError();
00137
00138 GCLOGINFOPOP( Base::m_pValueLog, "...GetIntValue = %" FMT_I64 "d", IntValue );
00139
00140 return IntValue;
00141
00142 }
00143
00144
00146 virtual IEnumEntry *GetEntry(const int64_t IntValue)
00147 {
00148 AutoLock l(Base::GetLock());
00149
00150 return Base::InternalGetEntry(IntValue);
00151 }
00152
00154 virtual IEnumEntry *GetCurrentEntry(bool Verify = false, bool IgnoreCache = false)
00155 {
00156 AutoLock l(Base::GetLock());
00157
00158 int64_t Value = GetIntValue(Verify, IgnoreCache);
00159
00160 return GetEntry(Value);
00161 }
00162
00164 virtual IEnumEntry *GetEntryByName(const GENICAM_NAMESPACE::gcstring& Symbolic)
00165 {
00166 AutoLock l(Base::GetLock());
00167
00168 return Base::InternalGetEntryByName(Symbolic);
00169 }
00170
00171
00172 };
00173
00174 }
00175 #endif