Quick Links:

bal | bbl | bdl | bsl

Public Types | Public Member Functions

bdld::DatumIntMapRef Class Reference

#include <bdld_datum.h>

List of all members.

Public Types

typedef Datum::SizeType SizeType

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (DatumIntMapRef, bsl::is_trivially_copyable)
 BSLMF_NESTED_TRAIT_DECLARATION (DatumIntMapRef, bdlb::HasPrintMethod)
 DatumIntMapRef (const DatumIntMapEntry *data, SizeType size, bool sorted)
 ~DatumIntMapRef ()
const DatumIntMapEntryoperator[] (SizeType index) const
const DatumIntMapEntrydata () const
bool isSorted () const
SizeType size () const
const Datumfind (int 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 DatumIntMapEntry 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::DatumIntMapRef::DatumIntMapRef ( const DatumIntMapEntry data,
SizeType  size,
bool  sorted 
)

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

bdld::DatumIntMapRef::~DatumIntMapRef (  ) 

Member Function Documentation

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

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

const DatumIntMapEntry* bdld::DatumIntMapRef::data (  )  const

Return pointer to the first element in the map.

bool bdld::DatumIntMapRef::isSorted (  )  const

Return true if underlying map is sorted and false otherwise.

SizeType bdld::DatumIntMapRef::size (  )  const

Return the size of the map.

const Datum* bdld::DatumIntMapRef::find ( int  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::DatumIntMapRef::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: