* If you are storing structs, you may want to be able to get a pointer to the data actually stored in the dmt (see find_zero). To do this, use the second template parameter:
* If you are storing structs (or you want to edit what is stored), you may want to be able to get a pointer to the data actually stored in the dmt (see find_zero). To do this, use the second template parameter:
* Effect: Return the size (in bytes) of the dmt, as it resides in main memory. If the data stored are pointers, don't include the size of what they all point to.
* Effect: Return the size (in bytes) of the dmt, as it resides in main memory.
* If the data stored are pointers, don't include the size of what they all point to.
* //TODO(leif or yoni): (maybe rename and) return memory footprint instead of allocated size
*/
*/
size_tmemory_size(void);
size_tmemory_size(void);
// Returns whether all values in the dmt are known to be the same size.
// Note:
// There are no false positives, but false negatives are allowed.
// A false negative can happen if this dmt had 2 (or more) different size values,
// and then enough were deleted so that all the remaining ones are the same size.
// Once that happens, this dmt will never again return true for this function unless/until
// ::clear() is called
boolvalue_length_is_fixed(void)const;
boolvalue_length_is_fixed(void)const;
// If this dmt is empty, return value is undefined.
// else if value_length_is_fixed() then it returns the fixed length.
// else returns 0
uint32_tget_fixed_length(void)const;
uint32_tget_fixed_length(void)const;
// Preprocesses the dmt so that serialization can happen quickly.
// After this call, serialize_values() can be called but no other mutator function can be called in between.
voidprepare_for_serialize(void);
voidprepare_for_serialize(void);
private:
private:
...
@@ -544,29 +577,49 @@ class dmt {
...
@@ -544,29 +577,49 @@ class dmt {
structdmt_treet;
structdmt_treet;
}d;
}d;
// Returns pad bytes per element (for alignment) or 0 if not fixed length.