2
0

shared_array.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ///////////////////////////////////////////////////////////////////////////////////////////////////
  2. // OpenGL Image Copyright (c) 2008 - 2011 G-Truc Creation (www.g-truc.net)
  3. ///////////////////////////////////////////////////////////////////////////////////////////////////
  4. // Created : 2008-12-19
  5. // Updated : 2005-06-13
  6. // Licence : This source is under MIT License
  7. // File : gli/shared_array.hpp
  8. ///////////////////////////////////////////////////////////////////////////////////////////////////
  9. #ifndef GLI_SHARED_ARRAY_INCLUDED
  10. #define GLI_SHARED_ARRAY_INCLUDED
  11. namespace gli
  12. {
  13. template <typename T>
  14. class shared_array
  15. {
  16. public:
  17. shared_array();
  18. shared_array(shared_array const & SharedArray);
  19. shared_array(T * Pointer);
  20. virtual ~shared_array();
  21. void reset();
  22. void reset(T * Pointer);
  23. T & operator*();
  24. T * operator->();
  25. T const & operator*() const;
  26. T const * const operator->() const;
  27. T * get();
  28. T const * const get() const;
  29. shared_array & operator=(shared_array const & SharedArray);
  30. bool operator==(shared_array const & SharedArray) const;
  31. bool operator!=(shared_array const & SharedArray) const;
  32. private:
  33. int * Counter;
  34. T * Pointer;
  35. };
  36. }//namespace gli
  37. #include "shared_array.inl"
  38. #endif //GLI_SHARED_ARRAY_INCLUDED