8#ifndef INCLUDED_BDLC_INDEXCLERK
9#define INCLUDED_BDLC_INDEXCLERK
161#include <bdlscm_version.h>
176#include <bsl_iosfwd.h>
177#include <bsl_iterator.h>
178#include <bsl_vector.h>
195 bsl::reverse_iterator<const int *> d_index_p;
352 template <
class STREAM>
384 template <
class STREAM>
423 bsl::ostream&
print(bsl::ostream& stream,
425 int spacesPerLevel = 4)
const;
427#ifndef BDE_OMIT_INTERNAL_DEPRECATED
480: d_index_p(original.d_index_p)
489 d_index_p = rhs.d_index_p;
515#if defined(BSLS_PLATFORM_CMP_GNU) && \
516 BSLS_PLATFORM_CMP_VERSION >= 120000 && BSLS_PLATFORM_CMP_VERSION < 150000
518#pragma GCC diagnostic push
519#pragma GCC diagnostic ignored "-Warray-bounds"
524#if defined(BSLS_PLATFORM_CMP_GNU) && \
525 BSLS_PLATFORM_CMP_VERSION >= 120000 && BSLS_PLATFORM_CMP_VERSION < 150000
526#pragma GCC diagnostic pop
536 return lhs.d_index_p == rhs.d_index_p;
542 return lhs.d_index_p != rhs.d_index_p;
554: d_unusedStack(basicAllocator)
562: d_unusedStack(original.d_unusedStack, basicAllocator)
563, d_nextNewIndex(original.d_nextNewIndex)
577 d_unusedStack = rhs.d_unusedStack;
578 d_nextNewIndex = rhs.d_nextNewIndex;
585 if (d_unusedStack.
empty()) {
586 return d_nextNewIndex++;
589 int index = d_unusedStack.
back();
608 d_unusedStack.
clear();
614template <
class STREAM>
632 if (!stream || !areInvariantsPreserved(unusedStack,
nextNewIndex)) {
637 d_unusedStack = unusedStack;
648template <
class STREAM>
655 stream.putInt32(d_nextNewIndex);
657 stream, d_unusedStack, version);
670 return d_nextNewIndex -
static_cast<int>(d_unusedStack.
size());
688 return static_cast<int>(d_unusedStack.
size());
694 return d_nextNewIndex;
703#ifndef BDE_OMIT_INTERNAL_DEPRECATED
720 return lhs.d_nextNewIndex == rhs.d_nextNewIndex
721 && lhs.d_unusedStack == rhs.d_unusedStack;
727 return lhs.d_nextNewIndex != rhs.d_nextNewIndex
728 || lhs.d_unusedStack != rhs.d_unusedStack;
734 return rhs.
print(stream, 0, -1);
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlc_indexclerk.h:192
friend bool operator==(const IndexClerkIter &lhs, const IndexClerkIter &rhs)
IndexClerkIter & operator++()
Definition bdlc_indexclerk.h:494
IndexClerkIter & operator=(const IndexClerkIter &rhs)
Definition bdlc_indexclerk.h:487
IndexClerkIter()
Create an unbound iterator.
Definition bdlc_indexclerk.h:467
IndexClerkIter & operator--()
Definition bdlc_indexclerk.h:503
BSLMF_NESTED_TRAIT_DECLARATION(IndexClerkIter, bslmf::IsBitwiseCopyable)
friend bool operator!=(const IndexClerkIter &lhs, const IndexClerkIter &rhs)
int operator*() const
Definition bdlc_indexclerk.h:513
Definition bdlc_indexclerk.h:276
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlc_indexclerk.h:615
IndexClerk(bslma::Allocator *basicAllocator=0)
Definition bdlc_indexclerk.h:553
friend bool operator!=(const IndexClerk &, const IndexClerk &)
static int maxSupportedBdexVersion()
Definition bdlc_indexclerk.h:707
IndexClerk & operator=(const IndexClerk &rhs)
Definition bdlc_indexclerk.h:575
int getIndex()
Definition bdlc_indexclerk.h:583
void putIndex(int index)
Definition bdlc_indexclerk.h:596
BSLMF_NESTED_TRAIT_DECLARATION(IndexClerk, bslma::UsesBslmaAllocator)
IndexClerkIter end() const
Definition bdlc_indexclerk.h:680
int numDecommissionedIndices() const
Return the number of indices that are currently decommissioned.
Definition bdlc_indexclerk.h:686
int numCommissionedIndices() const
Return the number of indices currently in use.
Definition bdlc_indexclerk.h:668
void removeAll()
Definition bdlc_indexclerk.h:606
IndexClerkIter begin() const
Definition bdlc_indexclerk.h:674
bool isInUse(int index) const
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlc_indexclerk.h:650
int nextNewIndex() const
Definition bdlc_indexclerk.h:692
~IndexClerk()
Destroy this index clerk.
Definition bdlc_indexclerk.h:568
friend bool operator==(const IndexClerk &, const IndexClerk &)
size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the number of elements in this vector.
Definition bslstl_vector.h:2664
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2511
reference back()
Definition bslstl_vector.h:2577
bool empty() const BSLS_KEYWORD_NOEXCEPT
Return true if this vector has size 0, and false otherwise.
Definition bslstl_vector.h:2679
Definition bslstl_vector.h:1025
void push_back(const VALUE_TYPE &value)
Definition bslstl_vector.h:3760
void swap(vector &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:1712
void pop_back()
Definition bslstl_vector.h:3792
Definition bslma_allocator.h:457
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1762
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
Definition bdlc_bitarray.h:503
bool operator==(const BitArray &lhs, const BitArray &rhs)
bool operator!=(const BitArray &lhs, const BitArray &rhs)
BitArray operator<<(const BitArray &array, bsl::size_t numBits)
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1247
STREAM & bdexStreamOut(STREAM &stream, const TYPE &value)
Definition bslx_outstreamfunctions.h:992
Definition bslma_usesbslmaallocator.h:343
Definition bslmf_isbitwisecopyable.h:298