Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
List of all members
CListCompact< T > Class Template Reference

Description

template<typename T>
class CListCompact< T >

Compact list.

This class is similar to CList, but stores the value objects in one big array and may therefore be more efficient in some cases. In particular, the memory layout is more compact, and read accesses as well as changes to individual entries are faster. On the other hand, adding or removing entries may be more time consuming for large objects.

The type 'T' must fulfill the following properties:

  1. The default constructor must not allocate any dynamic data. (A sample object will be copied using 'memcpy' to construct other objects.)
  2. It must be location-invariant, since it may be moved in memory. In particular, if elements are inserted or deleted, no pointers to dictionary elements must exist anywhere.
  3. The '=' operator must be defined appropriately.
  4. The '=' operator must free any dynamic data if the sample object is assigned.

Definition at line 1080 of file base.H.

#include "base.H"

Inheritance diagram for CListCompact< T >:
Inheritance graph
[legend]

Public Member Functions

Read access ...
T * Get (int idx)
 
T * operator[] (int idx)
 
Write access ...

For any operations passing a new value object, the object is copied.

void Set (int idx, T *value)
 Set (replace) a value. The entry must exist and 'idx' be valid. Complexity is O(1).
 
void Insert (int idx, T *value)
 Insert a new value. Complexity is O(n).
 
void Append (T *value)
 Append a new value. Complexity is O(1) if no resizing is necessary, else O(1).
 
- Public Member Functions inherited from CListRaw
int Entries () const
 Get number of entries.
 
void Clear ()
 Clear the list.
 
void Del (int idx)
 Delete entry; complexity is O(n).
 
virtual void Dump (const char *name)
 Dump contents by means of INFO logs (for debugging)
 

The documentation for this class was generated from the following file: