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  (This include file is for internal use only.)
13 
14 -------------------------------------------------------------------------------
15 
16  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
17  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
18  NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
20  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
24  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 
27 =============================================================================*/
28 
29 #ifndef AVT_VMBAPI_INTERFACE_HPP
30 #define AVT_VMBAPI_INTERFACE_HPP
31 
32 //
33 // Inline wrapper functions that allocate memory for STL objects in the application's context
34 // and to pass data across DLL boundaries using arrays
35 //
36 
37 // HINT: This information remains static throughout the object's lifetime
38 inline VmbErrorType Interface::GetID( std::string &rStrID ) const
39 {
40  VmbErrorType res;
41  VmbUint32_t nLength;
42 
43  res = GetID( NULL, nLength );
44  if ( VmbErrorSuccess == res)
45  {
46  if( 0 != nLength)
47  {
48  try
49  {
50  std::vector<std::string::value_type> tmpID( nLength + 1, '\0' );
51  res = GetID( &tmpID[0], nLength );
52  if( VmbErrorSuccess == res )
53  {
54  rStrID = &*tmpID.begin();
55  }
56  }
57  catch(...)
58  {
59  return VmbErrorResources;
60  }
61  }
62  else
63  {
64  rStrID.clear();
65  }
66  }
67 
68  return res;
69 }
70 
71 // HINT: This information remains static throughout the object's lifetime
72 inline VmbErrorType Interface::GetName( std::string &rStrName ) const
73 {
74  VmbErrorType res;
75  VmbUint32_t nLength;
76 
77  res = GetName( NULL, nLength );
78  if ( VmbErrorSuccess == res )
79  {
80  if( 0 != nLength )
81  {
82  try
83  {
84  std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
85  res = GetName( &tmpName[0], nLength );
86  if( VmbErrorSuccess == res )
87  {
88  rStrName = &*tmpName.begin();
89  }
90  }
91  catch(...)
92  {
93  return VmbErrorResources;
94  }
95  }
96  else
97  {
98  rStrName.clear();
99  }
100  }
101 
102  return res;
103 }
104 
105 // HINT: This information remains static throughout the object's lifetime
106 inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const
107 {
108  VmbErrorType res;
109  VmbUint32_t nLength;
110 
111  res = GetSerialNumber( NULL, nLength );
112  if ( VmbErrorSuccess == res )
113  {
114  if( 0 != nLength)
115  {
116  try
117  {
118  std::vector<std::string::value_type> tmpSerial( nLength + 1, '\0');
119  res = GetSerialNumber( &tmpSerial[0], nLength );
120  if( VmbErrorSuccess == res )
121  {
122  rStrSerial = &*tmpSerial.begin();
123  }
124  }
125  catch(...)
126  {
127  return VmbErrorResources;
128  }
129  }
130  else
131  {
132  rStrSerial.clear();
133  }
134  }
135 
136  return res;
137 }
138 
139 #endif
VmbErrorType
unsigned int VmbUint32_t


avt_vimba_camera
Author(s): Miquel Massot , Allied Vision Technologies
autogenerated on Mon Jun 10 2019 12:50:39