00001 /*============================================================================= 00002 Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved. 00003 00004 Redistribution of this file, in original or modified form, without 00005 prior written consent of Allied Vision Technologies is prohibited. 00006 00007 ------------------------------------------------------------------------------- 00008 00009 File: UserSharedPointerDefines.h 00010 00011 Description: Definition of macros for using different shared pointer 00012 implementations. 00013 00014 ------------------------------------------------------------------------------- 00015 00016 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED 00017 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE, 00018 NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 00020 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00023 AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 00024 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00025 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 00027 =============================================================================*/ 00028 00029 #ifndef AVT_VMBAPI_USERSHAREDPOINTERDEFINES_H 00030 #define AVT_VMBAPI_USERSHAREDPOINTERDEFINES_H 00031 00032 // 00033 // Vimba C++ API does not necessarily rely on AVT::VmbAPI::shared_ptr. You might want to use your own shared pointer type or the one that ships with your 00034 // implementation of the C++ standard. 00035 // To use a custom shared pointer implementation simply add the define USER_SHARED_POINTER to your project / compiler settings and complete this header file. 00036 // 00037 00038 00039 // Add all your required shared pointer implementation headers here. 00040 // HINT: #include <memory> is used for std::shared_ptr 00041 00042 00043 namespace AVT { 00044 namespace VmbAPI { 00045 00046 // Set the calls for your implementation of the shared pointer functions 00047 // a) Declaration 00048 // b) Reset with argument 00049 // c) Reset without argument 00050 // d) == operator 00051 // e) NULL test 00052 // f) Access to underlying raw pointer 00053 // g) Dynamic cast of shared pointer 00054 00055 // a) This is the define for a declaration. 00056 #define SP_DECL( T ) std::shared_ptr<T> 00057 // b) This is the define for setting an existing shared pointer. 00058 #define SP_SET( sp, rawPtr ) (sp).reset( rawPtr ) 00059 // c) This is the define for resetting without an argument to decrease the ref count. 00060 #define SP_RESET( sp ) (sp).reset() 00061 // d) This is the define for the equal operator. Shared pointers are usually considered equal when the raw pointers point to the same address. 00062 #define SP_ISEQUAL( sp1, sp2 ) ( (sp1) == (sp2) ) 00063 // e) This is the define for the NULL check. 00064 #define SP_ISNULL( sp ) ( NULL == (sp) ) 00065 // f) This is the define for the raw pointer access. This is usually accomplished through the dereferencing operator (->). 00066 #define SP_ACCESS( sp ) (sp).get() 00067 // g) This is the define for the dynamic cast of the pointer. 00068 #define SP_DYN_CAST( sp, T ) std::dynamic_pointer_cast<T>(sp) 00069 00070 // These are all uses of a SP_DECL shared_ptr declaration 00071 class Interface; 00072 typedef SP_DECL( Interface ) InterfacePtr; 00073 00074 class Camera; 00075 typedef SP_DECL( Camera ) CameraPtr; 00076 00077 class Feature; 00078 typedef SP_DECL( Feature ) FeaturePtr; 00079 00080 class FeatureContainer; 00081 typedef SP_DECL( FeatureContainer ) FeatureContainerPtr; 00082 00083 class IFeatureObserver; 00084 typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr; 00085 00086 class Frame; 00087 typedef SP_DECL( Frame ) FramePtr; 00088 00089 class FrameHandler; 00090 typedef SP_DECL( FrameHandler ) FrameHandlerPtr; 00091 00092 class IFrameObserver; 00093 typedef SP_DECL( IFrameObserver ) IFrameObserverPtr; 00094 00095 class AncillaryData; 00096 typedef SP_DECL( AncillaryData ) AncillaryDataPtr; 00097 00098 class ConstAncillaryData; 00099 typedef SP_DECL( const AncillaryData ) ConstAncillaryDataPtr; 00100 00101 class ICameraFactory; 00102 typedef SP_DECL( ICameraFactory ) ICameraFactoryPtr; 00103 00104 class ICameraListObserver; 00105 typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr; 00106 00107 class IInterfaceListObserver; 00108 typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr; 00109 00110 class Mutex; 00111 typedef SP_DECL( Mutex ) MutexPtr; 00112 00113 class BasicLockable; 00114 typedef SP_DECL( BasicLockable ) BasicLockablePtr; 00115 00116 }} // Namespace AVT::VmbAPI 00117 00118 00119 #endif //AVT_VMBAPI_USERSHAREDPOINTERDEFINES_H