This class provides a read‐only view to a map of datums (an array of DatumMapEntry objects). It holds the array by a const pointer and an integral size value. It acts as return value for accessors inside the Datum class that return a map of Datum objects. Note that zero‐size maps are valid.

Synopsis

Declared in <bdld_datum.h>

class DatumMapRef;

Type Aliases

Name

Description

SizeType

SizeType is an alias for an unsigned integral value, representing the capacity of a datum array, the capacity of a datum map, the capacity of the keys‐capacity of a datum‐key‐owning map or the length of a string.

const_iterator

Const iterator for this map reference.

const_pointer

Const pointer to a map entry.

const_reference

Const reference to a map entry.

const_reverse_iterator

Const reverse iterator for this map reference.

difference_type

Iterator difference type for this map reference.

element_type

This typedef is an alias for element_type.

iterator

Iterator for this map reference.

pointer

Pointer to a map entry.

reference

Reference to a map entry.

reverse_iterator

Reverse iterator for this map reference.

size_type

Size type for this map reference.

value_type

Value type for this map reference.

Member Functions

Name

Description

DatumMapRef [constructor]

Create a DatumMapRef object having the specified data of the specified size and the specified sorted and ownsKeys flags. The behavior is undefined unless 0 != data or 0 == size. Note that the pointer to the array is just copied.

back

Return a reference providing non‐modifiable access to the last element of the map this reference object represents. The behavior is undefined unless size() > 0.

begin

Return an iterator to the first map entry.

cbegin

Return an iterator providing non‐modifiable access to the first element of the array of map entries this reference object represents; return a past‐the‐end iterator if size() == 0.

cend

Return an iterator providing non‐modifiable access pointing past‐the‐end of the array this reference object represents.

crbegin

Return a reverse iterator providing non‐modifiable access to the last element of the array this reference object represents, and the past‐the‐end reverse iterator if size() == 0.

crend

Return a reverse iterator providing non‐modifiable access pointing past‐the‐end of the array this reference object represents.

data

Return the address providing non‐modifiable access to the first element of the map this reference object represents. Return a valid pointer which cannot be dereferenced if the size() == 0.

empty

Return size() == 0.

end

Return a past‐the‐end iterator for this map reference.

find

Return a const pointer to the datum having the specified key, if it exists and 0 otherwise. Note that the find has order of O(n) if the data is not sorted based on the keys. If the data is sorted, it has order of O(log(n)). Also note that if multiple entries with matching keys are present, which matching record is found is unspecified.

front

Return a reference providing non‐modifiable access to the first element of the map this reference object represents. The behavior is undefined unless size() > 0.

isSorted

Return true if underlying map is sorted and false otherwise.

operator[]

Return a reference providing non‐modifiable access to the element at the specified position in the array of map entries this reference object represents. The behavior is undefined unless position < size().

ownsKeys

Return true if underlying map owns the keys and false otherwise. Note that false is always returned for zero‐sized DatumMapRef.

print

Write the value of this object to the specified output stream in a human‐readable format, and return a reference to the modifiable stream. Optionally specify an initial indentation level, whose absolute value is incremented recursively for nested objects. If level is specified, optionally specify spacesPerLevel, whose absolute value indicates the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect. Note that this human‐readable format is not fully specified, and can change without notice.

rbegin

Return a reverse iterator to the last map entry.

rend

Return a past‐the‐end reverse iterator for this map reference.

size

Return a const‐pointer to the number of elements of the map this reference object represents.

operator BloombergLP::bslmf::NestedTraitDeclaration<DatumMapRef, HasPrintMethod>

DatumMapRef is trivially copyable.

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs have different values, and false otherwise. Two DatumMapRef objects have different values if they hold maps of different sizes or operator == returns false for at least one of the corresponding elements in the maps.

operator==

Return true if the specified lhs and rhs have the same value, and false otherwise. Two DatumMapRef objects have the same value if they hold maps of the same size and all the corresponding DatumMapEntry elements in the two maps also compare equal.

Created with MrDocs