## Public API Reference

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

# Containers
[Utilities]

## Classes

class | csArray< T, ElementHandler, MemoryAllocator >
| A templated array class. 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 | csArrayMemoryAllocator< T >
| The default allocator for csArray. 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 >
| 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 | csSafeCopyArray< T >
| Convenience class to make a version of csArray<> that does a safe-copy in case of reallocation of the array. More...
class | csSafeCopyArrayMemoryAllocator< T, ElementHandler >
| Special allocator 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 | csSet< T >
| 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...

## Defines

#define | csArrayCmpDecl(T1, T2) csArrayCmp<T1,T2>
#define | csArrayCmpInvoke(C, R) C(R)
#define | csArrayTemplate(K) template <class K>

## 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 new (size_t n, csMemoryPool *p)
void * | operator new (size_t n, csMemoryPool &p)
| Convenience `new` operator which makes the allocation from a csMemoryPool rather than from the system heap.

## Variables

const size_t | csArrayItemNotFound = (size_t)-1
| This value is returned whenever an array item could not be located or does not exist.

## 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` operator which makes the allocation 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 invoke the destructor of 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 invoke `foobar's` destructor as follows:

     foobar->~FooBar();
     // ... it is now safe to destroy `pool' ...

Definition at line 136 of file mempool.h.

References csMemoryPool::Alloc().

## 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 286 of file array.h.

Referenced by csPartialOrder< csHandlerID >::Add(), csPartialOrder< csHandlerID >::AddOrder(), csPartialOrder< csHandlerID >::ClearMark(), csPartialOrder< csHandlerID >::Contains(), csPartialOrder< csHandlerID >::CycleTest(), csPartialOrder< csHandlerID >::Delete(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::Delete(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::DeleteFast(), csPartialOrder< csHandlerID >::DeleteOrder(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::DeleteRange(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::Find(), csRefArrayObject< T >::FindByName(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::FindKey(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::FindSortedKey(), csBlockAllocator< csBSPTree >::Free(), csBlockAllocator< csBSPTree >::GetAllocationMap(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::InsertSorted(), csPartialOrder< csHandlerID >::IsEnabled(), csPartialOrder< csHandlerID >::IsMarked(), csPartialOrder< csHandlerID >::Mark(), csArray< csShaderVariable *, csRefArrayElementHandler< csShaderVariable * > >::PushSmart(), csTreeNode::RemoveChild(), scfImplementation< csBaseTextureFactory >::RemoveRefOwner(), and csPartialOrder< csHandlerID >::SanityCheck().