Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <IceContainer.h>
Contains a list of 32-bits values. Use this class when you need to store an unknown number of values. The list is automatically resized and can contains 32-bits entities (dwords or floats)
Definition at line 25 of file IceContainer.h.
Container::Container | ( | ) |
Constructor. No entries allocated there.
Definition at line 41 of file IceContainer.cpp.
Container::Container | ( | const Container & | object) |
Copy constructor.
Definition at line 68 of file IceContainer.cpp.
Constructor. Also allocates a given number of entries.
Definition at line 54 of file IceContainer.cpp.
Container::~Container | ( | ) |
A O(1) method to add a value in the container. The container is automatically resized if needed. The method is inline, not the resize. The call overhead happens on resizes only, which is not a problem since the resizing operation costs a lot more than the call overhead...
entry | [in] a udword to store in the container |
Definition at line 47 of file IceContainer.h.
Referenced by CollisionFaces::AddFace(), Pairs::AddPair(), TriList::AddTri(), and TriangleList::AddTriangle().
A O(1) method to add a value in the container. The container is automatically resized if needed. The method is inline, not the resize. The call overhead happens on resizes only, which is not a problem since the resizing operation costs a lot more than the call overhead...
entry | [in] a float to store in the container |
Definition at line 81 of file IceContainer.h.
Add unique [slow].
Definition at line 103 of file IceContainer.h.
Checks whether the container already contains a given value.
entry | [in] the value to look for in the container |
location | [out] a possible pointer to store the entry location |
Definition at line 225 of file IceContainer.cpp.
Deletes an entry. If the container contains such an entry, it's removed.
entry | [in] the value to delete. |
Definition at line 247 of file IceContainer.cpp.
Deletes the entry whose index is given.
Definition at line 164 of file IceContainer.h.
References index.
Deletes an entry, preserving the insertion order. If the container contains such an entry, it's removed.
entry | [in] the value to delete. |
Definition at line 270 of file IceContainer.cpp.
|
inline |
Deletes the very last entry.
Definition at line 162 of file IceContainer.h.
Referenced by Pairs::DeleteLastPair().
Container & Container::Empty | ( | ) |
Clears the container. All stored values are deleted, and it frees used ram.
Definition at line 98 of file IceContainer.cpp.
Container & Container::FindNext | ( | udword & | entry, |
FindMode | find_mode = FIND_CLAMP |
||
) |
Gets the next entry, starting from input one.
entry | [in/out] On input, the entry to look for. On output, the next entry |
find_mode | [in] wrap/clamp |
Definition at line 298 of file IceContainer.cpp.
Container & Container::FindPrev | ( | udword & | entry, |
FindMode | find_mode = FIND_CLAMP |
||
) |
Gets the previous entry, starting from input one.
entry | [in/out] On input, the entry to look for. On output, the previous entry |
find_mode | [in] wrap/clamp |
Definition at line 318 of file IceContainer.cpp.
Definition at line 133 of file IceContainer.h.
References size.
Returns the list of entries.
Definition at line 172 of file IceContainer.h.
Referenced by CollisionFaces::GetFaces(), Pairs::GetPair(), Pairs::GetPairs(), TriList::GetTriangles(), TriangleList::GetTriangles(), and operator=().
Returns ith entry.
Definition at line 171 of file IceContainer.h.
Definition at line 174 of file IceContainer.h.
Returns the growth factor.
Definition at line 178 of file IceContainer.h.
Definition at line 175 of file IceContainer.h.
Definition at line 195 of file IceContainer.h.
Returns the current number of entries.
Definition at line 170 of file IceContainer.h.
Referenced by Opcode::HybridSphereCollider::Collide(), Opcode::HybridAABBCollider::Collide(), Opcode::HybridLSSCollider::Collide(), Opcode::HybridPlanesCollider::Collide(), Opcode::HybridOBBCollider::Collide(), CollisionFaces::GetNbFaces(), Pairs::GetNbPairs(), TriList::GetNbTriangles(), TriangleList::GetNbTriangles(), and operator=().
Definition at line 196 of file IceContainer.h.
udword Container::GetUsedRam | ( | ) | const |
Gets the ram used by the container.
Definition at line 336 of file IceContainer.cpp.
Checks the container is full.
Definition at line 180 of file IceContainer.h.
Checks the container is empty.
Definition at line 181 of file IceContainer.h.
Referenced by Pairs::HasPairs().
void Container::operator= | ( | const Container & | object) |
Operator for "Container A = Container B".
Definition at line 341 of file IceContainer.cpp.
References CopyMemory(), GetEntries(), GetNbEntries(), and SetSize().
bool Container::Refit | ( | ) |
Refits the container and get rid of unused bytes.
Definition at line 182 of file IceContainer.cpp.
|
inline |
Resets the container. Stored values are discarded but the buffer is kept so that further calls don't need resizing again. That's a kind of temporal coherence.
Definition at line 125 of file IceContainer.h.
Referenced by Opcode::HybridSphereCollider::Collide(), Opcode::HybridAABBCollider::Collide(), Opcode::HybridLSSCollider::Collide(), Opcode::HybridPlanesCollider::Collide(), Opcode::HybridOBBCollider::Collide(), CollisionFaces::Reset(), and Pairs::ResetPairs().
Sets the growth factor.
Definition at line 179 of file IceContainer.h.
Sets the initial size of the container. If it already contains something, it's discarded.
nb | [in] Number of entries |
Definition at line 154 of file IceContainer.cpp.
Referenced by operator=().