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_STRINGT_H
00032 #define GENAPI_STRINGT_H
00033
00034 #include "../IString.h"
00035 #include "GenApi/Compatibility.h"
00036 #include "GenApi/impl/Log.h"
00037 #include "Exception.h"
00038
00039 namespace GENAPI_NAMESPACE
00040 {
00041
00045 template< class Base >
00046 class StringT : public Base
00047 {
00048 public:
00050 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true)
00051 {
00052
00053 std::list<CNodeCallback*> CallbacksToFire;
00054 {
00055 AutoLock l(Base::GetLock());
00056 typename Base::EntryMethodFinalizer E( this, meSetValue );
00057
00058 GCLOGINFOPUSH( Base::m_pValueLog, "SetValue( '%s' )...", Value.c_str() );
00059
00060 if( Verify && !IsWritable( this ) )
00061 throw ACCESS_EXCEPTION_NODE("Node is not writable");
00062
00063 {
00064 typename Base::PostSetValueFinalizer PostSetValueCaller(this, CallbacksToFire);
00065
00066 Base::PreSetValue();
00067
00068 Base::InternalSetValue(Value, Verify);
00069
00070 if( Verify )
00071 Base::InternalCheckError();
00072
00073
00074
00075 }
00076
00077 GCLOGINFOPOP( Base::m_pValueLog, "...SetValue" );
00078
00079
00080 std::list<CNodeCallback*>::iterator ptrCallback;
00081 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00082 {
00083 (*ptrCallback)->operator ()(cbPostInsideLock);
00084 }
00085 }
00086
00087
00088 std::list<CNodeCallback*>::iterator ptrCallback;
00089 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00090 {
00091 (*ptrCallback)->operator ()(cbPostOutsideLock);
00092 }
00093
00094 }
00095
00097 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value)
00098 {
00099 SetValue(Value);
00100 return *this;
00101 }
00102
00104 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false)
00105 {
00106 AutoLock l(Base::GetLock());
00107
00108 GCLOGINFOPUSH( Base::m_pValueLog, "GetValue...");
00109
00110
00111 if( !IsReadable( this ) )
00112 throw ACCESS_EXCEPTION_NODE("Node is not readable");
00113
00114 GENICAM_NAMESPACE::gcstring ValueStr( Base::InternalGetValue(Verify, IgnoreCache) );
00115
00116 if( Verify )
00117 Base::InternalCheckError();
00118
00119 GCLOGINFOPOP( Base::m_pValueLog, "...GetValue = %s", ValueStr.c_str() );
00120
00121 return ValueStr;
00122
00123 }
00124
00126 virtual GENICAM_NAMESPACE::gcstring operator()()
00127 {
00128 return GetValue();
00129 }
00130
00132 virtual GENICAM_NAMESPACE::gcstring operator*()
00133 {
00134 return GetValue();
00135 }
00136
00138 virtual int64_t GetMaxLength()
00139 {
00140 AutoLock l(Base::GetLock());
00141
00142 GCLOGINFOPUSH( Base::m_pRangeLog, "GetMaxLength...");
00143
00144 int64_t MaxLength = IsWritable( this ) ?
00145 Base::InternalGetMaxLength()
00146 :
00147 Base::InternalGetValue().size();
00148
00149 GCLOGINFOPOP( Base::m_pRangeLog, "...GetMaxLength = %" FMT_I64 "d", MaxLength );
00150
00151 return MaxLength;
00152 }
00153
00154 };
00155
00156 }
00157
00158 #endif // GENAPI_STRINGT_H