 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
20 template <
class Type,
int N,
class ComponentType>
34 if (!
copy(*cloneArray)) {
46 static_cast<std::vector<Type>&
>(dest) =
47 static_cast<const std::vector<Type>&
>(*
this);
48 }
catch (
const std::bad_alloc&) {
59 }
catch (
const std::bad_alloc&) {
67 inline bool isAllocated()
const {
return this->capacity() != 0; }
71 bool initNewElements =
false,
72 const Type* valueForNewElements =
nullptr) {
74 if (initNewElements) {
75 if (!valueForNewElements) {
77 "[ccArray::resizeSafe] Internal error: no new "
81 this->resize(
count, *valueForNewElements);
85 }
catch (
const std::bad_alloc&) {
96 inline virtual bool isShareable()
const override {
return true; }
100 inline Type&
getValue(
size_t index) {
return this->
at(index); }
101 inline const Type&
getValue(
size_t index)
const {
return this->
at(index); }
102 inline void setValue(
size_t index,
const Type& value) {
103 this->
at(index) = value;
105 inline void addElement(
const Type& value) { this->emplace_back(value); }
106 inline void fill(
const Type& value) {
108 this->resize(this->capacity(), value);
110 std::fill(this->begin(), this->end(), value);
113 return static_cast<unsigned>(this->
size());
115 inline void clear(
bool releaseMemory =
false) {
119 this->std::vector<Type>::clear();
121 inline void swap(
size_t i1,
size_t i2) {
133 if (dataVersion < 20) {
138 ComponentType>(*
this,
150 *
this, in, dataVersion,
"array");
virtual ~ccArray()
Destructor (protected)
Definition: ecvArray.h:129
void setValue(size_t index, const Type &value)
Definition: ecvArray.h:102
QMultiMap< unsigned, unsigned > LoadedIDMap
Map of loaded unique IDs (old ID --> new ID)
Definition: ecvSerializableObject.h:61
unsigned currentSize() const
Definition: ecvArray.h:112
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
Definition: ecvArray.h:132
virtual void setFlagState(CV_OBJECT_FLAG flag, bool state)
Sets flag state.
Definition: ecvObject.cpp:120
bool resizeSafe(size_t count, bool initNewElements=false, const Type *valueForNewElements=nullptr)
Resizes memory (no exception thrown)
Definition: ecvArray.h:70
const Type & getValue(size_t index) const
Definition: ecvArray.h:101
static short GenericArrayToFileMinVersion()
Returns the minimum file version to save/load a 'generic array'.
Definition: ecvSerializableObject.h:123
bool copy(Base &dest) const
Copies the content of this array in another one.
Definition: ecvArray.h:43
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
int size
Definition: FileIOFactory.cpp:130
Shareable array that can be properly inserted in the DB tree.
Definition: ecvArray.h:21
Rgb at(size_t color_id)
Definition: ecvColorTypes.cpp:77
@ CC_LOCKED
Definition: CVTypes.h:31
void swap(size_t i1, size_t i2)
Definition: ecvArray.h:121
bool reserveSafe(size_t count)
Reserves memory (no exception thrown)
Definition: ecvArray.h:56
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
Definition: ecvArray.h:144
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
Definition: ecvArray.h:93
virtual bool isShareable() const override
Returns whether object is shareable or not.
Definition: ecvArray.h:96
virtual Base * clone()
Duplicates array.
Definition: ecvArray.h:32
@ ARRAY
Definition: CVTypes.h:133
virtual bool isSerializable() const override
Returns whether object is serializable of not.
Definition: ecvArray.h:97
void swap(cloudViewer::core::SmallVectorImpl< T > &LHS, cloudViewer::core::SmallVectorImpl< T > &RHS)
Implement std::swap in terms of SmallVector swap.
Definition: SmallVector.h:1370
bool isAllocated() const
Returns whether some memory has been allocated or not.
Definition: ecvArray.h:67
void fill(const Type &value)
Definition: ecvArray.h:106
virtual void release()
Decrease counter and deletes object when 0.
Definition: CVShareable.cpp:35
void addElement(const Type &value)
Definition: ecvArray.h:105
static bool GenericArrayFromFile(std::vector< Type > &data, QFile &in, short dataVersion, const QString &verboseDescription)
Helper: loads a vector structure from file.
Definition: ecvSerializableObject.h:219
ccArray< Type, N, ComponentType > Base
Base type.
Definition: ecvArray.h:24
Type & getValue(size_t index)
Definition: ecvArray.h:100
void clear(bool releaseMemory=false)
Definition: ecvArray.h:115
static bool GenericArrayToFile(const std::vector< Type > &data, QFile &out)
Helper: saves a vector to file.
Definition: ecvSerializableObject.h:173
int count
Definition: FileIOFactory.cpp:132
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
virtual QString getName() const
Returns object name.
Definition: ecvObject.h:72
short minimumFileVersion_MeOnly() const override
Definition: ecvArray.h:141
ccArray(QString name=QString())
Default constructor.
Definition: ecvArray.h:27
Definition: CVShareable.h:22
std::string name
Definition: FileIOFactory.cpp:129