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_REFERENCE_H 00032 #define GENAPI_REFERENCE_H 00033 00034 #include <GenApi/Types.h> 00035 #include <GenApi/GenApiDll.h> 00036 00037 namespace GENAPI_NAMESPACE 00038 { 00039 interface IBase; 00040 00041 //************************************************************* 00042 // IReference interface 00043 //************************************************************* 00044 00049 interface GENAPI_DECL_ABSTRACT IReference 00050 { 00052 virtual void SetReference( GENAPI_NAMESPACE::IBase *pBase ) = 0; 00053 }; 00054 00055 //************************************************************* 00056 // IEnumReference interface 00057 //************************************************************* 00058 00063 interface GENAPI_DECL_ABSTRACT IEnumReference 00064 { 00066 virtual void SetEnumReference( int Index, GENICAM_NAMESPACE::gcstring Name) = 0; 00067 00069 virtual void SetNumEnums( int NumEnums ) = 0; 00070 }; 00071 00072 //************************************************************* 00073 // CReference class 00074 //************************************************************* 00075 00080 template <class T, class I=T> 00081 class CReferenceT : public T, public IReference 00082 { 00083 public: 00084 // Constructor 00085 CReferenceT() : 00086 m_Ptr(NULL) 00087 {} 00088 00089 /*--------------------------------------------------------*/ 00090 // IReference 00091 /*--------------------------------------------------------*/ 00092 00094 virtual void SetReference( IBase *ptr ) 00095 { 00096 m_Ptr = dynamic_cast<I*>( ptr ); 00097 } 00098 00099 protected: 00101 I *m_Ptr; 00102 }; 00103 00104 } 00105 00106 #endif // ifndef GENAPI_REFERENCE_H