Jetson Linux API Reference

32.6.1 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-2020, 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 
232 DEFINE_NAMED_UUID_CLASS(CaptureIntent);
233 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_MANUAL, FB3F3663,CC62,11E5,9956,62,56,62,87,07,61);
234 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_PREVIEW, FB3F3664,CC62,11E5,9956,62,56,62,87,07,61);
235 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_STILL_CAPTURE, FB3F3665,CC62,11E5,9956,62,56,62,87,07,61);
236 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_VIDEO_RECORD, FB3F3666,CC62,11E5,9956,62,56,62,87,07,61);
237 DEFINE_UUID(CaptureIntent, CAPTURE_INTENT_VIDEO_SNAPSHOT, FB3F3667,CC62,11E5,9956,62,56,62,87,07,61);
238 
242 DEFINE_NAMED_UUID_CLASS(DenoiseMode);
243 DEFINE_UUID(DenoiseMode, DENOISE_MODE_OFF, FB3F3668,CC62,11E5,9956,62,56,62,87,07,61);
244 DEFINE_UUID(DenoiseMode, DENOISE_MODE_FAST, FB3F3669,CC62,11E5,9956,62,56,62,87,07,61);
245 DEFINE_UUID(DenoiseMode, DENOISE_MODE_HIGH_QUALITY, FB3F366A,CC62,11E5,9956,62,56,62,87,07,61);
246 
250 DEFINE_NAMED_UUID_CLASS(EdgeEnhanceMode);
251 DEFINE_UUID(EdgeEnhanceMode, EDGE_ENHANCE_MODE_OFF, F7100B40,6A5F,11E6,BDF4,08,00,20,0C,9A,66);
252 DEFINE_UUID(EdgeEnhanceMode, EDGE_ENHANCE_MODE_FAST, F7100B41,6A5F,11E6,BDF4,08,00,20,0C,9A,66);
253 DEFINE_UUID(EdgeEnhanceMode, EDGE_ENHANCE_MODE_HIGH_QUALITY, F7100B42,6A5F,11E6,BDF4,08,00,20,0C,9A,66);
254 
258 DEFINE_NAMED_UUID_CLASS(ExtensionName);
259 
263 DEFINE_NAMED_UUID_CLASS(PixelFormat);
264 DEFINE_UUID(PixelFormat, PIXEL_FMT_UNKNOWN, 00000000,93d5,11e5,0000,1c,b7,2c,ef,d4,1e);
265 DEFINE_UUID(PixelFormat, PIXEL_FMT_Y8, 569be14a,93d5,11e5,91bc,1c,b7,2c,ef,d4,1e);
266 DEFINE_UUID(PixelFormat, PIXEL_FMT_Y16, 56ddb19c,93d5,11e5,8e2c,1c,b7,2c,ef,d4,1e);
267 DEFINE_UUID(PixelFormat, PIXEL_FMT_YCbCr_420_888, 570c10e6,93d5,11e5,8ff3,1c,b7,2c,ef,d4,1e);
268 DEFINE_UUID(PixelFormat, PIXEL_FMT_YCbCr_422_888, 573a7940,93d5,11e5,99c2,1c,b7,2c,ef,d4,1e);
269 DEFINE_UUID(PixelFormat, PIXEL_FMT_YCbCr_444_888, 576043dc,93d5,11e5,8983,1c,b7,2c,ef,d4,1e);
270 DEFINE_UUID(PixelFormat, PIXEL_FMT_JPEG_BLOB, 578b08c4,93d5,11e5,9686,1c,b7,2c,ef,d4,1e);
271 DEFINE_UUID(PixelFormat, PIXEL_FMT_RAW16, 57b484d8,93d5,11e5,aeb6,1c,b7,2c,ef,d4,1e);
272 DEFINE_UUID(PixelFormat, PIXEL_FMT_P016, 57b484d9,93d5,11e5,aeb6,1c,b7,2c,ef,d4,1e);
273 
278 DEFINE_NAMED_UUID_CLASS(SensorModeType);
279 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_DEPTH, 64483464,4b91,11e6,bbbd,40,16,7e,ab,86,92);
280 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_YUV, 6453e00c,4b91,11e6,871d,40,16,7e,ab,86,92);
281 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_RGB, 6463d4c6,4b91,11e6,88a3,40,16,7e,ab,86,92);
282 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_BAYER, 646f04ea,4b91,11e6,9c06,40,16,7e,ab,86,92);
283 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_BAYER_PWL, f6a08220,6a0f,11eb,8572,08,00,20,0c,9a,66);
284 DEFINE_UUID(SensorModeType, SENSOR_MODE_TYPE_BAYER_DOL, f6a08221,6a0f,11eb,8572,08,00,20,0c,9a,66);
285 
289 DEFINE_NAMED_UUID_CLASS(SensorPlacement);
290 DEFINE_UUID(SensorPlacement, SENSOR_PLACEMENT_REAR_OR_BOTTOM_OR_BOTTOM_LEFT, 01dba8b0,1946,11eb,8b6f,08,00,20,0c,9a,66);
291 DEFINE_UUID(SensorPlacement, SENSOR_PLACEMENT_FRONT_OR_TOP_OR_CENTER_LEFT, 01dba8b1,1946,11eb,8b6f,08,00,20,0c,9a,66);
292 DEFINE_UUID(SensorPlacement, SENSOR_PLACEMENT_CENTER_OR_CENTER_RIGHT, 01dba8b2,1946,11eb,8b6f,08,00,20,0c,9a,66);
293 DEFINE_UUID(SensorPlacement, SENSOR_PLACEMENT_TOP_LEFT, 01dba8b3,1946,11eb,8b6f,08,00,20,0c,9a,66);
294 DEFINE_UUID(SensorPlacement, SENSOR_PLACEMENT_BOTTOM_RIGHT, 01dba8b4,1946,11eb,8b6f,08,00,20,0c,9a,66);
295 DEFINE_UUID(SensorPlacement, SENSOR_PLACEMENT_TOP_RIGHT, 01dba8b5,1946,11eb,8b6f,08,00,20,0c,9a,66);
296 
300 DEFINE_NAMED_UUID_CLASS(BayerPhase);
301 DEFINE_UUID(BayerPhase, BAYER_PHASE_UNKNOWN, b9d43270,6a0e,12eb,8572,08,00,20,0c,9a,66);
302 DEFINE_UUID(BayerPhase, BAYER_PHASE_RGGB, b9d43271,6a0e,12eb,8572,08,00,20,0c,9a,66);
303 DEFINE_UUID(BayerPhase, BAYER_PHASE_BGGR, b9d43272,6a0e,12eb,8572,08,00,20,0c,9a,66);
304 DEFINE_UUID(BayerPhase, BAYER_PHASE_GRBG, b9d43273,6a0e,12eb,8572,08,00,20,0c,9a,66);
305 DEFINE_UUID(BayerPhase, BAYER_PHASE_GBRG, b9d43274,6a0e,12eb,8572,08,00,20,0c,9a,66);
306 
311 {
312 protected:
314 
315 private:
316  NonCopyable(NonCopyable& other);
317  NonCopyable& operator=(NonCopyable& other);
318 };
319 
328 {
329 protected:
332 };
333 
337 class InterfaceID : public NamedUUID
338 {
339 public:
340  InterfaceID(uint32_t time_low_
341  , uint16_t time_mid_
342  , uint16_t time_hi_and_version_
343  , uint16_t clock_seq_
344  , uint8_t c0, uint8_t c1, uint8_t c2, uint8_t c3, uint8_t c4, uint8_t c5
345  , const char* name)
346  : NamedUUID(time_low_, time_mid_, time_hi_and_version_, clock_seq_,
347  c0, c1, c2, c3, c4, c5, name)
348  {}
349 
351  : NamedUUID(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "IID_UNSPECIFIED")
352  {}
353 };
354 
359 {
360 public:
361 
367  virtual Interface* getInterface(const InterfaceID& interfaceId) = 0;
368 
369 protected:
371 };
372 
377 template <typename TheInterface>
378 inline TheInterface* interface_cast(InterfaceProvider* obj)
379 {
380  return static_cast<TheInterface*>(obj ? obj->getInterface(TheInterface::id()): 0);
381 }
382 
383 template <typename TheInterface>
384 inline TheInterface* interface_cast(const InterfaceProvider* obj)
385 {
386  return static_cast<TheInterface*>(
387  obj ? const_cast<const Interface*>(
388  const_cast<InterfaceProvider*>(obj)->getInterface(TheInterface::id())): 0);
389 }
390 
396 {
397 public:
398 
403  virtual void destroy() = 0;
404 
405 protected:
407 };
408 
413 template<typename T>
414 class rv : public T
415 {
416  rv();
417  ~rv();
418  rv(const rv&);
419  void operator=(const rv&);
420 };
421 
422 template<typename T>
423  rv<T>& move(T& self)
424 {
425  return *static_cast<rv<T>*>(&self);
426 }
433 template <typename T> struct remove_const;
434 template <typename T> struct remove_const<const T&>{ typedef T& type; };
435 template <typename T> struct remove_const<const T*>{ typedef T* type; };
436 template <typename T> struct remove_const<const T >{ typedef T type; };
437 template <typename T> struct remove_const { typedef T type; };
440 template <typename T>
442 {
443 public:
444  explicit UniqueObj(T* obj=NULL): m_obj(obj) {}
445 
446  void reset(T* obj=NULL)
447  { if (m_obj && (m_obj != obj)) const_cast<typename remove_const<T*>::type>(m_obj)->destroy(); m_obj = obj; }
448  T* release()
449  { T* obj = m_obj; m_obj = NULL; return obj; }
450 
451  UniqueObj( rv<UniqueObj>& moved ): m_obj(moved.release()) {}
452  UniqueObj& operator=( rv<UniqueObj>& moved ){ reset( moved.release()); return *this; }
453 
454  ~UniqueObj() { reset(); }
455 
456  T& operator*() const { return *m_obj; }
457  T* get() const { return m_obj; }
458 
459  operator bool() const { return !!m_obj; }
460 
461  operator rv<UniqueObj>&() { return *static_cast< rv<UniqueObj>*>(this); }
462  operator const rv<UniqueObj>&() const { return *static_cast<const rv<UniqueObj>*>(this); }
463 
464 private:
465  T* m_obj;
466 
467  T* operator->() const; // Prevent calling destroy() directly.
468  // Note: For getInterface functionality use interface_cast.
469 };
470 
471 template <typename TheInterface, typename TObject>
472 inline TheInterface* interface_cast(const UniqueObj<TObject>& obj)
473 {
474  return interface_cast<TheInterface>( obj.get());
475 }
476 
480 template <unsigned int N, typename T>
481 class Tuple
482 {
483 public:
484  Tuple() {}
485 
487  Tuple(T init)
488  {
489  for (unsigned int i = 0; i < N; i++)
490  m_data[i] = init;
491  }
492 
494  bool operator==(const Tuple<N,T>& rhs) const
495  {
496  return !memcmp(m_data, rhs.m_data, sizeof(m_data));
497  }
498 
500  bool operator!=(const Tuple<N,T>& rhs) const
501  {
502  return !(*this == rhs);
503  }
504 
507  {
508  for (unsigned int i = 0; i < N; i++)
509  m_data[i] += rhs.m_data[i];
510  return *this;
511  }
512 
515  {
516  for (unsigned int i = 0; i < N; i++)
517  m_data[i] -= rhs.m_data[i];
518  return *this;
519  }
520 
522  Tuple<N, T>& operator*=(const T& rhs)
523  {
524  for (unsigned int i = 0; i < N; i++)
525  m_data[i] *= rhs;
526  return *this;
527  }
528 
530  Tuple<N, T>& operator/=(const T& rhs)
531  {
532  for (unsigned int i = 0; i < N; i++)
533  m_data[i] /= rhs;
534  return *this;
535  }
536 
538  const Tuple<N, T> operator+(const Tuple<N, T>& rhs) const
539  {
540  return Tuple<N, T>(*this) += rhs;
541  }
542 
544  const Tuple<N, T> operator-(const Tuple<N, T>& rhs) const
545  {
546  return Tuple<N, T>(*this) -= rhs;
547  }
548 
550  const Tuple<N, T> operator*(const T& rhs) const
551  {
552  return Tuple<N, T>(*this) *= rhs;
553  }
554 
556  const Tuple<N, T> operator/(const T& rhs) const
557  {
558  return Tuple<N, T>(*this) /= rhs;
559  }
560 
561  T& operator[](unsigned int i) { assert(i < N); return m_data[i]; }
562  const T& operator[](unsigned int i) const { assert(i < N); return m_data[i]; }
563 
565  static unsigned int tupleSize() { return N; }
566 
567 protected:
568  T m_data[N];
569 };
570 
576 template <typename T>
577 class BayerTuple : public Tuple<BAYER_CHANNEL_COUNT, T>
578 {
579 public:
582 
583  BayerTuple(T init)
584  {
585  r() = gEven() = gOdd() = b() = init;
586  }
587 
588  BayerTuple(T _r, T _gEven, T _gOdd, T _b)
589  {
590  r() = _r;
591  gEven() = _gEven;
592  gOdd() = _gOdd;
593  b() = _b;
594  }
595 
604 };
605 
611 template <typename T>
612 class RGBTuple : public Tuple<RGB_CHANNEL_COUNT, T>
613 {
614 public:
615  RGBTuple() {}
617 
618  RGBTuple(T init)
619  {
620  r() = g() = b() = init;
621  }
622 
623  RGBTuple(T _r, T _g, T _b)
624  {
625  r() = _r;
626  g() = _g;
627  b() = _b;
628  }
629 
636 };
637 
643 template <typename T>
644 class Point2D : public Tuple<COORDINATE_2D_COUNT, T>
645 {
646 public:
647  Point2D() {}
649 
650  Point2D(T init)
651  {
652  x() = y() = init;
653  }
654 
655  Point2D(T _x, T _y)
656  {
657  x() = _x;
658  y() = _y;
659  }
660 
665 };
666 
667 
673 template <typename T>
674 class Point3D : public Tuple<COORDINATE_3D_COUNT, T>
675 {
676 public:
677  Point3D() {}
679 
680  Point3D(T init)
681  {
682  x() = y() = z() = init;
683  }
684 
685  Point3D(T _x, T _y, T _z)
686  {
687  x() = _x;
688  y() = _y;
689  z() = _z;
690  }
691 
698 };
699 
704 template <typename T>
705 class Size2D : public Tuple<2, T>
706 {
707 public:
708  Size2D() {}
709  Size2D(const Tuple<2, T>& other) : Tuple<2, T>(other) {}
710 
711  Size2D(T init)
712  {
713  width() = height() = init;
714  }
715 
716  Size2D(T _width, T _height)
717  {
718  width() = _width;
719  height() = _height;
720  }
721 
722  T& width() { return Tuple<2, T>::m_data[0]; }
723  const T& width() const { return Tuple<2, T>::m_data[0]; }
724  T& height() { return Tuple<2, T>::m_data[1]; }
725  const T& height() const { return Tuple<2, T>::m_data[1]; }
726 
728  T area() const { return width() * height(); }
729 };
730 
736 template <typename T>
737 class Rectangle : public Tuple<4, T>
738 {
739 public:
741  Rectangle(const Tuple<4, T>& other) : Tuple<4, T>(other) {}
742 
743  Rectangle(T init)
744  {
745  left() = top() = right() = bottom() = init;
746  }
747 
748  Rectangle(T _left, T _top, T _right, T _bottom)
749  {
750  left() = _left;
751  top() = _top;
752  right() = _right;
753  bottom() = _bottom;
754  }
755 
756  T& left() { return Tuple<4, T>::m_data[0]; }
757  const T& left() const { return Tuple<4, T>::m_data[0]; }
758  T& top() { return Tuple<4, T>::m_data[1]; }
759  const T& top() const { return Tuple<4, T>::m_data[1]; }
760  T& right() { return Tuple<4, T>::m_data[2]; }
761  const T& right() const { return Tuple<4, T>::m_data[2]; }
762  T& bottom() { return Tuple<4, T>::m_data[3]; }
763  const T& bottom() const { return Tuple<4, T>::m_data[3]; }
764 
766  T width() const { return right() - left(); }
767 
769  T height() const { return bottom() - top(); }
770 
772  T area() const { return width() * height(); }
773 };
774 
779 template <typename T>
780 class Range : public Tuple<2, T>
781 {
782 public:
783  Range() {}
784  Range(const Tuple<2, T>& other) : Tuple<2, T>(other) {}
785 
786  Range(T init)
787  {
788  min() = max() = init;
789  }
790 
791  Range(T _min, T _max)
792  {
793  min() = _min;
794  max() = _max;
795  }
796 
797  T& min() { return Tuple<2, T>::m_data[0]; }
798  const T& min() const { return Tuple<2, T>::m_data[0]; }
799  T& max() { return Tuple<2, T>::m_data[1]; }
800  const T& max() const { return Tuple<2, T>::m_data[1]; }
801 
802  bool empty() const { return max() < min(); }
803 };
804 
809 class AcRegion : public Rectangle<uint32_t>
810 {
811 public:
813  : Rectangle<uint32_t>(0, 0, 0, 0)
814  , m_weight(1.0f)
815  {}
816 
817  AcRegion(uint32_t _left, uint32_t _top, uint32_t _right, uint32_t _bottom, float _weight)
818  : Rectangle<uint32_t>(_left, _top, _right, _bottom)
819  , m_weight(_weight)
820  {}
821 
822  float& weight() { return m_weight; }
823  const float& weight() const { return m_weight; }
824 
825 protected:
826  float m_weight;
827 };
828 
836 template <typename T>
837 class Array2D
838 {
839 public:
840  // Iterator types.
841  typedef T* iterator;
842  typedef const T* const_iterator;
843 
845  Array2D() : m_size(0, 0) {}
846 
848  Array2D(const Size2D<uint32_t>& size) : m_size(size)
849  {
850  m_data.resize(size.width() * size.height());
851  }
852 
854  Array2D(const Size2D<uint32_t>& size, const T& value) : m_size(size)
855  {
856  m_data.resize(size.width() * size.height(), value);
857  }
858 
860  Array2D(const Array2D<T>& other)
861  {
862  m_data = other.m_data;
863  m_size = other.m_size;
864  }
865 
868  {
869  m_data = other.m_data;
870  m_size = other.m_size;
871  return *this;
872  }
873 
875  bool operator== (const Array2D<T>& other) const
876  {
877  return (m_size == other.m_size && m_data == other.m_data);
878  }
879 
881  Size2D<uint32_t> size() const { return m_size; }
882 
886  {
887  uint32_t s = size.width() * size.height();
888  m_data.resize(s);
889  if (m_data.size() != s)
890  return false;
891  m_size = size;
892  return true;
893  }
894 
896  inline const_iterator begin() const { return m_data.data(); }
897  inline const_iterator end() const { return m_data.data() + m_data.size(); }
898  inline iterator begin() { return m_data.data(); }
899  inline iterator end() { return m_data.data() + m_data.size(); }
900 
902  T& operator[](unsigned int i) { return m_data[checkIndex(i)]; }
903  const T& operator[](unsigned int i) const { return m_data[checkIndex(i)]; }
904 
906  inline const T& operator() (uint32_t i) const { return m_data[checkIndex(i)]; }
907  inline const T& operator() (uint32_t x, uint32_t y) const { return m_data[checkIndex(x, y)]; }
908  inline const T& operator() (const Point2D<uint32_t>& p) const
909  { return m_data[checkIndex(p.x(), p.y())]; }
910  inline T& operator() (uint32_t i) { return m_data[checkIndex(i)]; }
911  inline T& operator() (uint32_t x, uint32_t y) { return m_data[checkIndex(x, y)]; }
912  inline T& operator() (const Point2D<uint32_t>& p)
913  { return m_data[checkIndex(p.x(), p.y())]; }
914 
915  // Get pointers to data.
916  inline const T* data() const { return m_data.data(); }
917  inline T* data() { return m_data.data(); }
918 
919 private:
920  inline uint32_t checkIndex(uint32_t i) const
921  {
922  assert(i < m_data.size());
923  return i;
924  }
925 
926  inline uint32_t checkIndex(uint32_t x, uint32_t y) const
927  {
928  assert(x < m_size.width());
929  assert(y < m_size.height());
930  return x + (y * m_size.width());
931  }
932 
933  std::vector<T> m_data;
934  Size2D<uint32_t> m_size;
935 };
936 
937 typedef uint32_t AutoControlId;
938 
939 } // namespace Argus
940 
941 #endif // _ARGUS_TYPES_H
Range(const Tuple< 2, T > &other)
Definition: Types.h:784
Tuple< N, T > & operator/=(const T &rhs)
Divides every element in the tuple by a single value.
Definition: Types.h:530
The base interface for a class that provides libargus Interfaces.
Definition: Types.h:358
Tuple template class.
Definition: Types.h:481
DEFINE_UUID(ExtensionName, EXT_BAYER_AVERAGE_MAP, 12c3de20, 64c5, 11e6, bdf4, 08, 00, 20, 0c, 9a, 66)
const T & max() const
Definition: Types.h:800
T * release()
Definition: Types.h:448
void reset(T *obj=NULL)
Definition: Types.h:446
T height() const
Returns the height of the rectangle.
Definition: Types.h:769
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:494
T & x()
Definition: Types.h:692
const T * const_iterator
Definition: Types.h:842
Status
Status values returned by API function calls.
Definition: Types.h:93
T & right()
Definition: Types.h:760
iterator end()
Definition: Types.h:899
float & weight()
Definition: Types.h:822
T & operator[](unsigned int i)
Definition: Types.h:561
AcRegion(uint32_t _left, uint32_t _top, uint32_t _right, uint32_t _bottom, float _weight)
Definition: Types.h:817
TheInterface * interface_cast(InterfaceProvider *obj)
Interface-casting helper similar to dynamic_cast.
Definition: Types.h:378
Size2D(T init)
Definition: Types.h:711
The top-level interface class.
Definition: Types.h:327
Point3D template class.
Definition: Types.h:674
Size2D(T _width, T _height)
Definition: Types.h:716
Function succeeded.
Definition: Types.h:96
const T & width() const
Definition: Types.h:723
const T & g() const
Definition: Types.h:633
Tuple(T init)
Initialize every element of the tuple to a single value.
Definition: Types.h:487
UniqueObj(rv< UniqueObj > &moved)
Definition: Types.h:451
const T & b() const
Definition: Types.h:635
An operation timed out.
Definition: Types.h:114
A template class to hold a 2-dimensional array of data.
Definition: Types.h:837
const Tuple< N, T > operator*(const T &rhs) const
Returns the result of multiplying this tuple by a single value.
Definition: Types.h:550
const float & weight() const
Definition: Types.h:823
const Tuple< N, T > operator/(const T &rhs) const
Returns the result of dividing this tuple by a single value.
Definition: Types.h:556
const T & bottom() const
Definition: Types.h:763
const T & x() const
Definition: Types.h:662
T & x()
Definition: Types.h:661
const T * data() const
Definition: Types.h:916
Array2D(const Array2D< T > &other)
Copy constructor.
Definition: Types.h:860
const T & r() const
Definition: Types.h:597
Size2D template class.
Definition: Types.h:705
T m_data[N]
Definition: Types.h:568
const T & left() const
Definition: Types.h:757
bool operator==(const Array2D< T > &other) const
Equality operator.
Definition: Types.h:875
const T & top() const
Definition: Types.h:759
T & width()
Definition: Types.h:722
Point2D(T _x, T _y)
Definition: Types.h:655
Range(T _min, T _max)
Definition: Types.h:791
T area() const
Returns the area of the size (width * height).
Definition: Types.h:728
Point3D(T init)
Definition: Types.h:680
Rectangle template class.
Definition: Types.h:737
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:340
T area() const
Returns the area of the rectangle (width * height).
Definition: Types.h:772
Array2D & operator=(const Array2D< T > &other)
Assignment operator.
Definition: Types.h:867
Point3D(T _x, T _y, T _z)
Definition: Types.h:685
const Tuple< N, T > operator-(const Tuple< N, T > &rhs) const
Returns the result of subtracting another tuple from this tuple.
Definition: Types.h:544
T & z()
Definition: Types.h:696
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:514
const T & min() const
Definition: Types.h:798
The capture was aborted.
Definition: Types.h:117
T width() const
Returns the width of the rectangle.
Definition: Types.h:766
T * iterator
Definition: Types.h:841
const T & operator[](unsigned int i) const
Definition: Types.h:562
const T & b() const
Definition: Types.h:603
const T & gEven() const
Definition: Types.h:599
T * data()
Definition: Types.h:917
const Tuple< N, T > operator+(const Tuple< N, T > &rhs) const
Returns the result of adding another tuple to this tuple.
Definition: Types.h:538
Array2D()
Default Constructor.
Definition: Types.h:845
BayerTuple(const Tuple< BAYER_CHANNEL_COUNT, T > &other)
Definition: Types.h:581
RGBTuple(const Tuple< RGB_CHANNEL_COUNT, T > &other)
Definition: Types.h:616
BayerTuple(T init)
Definition: Types.h:583
bool operator!=(const Tuple< N, T > &rhs) const
Returns true if there are any differences between the two tuples.
Definition: Types.h:500
Tuple< N, T > & operator*=(const T &rhs)
Multiplies every element in the tuple by a single value.
Definition: Types.h:522
BayerTuple template class.
Definition: Types.h:577
T & min()
Definition: Types.h:797
const T & gOdd() const
Definition: Types.h:601
const T & operator()(uint32_t i) const
Array indexing using () operator.
Definition: Types.h:906
const T & y() const
Definition: Types.h:664
Point2D template class.
Definition: Types.h:644
const uint64_t TIMEOUT_INFINITE
Constant used for infinite timeouts.
Definition: Types.h:88
iterator begin()
Definition: Types.h:898
T & y()
Definition: Types.h:663
Range template class.
Definition: Types.h:780
float m_weight
Definition: Types.h:826
RGBTuple(T _r, T _g, T _b)
Definition: Types.h:623
Size2D(const Tuple< 2, T > &other)
Definition: Types.h:709
RGBTuple template class.
Definition: Types.h:612
The requested settings are invalid.
Definition: Types.h:102
Template helper emulating C++11 rvalue semantics.
Definition: Types.h:441
Rectangle(T _left, T _top, T _right, T _bottom)
Definition: Types.h:748
Array2D(const Size2D< uint32_t > &size)
Constructor given initial array size.
Definition: Types.h:848
Point2D(const Tuple< COORDINATE_2D_COUNT, T > &other)
Definition: Types.h:648
A unique identifier for a libargus Interface.
Definition: Types.h:337
T & bottom()
Definition: Types.h:762
Point3D(const Tuple< COORDINATE_3D_COUNT, T > &other)
Definition: Types.h:678
Rectangle(T init)
Definition: Types.h:743
Tuple< N, T > & operator+=(const Tuple< N, T > &rhs)
Adds every element of another tuple to the elements of this tuple.
Definition: Types.h:506
BayerTuple(T _r, T _gEven, T _gOdd, T _b)
Definition: Types.h:588
const T & r() const
Definition: Types.h:631
T * get() const
Definition: Types.h:457
const T & y() const
Definition: Types.h:695
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:456
A top level object class for libargus objects that are created and owned by the client.
Definition: Types.h:395
Defines an autocontrol region of interest (in pixel space).
Definition: Types.h:809
const T & right() const
Definition: Types.h:761
DEFINE_NAMED_UUID_CLASS(BufferType)
Coordinate
Coordinates used for 2D and 3D points.
Definition: Types.h:145
Range(T init)
Definition: Types.h:786
Size2D< uint32_t > size() const
Returns the size (dimensions) of the array.
Definition: Types.h:881
bool resize(const Size2D< uint32_t > &size)
Resize the array.
Definition: Types.h:885
uint32_t AutoControlId
Definition: Types.h:937
The set of parameters passed was invalid.
Definition: Types.h:99
This method has not been implemented.
Definition: Types.h:111
const T & z() const
Definition: Types.h:697
const_iterator begin() const
STL style iterators.
Definition: Types.h:896
const T & operator[](unsigned int i) const
Definition: Types.h:903
Point2D(T init)
Definition: Types.h:650
BayerChannel
Color channel constants for Bayer data.
Definition: Types.h:132
UniqueObj & operator=(rv< UniqueObj > &moved)
Definition: Types.h:452
const T & height() const
Definition: Types.h:725
const_iterator end() const
Definition: Types.h:897
RGBTuple(T init)
Definition: Types.h:618
Rectangle(const Tuple< 4, T > &other)
Definition: Types.h:741
const T & x() const
Definition: Types.h:693
bool empty() const
Definition: Types.h:802
T & left()
Definition: Types.h:756
T & y()
Definition: Types.h:694
T & operator[](unsigned int i)
Array indexing using [] operator.
Definition: Types.h:902
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:444
T & max()
Definition: Types.h:799
Utility class for libargus interfaces.
Definition: Types.h:310
static unsigned int tupleSize()
Returns the number of elements in the tuple.
Definition: Types.h:565
RGBChannel
Color channel constants for RGB data.
Definition: Types.h:158
T & height()
Definition: Types.h:724
Array2D(const Size2D< uint32_t > &size, const T &value)
Constructor given initial array size and initial fill value.
Definition: Types.h:854