HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_ScopedArray.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_ScopedArray.h (UT Library, C++)
7  *
8  * COMMENTS: A shared ptr for encapsulating dynamically allocated arrays
9  *
10  */
11 
12 #ifndef __UT_SCOPEDARRAY_H_INCLUDED__
13 #define __UT_SCOPEDARRAY_H_INCLUDED__
14 
15 #include <SYS/SYS_Deprecated.h>
16 #include <hboost/scoped_array.hpp>
17 #include <stddef.h>
18 
19 /// @brief A smart pointer for unique ownership of dynamically allocated arrays
20 ///
21 /// UT_ScopedArray stores a pointer to a dynamically allocated array, without
22 /// reference counting. The array pointed to is guaranteed to be deleted,
23 /// either upon destruction, or via an explicit reset. UT_ScopedArray is a
24 /// simple solution for simple needs; use UT_SharedArray if your needs are more
25 /// complex.
26 ///
27 /// As this is a wrapper around the hboost::scoped_array template, the
28 /// type (T) must have a <b>Copy Constructor</b> and a valid <b>Assignment
29 /// Operator</b>.
30 template<class T>
31 class UT_ScopedArray : public hboost::scoped_array<T>
32 {
33 public:
35  UT_ScopedArray(T *p = 0) : hboost::scoped_array<T>(p) { }
36 };
37 
38 #endif // __UT_SCOPEDARRAY_H_INCLUDED__
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
#define SYS_DEPRECATED_REPLACE(__V__, __R__)
A smart pointer for unique ownership of dynamically allocated arrays.