EnumEntry.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: EnumEntry.hpp
10 
11  Description: Inline wrapper functions for class AVT::VmbAPI::EnumEntry.
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_ENUMENTRY_HPP
29 #define AVT_VMBAPI_ENUMENTRY_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 EnumEntry::GetName( std::string &rStrName ) const
36 {
37  VmbErrorType res;
38  VmbUint32_t nLength;
39 
40  res = GetName( NULL, nLength );
41  if ( VmbErrorSuccess == res )
42  {
43  if ( 0 != nLength )
44  {
45  try
46  {
47  std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
48  res = GetName( &tmpName[0], nLength );
49  if ( VmbErrorSuccess == res )
50  {
51  rStrName = &*tmpName.begin();
52  }
53  }
54  catch(...)
55  {
56  return VmbErrorResources;
57  }
58  }
59  else
60  {
61  rStrName.clear();
62  }
63  }
64 
65  return res;
66 }
67 
68 inline VmbErrorType EnumEntry::GetDisplayName( std::string &rStrDisplayName ) const
69 {
70  VmbErrorType res;
71  VmbUint32_t nLength;
72 
73  res = GetDisplayName( NULL, nLength );
74  if ( VmbErrorSuccess == res )
75  {
76  if ( 0 != nLength )
77  {
78  try
79  {
80  std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
81  res = GetDisplayName( &tmpName[0], nLength );
82  if ( VmbErrorSuccess == res )
83  {
84  rStrDisplayName = &*tmpName.begin();
85  }
86  }
87  catch(...)
88  {
89  return VmbErrorResources;
90  }
91  }
92  else
93  {
94  rStrDisplayName.clear();
95  }
96  }
97 
98  return res;
99 }
100 
101 inline VmbErrorType EnumEntry::GetDescription( std::string &rStrDescription ) const
102 {
103  VmbErrorType res;
104  VmbUint32_t nLength;
105 
106  res = GetDescription( NULL, nLength );
107  if ( VmbErrorSuccess == res )
108  {
109  if ( 0 != nLength )
110  {
111  try
112  {
113  std::vector<std::string::value_type> tmpDescription( nLength + 1, '\0' );
114  res = GetDescription( &tmpDescription[0], nLength );
115  if ( VmbErrorSuccess == res )
116  {
117  rStrDescription = &*tmpDescription.begin();
118  }
119  }
120  catch(...)
121  {
122  return VmbErrorResources;
123  }
124  }
125  else
126  {
127  rStrDescription.clear();
128  }
129  }
130 
131  return res;
132 }
133 
134 inline VmbErrorType EnumEntry::GetTooltip( std::string &rStrTooltip ) const
135 {
136  VmbErrorType res;
137  VmbUint32_t nLength;
138 
139  res = GetTooltip( NULL, nLength );
140  if ( VmbErrorSuccess == res )
141  {
142  if ( 0 != nLength )
143  {
144  try
145  {
146  std::vector<std::string::value_type> tmpTooltip( nLength + 1, '\0' );
147  res = GetTooltip( &tmpTooltip[0], nLength );
148  if ( VmbErrorSuccess == res )
149  {
150  rStrTooltip = &*tmpTooltip.begin();
151  }
152  }
153  catch(...)
154  {
155  return VmbErrorResources;
156  }
157  }
158  else
159  {
160  rStrTooltip.clear();
161  }
162  }
163 
164  return res;
165 }
166 
167 inline VmbErrorType EnumEntry::GetSFNCNamespace( std::string &rStrNamespace ) const
168 {
169  VmbErrorType res;
170  VmbUint32_t nLength;
171 
172  res = GetSFNCNamespace( NULL, nLength );
173  if ( VmbErrorSuccess == res )
174  {
175  if ( 0 != nLength )
176  {
177  try
178  {
179  std::vector<std::string::value_type> tmpNamespace( nLength + 1, '\0' );
180  res = GetSFNCNamespace( &tmpNamespace[0], nLength );
181  if ( VmbErrorSuccess == res )
182  {
183  rStrNamespace =&*tmpNamespace.begin();
184  }
185  }
186  catch(...)
187  {
188  return VmbErrorResources;
189  }
190  }
191  else
192  {
193  rStrNamespace.clear();
194  }
195  }
196 
197  return res;
198 }
199 
200 #endif
VmbErrorType
unsigned int VmbUint32_t


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