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;
360 template <
class STREAM>
395 template <
class STREAM>
437 bsl::ostream&
print(bsl::ostream& stream,
439 int spacesPerLevel = 4)
const;
441#ifndef BDE_OMIT_INTERNAL_DEPRECATED
494: d_index_p(original.d_index_p)
503 d_index_p = rhs.d_index_p;
529#if defined(BSLS_PLATFORM_CMP_GNU) && \
530 BSLS_PLATFORM_CMP_VERSION >= 120000 && BSLS_PLATFORM_CMP_VERSION < 150000
532#pragma GCC diagnostic push
533#pragma GCC diagnostic ignored "-Warray-bounds"
538#if defined(BSLS_PLATFORM_CMP_GNU) && \
539 BSLS_PLATFORM_CMP_VERSION >= 120000 && BSLS_PLATFORM_CMP_VERSION < 150000
540#pragma GCC diagnostic pop
550 return lhs.d_index_p == rhs.d_index_p;
556 return lhs.d_index_p !=
rhs.d_index_p;
568: d_unusedStack(basicAllocator)
576: d_unusedStack(original.d_unusedStack, basicAllocator)
577, d_nextNewIndex(original.d_nextNewIndex)
591 d_unusedStack = rhs.d_unusedStack;
592 d_nextNewIndex = rhs.d_nextNewIndex;
599 if (d_unusedStack.
empty()) {
600 return d_nextNewIndex++;
603 int index = d_unusedStack.
back();
622 d_unusedStack.
clear();
628template <
class STREAM>
646 if (!stream || !areInvariantsPreserved(unusedStack,
nextNewIndex)) {
651 d_unusedStack = unusedStack;
662template <
class STREAM>
669 stream.putInt32(d_nextNewIndex);
671 stream, d_unusedStack, version);
684 return d_nextNewIndex -
static_cast<int>(d_unusedStack.
size());
702 return static_cast<int>(d_unusedStack.
size());
708 return d_nextNewIndex;
717#ifndef BDE_OMIT_INTERNAL_DEPRECATED
734 return lhs.d_nextNewIndex == rhs.d_nextNewIndex
735 && lhs.d_unusedStack == rhs.d_unusedStack;
741 return lhs.d_nextNewIndex !=
rhs.d_nextNewIndex
742 ||
lhs.d_unusedStack !=
rhs.d_unusedStack;
748 return rhs.print(stream, 0, -1);
Definition bdlc_indexclerk.h:192
friend bool operator==(const IndexClerkIter &lhs, const IndexClerkIter &rhs)
IndexClerkIter & operator++()
Definition bdlc_indexclerk.h:508
IndexClerkIter & operator=(const IndexClerkIter &rhs)
Definition bdlc_indexclerk.h:501
IndexClerkIter()
Create an unbound iterator.
Definition bdlc_indexclerk.h:481
IndexClerkIter & operator--()
Definition bdlc_indexclerk.h:517
BSLMF_NESTED_TRAIT_DECLARATION(IndexClerkIter, bslmf::IsBitwiseCopyable)
friend bool operator!=(const IndexClerkIter &lhs, const IndexClerkIter &rhs)
int operator*() const
Definition bdlc_indexclerk.h:527
Definition bdlc_indexclerk.h:281
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlc_indexclerk.h:629
IndexClerk(bslma::Allocator *basicAllocator=0)
Definition bdlc_indexclerk.h:567
friend bool operator!=(const IndexClerk &, const IndexClerk &)
static int maxSupportedBdexVersion()
Definition bdlc_indexclerk.h:721
IndexClerk & operator=(const IndexClerk &rhs)
Definition bdlc_indexclerk.h:589
int getIndex()
Definition bdlc_indexclerk.h:597
void putIndex(int index)
Definition bdlc_indexclerk.h:610
BSLMF_NESTED_TRAIT_DECLARATION(IndexClerk, bslma::UsesBslmaAllocator)
IndexClerkIter end() const
Definition bdlc_indexclerk.h:694
int numDecommissionedIndices() const
Return the number of indices that are currently decommissioned.
Definition bdlc_indexclerk.h:700
int numCommissionedIndices() const
Return the number of indices currently in use.
Definition bdlc_indexclerk.h:682
void removeAll()
Definition bdlc_indexclerk.h:620
IndexClerkIter begin() const
Definition bdlc_indexclerk.h:688
bool isInUse(int index) const
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlc_indexclerk.h:664
int nextNewIndex() const
Definition bdlc_indexclerk.h:706
~IndexClerk()
Destroy this index clerk.
Definition bdlc_indexclerk.h:582
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:3019
iterator begin() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:2866
reference back()
Definition bslstl_vector.h:2932
bool empty() const BSLS_KEYWORD_NOEXCEPT
Return true if this vector has size 0, and false otherwise.
Definition bslstl_vector.h:3034
Definition bslstl_vector.h:1120
void push_back(const VALUE_TYPE &value)
Definition bslstl_vector.h:4343
void swap(vector &other) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(AllocatorTraits void clear() BSLS_KEYWORD_NOEXCEPT
Definition bslstl_vector.h:1938
void pop_back()
Definition bslstl_vector.h:4375
Definition bslma_allocator.h:545
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_ASSERT_SAFE(X)
Definition bsls_assert.h:1917
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
Definition bdlc_bitarray.h:506
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)
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
STREAM & bdexStreamIn(STREAM &stream, VALUE_TYPE &variable)
Definition bslx_instreamfunctions.h:1263
STREAM & bdexStreamOut(STREAM &stream, const TYPE &value)
Definition bslx_outstreamfunctions.h:1004
Definition bslma_usesbslmaallocator.h:344
Definition bslmf_isbitwisecopyable.h:298