GCGlib
0.04.228
GCG Graphics Engine
|
Union type for defining digital keys for data map classes. The data maps might use fixed or variable length keys and a careful reading of their documentation is recommended. In general, a key is assumed a digital sequence that can be null terminated strings or a sequence of bytes with fixed size. In this case the bit sequence is assumed to be MSB first from the leftmost bit of the leftmost byte to the rightmost ones (lexicographic order). In general, keys having size up to sizeof(intptr_t), i.e. integers that fit within the same number of bits of a pointer, are copied for performance purposes. For simplicity, the bit sequence is also assumed to be the MSB first from leftmost bit of the word to the rightmost bit. If the keys are null terminated strings or fixed size greater than sizeof(intptr_t), their contents are not copied: only the pointer to the actual key is stored internally. If used as a pointer to the actual key, it can point to any memory region holding the digital sequence. However, its content must NEVER change while in use. The behaviour of the data map is undefined if that happens. A common practice is to point to an internal attribute of the corresponding gcgDATA instance. For ease of use, several constructors are provided for integer keys. Examples of use: trie->insert((int) b, data); // Implicit conversion from int to void* in pkey trie->insert(100L, data); // Implicit conversion from long to void* in pkey trie->insert(str, data); // Implicit conversion from char* to void* in pkey trie->insert(&key, data); // Implicit conversion from class* to void* in pkey trie->search((long long) a); trie->search(GCGDIGITALKEY(188));. More...
#include <gcg.h>
Public Attributes | |
void * | pkey |
Points to the actual key (null terminated strings or fixed integer keys with size greater than sizeof(intptr_t)), or the actual integer value, otherwise. | |
intptr_t | intkey |
Maximum integer key: guaranteed to be the same number of bits of a pointer. | |
long | lkey |
The key as a long integer: guaranteed to have at least 32 bits in C. It has 32 bits in x86-64 machines. | |
int | ikey |
The key as an integer: guaranteed to have at least 16 bits in C. It has 32 bits in x86-64 machines. | |
short | skey |
The key as a short integer: guaranteed to have at least 16 bits in C. It has 16 bits in x86-64 machines. | |
char | ckey |
The key as a char: guaranteed to have at least CHAR_BIT bits in C. It has 8 bits in x86-64 machines. | |
Union type for defining digital keys for data map classes. The data maps might use fixed or variable length keys and a careful reading of their documentation is recommended. In general, a key is assumed a digital sequence that can be null terminated strings or a sequence of bytes with fixed size. In this case the bit sequence is assumed to be MSB first from the leftmost bit of the leftmost byte to the rightmost ones (lexicographic order). In general, keys having size up to sizeof(intptr_t), i.e. integers that fit within the same number of bits of a pointer, are copied for performance purposes. For simplicity, the bit sequence is also assumed to be the MSB first from leftmost bit of the word to the rightmost bit. If the keys are null terminated strings or fixed size greater than sizeof(intptr_t), their contents are not copied: only the pointer to the actual key is stored internally. If used as a pointer to the actual key, it can point to any memory region holding the digital sequence. However, its content must NEVER change while in use. The behaviour of the data map is undefined if that happens. A common practice is to point to an internal attribute of the corresponding gcgDATA instance. For ease of use, several constructors are provided for integer keys. Examples of use: trie->insert((int) b, data); // Implicit conversion from int to void* in pkey trie->insert(100L, data); // Implicit conversion from long to void* in pkey trie->insert(str, data); // Implicit conversion from char* to void* in pkey trie->insert(&key, data); // Implicit conversion from class* to void* in pkey trie->search((long long) a); trie->search(GCGDIGITALKEY(188));.