1 #ifndef OPENPOSE_CORE_ARRAY_HPP
2 #define OPENPOSE_CORE_ARRAY_HPP
39 explicit Array(
const std::vector<int>& sizes = {});
48 Array(
const int size,
const T value);
57 Array(
const std::vector<int>& sizes,
const T value);
66 Array(
const int size, T*
const dataPtr);
75 Array(
const std::vector<int>& sizes, T*
const dataPtr);
89 Array(
const Array<T>& array,
const int index,
const bool noCopy =
false);
102 for (
auto i = 0u ; i < array.
getVolume() ; i++)
103 pData[i] = T(array[i]);
105 catch (
const std::exception& e)
107 error(e.what(), __LINE__, __FUNCTION__, __FILE__);
168 void reset(
const std::vector<int>& sizes = {});
177 void reset(
const int size,
const T value);
187 void reset(
const std::vector<int>& sizes,
const T value);
196 void reset(
const int size, T*
const dataPtr);
205 void reset(
const std::vector<int>& sizes, T*
const dataPtr);
230 return (mVolume == 0);
286 size_t getVolume(
const int indexA,
const int indexB = -1)
const;
410 inline const T&
operator[](
const std::vector<int>& indexes)
const
422 inline T&
at(
const int index)
424 return commonAt(index);
434 inline const T&
at(
const int index)
const
436 return commonAt(index);
446 inline T&
at(
const std::vector<int>& indexes)
448 return at(getIndexAndCheck(indexes));
458 inline const T&
at(
const std::vector<int>& indexes)
const
460 return at(getIndexAndCheck(indexes));
478 std::vector<int> mSize;
480 std::shared_ptr<T> spData;
482 std::pair<bool, Matrix> mCvMatData;
491 int getIndex(
const std::vector<int>& indexes)
const;
500 int getIndexAndCheck(
const std::vector<int>& indexes)
const;
507 T& commonAt(
const int index)
const;
509 void resetAuxiliary(
const std::vector<int>& sizes, T*
const dataPtr =
nullptr);
void reset(const std::vector< int > &sizes={})
const T & operator[](const int index) const
void reset(const int size)
void setTo(const T value)
void reset(const std::vector< int > &sizes, T *const dataPtr)
std::vector< int > getStride() const
std::string printSize() const
Array(const Array< T > &array, const int index, const bool noCopy=false)
std::vector< int > getSize() const
Array(const std::vector< int > &sizes={})
const T & at(const int index) const
size_t getVolume(const int indexA, const int indexB=-1) const
size_t getNumberDimensions() const
T * getPseudoConstPtr() const
T & at(const std::vector< int > &indexes)
Array(const std::vector< int > &sizes, T *const dataPtr)
Array(const std::vector< int > &sizes, const T value)
const Matrix & getConstCvMat() const
Array< T > & operator=(const Array< T > &array)
Array(const int size, T *const dataPtr)
void setFrom(const Matrix &cvMat)
T & operator[](const int index)
T & operator[](const std::vector< int > &indexes)
int getStride(const int index) const
int getSize(const int index) const
const T & operator[](const std::vector< int > &indexes) const
const T * getConstPtr() const
void reset(const int size, const T value)
Array(const int size, const T value)
void reset(const std::vector< int > &sizes, const T value)
void reset(const int size, T *const dataPtr)
Array< T > & operator=(Array< T > &&array)
const T & at(const std::vector< int > &indexes) const
const std::string toString() const
Array(const Array< T2 > &array)
#define OVERLOAD_C_OUT(className)
OP_API void error(const std::string &message, const int line=-1, const std::string &function="", const std::string &file="")