Jetson Linux Multimedia API Reference

32.4.3 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Types.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of NVIDIA CORPORATION nor the names of its
13  * contributors may be used to endorse or promote products derived
14  * from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
17  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
24  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
36 #ifndef _ARGUS_TYPES_H
37 #define _ARGUS_TYPES_H
38 
39 #include <stdint.h>
40 #include <vector>
41 #include <string>
42 #include <assert.h>
43 
44 #include <EGL/egl.h>
45 #include <EGL/eglext.h>
46 
47 // Some versions of the Xlib.h header file define 'Status' to 'int'.
48 // This collides with the libargus 'Status' type.
49 // If 'Status' is defined then undefine it and use a typedef instead.
50 #ifdef Status
51 #undef Status
52 typedef int Status;
53 #endif // Status
54 
55 namespace Argus
56 {
57 
58 /*
59  * Forward declaration of standard objects
60  */
61 class CameraDevice;
62 class CameraProvider;
63 class CaptureSession;
64 class CaptureMetadata;
65 class CaptureMetadataContainer;
66 class Event;
67 class EventQueue;
68 class InputStream;
69 class OutputStream;
70 class OutputStreamSettings;
71 class Request;
72 class SensorMode;
73 
74 /*
75  * Forward declaration of standard interfaces
76  */
77 class ICameraProperties;
78 class ICameraProvider;
79 class ICaptureSession;
80 class IAutoControlSettings;
81 class IRequest;
82 class IStream;
83 class IStreamSettings;
84 
88 const uint64_t TIMEOUT_INFINITE = 0xFFFFFFFFFFFFFFFF;
89 
93 enum Status
94 {
96  STATUS_OK = 0,
97 
100 
103 
106 
109 
112 
115 
118 
121 
124 
125  // Number of elements in this enum.
127 };
128 
133 {
138 
140 };
141 
146 {
150 
153 };
154 
159 {
163 
165 };
166 
170 DEFINE_NAMED_UUID_CLASS(AeAntibandingMode);
171 DEFINE_UUID(AeAntibandingMode, AE_ANTIBANDING_MODE_OFF, AD1E5560,9C16,11E8,B568,18,00,20,0C,9A,66);
172 DEFINE_UUID(AeAntibandingMode, AE_ANTIBANDING_MODE_AUTO, AD1E5561,9C16,11E8,B568,18,00,20,0C,9A,66);
173 DEFINE_UUID(AeAntibandingMode, AE_ANTIBANDING_MODE_50HZ, AD1E5562,9C16,11E8,B568,18,00,20,0C,9A,66);
174 DEFINE_UUID(AeAntibandingMode, AE_ANTIBANDING_MODE_60HZ, AD1E5563,9C16,11E8,B568,18,00,20,0C,9A,66);
175 
179 DEFINE_NAMED_UUID_CLASS(AeFlickerState);
180 DEFINE_UUID(AeFlickerState, AE_FLICKER_NONE, AD1E5564,9C16,11E8,B568,18,00,20,0C,9A,66);
181 DEFINE_UUID(AeFlickerState, AE_FLICKER_50HZ, AD1E5565,9C16,11E8,B568,18,00,20,0C,9A,66);
182 DEFINE_UUID(AeFlickerState, AE_FLICKER_60HZ, AD1E5566,9C16,11E8,B568,18,00,20,0C,9A,66);
183 
187 DEFINE_NAMED_UUID_CLASS(AeState);
188 DEFINE_UUID(AeState, AE_STATE_INACTIVE, D2EBEA50,9C16,11E8,B568,18,00,20,0C,9A,66);
189 DEFINE_UUID(AeState, AE_STATE_SEARCHING, D2EBEA51,9C16,11E8,B568,18,00,20,0C,9A,66);
190 DEFINE_UUID(AeState, AE_STATE_CONVERGED, D2EBEA52,9C16,11E8,B568,18,00,20,0C,9A,66);
191 DEFINE_UUID(AeState, AE_STATE_FLASH_REQUIRED, D2EBEA53,9C16,11E8,B568,18,00,20,0C,9A,66);
192 DEFINE_UUID(AeState, AE_STATE_TIMEOUT, D2EBEA54,9C16,11E8,B568,18,00,20,0C,9A,66);
193 
197 DEFINE_NAMED_UUID_CLASS(AwbMode);
198 DEFINE_UUID(AwbMode, AWB_MODE_OFF, FB3F365A,CC62,11E5,9956,62,56,62,87,07,61);
199 DEFINE_UUID(AwbMode, AWB_MODE_AUTO, FB3F365B,CC62,11E5,9956,62,56,62,87,07,61);
200 DEFINE_UUID(AwbMode, AWB_MODE_INCANDESCENT, FB3F365C,CC62,11E5,9956,62,56,62,87,07,61);
201 DEFINE_UUID(AwbMode, AWB_MODE_FLUORESCENT, FB3F365D,CC62,11E5,9956,62,56,62,87,07,61);
202 DEFINE_UUID(AwbMode, AWB_MODE_WARM_FLUORESCENT, FB3F365E,CC62,11E5,9956,62,56,62,87,07,61);
203 DEFINE_UUID(AwbMode, AWB_MODE_DAYLIGHT, FB3F365F,CC62,11E5,9956,62,56,62,87,07,61);
204 DEFINE_UUID(AwbMode, AWB_MODE_CLOUDY_DAYLIGHT, FB3F3660,CC62,11E5,9956,62,56,62,87,07,61);
205 DEFINE_UUID(AwbMode, AWB_MODE_TWILIGHT, FB3F3661,CC62,11E5,9956,62,56,62,87,07,61);
206 DEFINE_UUID(AwbMode, AWB_MODE_SHADE, FB3F3662,CC62,11E5,9956,62,56,62,87,07,61);
207 DEFINE_UUID(AwbMode, AWB_MODE_MANUAL, 20FB45DA,C49F,4293,AB02,13,3F,8C,CA,DD,69);
208 
212 DEFINE_NAMED_UUID_CLASS(AwbState);
213 DEFINE_UUID(AwbState, AWB_STATE_INACTIVE, E33CDB30,9C16,11E8,B568,18,00,20,0C,9A,66);
214 DEFINE_UUID(AwbState, AWB_STATE_SEARCHING, E33CDB31,9C16,11E8,B568,18,00,20,0C,9A,66);
215 DEFINE_UUID(AwbState, AWB_STATE_CONVERGED, E33CDB32,9C16,11E8,B568,18,00,20,0C,9A,66);
216 DEFINE_UUID(AwbState, AWB_STATE_LOCKED, E33CDB33,9C16,11E8,B568,18,00,20,0C,9A,66);
217 
225 DEFINE_NAMED_UUID_CLASS(CaptureIntent);
226 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_MANUAL, FB3F3663,CC62,11E5,9956,62,56,62,87,07,61);
227 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_PREVIEW, FB3F3664,CC62,11E5,9956,62,56,62,87,07,61);
228 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_STILL_CAPTURE, FB3F3665,CC62,11E5,9956,62,56,62,87,07,61);
229 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_VIDEO_RECORD, FB3F3666,CC62,11E5,9956,62,56,62,87,07,61);
230 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_VIDEO_SNAPSHOT, FB3F3667,CC62,11E5,9956,62,56,62,87,07,61);
231 
235 DEFINE_NAMED_UUID_CLASS(DenoiseMode);
236 DEFINE_UUID(DenoiseMode, DENOISE_MODE_OFF, FB3F3668,CC62,11E5,9956,62,56,62,87,07,61);
237 DEFINE_UUID(DenoiseMode, DENOISE_MODE_FAST, FB3F3669,CC62,11E5,9956,62,56,62,87,07,61);
238 DEFINE_UUID(DenoiseMode, DENOISE_MODE_HIGH_QUALITY, FB3F366A,CC62,11E5,9956,62,56,62,87,07,61);
239 
243 DEFINE_NAMED_UUID_CLASS(EdgeEnhanceMode);
244 DEFINE_UUID(EdgeEnhanceMode, EDGE_ENHANCE_MODE_OFF, F7100B40,6A5F,11E6,BDF4,08,00,20,0C,9A,66);
245 DEFINE_UUID(EdgeEnhanceMode, EDGE_ENHANCE_MODE_FAST, F7100B41,6A5F,11E6,BDF4,08,00,20,0C,9A,66);
246 DEFINE_UUID(EdgeEnhanceMode, EDGE_ENHANCE_MODE_HIGH_QUALITY, F7100B42,6A5F,11E6,BDF4,08,00,20,0C,9A,66);
247 
251 DEFINE_NAMED_UUID_CLASS(ExtensionName);
252 
256 DEFINE_NAMED_UUID_CLASS(PixelFormat);
257 DEFINE_UUID(PixelFormat, PIXEL_FMT_UNKNOWN, 00000000,93d5,11e5,0000,1c,b7,2c,ef,d4,1e);
258 DEFINE_UUID(PixelFormat, PIXEL_FMT_Y8, 569be14a,93d5,11e5,91bc,1c,b7,2c,ef,d4,1e);
259 DEFINE_UUID(PixelFormat, PIXEL_FMT_Y16, 56ddb19c,93d5,11e5,8e2c,1c,b7,2c,ef,d4,1e);
260 DEFINE_UUID(PixelFormat, PIXEL_FMT_YCbCr_420_888, 570c10e6,93d5,11e5,8ff3,1c,b7,2c,ef,d4,1e);
261 DEFINE_UUID(PixelFormat, PIXEL_FMT_YCbCr_422_888, 573a7940,93d5,11e5,99c2,1c,b7,2c,ef,d4,1e);
262 DEFINE_UUID(PixelFormat, PIXEL_FMT_YCbCr_444_888, 576043dc,93d5,11e5,8983,1c,b7,2c,ef,d4,1e);
263 DEFINE_UUID(PixelFormat, PIXEL_FMT_JPEG_BLOB, 578b08c4,93d5,11e5,9686,1c,b7,2c,ef,d4,1e);
264 DEFINE_UUID(PixelFormat, PIXEL_FMT_RAW16, 57b484d8,93d5,11e5,aeb6,1c,b7,2c,ef,d4,1e);
265 DEFINE_UUID(PixelFormat, PIXEL_FMT_P016, 57b484d9,93d5,11e5,aeb6,1c,b7,2c,ef,d4,1e);
266 
271 DEFINE_NAMED_UUID_CLASS(SensorModeType);
272 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_DEPTH, 64483464,4b91,11e6,bbbd,40,16,7e,ab,86,92);
273 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_YUV, 6453e00c,4b91,11e6,871d,40,16,7e,ab,86,92);
274 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_RGB, 6463d4c6,4b91,11e6,88a3,40,16,7e,ab,86,92);
275 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_BAYER, 646f04ea,4b91,11e6,9c06,40,16,7e,ab,86,92);
276 
277 
282 {
283 protected:
285 
286 private:
287  NonCopyable(NonCopyable& other);
288  NonCopyable& operator=(NonCopyable& other);
289 };
290 
299 {
300 protected:
303 };
304 
308 class InterfaceID : public NamedUUID
309 {
310 public:
311  InterfaceID(uint32_t time_low_
312  , uint16_t time_mid_
313  , uint16_t time_hi_and_version_
314  , uint16_t clock_seq_
315  , uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5
316  , const char* name)
317  : NamedUUID(time_low_, time_mid_, time_hi_and_version_, clock_seq_,
318  c0, c1, c2, c3, c4, c5, name)
319  {}
320 
322  : NamedUUID(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "IID_UNSPECIFIED")
323  {}
324 };
325 
330 {
331 public:
332 
338  virtual Interface* getInterface(const InterfaceID& interfaceId) = 0;
339 
340 protected:
342 };
343 
348 template <typename TheInterface>
349 inline TheInterface* interface_cast(InterfaceProvider* obj)
350 {
351  return static_cast<TheInterface*>(obj ? obj->getInterface(TheInterface::id()): 0);
352 }
353 
354 template <typename TheInterface>
355 inline TheInterface* interface_cast(const InterfaceProvider* obj)
356 {
357  return static_cast<TheInterface*>(
358  obj ? const_cast<const Interface*>(
359  const_cast<InterfaceProvider*>(obj)->getInterface(TheInterface::id())): 0);
360 }
361 
367 {
368 public:
369 
374  virtual void destroy() = 0;
375 
376 protected:
378 };
379 
384 template<typename T>
385 class rv : public T
386 {
387  rv();
388  ~rv();
389  rv(const rv&);
390  void operator=(const rv&);
391 };
392 
393 template<typename T>
394  rv<T>& move(T& self)
395 {
396  return *static_cast<rv<T>*>(&self);
397 }
404 template <typename T> struct remove_const;
405 template <typename T> struct remove_const<const T&>{ typedef T& type; };
406 template <typename T> struct remove_const<const T*>{ typedef T* type; };
407 template <typename T> struct remove_const<const T >{ typedef T type; };
408 template <typename T> struct remove_const { typedef T type; };
411 template <typename T>
413 {
414 public:
415  explicit UniqueObj(T* obj=NULL): m_obj(obj) {}
416 
417  void reset(T* obj=NULL)
418  { if (m_obj) const_cast<typename remove_const<T*>::type>(m_obj)->destroy(); m_obj = obj; }
419  T* release()
420  { T* obj = m_obj; m_obj = NULL; return obj; }
421 
422  UniqueObj( rv<UniqueObj>& moved ): m_obj(moved.release()) {}
423  UniqueObj& operator=( rv<UniqueObj>& moved ){ reset( moved.release()); return *this; }
424 
425  ~UniqueObj() { reset(); }
426 
427  T& operator*() const { return *m_obj; }
428  T* get() const { return m_obj; }
429 
430  operator bool() const { return !!m_obj; }
431 
432  operator rv<UniqueObj>&() { return *static_cast< rv<UniqueObj>*>(this); }
433  operator const rv<UniqueObj>&() const { return *static_cast<const rv<UniqueObj>*>(this); }
434 
435 private:
436  T* m_obj;
437 
438  T* operator->() const; // Prevent calling destroy() directly.
439  // Note: For getInterface functionality use interface_cast.
440 };
441 
442 template <typename TheInterface, typename TObject>
443 inline TheInterface* interface_cast(const UniqueObj<TObject>& obj)
444 {
445  return interface_cast<TheInterface>( obj.get());
446 }
447 
451 template <unsigned int N, typename T>
452 class Tuple
453 {
454 public:
455  Tuple() {}
456 
458  Tuple(T init)
459  {
460  for (unsigned int i = 0; i < N; i++)
461  m_data[i] = init;
462  }
463 
465  bool operator==(const Tuple<N,T>& rhs) const
466  {
467  return !memcmp(m_data, rhs.m_data, sizeof(m_data));
468  }
469 
471  bool operator!=(const Tuple<N,T>& rhs) const
472  {
473  return !(*this == rhs);
474  }
475 
478  {
479  for (unsigned int i = 0; i < N; i++)
480  m_data[i] += rhs.m_data[i];
481  return *this;
482  }
483 
486  {
487  for (unsigned int i = 0; i < N; i++)
488  m_data[i] -= rhs.m_data[i];
489  return *this;
490  }
491 
493  Tuple<N, T>& operator*=(const T& rhs)
494  {
495  for (unsigned int i = 0; i < N; i++)
496  m_data[i] *= rhs;
497  return *this;
498  }
499 
501  Tuple<N, T>& operator/=(const T& rhs)
502  {
503  for (unsigned int i = 0; i < N; i++)
504  m_data[i] /= rhs;
505  return *this;
506  }
507 
509  const Tuple<N, T> operator+(const Tuple<N, T>& rhs) const
510  {
511  return Tuple<N, T>(*this) += rhs;
512  }
513 
515  const Tuple<N, T> operator-(const Tuple<N, T>& rhs) const
516  {
517  return Tuple<N, T>(*this) -= rhs;
518  }
519 
521  const Tuple<N, T> operator*(const T& rhs) const
522  {
523  return Tuple<N, T>(*this) *= rhs;
524  }
525 
527  const Tuple<N, T> operator/(const T& rhs) const
528  {
529  return Tuple<N, T>(*this) /= rhs;
530  }
531 
532  T& operator[](unsigned int i) { assert(i < N); return m_data[i]; }
533  const T& operator[](unsigned int i) const { assert(i < N); return m_data[i]; }
534 
536  static unsigned int tupleSize() { return N; }
537 
538 protected:
539  T m_data[N];
540 };
541 
547 template <typename T>
548 class BayerTuple : public Tuple<BAYER_CHANNEL_COUNT, T>
549 {
550 public:
553 
554  BayerTuple(T init)
555  {
556  r() = gEven() = gOdd() = b() = init;
557  }
558 
559  BayerTuple(T _r, T _gEven, T _gOdd, T _b)
560  {
561  r() = _r;
562  gEven() = _gEven;
563  gOdd() = _gOdd;
564  b() = _b;
565  }
566 
575 };
576 
582 template <typename T>
583 class RGBTuple : public Tuple<RGB_CHANNEL_COUNT, T>
584 {
585 public:
586  RGBTuple() {}
588 
589  RGBTuple(T init)
590  {
591  r() = g() = b() = init;
592  }
593 
594  RGBTuple(T _r, T _g, T _b)
595  {
596  r() = _r;
597  g() = _g;
598  b() = _b;
599  }
600 
607 };
608 
614 template <typename T>
615 class Point2D : public Tuple<COORDINATE_2D_COUNT, T>
616 {
617 public:
618  Point2D() {}
620 
621  Point2D(T init)
622  {
623  x() = y() = init;
624  }
625 
626  Point2D(T _x, T _y)
627  {
628  x() = _x;
629  y() = _y;
630  }
631 
636 };
637 
642 template <typename T>
643 class Size2D : public Tuple<2, T>
644 {
645 public:
646  Size2D() {}
647  Size2D(const Tuple<2, T>& other) : Tuple<2, T>(other) {}
648 
649  Size2D(T init)
650  {
651  width() = height() = init;
652  }
653 
654  Size2D(T _width, T _height)
655  {
656  width() = _width;
657  height() = _height;
658  }
659 
660  T& width() { return Tuple<2, T>::m_data[0]; }
661  const T& width() const { return Tuple<2, T>::m_data[0]; }
662  T& height() { return Tuple<2, T>::m_data[1]; }
663  const T& height() const { return Tuple<2, T>::m_data[1]; }
664 
666  T area() const { return width() * height(); }
667 };
668 
674 template <typename T>
675 class Rectangle : public Tuple<4, T>
676 {
677 public:
679  Rectangle(const Tuple<4, T>& other) : Tuple<4, T>(other) {}
680 
681  Rectangle(T init)
682  {
683  left() = top() = right() = bottom() = init;
684  }
685 
686  Rectangle(T _left, T _top, T _right, T _bottom)
687  {
688  left() = _left;
689  top() = _top;
690  right() = _right;
691  bottom() = _bottom;
692  }
693 
694  T& left() { return Tuple<4, T>::m_data[0]; }
695  const T& left() const { return Tuple<4, T>::m_data[0]; }
696  T& top() { return Tuple<4, T>::m_data[1]; }
697  const T& top() const { return Tuple<4, T>::m_data[1]; }
698  T& right() { return Tuple<4, T>::m_data[2]; }
699  const T& right() const { return Tuple<4, T>::m_data[2]; }
700  T& bottom() { return Tuple<4, T>::m_data[3]; }
701  const T& bottom() const { return Tuple<4, T>::m_data[3]; }
702 
704  T width() const { return right() - left(); }
705 
707  T height() const { return bottom() - top(); }
708 
710  T area() const { return width() * height(); }
711 };
712 
717 template <typename T>
718 class Range : public Tuple<2, T>
719 {
720 public:
721  Range() {}
722  Range(const Tuple<2, T>& other) : Tuple<2, T>(other) {}
723 
724  Range(T init)
725  {
726  min() = max() = init;
727  }
728 
729  Range(T _min, T _max)
730  {
731  min() = _min;
732  max() = _max;
733  }
734 
735  T& min() { return Tuple<2, T>::m_data[0]; }
736  const T& min() const { return Tuple<2, T>::m_data[0]; }
737  T& max() { return Tuple<2, T>::m_data[1]; }
738  const T& max() const { return Tuple<2, T>::m_data[1]; }
739 
740  bool empty() const { return max() < min(); }
741 };
742 
747 class AcRegion : public Rectangle<uint32_t>
748 {
749 public:
751  : Rectangle<uint32_t>(0, 0, 0, 0)
752  , m_weight(1.0f)
753  {}
754 
755  AcRegion(uint32_t _left, uint32_t _top, uint32_t _right, uint32_t _bottom, float _weight)
756  : Rectangle<uint32_t>(_left, _top, _right, _bottom)
757  , m_weight(_weight)
758  {}
759 
760  float& weight() { return m_weight; }
761  const float& weight() const { return m_weight; }
762 
763 protected:
764  float m_weight;
765 };
766 
774 template <typename T>
775 class Array2D
776 {
777 public:
778  // Iterator types.
779  typedef T* iterator;
780  typedef const T* const_iterator;
781 
783  Array2D() : m_size(0, 0) {}
784 
786  Array2D(const Size2D<uint32_t>& size) : m_size(size)
787  {
788  m_data.resize(size.width() * size.height());
789  }
790 
792  Array2D(const Size2D<uint32_t>& size, const T& value) : m_size(size)
793  {
794  m_data.resize(size.width() * size.height(), value);
795  }
796 
798  Array2D(const Array2D<T>& other)
799  {
800  m_data = other.m_data;
801  m_size = other.m_size;
802  }
803 
806  {
807  m_data = other.m_data;
808  m_size = other.m_size;
809  return *this;
810  }
811 
813  bool operator== (const Array2D<T>& other) const
814  {
815  return (m_size == other.m_size && m_data == other.m_data);
816  }
817 
819  Size2D<uint32_t> size() const { return m_size; }
820 
824  {
825  uint32_t s = size.width() * size.height();
826  m_data.resize(s);
827  if (m_data.size() != s)
828  return false;
829  m_size = size;
830  return true;
831  }
832 
834  inline const_iterator begin() const { return m_data.data(); }
835  inline const_iterator end() const { return m_data.data() + m_data.size(); }
836  inline iterator begin() { return m_data.data(); }
837  inline iterator end() { return m_data.data() + m_data.size(); }
838 
840  T& operator[](unsigned int i) { return m_data[checkIndex(i)]; }
841  const T& operator[](unsigned int i) const { return m_data[checkIndex(i)]; }
842 
844  inline const T& operator() (uint32_t i) const { return m_data[checkIndex(i)]; }
845  inline const T& operator() (uint32_t x, uint32_t y) const { return m_data[checkIndex(x, y)]; }
846  inline const T& operator() (const Point2D<uint32_t>& p) const
847  { return m_data[checkIndex(p.x(), p.y())]; }
848  inline T& operator() (uint32_t i) { return m_data[checkIndex(i)]; }
849  inline T& operator() (uint32_t x, uint32_t y) { return m_data[checkIndex(x, y)]; }
850  inline T& operator() (const Point2D<uint32_t>& p)
851  { return m_data[checkIndex(p.x(), p.y())]; }
852 
853  // Get pointers to data.
854  inline const T* data() const { return m_data.data(); }
855  inline T* data() { return m_data.data(); }
856 
857 private:
858  inline uint32_t checkIndex(uint32_t i) const
859  {
860  assert(i < m_data.size());
861  return i;
862  }
863 
864  inline uint32_t checkIndex(uint32_t x, uint32_t y) const
865  {
866  assert(x < m_size.width());
867  assert(y < m_size.height());
868  return x + (y * m_size.width());
869  }
870 
871  std::vector<T> m_data;
872  Size2D<uint32_t> m_size;
873 };
874 
875 typedef uint32_t AutoControlId;
876 
877 } // namespace Argus
878 
879 #endif // _ARGUS_TYPES_H
Range(const Tuple< 2, T > &other)
Definition: Types.h:722
Tuple< N, T > & operator/=(const T &rhs)
Divides every element in the tuple by a single value.
Definition: Types.h:501
The base interface for a class that provides libargus Interfaces.
Definition: Types.h:329
Tuple template class.
Definition: Types.h:452
DEFINE_UUID(ExtensionName, EXT_BAYER_AVERAGE_MAP, 12c3de20, 64c5, 11e6, bdf4, 08, 00, 20, 0c, 9a, 66)
const T & max() const
Definition: Types.h:738
T * release()
Definition: Types.h:419
void reset(T *obj=NULL)
Definition: Types.h:417
T height() const
Returns the height of the rectangle.
Definition: Types.h:707
The stream or other resource has been disconnected.
Definition: Types.h:120
bool operator==(const Tuple< N, T > &rhs) const
Returns true when every element in the two tuples are identical.
Definition: Types.h:465
const T * const_iterator
Definition: Types.h:780
Status
Status values returned by API function calls.
Definition: Types.h:93
T & right()
Definition: Types.h:698
iterator end()
Definition: Types.h:837
float & weight()
Definition: Types.h:760
T & operator[](unsigned int i)
Definition: Types.h:532
AcRegion(uint32_t _left, uint32_t _top, uint32_t _right, uint32_t _bottom, float _weight)
Definition: Types.h:755
TheInterface * interface_cast(InterfaceProvider *obj)
Interface-casting helper similar to dynamic_cast.
Definition: Types.h:349
Size2D(T init)
Definition: Types.h:649
The top-level interface class.
Definition: Types.h:298
Size2D(T _width, T _height)
Definition: Types.h:654
Function succeeded.
Definition: Types.h:96
const T & width() const
Definition: Types.h:661
const T & g() const
Definition: Types.h:604
Tuple(T init)
Initialize every element of the tuple to a single value.
Definition: Types.h:458
UniqueObj(rv< UniqueObj > &moved)
Definition: Types.h:422
const T & b() const
Definition: Types.h:606
An operation timed out.
Definition: Types.h:114
A template class to hold a 2-dimensional array of data.
Definition: Types.h:775
const Tuple< N, T > operator*(const T &rhs) const
Returns the result of multiplying this tuple by a single value.
Definition: Types.h:521
const float & weight() const
Definition: Types.h:761
const Tuple< N, T > operator/(const T &rhs) const
Returns the result of dividing this tuple by a single value.
Definition: Types.h:527
const T & bottom() const
Definition: Types.h:701
const T & x() const
Definition: Types.h:633
T & x()
Definition: Types.h:632
const T * data() const
Definition: Types.h:854
Array2D(const Array2D< T > &other)
Copy constructor.
Definition: Types.h:798
const T & r() const
Definition: Types.h:568
Size2D template class.
Definition: Types.h:643
T m_data[N]
Definition: Types.h:539
const T & left() const
Definition: Types.h:695
bool operator==(const Array2D< T > &other) const
Equality operator.
Definition: Types.h:813
const T & top() const
Definition: Types.h:697
T & width()
Definition: Types.h:660
Point2D(T _x, T _y)
Definition: Types.h:626
Range(T _min, T _max)
Definition: Types.h:729
T area() const
Returns the area of the size (width * height).
Definition: Types.h:666
Rectangle template class.
Definition: Types.h:675
InterfaceID(uint32_t time_low_, uint16_t time_mid_, uint16_t time_hi_and_version_, uint16_t clock_seq_, uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5, const char *name)
Definition: Types.h:311
T area() const
Returns the area of the rectangle (width * height).
Definition: Types.h:710
Array2D & operator=(const Array2D< T > &other)
Assignment operator.
Definition: Types.h:805
const Tuple< N, T > operator-(const Tuple< N, T > &rhs) const
Returns the result of subtracting another tuple from this tuple.
Definition: Types.h:515
A universally unique identifier with a name (used for debugging purposes).
Definition: UUID.h:72
virtual void destroy()=0
Destroy this object.
Tuple< N, T > & operator-=(const Tuple< N, T > &rhs)
Subtracts every element of another tuple from the elements of this tuple.
Definition: Types.h:485
const T & min() const
Definition: Types.h:736
The capture was aborted.
Definition: Types.h:117
T width() const
Returns the width of the rectangle.
Definition: Types.h:704
T * iterator
Definition: Types.h:779
const T & operator[](unsigned int i) const
Definition: Types.h:533
const T & b() const
Definition: Types.h:574
const T & gEven() const
Definition: Types.h:570
T * data()
Definition: Types.h:855
const Tuple< N, T > operator+(const Tuple< N, T > &rhs) const
Returns the result of adding another tuple to this tuple.
Definition: Types.h:509
Array2D()
Default Constructor.
Definition: Types.h:783
DEFINE_NAMED_UUID_CLASS(StreamType)
The general operation, buffer source, and interfaces supported by a stream object are defined by its ...
BayerTuple(const Tuple< BAYER_CHANNEL_COUNT, T > &other)
Definition: Types.h:552
RGBTuple(const Tuple< RGB_CHANNEL_COUNT, T > &other)
Definition: Types.h:587
BayerTuple(T init)
Definition: Types.h:554
bool operator!=(const Tuple< N, T > &rhs) const
Returns true if there are any differences between the two tuples.
Definition: Types.h:471
Tuple< N, T > & operator*=(const T &rhs)
Multiplies every element in the tuple by a single value.
Definition: Types.h:493
BayerTuple template class.
Definition: Types.h:548
T & min()
Definition: Types.h:735
const T & gOdd() const
Definition: Types.h:572
const T & operator()(uint32_t i) const
Array indexing using () operator.
Definition: Types.h:844
const T & y() const
Definition: Types.h:635
Point2D template class.
Definition: Types.h:615
const uint64_t TIMEOUT_INFINITE
Constant used for infinite timeouts.
Definition: Types.h:88
iterator begin()
Definition: Types.h:836
T & y()
Definition: Types.h:634
Range template class.
Definition: Types.h:718
float m_weight
Definition: Types.h:764
RGBTuple(T _r, T _g, T _b)
Definition: Types.h:594
Size2D(const Tuple< 2, T > &other)
Definition: Types.h:647
RGBTuple template class.
Definition: Types.h:583
The requested settings are invalid.
Definition: Types.h:102
Template helper emulating C++11 rvalue semantics.
Definition: Types.h:412
Rectangle(T _left, T _top, T _right, T _bottom)
Definition: Types.h:686
Array2D(const Size2D< uint32_t > &size)
Constructor given initial array size.
Definition: Types.h:786
Point2D(const Tuple< COORDINATE_2D_COUNT, T > &other)
Definition: Types.h:619
A unique identifier for a libargus Interface.
Definition: Types.h:308
T & bottom()
Definition: Types.h:700
Rectangle(T init)
Definition: Types.h:681
Tuple< N, T > & operator+=(const Tuple< N, T > &rhs)
Adds every element of another tuple to the elements of this tuple.
Definition: Types.h:477
BayerTuple(T _r, T _gEven, T _gOdd, T _b)
Definition: Types.h:559
const T & r() const
Definition: Types.h:602
T * get() const
Definition: Types.h:428
The requested device is unavailable.
Definition: Types.h:105
End of stream, used by Stream objects.
Definition: Types.h:123
T & operator*() const
Definition: Types.h:427
A top level object class for libargus objects that are created and owned by the client.
Definition: Types.h:366
Defines an autocontrol region of interest (in pixel space).
Definition: Types.h:747
const T & right() const
Definition: Types.h:699
Coordinate
Coordinates used for 2D and 3D points.
Definition: Types.h:145
Range(T init)
Definition: Types.h:724
Size2D< uint32_t > size() const
Returns the size (dimensions) of the array.
Definition: Types.h:819
bool resize(const Size2D< uint32_t > &size)
Resize the array.
Definition: Types.h:823
uint32_t AutoControlId
Definition: Types.h:875
The set of parameters passed was invalid.
Definition: Types.h:99
This method has not been implemented.
Definition: Types.h:111
const_iterator begin() const
STL style iterators.
Definition: Types.h:834
const T & operator[](unsigned int i) const
Definition: Types.h:841
Point2D(T init)
Definition: Types.h:621
BayerChannel
Color channel constants for Bayer data.
Definition: Types.h:132
UniqueObj & operator=(rv< UniqueObj > &moved)
Definition: Types.h:423
const T & height() const
Definition: Types.h:663
const_iterator end() const
Definition: Types.h:835
RGBTuple(T init)
Definition: Types.h:589
Rectangle(const Tuple< 4, T > &other)
Definition: Types.h:679
bool empty() const
Definition: Types.h:740
T & left()
Definition: Types.h:694
T & operator[](unsigned int i)
Array indexing using [] operator.
Definition: Types.h:840
virtual Interface * getInterface(const InterfaceID &interfaceId)=0
Acquire the interface specified by interfaceId.
An operation failed because of insufficient mavailable memory.
Definition: Types.h:108
UniqueObj(T *obj=NULL)
Definition: Types.h:415
T & max()
Definition: Types.h:737
Utility class for libargus interfaces.
Definition: Types.h:281
static unsigned int tupleSize()
Returns the number of elements in the tuple.
Definition: Types.h:536
RGBChannel
Color channel constants for RGB data.
Definition: Types.h:158
T & height()
Definition: Types.h:662
Array2D(const Size2D< uint32_t > &size, const T &value)
Constructor given initial array size and initial fill value.
Definition: Types.h:792