Feature.h
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: Feature.h
10 
11  Description: Definition of base class AVT::VmbAPI::Feature.
12  This class wraps every call to BaseFeature resp. its concrete
13  subclass. That way polymorphism is hidden away from the user.
14 
15 
16 -------------------------------------------------------------------------------
17 
18  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
19  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
20  NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
22  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
25  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
26  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 =============================================================================*/
30 
31 #ifndef AVT_VMBAPI_FEATURE_H
32 #define AVT_VMBAPI_FEATURE_H
33 
34 #include <vector>
35 #include <map>
36 
37 #include <VimbaC/Include/VimbaC.h>
42 
43 namespace AVT {
44 namespace VmbAPI {
45 
47 
48 typedef std::vector<FeaturePtr> FeaturePtrVector;
49 typedef std::map<std::string, FeaturePtr> FeaturePtrMap;
50 
51 class Feature
52 {
53  public:
54  Feature( const VmbFeatureInfo_t *pFeatureInfo, FeatureContainer *pFeatureContainer );
55  virtual ~Feature();
56 
57  //
58  // Method: GetValue()
59  //
60  // Purpose: Queries the value of a feature of type VmbInt64
61  //
62  // Parameters:
63  //
64  // [out] VmbInt64_t& value The feature's value
65  //
66  IMEXPORT VmbErrorType GetValue( VmbInt64_t &value ) const;
67 
68  //
69  // Method: GetValue()
70  //
71  // Purpose: Queries the value of a feature of type double
72  //
73  // Parameters:
74  //
75  // [out] double& value The feature's value
76  //
77  IMEXPORT VmbErrorType GetValue( double &value ) const;
78 
79  //
80  // Method: GetValue()
81  //
82  // Purpose: Queries the value of a feature of type string
83  //
84  // Parameters:
85  //
86  // [out] std::string& value The feature's value
87  //
88  // Details: When an empty string is returned, its size
89  // indicates the maximum length
90  VmbErrorType GetValue( std::string &value ) const;
91 
92  //
93  // Method: GetValue()
94  //
95  // Purpose: Queries the value of a feature of type bool
96  //
97  // Parameters:
98  //
99  // [out] bool& value The feature's value
100  //
101  IMEXPORT VmbErrorType GetValue( bool &value ) const;
102 
103  //
104  // Method: GetValue()
105  //
106  // Purpose: Queries the value of a feature of type UcharVector
107  //
108  // Parameters:
109  //
110  // [out] UcharVector& value The feature's value
111  //
112  VmbErrorType GetValue( UcharVector &value ) const;
113 
114  //
115  // Method: GetValue()
116  //
117  // Purpose: Queries the value of a feature of type const UcharVector
118  //
119  // Parameters:
120  //
121  // [out] UcharVector& value The feature's value
122  // [out] VmbUint32_t& sizeFilled The number of actually received values
123  //
124  VmbErrorType GetValue( UcharVector &value, VmbUint32_t &sizeFilled ) const;
125 
126  //
127  // Method: GetValues()
128  //
129  // Purpose: Queries the values of a feature of type Int64Vector
130  //
131  // Parameters:
132  //
133  // [out] Int64Vector& values The feature's values
134  //
136 
137  //
138  // Method: GetValues()
139  //
140  // Purpose: Queries the values of a feature of type StringVector
141  //
142  // Parameters:
143  //
144  // [out] StringVector& values The feature's values
145  //
147 
148  //
149  // Method: GetEntry()
150  //
151  // Purpose: Queries a single enum entry of a feature of type Enumeration
152  //
153  // Parameters:
154  //
155  // [out] EnumEntry& entry An enum feature's enum entry
156  // [in ] const char* pEntryName The name of the enum entry
157  //
158  IMEXPORT VmbErrorType GetEntry( EnumEntry &entry, const char *pEntryName ) const;
159 
160  //
161  // Method: GetEntries()
162  //
163  // Purpose: Queries all enum entries of a feature of type Enumeration
164  //
165  // Parameters:
166  //
167  // [out] EnumEntryVector& entries An enum feature's enum entries
168  //
170 
171  //
172  // Method: GetRange()
173  //
174  // Purpose: Queries the range of a feature of type double
175  //
176  // Parameters:
177  //
178  // [out] double& minimum The feature's min value
179  // [out] double& maximum The feature's max value
180  //
181  IMEXPORT VmbErrorType GetRange( double &minimum, double &maximum ) const;
182 
183  //
184  // Method: GetRange()
185  //
186  // Purpose: Queries the range of a feature of type VmbInt64
187  //
188  // Parameters:
189  //
190  // [out] VmbInt64_t& minimum The feature's min value
191  // [out] VmbInt64_t& maximum The feature's max value
192  //
193  IMEXPORT VmbErrorType GetRange( VmbInt64_t &minimum, VmbInt64_t &maximum ) const;
194 
195  //
196  // Method: SetValue()
197  //
198  // Purpose: Sets the value of a feature of type VmbInt32
199  //
200  // Parameters:
201  //
202  // [in ] const VmbInt32_t& value The feature's value
203  //
204  IMEXPORT VmbErrorType SetValue( const VmbInt32_t &value );
205 
206  //
207  // Method: SetValue()
208  //
209  // Purpose: Sets the value of a feature of type VmbInt64
210  //
211  // Parameters:
212  //
213  // [in ] const VmbInt64_t& value The feature's value
214  //
215  IMEXPORT VmbErrorType SetValue( const VmbInt64_t &value );
216 
217  //
218  // Method: SetValue()
219  //
220  // Purpose: Sets the value of a feature of type double
221  //
222  // Parameters:
223  //
224  // [in ] const double& value The feature's value
225  //
226  IMEXPORT VmbErrorType SetValue( const double &value );
227 
228  //
229  // Method: SetValue()
230  //
231  // Purpose: Sets the value of a feature of type char*
232  //
233  // Parameters:
234  //
235  // [in ] const char* pValue The feature's value
236  //
237  IMEXPORT VmbErrorType SetValue( const char *pValue );
238 
239  //
240  // Method: SetValue()
241  //
242  // Purpose: Sets the value of a feature of type bool
243  //
244  // Parameters:
245  //
246  // [in ] bool value The feature's value
247  //
248  IMEXPORT VmbErrorType SetValue( bool value );
249 
250  //
251  // Method: SetValue()
252  //
253  // Purpose: Sets the value of a feature of type UcharVector
254  //
255  // Parameters:
256  //
257  // [in ] const UcharVector& value The feature's value
258  //
259  VmbErrorType SetValue( const UcharVector &value );
260 
261  // Method: HasIncrement()
262  //
263  // Purpose: Gets the support state increment of a feature
264  //
265  // Parameters:
266  //
267  // [out] VmbBool_t& incrementsupported The feature's increment support state
268  //
269  IMEXPORT VmbErrorType HasIncrement( VmbBool_t &incrementSupported ) const;
270 
271 
272  //
273  // Method: GetIncrement()
274  //
275  // Purpose: Gets the increment of a feature of type VmbInt64
276  //
277  // Parameters:
278  //
279  // [out] VmbInt64_t& increment The feature's increment
280  //
281  IMEXPORT VmbErrorType GetIncrement( VmbInt64_t &increment ) const;
282 
283  // Method: GetIncrement()
284  //
285  // Purpose: Gets the increment of a feature of type double
286  //
287  // Parameters:
288  //
289  // [out] double& increment The feature's increment
290  //
291  IMEXPORT VmbErrorType GetIncrement( double &increment ) const;
292 
293  //
294  // Method: IsValueAvailable()
295  //
296  // Purpose: Indicates whether an existing enumeration value is currently available.
297  // An enumeration value might not be selectable due to the camera's
298  // current configuration.
299  //
300  // Parameters:
301  //
302  // [in ] const char* pValue The enumeration value as string
303  // [out] bool& available True when the given value is available
304  //
305  // Returns:
306  //
307  // - VmbErrorSuccess: If no error
308  // - VmbErrorInvalidValue: If the given value is not a valid enumeration value for this enum
309  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
310  // - VmbErrorInvalidAccess: Operation is invalid with the current access mode
311  // - VmbErrorWrongType: The feature is not an enumeration
312  //
313  IMEXPORT VmbErrorType IsValueAvailable( const char *pValue, bool &available ) const;
314 
315  //
316  // Method: IsValueAvailable()
317  //
318  // Purpose: Indicates whether an existing enumeration value is currently available.
319  // An enumeration value might not be selectable due to the camera's
320  // current configuration.
321  //
322  // Parameters:
323  //
324  // [in ] const VmbInt64_t value The enumeration value as int
325  // [out] bool& available True when the given value is available
326  //
327  // Returns:
328  //
329  // - VmbErrorSuccess: If no error
330  // - VmbErrorInvalidValue: If the given value is not a valid enumeration value for this enum
331  // - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
332  // - VmbErrorInvalidAccess: Operation is invalid with the current access mode
333  // - VmbErrorWrongType: The feature is not an enumeration
334  //
335  IMEXPORT VmbErrorType IsValueAvailable( const VmbInt64_t value, bool &available ) const;
336 
337  //
338  // Method: RunCommand()
339  //
340  // Purpose: Executes a feature of type Command
341  //
342  IMEXPORT VmbErrorType RunCommand();
343 
344  //
345  // Method: IsCommandDone()
346  //
347  // Purpose: Indicates whether the execution of a feature of type Command has finished
348  //
349  // Parameters:
350  //
351  // [out] bool& isDone True when execution has finished
352  //
353  IMEXPORT VmbErrorType IsCommandDone( bool &isDone ) const;
354 
355  //
356  // Method: GetName()
357  //
358  // Purpose: Queries a feature's name
359  //
360  // Parameters:
361  //
362  // [out] std::string& name The feature's name
363  //
364  VmbErrorType GetName( std::string &name ) const;
365 
366  //
367  // Method: GetDisplayName()
368  //
369  // Purpose: Queries a feature's display name
370  //
371  // Parameters:
372  //
373  // [out] std::string& displayName The feature's display name
374  //
375  VmbErrorType GetDisplayName( std::string &displayName ) const;
376 
377  //
378  // Method: GetDataType()
379  //
380  // Purpose: Queries a feature's type
381  //
382  // Parameters:
383  //
384  // [out] VmbFeatureDataType& dataType The feature's type
385  //
386  IMEXPORT VmbErrorType GetDataType( VmbFeatureDataType &dataType ) const;
387 
388  //
389  // Method: GetFlags()
390  //
391  // Purpose: Queries a feature's access status
392  //
393  // Parameters:
394  //
395  // [out] VmbFeatureFlagsType& flags The feature's access status
396  //
397  IMEXPORT VmbErrorType GetFlags( VmbFeatureFlagsType &flags ) const;
398 
399  //
400  // Method: GetCategory()
401  //
402  // Purpose: Queries a feature's category in the feature tress
403  //
404  // Parameters:
405  //
406  // [out] std::string& category The feature's position in the feature tree
407  //
408  VmbErrorType GetCategory( std::string &category ) const;
409 
410  //
411  // Method: GetPollingTime()
412  //
413  // Purpose: Queries a feature's polling time
414  //
415  // Parameters:
416  //
417  // [out] VmbUint32_t& pollingTime The interval to poll the feature
418  //
419  IMEXPORT VmbErrorType GetPollingTime( VmbUint32_t &pollingTime ) const;
420 
421  //
422  // Method: GetUnit()
423  //
424  // Purpose: Queries a feature's unit
425  //
426  // Parameters:
427  //
428  // [out] std::string& unit The feature's unit
429  //
430  VmbErrorType GetUnit( std::string &unit ) const;
431 
432  //
433  // Method: GetRepresentation()
434  //
435  // Purpose: Queries a feature's representation
436  //
437  // Parameters:
438  //
439  // [out] std::string& representation The feature's representation
440  //
441  VmbErrorType GetRepresentation( std::string &representation ) const;
442 
443  //
444  // Method: GetVisibility()
445  //
446  // Purpose: Queries a feature's visibility
447  //
448  // Parameters:
449  //
450  // [out] VmbFeatureVisibilityType& visibility The feature's visibility
451  //
452  IMEXPORT VmbErrorType GetVisibility( VmbFeatureVisibilityType &visibility ) const;
453 
454  //
455  // Method: GetToolTip()
456  //
457  // Purpose: Queries a feature's tool tip to display in the GUI
458  //
459  // Parameters:
460  //
461  // [out] std::string& toolTip The feature's tool tip
462  //
463  VmbErrorType GetToolTip( std::string &toolTip ) const;
464 
465  //
466  // Method: GetDescription()
467  //
468  // Purpose: Queries a feature's description
469  //
470  // Parameters:
471  //
472  // [out] std::string& description The feature'sdescription
473  //
474  VmbErrorType GetDescription( std::string &description ) const;
475 
476  //
477  // Method: GetSFNCNamespace()
478  //
479  // Purpose: Queries a feature's Standard Feature Naming Convention namespace
480  //
481  // Parameters:
482  //
483  // [out] std::string& sFNCNamespace The feature's SFNC namespace
484  //
485  VmbErrorType GetSFNCNamespace( std::string &sFNCNamespace ) const;
486 
487  //
488  // Method: GetAffectedFeatures()
489  //
490  // Purpose: Queries the feature's that are dependent from the current feature
491  //
492  // Parameters:
493  //
494  // [out] FeaturePtrVector& affectedFeatures The features that get invalidated through the current feature
495  //
496  VmbErrorType GetAffectedFeatures( FeaturePtrVector &affectedFeatures );
497 
498  //
499  // Method: GetSelectedFeatures()
500  //
501  // Purpose: Gets the features that get selected by the current feature
502  //
503  // Parameters:
504  //
505  // [out] FeaturePtrVector& selectedFeatures The selected features
506  //
507  VmbErrorType GetSelectedFeatures( FeaturePtrVector &selectedFeatures );
508 
509  //
510  // Method: IsReadable()
511  //
512  // Purpose: Queries the read access status of a feature
513  //
514  // Parameters:
515  //
516  // [out] bool& isReadable True when feature can be read
517  //
518  IMEXPORT VmbErrorType IsReadable( bool &isReadable );
519 
520  //
521  // Method: IsWritable()
522  //
523  // Purpose: Queries the write access status of a feature
524  //
525  // Parameters:
526  //
527  // [out] bool& isWritable True when feature can be written
528  //
529  IMEXPORT VmbErrorType IsWritable( bool &isWritable );
530 
531  //
532  // Method: IsStreamable()
533  //
534  // Purpose: Queries whether a feature's value can be transferred as a stream
535  //
536  // Parameters:
537  //
538  // [out] bool& isStreamable True when streamable
539  //
540  IMEXPORT VmbErrorType IsStreamable( bool &isStreamable ) const;
541 
542  //
543  // Method: RegisterObserver()
544  //
545  // Purpose: Registers an observer that notifies the application whenever a features value changes
546  //
547  // Parameters:
548  //
549  // [out] const IFeatureObserverPtr& pObserver The observer to be registered
550  //
551  // Returns:
552  //
553  // - VmbErrorSuccess: If no error
554  // - VmbErrorBadParameter: "pObserver" is NULL.
555  //
556  IMEXPORT VmbErrorType RegisterObserver( const IFeatureObserverPtr &pObserver );
557 
558  //
559  // Method: UnregisterObserver()
560  //
561  // Purpose: Unregisters an observer
562  //
563  // Parameters:
564  //
565  // [out] const IFeatureObserverPtr& pObserver The observer to be unregistered
566  //
567  // Returns:
568  //
569  // - VmbErrorSuccess: If no error
570  // - VmbErrorBadParameter: "pObserver" is NULL.
571  //
572  IMEXPORT VmbErrorType UnregisterObserver( const IFeatureObserverPtr &pObserver );
573 
574  void ResetFeatureContainer();
575 
576  private:
578 
579  // No default ctor
580  Feature();
581  // No copy ctor
582  Feature( const Feature& );
583  // No assignment operator
584  Feature& operator=( const Feature& );
585 
586  // Array functions to pass data across DLL boundaries
587  IMEXPORT VmbErrorType GetValue( char * const pValue, VmbUint32_t &length ) const;
588  IMEXPORT VmbErrorType GetValue( VmbUchar_t *pValue, VmbUint32_t &size, VmbUint32_t &sizeFilled ) const;
589  IMEXPORT VmbErrorType GetValues( const char **pValues, VmbUint32_t &size );
590  IMEXPORT VmbErrorType GetValues( VmbInt64_t *pValues, VmbUint32_t &Size );
591 
592  IMEXPORT VmbErrorType GetEntries( EnumEntry *pEnumEntries, VmbUint32_t &size );
593 
594  IMEXPORT VmbErrorType SetValue( const VmbUchar_t *pValue, VmbUint32_t size );
595 
596  IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const;
597  IMEXPORT VmbErrorType GetDisplayName( char * const pDisplayName, VmbUint32_t &length ) const;
598  IMEXPORT VmbErrorType GetCategory( char * const pCategory, VmbUint32_t &length ) const;
599  IMEXPORT VmbErrorType GetUnit( char * const pUnit, VmbUint32_t &length ) const;
600  IMEXPORT VmbErrorType GetRepresentation( char * const pRepresentation, VmbUint32_t &length ) const;
601  IMEXPORT VmbErrorType GetToolTip( char * const pToolTip, VmbUint32_t &length ) const;
602  IMEXPORT VmbErrorType GetDescription( char * const pDescription, VmbUint32_t &length ) const;
603  IMEXPORT VmbErrorType GetSFNCNamespace( char * const pSFNCNamespace, VmbUint32_t &length ) const;
604  IMEXPORT VmbErrorType GetAffectedFeatures( FeaturePtr *pAffectedFeatures, VmbUint32_t &nSize );
605  IMEXPORT VmbErrorType GetSelectedFeatures( FeaturePtr *pSelectedFeatures, VmbUint32_t &nSize );
606 };
607 
609 
610 }} // namespace AVT::VmbAPI
611 
612 #endif
IMEXPORT VmbErrorType IsWritable(bool &isWritable)
Definition: Feature.cpp:318
BaseFeature * m_pImpl
Definition: Feature.h:577
IMEXPORT VmbErrorType GetEntry(EnumEntry &entry, const char *pEntryName) const
Definition: Feature.cpp:178
VmbErrorType GetAffectedFeatures(FeaturePtrVector &affectedFeatures)
char VmbBool_t
IMEXPORT VmbErrorType IsStreamable(bool &isStreamable) const
Definition: Feature.cpp:323
IMEXPORT VmbErrorType GetVisibility(VmbFeatureVisibilityType &visibility) const
Definition: Feature.cpp:283
std::vector< EnumEntry > EnumEntryVector
VmbFeatureVisibilityType
Definition: VimbaC.h:181
VmbErrorType GetUnit(std::string &unit) const
long long VmbInt64_t
VmbErrorType GetDescription(std::string &description) const
int VmbInt32_t
IMEXPORT VmbErrorType IsCommandDone(bool &isDone) const
Definition: Feature.cpp:226
IMEXPORT VmbErrorType UnregisterObserver(const IFeatureObserverPtr &pObserver)
Definition: Feature.cpp:95
VmbFeatureDataType
Definition: VimbaC.h:164
VmbErrorType GetRepresentation(std::string &representation) const
VmbErrorType
std::map< std::string, FeaturePtr > FeaturePtrMap
Definition: Feature.h:49
Feature & operator=(const Feature &)
unsigned char VmbUchar_t
IMEXPORT VmbErrorType GetPollingTime(VmbUint32_t &pollingTime) const
Definition: Feature.cpp:268
std::vector< std::string > StringVector
NetPointer< Feature, AVT::VmbAPINET::Feature > FeaturePtr
VmbErrorType GetSelectedFeatures(FeaturePtrVector &selectedFeatures)
IMEXPORT VmbErrorType GetIncrement(VmbInt64_t &increment) const
Definition: Feature.cpp:129
IMEXPORT VmbErrorType RegisterObserver(const IFeatureObserverPtr &pObserver)
Definition: Feature.cpp:90
VmbErrorType GetCategory(std::string &category) const
virtual ~Feature()
Definition: Feature.cpp:80
IMEXPORT VmbErrorType HasIncrement(VmbBool_t &incrementSupported) const
Definition: Feature.cpp:124
IMEXPORT VmbErrorType IsValueAvailable(const char *pValue, bool &available) const
Definition: Feature.cpp:190
IMEXPORT VmbErrorType GetFlags(VmbFeatureFlagsType &flags) const
Definition: Feature.cpp:258
std::vector< VmbUchar_t > UcharVector
IMEXPORT VmbErrorType IsReadable(bool &isReadable)
Definition: Feature.cpp:313
VmbErrorType GetName(std::string &name) const
VmbErrorType GetDisplayName(std::string &displayName) const
unsigned int VmbUint32_t
IMEXPORT VmbErrorType RunCommand()
Definition: Feature.cpp:220
VmbErrorType GetToolTip(std::string &toolTip) const
IMEXPORT VmbErrorType GetValue(VmbInt64_t &value) const
Definition: Feature.cpp:101
VmbErrorType GetSFNCNamespace(std::string &sFNCNamespace) const
VmbFeatureFlagsType
Definition: VimbaC.h:194
void ResetFeatureContainer()
Definition: Feature.cpp:85
IMEXPORT VmbErrorType SetValue(const VmbInt32_t &value)
Definition: Feature.cpp:113
IMEXPORT VmbErrorType GetRange(double &minimum, double &maximum) const
Definition: Feature.cpp:153
std::vector< FeaturePtr > FeaturePtrVector
Definition: Feature.h:46
IMEXPORT VmbErrorType GetDataType(VmbFeatureDataType &dataType) const
Definition: Feature.cpp:253
VmbErrorType GetEntries(EnumEntryVector &entries)
VmbErrorType GetValues(Int64Vector &values)
void increment(int *value)
std::vector< VmbInt64_t > Int64Vector


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