Interface.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: Interface.hpp
10 
11  Description: Inline wrapper functions for class AVT::VmbAPI::Interface.
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_INTERFACE_HPP
29 #define AVT_VMBAPI_INTERFACE_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 
36 // HINT: This information remains static throughout the object's lifetime
37 inline VmbErrorType Interface::GetID( std::string &rStrID ) const
38 {
39  VmbErrorType res;
40  VmbUint32_t nLength;
41 
42  res = GetID( NULL, nLength );
43  if ( VmbErrorSuccess == res)
44  {
45  if( 0 != nLength)
46  {
47  try
48  {
49  std::vector<std::string::value_type> tmpID( nLength + 1, '\0' );
50  res = GetID( &tmpID[0], nLength );
51  if( VmbErrorSuccess == res )
52  {
53  rStrID = &*tmpID.begin();
54  }
55  }
56  catch(...)
57  {
58  return VmbErrorResources;
59  }
60  }
61  else
62  {
63  rStrID.clear();
64  }
65  }
66 
67  return res;
68 }
69 
70 // HINT: This information remains static throughout the object's lifetime
71 inline VmbErrorType Interface::GetName( std::string &rStrName ) const
72 {
73  VmbErrorType res;
74  VmbUint32_t nLength;
75 
76  res = GetName( NULL, nLength );
77  if ( VmbErrorSuccess == res )
78  {
79  if( 0 != nLength )
80  {
81  try
82  {
83  std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
84  res = GetName( &tmpName[0], nLength );
85  if( VmbErrorSuccess == res )
86  {
87  rStrName = &*tmpName.begin();
88  }
89  }
90  catch(...)
91  {
92  return VmbErrorResources;
93  }
94  }
95  else
96  {
97  rStrName.clear();
98  }
99  }
100 
101  return res;
102 }
103 
104 // HINT: This information remains static throughout the object's lifetime
105 inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const
106 {
107  VmbErrorType res;
108  VmbUint32_t nLength;
109 
110  res = GetSerialNumber( NULL, nLength );
111  if ( VmbErrorSuccess == res )
112  {
113  if( 0 != nLength)
114  {
115  try
116  {
117  std::vector<std::string::value_type> tmpSerial( nLength + 1, '\0');
118  res = GetSerialNumber( &tmpSerial[0], nLength );
119  if( VmbErrorSuccess == res )
120  {
121  rStrSerial = &*tmpSerial.begin();
122  }
123  }
124  catch(...)
125  {
126  return VmbErrorResources;
127  }
128  }
129  else
130  {
131  rStrSerial.clear();
132  }
133  }
134 
135  return res;
136 }
137 
138 #endif
VmbErrorType
unsigned int VmbUint32_t


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