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 #ifdef _MSC_VER
00039 # pragma warning ( push )
00040 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
00041 #endif
00042
00043 namespace GENAPI_NAMESPACE
00044 {
00045
00046
00047
00048
00053 interface GENAPI_DECL_ABSTRACT IRegister : virtual public IValue
00054 {
00056
00061 virtual void Set(const uint8_t *pBuffer, int64_t Length, bool Verify = true) = 0;
00062
00064
00070 virtual void Get(uint8_t *pBuffer, int64_t Length, bool Verify = false, bool IgnoreCache = false) = 0;
00071
00073 virtual int64_t GetLength() = 0;
00074
00076 virtual int64_t GetAddress() = 0;
00077 };
00078
00079
00080
00081
00082
00083
00084 #ifndef DOXYGEN_IGNORE
00085
00091 template <class T>
00092 class CRegisterRefT : public CValueRefT<T>
00093 {
00094 typedef CValueRefT<T> ref;
00095
00096 public:
00097
00098
00099
00100
00102 virtual void Set(const uint8_t *pBuffer, int64_t Length, bool Verify = true)
00103 {
00104 if(ref::m_Ptr)
00105 return ref::m_Ptr->Set(pBuffer, Length, Verify);
00106 else
00107 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00108 }
00109
00111 virtual void Get(uint8_t *pBuffer, int64_t Length, bool Verify = false, bool IgnoreCache = false)
00112 {
00113 if(ref::m_Ptr)
00114 return ref::m_Ptr->Get(pBuffer, Length, Verify, IgnoreCache);
00115 else
00116 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00117 }
00118
00120 virtual int64_t GetLength()
00121 {
00122 if(ref::m_Ptr)
00123 return ref::m_Ptr->GetLength();
00124 else
00125 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00126 }
00127
00129 virtual int64_t GetAddress()
00130 {
00131 if(ref::m_Ptr)
00132 return ref::m_Ptr->GetAddress();
00133 else
00134 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00135 }
00136
00137 };
00138
00141 typedef CRegisterRefT<IRegister> CRegisterRef;
00142
00143 #endif
00144
00145 }
00146
00147 #ifdef _MSC_VER
00148 # pragma warning ( pop )
00149 #endif
00150
00151 #endif // ifndef GENAPI_IREGISTER_H