Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

bdld::DatumMapRef Class Reference

#include <bdld_datum.h>

List of all members.

Public Types

typedef Datum::SizeType SizeType

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (DatumMapRef, bsl::is_trivially_copyable)
 BSLMF_NESTED_TRAIT_DECLARATION (DatumMapRef, bdlb::HasPrintMethod)
 DatumMapRef (const DatumMapEntry *data, SizeType size, bool sorted, bool ownsKeys)
 ~DatumMapRef ()
const DatumMapEntryoperator[] (SizeType index) const
const DatumMapEntrydata () const
bool isSorted () const
bool ownsKeys () const
SizeType size () const
const Datumfind (const bslstl::StringRef &key) const
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const

Detailed Description

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.

See Component bdld_datum


Member Typedef Documentation


Constructor & Destructor Documentation

bdld::DatumMapRef::DatumMapRef ( const DatumMapEntry data,
SizeType  size,
bool  sorted,
bool  ownsKeys 
)

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.

bdld::DatumMapRef::~DatumMapRef (  ) 

Member Function Documentation

bdld::DatumMapRef::BSLMF_NESTED_TRAIT_DECLARATION ( DatumMapRef  ,
bsl::is_trivially_copyable   
)
bdld::DatumMapRef::BSLMF_NESTED_TRAIT_DECLARATION ( DatumMapRef  ,
bdlb::HasPrintMethod   
)
const DatumMapEntry& bdld::DatumMapRef::operator[] ( SizeType  index  )  const

Return the element stored at the specified index position in this map. The behavior is undefined unless index < size().

const DatumMapEntry* bdld::DatumMapRef::data (  )  const

Return pointer to the first element in the map.

bool bdld::DatumMapRef::isSorted (  )  const

Return true if underlying map is sorted and false otherwise.

bool bdld::DatumMapRef::ownsKeys (  )  const

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

SizeType bdld::DatumMapRef::size (  )  const

Return the size of the map.

const Datum* bdld::DatumMapRef::find ( const bslstl::StringRef key  )  const

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.

bsl::ostream& bdld::DatumMapRef::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

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.


The documentation for this class was generated from the following file: