Crystal Space: Containers (Crystal Space Public API Reference)

| ## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# Containers
[Utilities]

## Classes
class | csArray< T, ElementHandler, MemoryAllocator, CapacityHandler >
| A templated array class. More...
struct | csArrayCapacityDefault
class | csArrayCapacityLinear< Threshold >
| csArray capacity handler. More...
class | csArrayCmp< T, K >
| A functor template which encapsulates a key and a comparison function for use with key-related csArray<> searching methods, such as FindKey() and FindSortedKey(). More...
class | csArrayElementHandler< T >
| The default element handler for csArray. More...
class | csArraySafeCopyElementHandler< T >
| Special element handler for csArray that makes sure that when the array is reallocated that the objects are properly constructed and destructed at their new position. More...
class | csArrayThresholdFixed< N >
| csArray fixed threshold for capacity handlers. More...
class | csArrayThresholdVariable
| csArray variable threshold for capacity handlers. More...
class | csComparator< T1, T2 >
| A template providing various comparison and ordering functions. More...
class | csComparator< const char *, const char * >
| csComparator<> specialization for strings that uses strcmp(). More...
class | csComparator< csString, csString >
| csComparator<> specialization for csString that uses strcmp(). More...
class | csComparator< csString, csString >
| csComparator<> specialization for csString that uses strcmp(). More...
class | csComparator< csStringBase, csStringBase >
class | csComparator< csStrKey, csStrKey >
| csComparator<> specialization for csStrKey that uses strcmp(). More...
class | csComparatorString< T >
| Template that can be used as a base class for comparators for string types. More...
class | csComparatorStruct< T >
| Template that can be used as a base class for comparators for POD (plain old data) types. More...
class | csHash< T, K, ArrayMemoryAlloc >
| A generic hash table class, which grows dynamically and whose buckets are unsorted arrays. More...
class | csHashComputer< T >
| Template for hash value computing. More...
class | csHashComputer< const char * >
| csHashComputer<> specialization for strings that uses csHashCompute(). More...
class | csHashComputer< double >
class | csHashComputer< float >
class | csHashComputer< int >
class | csHashComputer< long >
class | csHashComputer< longlong >
class | csHashComputer< ulonglong >
class | csHashComputer< unsigned int >
class | csHashComputer< unsigned long >
class | csHashComputer< void * >
| csHashComputer<> specialization for an integral type. More...
class | csHashComputer< void * >
| csHashComputer<> specialization for an integral type. More...
class | csHashComputerIntegral< T >
| Template for hash value computing, suitable for integral types and types that can be casted to such. More...
class | csHashComputerString< T >
| Template that can be used as a base class for hash computers for string types (must support cast to const char*). More...
class | csHashComputerStruct< T >
| Template that can be used as a base class for hash computers for POD structs. More...
class | csHashReversible< T, K >
| A csHash<> that maintains a reverse hash for indexing keys by values. More...
class | csMemoryPool
| A quick-allocation pool for storage of arbitrary data. More...
class | csPtrKey< T >
| A helper template to use pointers as keys for hashes. More...
class | csRedBlackTree< K >
| A red-black-tree. More...
class | csRedBlackTreeMap< K, T >
| Key-value-map, backed by csRedBlackTree. More...
class | csRedBlackTreePayload< K, T >
| Helper template to allow storage of a payload together with a key in a csRedBlackTree. More...
class | csRefArrayObject< T >
| This class implements a typed array that correctly keeps track of reference count and also is able to find by name. More...
class | csSafeCopyArray< T >
| Convenience class to make a version of csArray<> that does a safe-copy in case of reallocation of the array. More...
class | csSet< T, Allocator >
| This class implements a basic set for objects. More...
class | csStrKey
| This is a simple helper class to make a copy of a const char*. More...
struct | iArrayChangeAll< T >
| Array interface template, completely changeable. More...
struct | iArrayChangeElements< T >
| Array interface template, elements are changeable. More...
struct | iArrayReadOnly< T >
| Array interface template, read-only. More...
class | scfArray< IF, Backend >
| Implementation for iArrayReadOnly<>-, iArrayChangeElements<>- and iArrayChangeAll<>-derived interfaces, backed by a per-instance array. More...
class | scfArrayWrap< IF, Backend >
| Implementation for iArrayReadOnly<>-, iArrayChangeElements<>- and iArrayChangeAll<>-derived interfaces, backed by a reference to another array. More...
class | scfArrayWrapConst< IF, Backend >
| Implementation for iArrayReadOnly<>-derived interfaces, backed by a reference to another array. More...
## Defines
#define | SCF_IARRAYCHANGEALL_INTERFACE(Name) SCF_INTERFACE(Name, 0, 0, 1)
| Macro to define interface version of an iArrayChangeAll-derived interface.
#define | SCF_IARRAYCHANGEELEMENTS_INTERFACE(Name) SCF_INTERFACE(Name, 0, 0, 1)
| Macro to define interface version of an iArrayChangeElements-derived interface.
#define | SCF_IARRAYREADONLY_INTERFACE(Name) SCF_INTERFACE(Name, 0, 0, 1)
| Macro to define interface version of an iArrayReadOnly-derived interface.
## Functions
unsigned int | csHashCompute (char const *, size_t length)
| Compute a hash key for a string of a given length.
unsigned int | csHashCompute (char const *)
| Compute a hash key for a null-terminated string.
void | operator delete (void *, csMemoryPool *)
void | operator delete (void *, csMemoryPool &)
void * | operator new (size_t n, csMemoryPool *p)
void * | operator new (size_t n, csMemoryPool &p)
| Convenience `new` and delete operators which for allocations from a csMemoryPool rather than from the system heap.
| scfArray::scfArray (iBase *scfParent)
| scfArray::scfArray ()
| Construct with empty storage.
## Variables
const size_t | csArrayItemNotFound = (size_t)-1
| This value is returned whenever an array item could not be located or does not exist.

