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_VALUET_H
00032 #define GENAPI_VALUET_H
00033
00034 #include "GenApi/NodeCallback.h"
00035 #include "../IValue.h"
00036 #include "Base/GCException.h"
00037 #include "GenApi/impl/Log.h"
00038 #include "../Synch.h"
00039
00040
00041 namespace GENAPI_NAMESPACE
00042 {
00043
00047 template< class Base>
00048 class ValueT
00049 : public Base
00050 {
00051 public:
00052
00054 virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false)
00055 {
00056 AutoLock l(Base::GetLock());
00057 typename Base::EntryMethodFinalizer E( this, meToString, IgnoreCache );
00058
00059 GCLOGINFOPUSH( Base::m_pValueLog, "ToString...");
00060
00061
00062 if( !IsReadable( this ) )
00063 throw ACCESS_EXCEPTION_NODE("Node is not readable");
00064
00065 GENICAM_NAMESPACE::gcstring ValueStr = Base::InternalToString(Verify, IgnoreCache);
00066
00067 if( Verify )
00068 Base::InternalCheckError();
00069
00070 GCLOGINFOPOP( Base::m_pValueLog, "...ToString = %s", ValueStr.c_str() );
00071
00072 return ValueStr;
00073 }
00074
00076 virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true)
00077 {
00078
00079 std::list<CNodeCallback*> CallbacksToFire;
00080 {
00081 AutoLock l(Base::GetLock());
00082 typename Base::EntryMethodFinalizer E( this, meFromString );
00083
00084 if( Verify && !IsWritable( this ) )
00085 throw ACCESS_EXCEPTION_NODE("Node is not writable");
00086
00087 GCLOGINFO( Base::m_pValueLog, "FromString = '%s' ", ValueStr.c_str() );
00088
00089 {
00090 typename Base::PostSetValueFinalizer PostSetValueCaller(this, CallbacksToFire);
00091
00092 Base::PreSetValue();
00093
00094 Base::InternalFromString(ValueStr, Verify);
00095
00096 if( Verify )
00097 Base::InternalCheckError();
00098 }
00099
00100
00101 std::list<CNodeCallback*>::iterator ptrCallback;
00102 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00103 {
00104 (*ptrCallback)->operator ()(cbPostInsideLock);
00105 }
00106 }
00107
00108
00109 std::list<CNodeCallback*>::iterator ptrCallback;
00110 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00111 {
00112 (*ptrCallback)->operator ()(cbPostOutsideLock);
00113 }
00114
00115 }
00116
00118 virtual bool IsValueCacheValid() const
00119 {
00120 return Base::InternalIsValueCacheValid();
00121 }
00122
00123 };
00124
00125
00126 }
00127
00128 #endif // GENAPI_VALUET_H