AutovectorImpl.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2012 by Teledyne DALSA
3 // Section: Digital Imaging
4 // Project: GenAPI
5 // Author: Eric Bourbonnais
6 //
7 // License: This file is published under the license of the EMVA GenICam Standard Group.
8 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
9 // If for some reason you are missing this file please contact the EMVA or visit the website
10 // (http://www.genicam.org) for a full copy.
11 //
12 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
13 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
14 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
15 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
16 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
17 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
18 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
19 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
21 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
22 // POSSIBILITY OF SUCH DAMAGE.
23 //-----------------------------------------------------------------------------
24 //
30 
32 #ifndef GENAPI_GCAUTIVECTOR_H
33 #define GENAPI_GCAUTIVECTOR_H
34 
35 #include "GenApi/Autovector.h"
36 #ifdef _MSC_VER
38 #endif
40 #include <algorithm>
41 
42 
43 namespace GENAPI_NAMESPACE
44 {
45  template<class T, class Base>
46  class _autovector_impl : public Base
47  {
48  public:
49  _autovector_impl() : Base()
50  {};
51 
52  _autovector_impl(const _autovector_impl &obj) : Base(obj)
53  {};
54 
55  explicit _autovector_impl(const size_t uiSize)
56  {
57  // fill with uiSize default values
58  Base::_pv->reserve(uiSize);
59  for (size_t i = 0; i < uiSize; ++i)
60  {
61  Base::_pv->push_back(T());
62  }
63  };
64 
65  _autovector_impl(T *values, const size_t count)
66  {
67  Base::_pv->reserve(count);
68  for (size_t index = 0; index < count; index++)
69  Base::_pv->push_back(values[index]);
70  std::sort(Base::_pv->begin(), Base::_pv->end());
71 
72  };
73 
74  virtual ~_autovector_impl() {}
75 
76  void ToStrings(GENICAM_NAMESPACE::gcstring_vector &srtList) const
77  {
79  typename std::vector<T>::const_iterator it;
80  for (it = Base::_pv->begin(); it != Base::_pv->end(); it++)
81  {
82  Value2String(*it, valueStr);
83  srtList.push_back(valueStr);
84  }
85  };
86 
87  _autovector_impl & operator= (const Base &obj)
88  {
89  Base::operator=(obj);
90  return *this;
91  }
93  {
94  Base::operator=(obj);
95  return *this;
96  }
97 
98  _autovector_impl & operator= (const GENICAM_NAMESPACE::gcstring_vector &obj)
99  {
100  Base::_pv->clear();
101  for (GENICAM_NAMESPACE::gcstring_vector::const_iterator it = obj.begin();
102  it != obj.end(); it++)
103  {
104  T value;
105  if (String2Value(*it, &value))
106  Base::_pv->push_back(value);
107  }
108  std::sort(Base::_pv->begin(), Base::_pv->end());
109  return *this;
110  }
111 
112  const _autovector_impl duplicate(T min, T max)
113  {
114  _autovector_impl resizeVect;
115  typename std::vector<T>::const_iterator it;
116  for (it = Base::_pv->begin(); it != Base::_pv->end(); it++)
117  {
118  if (*it >= min && *it <= max)
119  resizeVect._pv->push_back(*it);
120  }
121  return resizeVect;
122  };
123 
124  size_t size() const
125  {
126  return Base::size();
127  }
128 
129  };
130 
133 }
134 
135 #endif // GENICAM_GCAUTIVECTOR_H
Definition of value2string and string2value functions.
const _autovector_impl duplicate(T min, T max)
_autovector_impl< double, double_autovector_t > double_autovector_impl
_autovector_impl(const _autovector_impl &obj)
virtual void operator=(bool Value)
Set node value.
Definition: IBoolean.h:64
This file contains the public definition of the autovector classes.
_autovector_impl(const size_t uiSize)
void ToStrings(GENICAM_NAMESPACE::gcstring_vector &srtList) const
_autovector_impl & operator=(const Base &obj)
_autovector_impl< int64_t, int64_autovector_t > int64_autovector_impl
_autovector_impl(T *values, const size_t count)
This file must be included FIRST.
A string class which is a clone of std::string.
Definition: GCString.h:52
void Value2String(T Value, GENICAM_NAMESPACE::gcstring &ValueStr)
Converts an T property to a string.
Definition: Value2String.h:62
Part of the generic device API.
Definition: Autovector.h:48
bool String2Value(const GENICAM_NAMESPACE::gcstring &ValueStr, T *Value)
Converts a string to an T property.
Definition: Value2String.h:72


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:53