libnative-utilities/include/array/GrowableObjectArray.hpp
2024-08-15 18:40:30 +08:00

56 lines
1.1 KiB
C++

#ifndef GROWABLEOBJECTARRAY_HPP
#define GROWABLEOBJECTARRAY_HPP
#include "include/array/GrowableArray.hpp"
class GrowableObjectArray{
public:
GrowableObjectArray(unsigned int initSize=minmum_capacity);
void* getArrayData();
unsigned int capacity();
const unsigned int& length=arrlen;
const unsigned int& element_size=elementSize;
void put(const void* e);
void set(unsigned index, const void* e);
void copyFrom(const void* data, unsigned int count);
void copyFrom(const void* data, unsigned int index, unsigned int count);
void copyFrom(const void* data, unsigned int index, unsigned int bufferOffset, unsigned int count);
void* get(unsigned int index);
void remove(unsigned int index);
void gc();
void clear();
void destroyAllObjectOnDelete(unsigned int flag);
~GrowableObjectArray();
private:
GrowableArray* array;
unsigned int arrlen;
unsigned int elementSize;
unsigned int destroyFlag=false;
static const unsigned int minmum_capacity;
};
#endif // GROWABLEOBJECTARRAY_HPP