Autovector.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. //
  25. /*!
  26. \file
  27. \brief This file contains the public definition of the autovector classes.
  28. \ingroup GenApi_PublicInterface
  29. */
  30. //////////////////////////////////////////////////////////////////////////////
  31. #ifndef GENAPI_AUTOVECTOR_H
  32. #define GENAPI_AUTOVECTOR_H
  33. #include <vector>
  34. #include <Base/GCTypes.h>
  35. #include <GenApi/GenApiDll.h>
  36. #if defined (_WIN32)
  37. typedef long ATOMIC_VARIABLE;
  38. #elif (defined(__GNUC__) && (defined (__linux__)) || defined (__APPLE__)) || defined(VXWORKS)
  39. typedef uint32_t ATOMIC_VARIABLE;
  40. #else
  41. # error Unsupported platform
  42. #endif
  43. namespace GENAPI_NAMESPACE
  44. {
  45. /**
  46. \brief Vector of integers with reference counting
  47. \ingroup GenApi_PublicInterface
  48. */
  49. class GENAPI_DECL int64_autovector_t
  50. {
  51. public:
  52. explicit int64_autovector_t();
  53. int64_autovector_t( const int64_autovector_t& obj );
  54. explicit int64_autovector_t( size_t n );
  55. virtual ~int64_autovector_t( void );
  56. int64_autovector_t& operator=( const int64_autovector_t& obj );
  57. int64_t& operator[]( size_t uiIndex );
  58. const int64_t& operator[]( size_t uiIndex ) const;
  59. size_t size( void ) const;
  60. protected:
  61. std::vector<int64_t>* _pv;
  62. ATOMIC_VARIABLE* _pCount;
  63. };
  64. /**
  65. \brief Vector of doubles with reference counting
  66. \ingroup GenApi_PublicInterface
  67. */
  68. class GENAPI_DECL double_autovector_t
  69. {
  70. public:
  71. explicit double_autovector_t();
  72. double_autovector_t( const double_autovector_t& obj );
  73. explicit double_autovector_t( size_t n );
  74. virtual ~double_autovector_t( void );
  75. double_autovector_t& operator=( const double_autovector_t& obj );
  76. double& operator[]( size_t uiIndex );
  77. const double& operator[]( size_t uiIndex ) const;
  78. size_t size( void )const;
  79. protected:
  80. std::vector<double>* _pv;
  81. ATOMIC_VARIABLE* _pCount;
  82. };
  83. }
  84. #endif // GENAPI_AUTOVECTOR_H