Go to the documentation of this file.
120 template<
unsigned nBits>
122 template<
unsigned nBits>
146 template<
unsigned nBits=1>
149 public PackedListCore,
150 private List<unsigned int>
191 inline static unsigned int max_bits();
198 inline static unsigned int packing();
201 inline static unsigned int maskLower(
unsigned offset);
208 class const_iterator;
252 inline bool empty()
const;
256 inline unsigned int get(
const label)
const;
261 inline bool set(
const label,
const unsigned int val = ~0u);
279 inline std::streamsize
byteSize()
const;
284 unsigned int count()
const;
321 inline void resize(
const label,
const unsigned int& val = 0u);
324 inline void setSize(
const label,
const unsigned int& val = 0u);
372 const bool indexedOutput=
false
389 inline unsigned int remove();
437 inline unsigned int get()
const;
440 inline bool set(
unsigned int);
475 inline unsigned int operator=(
const unsigned int val);
479 inline operator unsigned int ()
const;
617 friend Istream&
operator>> <nBits>
623 friend Ostream& operator<< <nBits>
bool unset(const label)
Unset the entry at index I. Return true if value changed.
void reset()
Clear all bits.
StaticAssert(nBits &&nBits<=(sizeof(StorageType)<< 2))
nBits must be positive (non-zero) and fit within the storage.
A class for handling words, derived from string.
unsigned int operator*() const
Return referenced value directly.
The iterator base for PackedList.
label packedLength() const
The list length when packed.
const_iterator cend() const
const_iterator set to beyond the end of the PackedList
unsigned int operator()() const
Return referenced value directly.
List< unsigned int > & storage()
Return the underlying packed storage.
Ostream & printBits(Ostream &, const bool fullOutput=false) const
Print bit patterns, optionally output unused elements.
PackedList * list_
Pointer to original list.
void operator=(const const_iterator &)
Disallow assignment from const_iterator.
static unsigned int packing()
The number of entries per packed storage element.
void setCapacity(const label)
Alter the size of the underlying storage.
unsigned int operator*() const
Return value.
void writeEntry(Ostream &) const
Write as a dictionary entry.
A simple container for copying or transferring objects of type <T>.
static unsigned int max_bits()
The max. number of bits that can be templated.
void reserve(const label)
Reserve allocation space for at least this size.
void setSize(const label, const unsigned int &val=0u)
Alias for resize()
bool operator==(const iteratorBase &) const
Compare positions (not values)
unsigned int get() const
Get value as unsigned, no range-checking.
label size_
Number of nBits entries.
static unsigned int maskLower(unsigned offset)
Masking for all bits below the offset.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
bool operator!=(const iteratorBase &) const
static unsigned int readValue(Istream &)
Read a list entry (allows for specialization)
label key() const
Return the element index corresponding to the iterator.
void setPair(Istream &)
Read an index/value pair and set accordingly.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Xfer< labelList > values() const
Return the values as a list of labels.
List< StorageType > StorageList
bool operator!=(const iteratorBase &) const
The iterator class used for PackedList.
void flip()
Invert the bits in the addressable region.
bool set(unsigned int)
Set value, returning true if changed, no range-checking.
bool writeIfSet(Ostream &) const
Write index/value for a non-zero entry.
unsigned int remove()
Remove and return the last element.
unsigned int count() const
Count number of bits set, O(log(n))
iterator begin()
Iterator set to the beginning of the PackedList.
Ostream & operator<<(Ostream &, const edgeMesh &)
unsigned int operator()() const
Return value.
bool empty() const
Return true if the list is empty (ie, size() is zero).
std::streamsize byteSize() const
Return the binary size in number of characters.
bool set(const label, const unsigned int val=~0u)
Set value at index I. Return true if value changed.
ClassName("PackedList")
Define template name and debug.
bool trim()
Trim any trailing zero elements.
unsigned int get(const label) const
Get value at index I.
Ostream & printInfo(Ostream &, const bool fullOutput=false) const
Print information and bit patterns (with printBits)
Ostream & printInfo(Ostream &) const
Print information and values.
bool operator==(const iteratorBase &) const
Compare values (not positions)
static unsigned int max_value()
The max. value for an entry, which simultaneously the bit-mask.
autoPtr< PackedList< nBits > > clone() const
Clone.
iterator end()
Iterator set to beyond the end of the PackedList.
iterator()
Construct null.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
unsigned int operator=(const iteratorBase &)
Assign value, not position.
label capacity() const
The number of elements that can be stored before reallocating.
PackedListCore()
Construct null.
iteratorBase()
Construct null.
bool operator!=(const iteratorBase &) const
PackedList< nBits > & append(const unsigned int val)
Append a value at the end of the list.
Xfer< PackedList< nBits > > xfer()
Transfer contents to the Xfer container.
const_iterator()
Construct null.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
A dynamically allocatable list of packed unsigned integers.
Istream & read(Istream &)
Clear list and read from stream.
Ostream & write(Ostream &, const bool indexedOutput=false) const
Write, optionally with indexedOutput.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
Template-invariant bits for PackedList.
Istream & operator>>(Istream &, edgeMesh &)
void resize(const label, const unsigned int &val=0u)
Reset addressable list size, does not shrink the allocated size.
void clearStorage()
Clear the list and delete storage.
PackedList()
Null constructor.
A List with indirect addressing.
void shrink()
Shrink the allocated space to what is actually used.
const_iterator & operator++()
label size() const
Number of entries.
void transfer(PackedList< nBits > &)
Transfer the contents of the argument list into this list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
The const_iterator for PackedList.
PackedList< nBits > & operator=(const unsigned int val)
Assignment of all entries to the given value. Takes linear time.
bool operator==(const iteratorBase &) const
Compare positions (not values)
const_iterator cbegin() const
const_iterator set to the beginning of the PackedList
label index_
Element index.
void clear()
Clear the list, i.e. set addressable size to zero.
const_iterator & operator--()
const_iterator & operator=(const iteratorBase &)
Assign from iteratorBase or derived.
unsigned int operator[](const label) const
Get value at index I.