00001 //----------------------------------------------------------------------------- 00002 // (c) 2006 by Basler Vision Technologies 00003 // Section: Vision Components 00004 // Project: GenApi 00005 // Author: Fritz Dierks 00006 // $Header$ 00007 // 00008 // License: This file is published under the license of the EMVA GenICam Standard Group. 00009 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'. 00010 // If for some reason you are missing this file please contact the EMVA or visit the website 00011 // (http://www.genicam.org) for a full copy. 00012 // 00013 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS" 00014 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00015 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00016 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP 00017 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00018 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00019 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00020 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00021 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 // POSSIBILITY OF SUCH DAMAGE. 00024 //----------------------------------------------------------------------------- 00031 #ifndef GENAPI_PORTIMPL_H 00032 #define GENAPI_PORTIMPL_H 00033 00034 #include <Base/GCException.h> 00035 #include <GenApi/GenApiDll.h> 00036 #include <GenApi/Types.h> 00037 #include <GenApi/IPortConstruct.h> 00038 #include <GenApi/IPortRecorder.h> 00039 #include <GenApi/Pointer.h> 00040 00041 #ifdef _MSC_VER 00042 # pragma warning( push ) 00043 # pragma warning( disable : 4251 ) // enApi::CPortImpl::m_ptrPort' : class 'GenApi::CPointer<T>' needs to have dll-interface 00044 # pragma warning( disable : 4275 ) // DLL interface (this is a bug) 00045 # pragma warning( disable : 4068 ) // unknown pragma; refers to BullsEyeCoverage 00046 #endif 00047 00048 namespace GENAPI_NAMESPACE 00049 { 00050 //************************************************************* 00051 // CPortImpl class 00052 //************************************************************* 00053 00057 00058 class CPortImpl : public IPortConstruct, public IPortReplay 00059 { 00060 public: 00062 CPortImpl() 00063 { 00064 } 00065 00067 virtual ~CPortImpl() 00068 { 00069 } 00070 00071 /*---------------------------------------------------------------*/ 00072 // IBase ==> You need to override this method 00073 /*---------------------------------------------------------------*/ 00074 00076 00077 virtual EAccessMode GetAccessMode() const = 0; 00078 00079 /*---------------------------------------------------------------*/ 00080 // IPort ==> You need to override these methods 00081 /*---------------------------------------------------------------*/ 00082 00084 virtual void Read(void *pBuffer, int64_t Address, int64_t Length) = 0; 00085 00087 virtual void Write(const void *pBuffer, int64_t Address, int64_t Length) = 0; 00088 00089 /*---------------------------------------------------------------*/ 00090 // IPortConstruct implementation (without IPort & IBase) 00091 /*---------------------------------------------------------------*/ 00092 00094 virtual void SetPortImpl(IPort* pPort) 00095 { 00096 m_ptrPort = pPort; 00097 assert(m_ptrPort.IsValid()); 00098 } 00099 00101 virtual EYesNo GetSwapEndianess() 00102 { 00103 return No; 00104 } 00105 00106 00107 //--------------------------------------------------------------- 00108 // IPortReplay implementation 00109 //--------------------------------------------------------------- 00110 00112 00117 virtual void Replay( IPortWriteList *pPortRecorder, bool Invalidate = true ) 00118 { 00119 if(pPortRecorder) 00120 pPortRecorder->Replay(this); 00121 00122 if(Invalidate) 00123 InvalidateNode(); 00124 } 00125 00126 // Invalidate the node 00127 void InvalidateNode() 00128 { 00129 if(m_ptrPort.IsValid()) 00130 m_ptrPort->InvalidateNode(); 00131 } 00132 00133 private: 00135 CNodePtr m_ptrPort; 00136 00137 }; 00138 } 00139 00140 #ifdef _MSC_VER 00141 # pragma warning(pop) 00142 #endif 00143 #endif // ifndef GENAPI_PORTIMPL_H