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 #pragma warning( push ) 00042 #pragma warning( disable: 4251 ) // enApi::CPortImpl::m_ptrPort' : class 'GenApi::CPointer<T>' needs to have dll-interface 00043 #pragma warning ( disable : 4068 ) // unknown pragma; refers to BullsEyeCoverage 00044 00045 namespace GENAPI_NAMESPACE 00046 { 00047 # pragma warning ( push ) 00048 # pragma warning ( disable : 4251 ) // DLL interface (this is a bug) 00049 # pragma warning ( disable : 4275 ) // DLL interface (this is a bug) 00050 00051 //************************************************************* 00052 // CPortImpl class 00053 //************************************************************* 00054 00058 00059 class CPortImpl : public IPortConstruct, public IPortReplay 00060 { 00061 public: 00063 CPortImpl() 00064 { 00065 } 00066 00068 virtual ~CPortImpl() 00069 { 00070 } 00071 00072 /*---------------------------------------------------------------*/ 00073 // IBase ==> You need to override this method 00074 /*---------------------------------------------------------------*/ 00075 00077 00078 virtual EAccessMode GetAccessMode() const = 0; 00079 00080 /*---------------------------------------------------------------*/ 00081 // IPort ==> You need to override these methods 00082 /*---------------------------------------------------------------*/ 00083 00085 virtual void Read(void *pBuffer, int64_t Address, int64_t Length) = 0; 00086 00088 virtual void Write(const void *pBuffer, int64_t Address, int64_t Length) = 0; 00089 00090 /*---------------------------------------------------------------*/ 00091 // IPortConstruct implementation (without IPort & IBase) 00092 /*---------------------------------------------------------------*/ 00093 00095 virtual void SetPortImpl(IPort* pPort) 00096 { 00097 m_ptrPort = pPort; 00098 assert(m_ptrPort.IsValid()); 00099 } 00100 00102 virtual EYesNo GetSwapEndianess() 00103 { 00104 return No; 00105 } 00106 00107 00108 //--------------------------------------------------------------- 00109 // IPortReplay implementation 00110 //--------------------------------------------------------------- 00111 00113 00118 virtual void Replay( IPortWriteList *pPortRecorder, bool Invalidate = true ) 00119 { 00120 if(pPortRecorder) 00121 pPortRecorder->Replay(this); 00122 00123 if(Invalidate) 00124 InvalidateNode(); 00125 } 00126 00127 // Invalidate the node 00128 void InvalidateNode() 00129 { 00130 if(m_ptrPort.IsValid()) 00131 m_ptrPort->InvalidateNode(); 00132 } 00133 00134 private: 00136 CNodePtr m_ptrPort; 00137 00138 }; 00139 00140 # pragma warning ( pop ) 00141 } 00142 00143 #pragma warning(pop) 00144 #endif // ifndef GENAPI_PORTIMPL_H