oasys::SparseBitmap< _inttype_t > Class Template Reference

#include <SparseBitmap.h>

Inheritance diagram for oasys::SparseBitmap< _inttype_t >:

oasys::Formatter oasys::SerializableObject List of all members.

Detailed Description

template<typename _inttype_t>
class oasys::SparseBitmap< _inttype_t >

This class represents a bitmap, where the implementation is biased towards space efficiency rather than lookup time.

To that end, the implementation uses a vector of bitmap entries, each storing a start and an end value.

Note that in all cases, ranges must be well-formed, i.e. the end must always be greater than start.

XXX/bowei -- this isn't a bitmap. that still needs to be implemented.

Definition at line 44 of file SparseBitmap.h.

Public Member Functions

 SparseBitmap ()
 Default constructor.
 SparseBitmap (const Builder &)
 Builder constructor.
void set (_inttype_t start, _inttype_t len=1)
 Set the given bit range to true.
void clear (_inttype_t start, _inttype_t len=1)
 Set the given bit range to false.
bool is_set (_inttype_t start, _inttype_t len=1)
 Check if the given range is set.
bool operator[] (_inttype_t val)
 Array operator overload for syntactic sugar.
_inttype_t num_set ()
 Return the total number of set bits.
bool empty ()
 Return whether or not the bitmap is empty.
size_t num_entries ()
 Return the number of range entries (for testing only).
void clear ()
 Clear the whole bitmap.
_inttype_t num_contiguous ()
 Return the total number of contiguous bits on the left of the range.
int format (char *bp, size_t len) const
 Virtual from Formatter.
void serialize (SerializeAction *a)
 Virtual from SerializableObject.
iterator begin ()
 Return an iterator at the start of the vector.
iterator end ()
 Return an iterator at the end of the vector.
_inttype_t first ()
 Syntactic sugar to get the first bit set.
_inttype_t last ()
 Syntactic sugar to get the last bit set.

Protected Types

typedef SerializableVector<
Range
RangeVector

Protected Member Functions

void validate ()

Protected Attributes

RangeVector bitmap_

Classes

class  iterator
 An STL-like iterator class. More...
class  Range


Member Typedef Documentation

template<typename _inttype_t>
typedef SerializableVector<Range> oasys::SparseBitmap< _inttype_t >::RangeVector [protected]

Definition at line 134 of file SparseBitmap.h.


Constructor & Destructor Documentation

template<typename _inttype_t>
oasys::SparseBitmap< _inttype_t >::SparseBitmap (  ) 

Default constructor.

Definition at line 277 of file SparseBitmap.h.

template<typename _inttype_t>
oasys::SparseBitmap< _inttype_t >::SparseBitmap ( const Builder  ) 

Builder constructor.

Definition at line 283 of file SparseBitmap.h.


Member Function Documentation

template<typename _inttype_t>
void oasys::SparseBitmap< _inttype_t >::set ( _inttype_t  start,
_inttype_t  len = 1 
)

Set the given bit range to true.

Definition at line 291 of file SparseBitmap.h.

template<typename _inttype_t>
void oasys::SparseBitmap< _inttype_t >::clear ( _inttype_t  start,
_inttype_t  len = 1 
)

Set the given bit range to false.

Definition at line 381 of file SparseBitmap.h.

template<typename _inttype_t>
bool oasys::SparseBitmap< _inttype_t >::is_set ( _inttype_t  start,
_inttype_t  len = 1 
)

Check if the given range is set.

Definition at line 426 of file SparseBitmap.h.

Referenced by oasys::SparseBitmap< _inttype_t >::operator[]().

template<typename _inttype_t>
bool oasys::SparseBitmap< _inttype_t >::operator[] ( _inttype_t  val  )  [inline]

Array operator overload for syntactic sugar.

Definition at line 75 of file SparseBitmap.h.

References oasys::SparseBitmap< _inttype_t >::is_set().

template<typename _inttype_t>
_inttype_t oasys::SparseBitmap< _inttype_t >::num_set (  ) 

Return the total number of set bits.

Definition at line 453 of file SparseBitmap.h.

template<typename _inttype_t>
bool oasys::SparseBitmap< _inttype_t >::empty (  )  [inline]

Return whether or not the bitmap is empty.

Definition at line 88 of file SparseBitmap.h.

References oasys::SparseBitmap< _inttype_t >::bitmap_.

template<typename _inttype_t>
size_t oasys::SparseBitmap< _inttype_t >::num_entries (  )  [inline]

Return the number of range entries (for testing only).

Definition at line 93 of file SparseBitmap.h.

References oasys::SparseBitmap< _inttype_t >::bitmap_.

template<typename _inttype_t>
void oasys::SparseBitmap< _inttype_t >::clear (  )  [inline]

Clear the whole bitmap.

Definition at line 98 of file SparseBitmap.h.

References oasys::SparseBitmap< _inttype_t >::bitmap_.

template<typename _inttype_t>
_inttype_t oasys::SparseBitmap< _inttype_t >::num_contiguous (  ) 

Return the total number of contiguous bits on the left of the range.

Definition at line 441 of file SparseBitmap.h.

template<typename _inttype_t>
int oasys::SparseBitmap< _inttype_t >::format ( char *  bp,
size_t  len 
) const [virtual]

Virtual from Formatter.

Implements oasys::Formatter.

Definition at line 466 of file SparseBitmap.h.

template<typename _inttype_t>
void oasys::SparseBitmap< _inttype_t >::serialize ( SerializeAction a  )  [virtual]

Virtual from SerializableObject.

Implements oasys::SerializableObject.

Definition at line 493 of file SparseBitmap.h.

template<typename _inttype_t>
void oasys::SparseBitmap< _inttype_t >::validate (  )  [protected]

Definition at line 510 of file SparseBitmap.h.

template<typename _inttype_t>
SparseBitmap< _inttype_t >::iterator oasys::SparseBitmap< _inttype_t >::begin (  ) 

Return an iterator at the start of the vector.

Definition at line 689 of file SparseBitmap.h.

Referenced by oasys::SparseBitmap< _inttype_t >::first().

template<typename _inttype_t>
SparseBitmap< _inttype_t >::iterator oasys::SparseBitmap< _inttype_t >::end (  ) 

Return an iterator at the end of the vector.

Definition at line 697 of file SparseBitmap.h.

Referenced by oasys::SparseBitmap< _inttype_t >::last().

template<typename _inttype_t>
_inttype_t oasys::SparseBitmap< _inttype_t >::first (  )  [inline]

Syntactic sugar to get the first bit set.

Definition at line 246 of file SparseBitmap.h.

References oasys::SparseBitmap< _inttype_t >::begin().

template<typename _inttype_t>
_inttype_t oasys::SparseBitmap< _inttype_t >::last (  )  [inline]

Syntactic sugar to get the last bit set.

Definition at line 251 of file SparseBitmap.h.

References oasys::SparseBitmap< _inttype_t >::end().


Member Data Documentation

template<typename _inttype_t>
RangeVector oasys::SparseBitmap< _inttype_t >::bitmap_ [protected]

Definition at line 135 of file SparseBitmap.h.

Referenced by oasys::SparseBitmap< _inttype_t >::clear(), oasys::SparseBitmap< _inttype_t >::empty(), and oasys::SparseBitmap< _inttype_t >::num_entries().


The documentation for this class was generated from the following file:
Generated on Thu Jun 7 12:54:37 2007 for DTN Reference Implementation by  doxygen 1.5.1