VimbaSystem.hpp
Go to the documentation of this file.
1 /*=============================================================================
2  Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
3 
4  Redistribution of this file, in original or modified form, without
5  prior written consent of Allied Vision Technologies is prohibited.
6 
7  -----------------------------------------------------------------------------
8 
9  File: VimbaSystem.hpp
10 
11  Description: Inline wrapper functions for class AVT::VmbAPI::VimbaSystem.
12 
13  -----------------------------------------------------------------------------
14 
15  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
16  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
17  NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
19  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 =============================================================================*/
27 
28 #ifndef AVT_VMBAPI_VIMBASYSTEM_HPP
29 #define AVT_VMBAPI_VIMBASYSTEM_HPP
30 
31 //
32 // Inline wrapper functions that allocate memory for STL objects in the application's context
33 // and to pass data across DLL boundaries using arrays
34 //
35 inline VmbErrorType VimbaSystem::GetInterfaces( InterfacePtrVector &rInterfaces )
36 {
37  VmbErrorType res;
38  VmbUint32_t nSize;
39 
40  res = GetInterfaces( NULL, nSize );
41  if ( VmbErrorSuccess == res )
42  {
43  if( 0 != nSize)
44  {
45  try
46  {
47  InterfacePtrVector tmpInterfaces( nSize );
48  res = GetInterfaces( &tmpInterfaces[0], nSize );
49  if( VmbErrorSuccess == res )
50  {
51  rInterfaces.swap( tmpInterfaces);
52  }
53  }
54  catch(...)
55  {
56  return VmbErrorResources;
57  }
58  }
59  else
60  {
61  rInterfaces.clear();
62  }
63  }
64 
65  return res;
66 }
67 
68 inline VmbErrorType VimbaSystem::GetCameras( CameraPtrVector &rCameras )
69 {
70  VmbErrorType res;
71  VmbUint32_t nSize;
72 
73  res = GetCameras( NULL, nSize );
74  if ( VmbErrorSuccess == res)
75  {
76  if( 0 != nSize)
77  {
78  try
79  {
80  CameraPtrVector tmpCameras( nSize );
81  res = GetCameras( &tmpCameras[0], nSize );
82  if( VmbErrorSuccess == res )
83  {
84  if( nSize < tmpCameras.size() )
85  {
86  tmpCameras.resize( nSize);
87  }
88  rCameras.swap( tmpCameras );
89  }
90  }
91  catch(...)
92  {
93  return VmbErrorResources;
94  }
95  }
96  else
97  {
98  rCameras.clear();
99  }
100  }
101 
102  return res;
103 }
104 
105 #endif
std::vector< CameraPtr > CameraPtrVector
Definition: Camera.h:45
VmbErrorType
unsigned int VmbUint32_t
std::vector< InterfacePtr > InterfacePtrVector
Definition: VimbaSystem.h:46


avt_vimba_camera
Author(s): Allied Vision Technologies, Miquel Massot
autogenerated on Fri Jun 2 2023 02:21:10