37 T*
at(
unsigned int pos);
39 const
T*
at(
unsigned int pos) const;
41 void swap(
unsigned int i,
unsigned int j) override;
77 return reinterpret_cast<T*
>(wp);
103 const unsigned int n =
num();
105 for (
unsigned int i=0;i<n;i++)
124 at(i)->setHeapPosition(i);
125 at(j)->setHeapPosition(j);
133 if (wp ==
nullptr) {
return (
num()-1); }
137 last()->setHeapPosition(
num()-1);
158 if (wp ==
nullptr) {
return -1; }
161 if (i >= n) {
return -1; }
162 if (i <= -1) {
return -1; }
168 at(n - 1)->setHeapPosition(-1);
void destroy() override
Destroys all elements in this vector.
T * at(unsigned int pos)
Returns the element at the given position, typecast from WEMPrimitive to T.
~WEMContainer() override
Standard destructor.
void swap(unsigned int i, unsigned int j) override
Swaps elements and updates their indices.
WEMContainer(WEMContainer &&) noexcept=default
WEMContainer(unsigned int init=0)
Standard constructor.
void replace(WEMPrimitive *wp, unsigned int pos) override
Replaces the given element at the given position, updates index.
int remove(WEMPrimitive *wp) override
unsigned int append(WEMPrimitive *wp) override
This is the base class for the WEM elements nodes, edges, and faces.
int getHeapPosition() const
Returns the heap position.
void setHeapPosition(int heapPosition)
Sets the heap position.
WEMVector(unsigned int init=0)
virtual void replace(T *elem, unsigned int pos)
Replaces the given position with the given element.
T * at(unsigned int pos) const
Returns the element at the given position or returns NULL if out of range.
virtual void swap(unsigned int p1, unsigned int p2)
Swaps the two elements given by their indices in this vector.
virtual unsigned int appendUnsafe(T *elem)
virtual void deleteLast()