EnumEntry.cpp
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.cpp
10 
11  Description: Implementation of 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 
29 
30 namespace AVT {
31 namespace VmbAPI {
32 
34 {
35  std::string m_strName;
36  std::string m_strDisplayName;
37  std::string m_strDescription;
38  std::string m_strTooltip;
39  std::string m_strNamespace;
42  PrivateImpl( const char *pStrName,
43  const char *pStrDisplayName,
44  const char *pStrDescription,
45  const char *pStrTooltip,
46  const char *pStrSNFCNamespace,
47  VmbFeatureVisibility_t visibility,
48  VmbInt64_t nValue)
49  : m_nValue( nValue )
50  , m_Visibility ( (VmbFeatureVisibilityType)visibility )
51  {
52  m_strName = pStrName != NULL ? std::string( pStrName ) : "";
53  m_strDisplayName = pStrDisplayName != NULL ? std::string( pStrDisplayName ) : "";
54  m_strDescription = pStrDescription != NULL ? std::string( pStrDescription ) : "";
55  m_strTooltip = pStrTooltip != NULL ? std::string( pStrTooltip ) : "";
56  m_strNamespace = pStrSNFCNamespace != NULL ? std::string( pStrSNFCNamespace ) : "";
57  }
58  VmbErrorType GetName( char * const pStrName, VmbUint32_t &rnSize ) const
59  {
60  VmbErrorType res;
61 
62  if ( NULL == pStrName )
63  {
64  rnSize = static_cast<VmbUint32_t>( m_strName.size() );
65  res = VmbErrorSuccess;
66  }
67  else if ( m_strName.size() <= rnSize )
68  {
69  std::copy( m_strName.begin(), m_strName.end(), pStrName );
70  rnSize = static_cast<VmbUint32_t>( m_strName.size() );
71  res = VmbErrorSuccess;
72  }
73  else
74  {
75  res = VmbErrorMoreData;
76  }
77 
78  return res;
79  }
80 
81  VmbErrorType GetDisplayName( char * const pStrDisplayName, VmbUint32_t &rnSize ) const
82  {
83  VmbErrorType res;
84 
85  if ( NULL == pStrDisplayName )
86  {
87  rnSize = static_cast<VmbUint32_t>( m_strDisplayName.size() );
88  res = VmbErrorSuccess;
89  }
90  else if ( m_strDisplayName.size() <= rnSize )
91  {
92  std::copy( m_strDisplayName.begin(), m_strDisplayName.end(), pStrDisplayName );
93  rnSize = static_cast<VmbUint32_t>( m_strDisplayName.size() );
94  res = VmbErrorSuccess;
95  }
96  else
97  {
98  res = VmbErrorMoreData;
99  }
100 
101  return res;
102  }
103 
104  VmbErrorType GetDescription( char * const pStrDescription, VmbUint32_t &rnSize ) const
105  {
106  VmbErrorType res;
107 
108  if ( NULL == pStrDescription )
109  {
110  rnSize = static_cast<VmbUint32_t>( m_strDescription.size() );
111  res = VmbErrorSuccess;
112  }
113  else if ( m_strDescription.size() <= rnSize )
114  {
115  std::copy( m_strDescription.begin(), m_strDescription.end(), pStrDescription );
116  rnSize = static_cast<VmbUint32_t>( m_strDescription.size() );
117  res = VmbErrorSuccess;
118  }
119  else
120  {
121  res = VmbErrorMoreData;
122  }
123 
124  return res;
125  }
126 
127  VmbErrorType GetTooltip( char * const pStrTooltip, VmbUint32_t &rnSize ) const
128  {
129  VmbErrorType res;
130 
131  if ( NULL == pStrTooltip )
132  {
133  rnSize = static_cast<VmbUint32_t>( m_strTooltip.size() );
134  res = VmbErrorSuccess;
135  }
136  else if ( m_strTooltip.size() <= rnSize )
137  {
138  std::copy( m_strTooltip.begin(), m_strTooltip.end(), pStrTooltip );
139  rnSize = static_cast<VmbUint32_t>( m_strTooltip.size() );
140  res = VmbErrorSuccess;
141  }
142  else
143  {
144  res = VmbErrorMoreData;
145  }
146 
147  return res;
148  }
149 
150  VmbErrorType GetSFNCNamespace( char * const pStrNamespace, VmbUint32_t &rnSize ) const
151  {
152  VmbErrorType res;
153 
154  if ( NULL == pStrNamespace )
155  {
156  rnSize = static_cast<VmbUint32_t>( m_strNamespace.size() );
157  res = VmbErrorSuccess;
158  }
159  else if ( m_strNamespace.size() <= rnSize )
160  {
161  std::copy( m_strNamespace.begin(), m_strNamespace.end(), pStrNamespace );
162  rnSize = static_cast<VmbUint32_t>( m_strNamespace.size() );
163  res = VmbErrorSuccess;
164  }
165  else
166  {
167  res = VmbErrorMoreData;
168  }
169 
170  return res;
171  }
172 
173  VmbErrorType GetValue( VmbInt64_t &rnValue ) const
174  {
175  rnValue = m_nValue;
176 
177  return VmbErrorSuccess;
178  }
179 
181  {
182  rVisibility = m_Visibility;
183 
184  return VmbErrorSuccess;
185  }
186 
187 
188 };
189 EnumEntry::EnumEntry( const char *pStrName,
190  const char *pStrDisplayName,
191  const char *pStrDescription,
192  const char *pStrTooltip,
193  const char *pStrSNFCNamespace,
194  VmbFeatureVisibility_t visibility,
195  VmbInt64_t nValue)
196  : m_pImpl( new PrivateImpl(pStrName, pStrDisplayName, pStrDescription, pStrTooltip, pStrSNFCNamespace, visibility, nValue) )
197 {
198 }
200  : m_pImpl( NULL == other.m_pImpl ? NULL : new PrivateImpl( *other.m_pImpl) )
201 {
202 }
204 {
205  if( this != &other)
206  {
207  PrivateImpl *tmp = NULL == other.m_pImpl ? NULL : new PrivateImpl(*other.m_pImpl);
208  if( NULL != tmp)
209  {
210  delete m_pImpl;
211  m_pImpl = tmp;
212  }
213  }
214  return *this;
215 }
217  : m_pImpl()
218 {
219  // No default ctor
220 }
221 
223 {
224  if( NULL != m_pImpl)
225  {
226  delete m_pImpl;
227  m_pImpl = NULL;
228  }
229 }
230 
231 VmbErrorType EnumEntry::GetName( char * const pStrName, VmbUint32_t &rnSize ) const
232 {
233  if( NULL == m_pImpl )
234  {
235  return VmbErrorInternalFault;
236  }
237  return m_pImpl->GetName( pStrName, rnSize );
238 }
239 
240 VmbErrorType EnumEntry::GetDisplayName( char * const pStrDisplayName, VmbUint32_t &rnSize ) const
241 {
242  if( NULL == m_pImpl )
243  {
244  return VmbErrorInternalFault;
245  }
246  return m_pImpl->GetDisplayName( pStrDisplayName, rnSize);
247 }
248 
249 VmbErrorType EnumEntry::GetDescription( char * const pStrDescription, VmbUint32_t &rnSize ) const
250 {
251  if( NULL == m_pImpl )
252  {
253  return VmbErrorInternalFault;
254  }
255  return m_pImpl->GetDescription( pStrDescription, rnSize);
256 }
257 
258 VmbErrorType EnumEntry::GetTooltip( char * const pStrTooltip, VmbUint32_t &rnSize ) const
259 {
260  if( NULL == m_pImpl )
261  {
262  return VmbErrorInternalFault;
263  }
264  return m_pImpl->GetTooltip( pStrTooltip, rnSize );
265 }
266 
267 VmbErrorType EnumEntry::GetSFNCNamespace( char * const pStrNamespace, VmbUint32_t &rnSize ) const
268 {
269  if( NULL == m_pImpl )
270  {
271  return VmbErrorInternalFault;
272  }
273  return m_pImpl->GetSFNCNamespace( pStrNamespace, rnSize);
274 }
275 
277 {
278  if( NULL == m_pImpl )
279  {
280  return VmbErrorInternalFault;
281  }
282  rnValue = m_pImpl->m_nValue;
283 
284  return VmbErrorSuccess;
285 }
286 
288 {
289  if( NULL == m_pImpl )
290  {
291  return VmbErrorInternalFault;
292  }
293  rVisibility = m_pImpl->m_Visibility;
294 
295  return VmbErrorSuccess;
296 }
297 
298 
299 }} // namespace AVT::VmbAPI
VmbErrorType GetDisplayName(char *const pStrDisplayName, VmbUint32_t &rnSize) const
Definition: EnumEntry.cpp:81
VmbFeatureVisibilityType
Definition: VimbaC.h:181
PrivateImpl(const char *pStrName, const char *pStrDisplayName, const char *pStrDescription, const char *pStrTooltip, const char *pStrSNFCNamespace, VmbFeatureVisibility_t visibility, VmbInt64_t nValue)
Definition: EnumEntry.cpp:42
long long VmbInt64_t
VmbErrorType GetName(std::string &name) const
VmbErrorType GetSFNCNamespace(std::string &sFNCNamespace) const
VmbErrorType GetTooltip(std::string &tooltip) const
VmbErrorType GetDisplayName(std::string &displayName) const
VmbErrorType GetDescription(char *const pStrDescription, VmbUint32_t &rnSize) const
Definition: EnumEntry.cpp:104
VmbErrorType
IMEXPORT EnumEntry & operator=(const EnumEntry &o)
Definition: EnumEntry.cpp:203
PrivateImpl * m_pImpl
Definition: EnumEntry.h:176
IMEXPORT VmbErrorType GetValue(VmbInt64_t &value) const
Definition: EnumEntry.cpp:276
VmbErrorType GetTooltip(char *const pStrTooltip, VmbUint32_t &rnSize) const
Definition: EnumEntry.cpp:127
VmbErrorType GetValue(VmbInt64_t &rnValue) const
Definition: EnumEntry.cpp:173
VmbErrorType GetSFNCNamespace(char *const pStrNamespace, VmbUint32_t &rnSize) const
Definition: EnumEntry.cpp:150
VmbErrorType GetVisibility(VmbFeatureVisibilityType &rVisibility) const
Definition: EnumEntry.cpp:180
unsigned int VmbUint32_t
VmbErrorType GetDescription(std::string &description) const
VmbErrorType GetName(char *const pStrName, VmbUint32_t &rnSize) const
Definition: EnumEntry.cpp:58
virtual IMEXPORT ~EnumEntry()
Definition: EnumEntry.cpp:222
IMEXPORT VmbErrorType GetVisibility(VmbFeatureVisibilityType &value) const
Definition: EnumEntry.cpp:287
VmbFeatureVisibilityType m_Visibility
Definition: EnumEntry.cpp:40
VmbUint32_t VmbFeatureVisibility_t
Definition: VimbaC.h:189


avt_vimba_camera
Author(s): Miquel Massot , Allied Vision Technologies
autogenerated on Wed Jun 5 2019 22:22:40