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_IREGISTER_H
00032 #define GENAPI_IREGISTER_H
00033
00034 #include <GenApi/GenApiDll.h>
00035 #include <GenApi/Types.h>
00036 #include <GenApi/IValue.h>
00037
00038 #pragma warning ( push )
00039 #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
00040
00041 namespace GENAPI_NAMESPACE
00042 {
00043
00044
00045
00046
00051 interface GENAPI_DECL_ABSTRACT IRegister : virtual public IValue
00052 {
00054
00059 virtual void Set(const uint8_t *pBuffer, int64_t Length, bool Verify = true) = 0;
00060
00062
00068 virtual void Get(uint8_t *pBuffer, int64_t Length, bool Verify = false, bool IgnoreCache = false) = 0;
00069
00071 virtual int64_t GetLength() = 0;
00072
00074 virtual int64_t GetAddress() = 0;
00075 };
00076
00077
00078
00079
00080
00081
00082 #ifndef DOXYGEN_IGNORE
00083
00089 template <class T>
00090 class CRegisterRefT : public CValueRefT<T>
00091 {
00092 typedef CValueRefT<T> ref;
00093
00094 public:
00095
00096
00097
00098
00100 virtual void Set(const uint8_t *pBuffer, int64_t Length, bool Verify = true)
00101 {
00102 if(ref::m_Ptr)
00103 return ref::m_Ptr->Set(pBuffer, Length, Verify);
00104 else
00105 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00106 }
00107
00109 virtual void Get(uint8_t *pBuffer, int64_t Length, bool Verify = false, bool IgnoreCache = false)
00110 {
00111 if(ref::m_Ptr)
00112 return ref::m_Ptr->Get(pBuffer, Length, Verify, IgnoreCache);
00113 else
00114 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00115 }
00116
00118 virtual int64_t GetLength()
00119 {
00120 if(ref::m_Ptr)
00121 return ref::m_Ptr->GetLength();
00122 else
00123 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00124 }
00125
00127 virtual int64_t GetAddress()
00128 {
00129 if(ref::m_Ptr)
00130 return ref::m_Ptr->GetAddress();
00131 else
00132 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00133 }
00134
00135 };
00136
00139 typedef CRegisterRefT<IRegister> CRegisterRef;
00140
00141 #endif
00142
00143 }
00144
00145 #pragma warning ( pop )
00146
00147 #endif // ifndef GENAPI_IREGISTER_H