Structure containing a set of chunk IDs. More...
Go to the source code of this file.
Typedefs | |
| typedef struct chunkID_set | ChunkIDSet |
Enumerations | |
| enum | chunkID_set_encoding_type { bitmap, priority } |
Functions | |
| struct chunkID_set * | chunkID_set_init (const char *config) |
| Allocate a chunk ID set. | |
| int | chunkID_set_add_chunk (struct chunkID_set *h, int chunk_id) |
| Add a chunk ID to the set. | |
| int | chunkID_set_size (const struct chunkID_set *h) |
| Get the set size. | |
| int | chunkID_set_get_chunk (const struct chunkID_set *h, int i) |
| Get a chunk ID from a set. | |
| int | chunkID_set_check (const struct chunkID_set *h, int chunk_id) |
| Check if a chunk ID is in a set. | |
| int | chunkID_set_union (struct chunkID_set *h, struct chunkID_set *a) |
| void | chunkID_set_clear (struct chunkID_set *h, int size) |
| void | chunkID_set_free (struct chunkID_set *h) |
| Clear a set and free all associated memory. | |
| int | chunkID_set_get_earliest (const struct chunkID_set *h) |
| int | chunkID_set_get_latest (const struct chunkID_set *h) |
Structure containing a set of chunk IDs.
The Chunk ID Set is an abstract data structure that can contain a set of (chunk ID, priority) couples. Few simple operations for adding chunk IDs in a set, for getting the chunk IDs present in a set, for allocating a set, and for clearing a set are provided.
| typedef struct chunkID_set ChunkIDSet |
Opaque data type representing a Chunk ID Set
| int chunkID_set_add_chunk | ( | struct chunkID_set * | h, | |
| int | chunk_id | |||
| ) |
Add a chunk ID to the set.
Insert a chunk ID, and its associated priority (the priority is assumed to depend on the insertion order), to the set. If the chunk ID is already in the set, nothing happens.
| h | a pointer to the set where the chunk ID has to be added | |
| chunk_id | the ID of the chunk to be inserted in the set |
| int chunkID_set_check | ( | const struct chunkID_set * | h, | |
| int | chunk_id | |||
| ) |
Check if a chunk ID is in a set.
| h | a pointer to the set | |
| chunk_id | the chunk ID we are searching for |
| void chunkID_set_clear | ( | struct chunkID_set * | h, | |
| int | size | |||
| ) |
Clear a set
Remove all the chunk IDs from a set.
| h | a pointer to the set | |
| size | the expected number of chunk IDs that will be stored in the set; 0 if such a number is not known. |
| void chunkID_set_free | ( | struct chunkID_set * | h | ) |
Clear a set and free all associated memory.
| h | a pointer to the set |
| int chunkID_set_get_chunk | ( | const struct chunkID_set * | h, | |
| int | i | |||
| ) |
Get a chunk ID from a set.
Return the i^th chunk ID from the set. The chunk's priority is assumed to depend on i.
| h | a pointer to the set | |
| i | the index of the chunk ID to be returned |
| struct chunkID_set* chunkID_set_init | ( | const char * | config | ) | [read] |
Allocate a chunk ID set.
Create an empty chunk ID set, and return a pointer to it.
| config | a configuration string containing tags which describe the chunk ID set. For example, the "size" tag indicates the expected number of chunk IDs that will be stored in the set; 0 or not present if such a number is not known. |
| int chunkID_set_size | ( | const struct chunkID_set * | h | ) |
Get the set size.
Return the number of chunk IDs present in a set.
| h | a pointer to the set |
| int chunkID_set_union | ( | struct chunkID_set * | h, | |
| struct chunkID_set * | a | |||
| ) |
Add chunks from a chunk ID set to another one
Insert all chunk from a chunk ID set into another one. Priority is kept in the old one. New chunks from the added one are added with lower priorities, but keeping their order.
| h | a pointer to the set where the chunk ID has to be added | |
| a | a pointer to the set which has to be added |
1.6.3