## Define Documentation

#define SCF_IARRAYCHANGEALL_INTERFACE | ( | Name |  | ) | SCF_INTERFACE(Name, 0, 0, 1)

Macro to define interface version of an iArrayChangeAll-derived interface.

Use this instead of SCF_INTERFACE to automatically get version number bumps for your array interface in case the base iArrayChangeAll gets extended.

Definition at line 262 of file array.h.

#define SCF_IARRAYCHANGEELEMENTS_INTERFACE | ( | Name |  | ) | SCF_INTERFACE(Name, 0, 0, 1)

Macro to define interface version of an iArrayChangeElements-derived interface.

Use this instead of SCF_INTERFACE to automatically get version number bumps for your array interface in case the base iArrayChangeElements gets extended.

Definition at line 130 of file array.h.

#define SCF_IARRAYREADONLY_INTERFACE | ( | Name |  | ) | SCF_INTERFACE(Name, 0, 0, 1)

Macro to define interface version of an iArrayReadOnly-derived interface.

Use this instead of SCF_INTERFACE to automatically get version number bumps for your array interface in case the base iArrayReadOnly gets extended.

Definition at line 93 of file array.h.

## Function Documentation

unsigned int csHashCompute | ( | char const * | ,
|  | size_t | length |
| ) |  |  |

Compute a hash key for a string of a given length.

Note that these keys are non-unique; some dissimilar strings may generate the same key. For unique keys, see csStringSet.

unsigned int csHashCompute | ( | char const * |  | ) |

Compute a hash key for a null-terminated string.

Note that these keys are non-unique; some dissimilar strings may generate the same key. For unique keys, see csStringSet.

Referenced by csHashComputerStruct< T >::ComputeHash(), csHashComputerString< const char * >::ComputeHash(), and csStrKey::GetHash().

void* operator new | ( | size_t | n,
|  | csMemoryPool & | p |
| ) |  |  | `[inline]`

Convenience `new` and delete operators which for allocations from a csMemoryPool rather than from the system heap.

For instance, if `pool` is a pointer or reference to a csMemoryPool, and you want to allocate an object of type FooBar from the csMemoryPool, then you can do this:

     FooBar* foobar = new (pool) FooBar;

It is your responsibility to delete the objects you allocate from the csMemoryPool before the csMemoryPool itself is destroyed(since it knows nothing about the objects which you placed into it). For instance, continuing the above example, before destroying `pool`, you should delete `foobar's` destructor as follows:

     delete (pool) foobar;
     // ... it is now safe to destroy `pool' ...

Remarks:
  Actually, since you cannot reclaim memory from a csMemoryPool, the delete operator is a no-op. However, even with a no-op delete, the object's destructor will be called; hence, even objects allocated from a csMemoryPool should be deleted to ensure a proper cleanup.

Definition at line 137 of file mempool.h.

References csMemoryPool::Alloc().

template<typename IF, typename Backend = csArray<typename IF::ContainedType>>

scfArray< IF, Backend >::scfArray | ( |  | ) | `[inline, inherited]`

Construct with empty storage.

Definition at line 69 of file scfarray.h.

## Variable Documentation

const size_t csArrayItemNotFound = (size_t)-1

This value is returned whenever an array item could not be located or does not exist.

Definition at line 336 of file array.h.

Referenced by csPartialOrder< csStringID >::Add(), csPartialOrder< csStringID >::AddOrder(), csPartialOrder< csStringID >::ClearMark(), csPartialOrder< csStringID >::Contains(), csPartialOrder< csStringID >::CycleTest(), csPartialOrder< csStringID >::Delete(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Delete(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::DeleteFast(), csPartialOrder< csStringID >::DeleteOrder(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::DeleteRange(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::Find(), csRefArrayObject< T >::FindByName(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::FindKey(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::FindSortedKey(), csFixedSizeAllocator< sizeof(T), Allocator >::Free(), csFixedSizeAllocator< sizeof(T), Allocator >::GetAllocationMap(), csRefArrayObject< T >::GetIndexByName(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::InsertSorted(), csPartialOrder< csStringID >::IsEnabled(), csPartialOrder< csStringID >::IsMarked(), csPartialOrder< csStringID >::Mark(), csArray< unsigned int, csArrayElementHandler< unsigned int > >::PushSmart(), csTreeNode::RemoveChild(), scfImplementation< csBaseTextureFactory >::RemoveRefOwner(), csPartialOrder< csStringID >::SanityCheck(), and csFixedSizeAllocator< sizeof(T), Allocator >::TryFree().