All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GCArray.h
Go to the documentation of this file.
1 /****************************************************************************
2  (c) 2014 by Teledyne DALSA
3  Section: Digital Imaging
4  Project: GCBase
5  Author: Eric Bourbonnais
6 
7 
8  License: This file is published under the license of the EMVA GenICam Standard Group.
9  A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
10  If for some reason you are missing this file please contact the EMVA or visit the website
11  (http://www.genicam.org) for a full copy.
12 
13  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
14  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
17  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23  POSSIBILITY OF SUCH DAMAGE.
24 
25 ****************************************************************************/
26 
27 #ifndef GCBASE_GCARRAY_H
28 #define GCBASE_GCARRAY_H
29 
30 #include <Base/GCTypes.h>
31 #include <Base/GCException.h>
33 {
34  template< class T>
35  class gcarray
36  {
37  public:
38  gcarray(size_t size) : m_p(NULL)
39  {
40  if (size)
41  {
42  m_p = new T[size];
43  if (!m_p)
44  {
45  throw BAD_ALLOC_EXCEPTION("Unable to create gcarray");
46  }
47  }
48  };
49  ~gcarray(){ if(m_p) delete [] m_p;};
50  T* get() const {return m_p;} ;
51  T* operator *() {return m_p;} ;
52  T operator[](size_t idx) {return m_p[idx];} ;
53  private:
54  gcarray(const gcarray&); // copy constructor is not implemented
55  gcarray& operator =(const gcarray&); // assignment operator is not implemented
56  private:
57  T* m_p;
58  };
59 
60 }
61 
62 #endif // GCBASE_GCARRAY_H
GENICAM_NAMESPACE::gcarray
Definition: GCArray.h:59
BAD_ALLOC_EXCEPTION
#define BAD_ALLOC_EXCEPTION
Fires a bad alloc exception, e.g. throw BAD_ALLOC_EXCEPTION();.
Definition: GCException.h:235
GENICAM_NAMESPACE::gcarray::~gcarray
~gcarray()
Definition: GCArray.h:97
GENICAM_NAMESPACE::gcarray::operator*
T * operator*()
Definition: GCArray.h:99
GENICAM_NAMESPACE::gcarray::get
T * get() const
Definition: GCArray.h:98
GENICAM_NAMESPACE
Definition: GCArray.h:32
GENICAM_NAMESPACE::gcarray::m_p
T * m_p
Definition: GCArray.h:105
GCTypes.h
Platform-dependent type definitions.
GENICAM_NAMESPACE::gcarray::operator=
gcarray & operator=(const gcarray &)
GENICAM_NAMESPACE::gcarray::operator[]
T operator[](size_t idx)
Definition: GCArray.h:100
GCException.h
GENICAM_NAMESPACE::gcarray::gcarray
gcarray(size_t size)
Definition: GCArray.h:86


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Dec 4 2024 03:10:11