#include <tbb/cache_aligned_allocator.h>\r
\r
#include <cstddef>\r
-#include <stdint.h>\r
+#include <cstdint>\r
\r
FORWARD1(boost, template<typename> class shared_future);\r
\r
namespace caspar { namespace core {\r
\r
-class const_array\r
-{\r
-public:\r
-\r
- // Static Members\r
-\r
- // Constructors\r
-\r
- template<typename T>\r
- explicit const_array(const uint8_t* ptr, std::size_t size, T&& storage)\r
- : ptr_(ptr)\r
- , size_(size)\r
- , storage_(new boost::any(std::forward<T>(storage)))\r
- {\r
- }\r
- \r
- const_array(const const_array& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(other.storage_)\r
- {\r
- }\r
-\r
- const_array(const_array&& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(std::move(other.storage_))\r
- {\r
- }\r
-\r
- // Methods\r
-\r
- const_array& operator=(const_array other)\r
- {\r
- other.swap(*this);\r
- return *this;\r
- }\r
-\r
- void swap(const_array& other)\r
- {\r
- std::swap(ptr_, other.ptr_);\r
- std::swap(size_, other.size_);\r
- std::swap(storage_, other.storage_);\r
- }\r
-\r
- // Properties\r
- \r
- const uint8_t* begin() const {return ptr_;} \r
- const uint8_t* data() const {return ptr_;}\r
- const uint8_t* end() const {return ptr_ + size_;}\r
- std::size_t size() const {return size_;}\r
- bool empty() const {return size() == 0;}\r
- \r
-private:\r
- const uint8_t* ptr_;\r
- std::size_t size_;\r
- spl::shared_ptr<boost::any> storage_;\r
-};\r
-\r
-class mutable_array\r
-{\r
- mutable_array(const mutable_array&);\r
- mutable_array& operator=(const mutable_array&);\r
-public:\r
-\r
- // Static Members\r
-\r
- // Constructors\r
- \r
- template<typename T>\r
- explicit mutable_array(uint8_t* ptr, std::size_t size, T&& storage)\r
- : ptr_(ptr)\r
- , size_(size)\r
- , storage_(new boost::any(std::forward<T>(storage)))\r
- {\r
- }\r
-\r
- mutable_array(mutable_array&& other)\r
- : ptr_(other.ptr_)\r
- , size_(other.size_)\r
- , storage_(std::move(other.storage_))\r
- {\r
- }\r
-\r
- // Methods\r
-\r
- mutable_array& operator=(mutable_array&& other)\r
- {\r
- ptr_ = other.ptr_;\r
- size_ = other.size_;\r
- storage_ = std::move(other.storage_);\r
- return *this;\r
- }\r
-\r
- // Properties\r
- \r
- uint8_t* begin() {return ptr_;} \r
- uint8_t* data() {return ptr_;}\r
- uint8_t* end() {return ptr_ + size_;} \r
- const uint8_t* begin() const {return ptr_;} \r
- const uint8_t* data() const {return ptr_;}\r
- const uint8_t* end() const {return ptr_ + size_;}\r
- std::size_t size() const {return size_;}\r
- bool empty() const {return size() == 0;}\r
- const boost::any& storage() const {return *storage_;}\r
-private:\r
- uint64_t id_;\r
- uint8_t* ptr_;\r
- std::size_t size_;\r
- spl::unique_ptr<boost::any> storage_;\r
-};\r
+class const_array;\r
+class mutable_array;\r
\r
typedef std::vector<int32_t, tbb::cache_aligned_allocator<int32_t>> audio_buffer;\r
\r