.TH "corm_constants" 3 "corm" \" -*- nroff -*- .ad l .nh .SH NAME corm_constants \- Corm constants .PP \- Constant definitions for flags and built-in types\&. .SH SYNOPSIS .br .PP .SS "Macros" .in +1c .ti -1c .RI "#define \fBCM_RECORD_MASK\fP 0x0000FF00u" .br .RI "Macro and mask for record-aware maps\&. " .ti -1c .RI "#define \fBCM_REFERENCE\fP 6" .br .RI "Record field type constants\&. " .ti -1c .RI "#define \fBCM_MULTI_REFERENCE\fP 7" .br .ti -1c .RI "#define \fBCM_VSTR\fP 8" .br .in -1c .SS "Enumerations" .in +1c .ti -1c .RI "enum \fBcorm_flags\fP { \fBCM_AINDEX\fP = 1, \fBCM_MIRROR\fP = 2, \fBCM_PGET\fP = 4, \fBCM_SORTED\fP = 8, \fBCM_MULTIVALUE\fP = 16, \fBCM_NOGROW\fP = 32 }" .br .RI "Corm flags\&. " .ti -1c .RI "enum \fBcorm_tbi\fP { \fBCM_PTR\fP = 0, \fBCM_HNDL\fP = 1, \fBCM_STR\fP = 2, \fBCM_U32\fP = 3 }" .br .RI "Built-in type identifiers\&. " .ti -1c .RI "enum \fBcorm_if\fP { \fBCM_RANGE\fP = 1, \fBCM_RANGE_GE\fP = 2 }" .br .RI "Iterator flags\&. " .in -1c .SH "Detailed Description" .PP Constant definitions for flags and built-in types\&. .PP \fBSee also\fP .RS 4 \fBCorm get, put, del and drop\fP .PP \fBcorm_assoc\fP .PP \fBCorm iteration\fP .PP \fBCorm type customization\fP .RE .PP .SH "Macro Definition Documentation" .PP .SS "#define CM_MULTI_REFERENCE 7" .br -separated positions in char[max_size]\&. .SS "#define CM_RECORD_MASK 0x0000FF00u" .PP Macro and mask for record-aware maps\&. Pass CM_RECORD(record_id) as the flags parameter to corm_open to enable record-aware access\&. The map must have ktype=CM_STR and vtype equal to the struct type ID returned by corm_record_type_id(record_id)\&. .PP When a map is record-aware, keys containing ':' are treated as composite keys "struct_key:field_name" and resolve to a pointer directly into the stored struct's pool allocation at the field's byte offset\&. This allows whole-struct storage and per-field access to coexist without data duplication\&. .SS "#define CM_REFERENCE 6" .PP Record field type constants\&. These are only meaningful as \fBcorm_record_field_t\&.type\fP values, NOT as key/value types for \fBcorm_open()\fP\&. Single uint32_t position in target's map\&. .SS "#define CM_VSTR 8" Variable-length string stored outside the struct\&. .SH "Enumeration Type Documentation" .PP .SS "enum \fBcorm_flags\fP" .PP Corm flags\&. .PP \fBEnumerator\fP .in +1c .TP \f(BICM_AINDEX \fP Auto–index for NULL keys\&. When enabled, passing NULL as the key to corm_put generates auto-incrementing IDs\&. .TP \f(BICM_MIRROR \fP Create reverse-lookup (secondary) map\&. The mirror map handle is always primary_hd + 1 and swaps keys/values\&. .PP CM_MIRROR is useful when you need bidirectional lookup (key→value and value→key) and is commonly used with file persistence\&. .PP The mirror map is automatically closed when you close the primary map via corm_close(hd)\&. .TP \f(BICM_PGET \fP For associated maps: default to obtaining primary keys instead of values\&. Used internally for mirror maps and essential for creating value→key secondary indexes\&. .PP When a secondary map has CM_PGET, \fBcorm_get()\fP returns the primary key instead of the primary value\&. This allows secondary indexes to map from values back to keys\&. .TP \f(BICM_SORTED \fP Enable sorted index support (B-tree search)\&. Enables ordered iteration\&. Index is automatically rebuilt on modifications (put/del operations mark it dirty)\&. .PP Performance Note: The sorted index is rebuilt from scratch whenever it's marked dirty and iteration is requested\&. This makes the first iteration after modifications O(n log n) instead of O(n)\&. .TP \f(BICM_MULTIVALUE \fP Allow duplicate keys in sorted maps\&. Enables multi-value lookups where multiple entries can share the same key\&. .PP REQUIRES CM_SORTED: This flag cannot be used without CM_SORTED\&. \fBcorm_open()\fP will return CM_MISS if CM_MULTIVALUE is set without CM_SORTED\&. .PP Behavior: .IP "\(bu" 2 \fBcorm_put()\fP with an existing key ADDS a new entry (does not replace) .IP "\(bu" 2 \fBcorm_get()\fP returns the FIRST matching value .IP "\(bu" 2 \fBcorm_get_multi()\fP returns cursor to iterate over ALL matching values .IP "\(bu" 2 \fBcorm_count()\fP returns the number of entries for a key .IP "\(bu" 2 \fBcorm_del()\fP deletes only the FIRST matching entry .IP "\(bu" 2 \fBcorm_del_all()\fP deletes ALL entries with the specified key .PP .PP Use Case: Secondary indexes via \fBcorm_assoc()\fP where multiple primary entries map to the same secondary key\&. .TP \f(BICM_NOGROW \fP Disable auto-grow\&. When set and the map reaches capacity, inserts return CM_MISS instead of growing the table\&. Use for memory-constrained environments or fixed-size tables\&. .SS "enum \fBcorm_if\fP" .PP Iterator flags\&. .PP \fBEnumerator\fP .in +1c .TP \f(BICM_RANGE \fP Continue iteration even if key differs from the initial\&. Behavior depends on whether CM_SORTED was set on the map: .IP "\(bu" 2 With CM_SORTED: performs ordered range scan from the starting key onwards (B-tree ordered iteration) .IP "\(bu" 2 Without CM_SORTED: performs linear scan through the hash table, comparing keys with the initial key using the type's comparison function .PP .TP \f(BICM_RANGE_GE \fP Lower-bound range: with CM_RANGE on a CM_SORTED map, start iteration at the first key >= the starting key and continue to the end (all entries in ascending key order, duplicates included)\&. Unlike plain CM_RANGE, this applies to CM_MULTIVALUE maps too (plain CM_RANGE on a MULTIVALUE map iterates only the duplicates of the one exact starting key)\&. Requires CM_SORTED; on unsorted maps it degrades to a full linear scan\&. .SS "enum \fBcorm_tbi\fP" .PP Built-in type identifiers\&. .PP \fBEnumerator\fP .in +1c .TP \f(BICM_PTR \fP Pointer (hashed)\&. .TP \f(BICM_HNDL \fP Opaque handle\&. Uses value directly as hash (no transformation)\&. .TP \f(BICM_STR \fP String contents hash and compare\&. .TP \f(BICM_U32 \fP 32-bit unsigned integer (hash and mask)\&. .SH "Author" .PP Generated automatically by Doxygen for corm from the source code\&.