8#ifndef INCLUDED_BDLC_PACKEDINTARRAY
9#define INCLUDED_BDLC_PACKEDINTARRAY
194#include <bdlscm_version.h>
211#include <bsl_cstddef.h>
212#include <bsl_cstdint.h>
213#include <bsl_cstring.h>
214#include <bsl_limits.h>
215#include <bsl_iosfwd.h>
217#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
225template <
class TYPE>
class PackedIntArray;
227template <
class TYPE>
class PackedIntArrayConstIterator;
229template <
class TYPE> PackedIntArrayConstIterator<TYPE>
285 template <
class STREAM>
286 static void bdexGet8(STREAM& stream, bsl::int8_t& variable);
290 template <
class STREAM>
291 static void bdexGet16(STREAM& stream, bsl::int16_t& variable);
295 template <
class STREAM>
296 static void bdexGet32(STREAM& stream, bsl::int32_t& variable);
300 template <
class STREAM>
301 static void bdexGet64(STREAM& stream, bsl::int64_t& variable);
305 template <
class STREAM>
306 static void bdexPut8(STREAM& stream, bsl::int8_t value);
310 template <
class STREAM>
311 static void bdexPut16(STREAM& stream, bsl::int16_t value);
315 template <
class STREAM>
316 static void bdexPut32(STREAM& stream, bsl::int32_t value);
320 template <
class STREAM>
321 static void bdexPut64(STREAM& stream, bsl::int64_t value);
349 template <
class STREAM>
350 static void bdexGet8(STREAM& stream, bsl::uint8_t& variable);
354 template <
class STREAM>
355 static void bdexGet16(STREAM& stream, bsl::uint16_t& variable);
359 template <
class STREAM>
360 static void bdexGet32(STREAM& stream, bsl::uint32_t& variable);
364 template <
class STREAM>
365 static void bdexGet64(STREAM& stream, bsl::uint64_t& variable);
369 template <
class STREAM>
370 static void bdexPut8(STREAM& stream, bsl::uint8_t value);
374 template <
class STREAM>
375 static void bdexPut16(STREAM& stream, bsl::uint16_t value);
379 template <
class STREAM>
380 static void bdexPut32(STREAM& stream, bsl::uint32_t value);
384 template <
class STREAM>
385 static void bdexPut64(STREAM& stream, bsl::uint64_t value);
403template <
class STORAGE>
418 bsl::size_t d_length;
420 int d_bytesPerElement;
423 bsl::size_t d_capacityInBytes;
432 static bsl::size_t nextCapacityGE(bsl::size_t minValue, bsl::size_t value);
440 void expandImp(
int requiredBytesPerElement,
441 bsl::size_t requiredCapacityInBytes);
447 void replaceImp(bsl::size_t dstIndex,
ElementType value);
459 void replaceImp(
void *dst,
460 bsl::size_t dstIndex,
461 int dstBytesPerElement,
463 bsl::size_t srcIndex,
464 int srcBytesPerElement,
465 bsl::size_t numElements);
470 char *address()
const;
483 int requiredBytesPerElement(bsl::size_t index,
484 bsl::size_t numElements)
const;
544 bsl::size_t srcIndex,
545 bsl::size_t numElements);
557 template <
class STREAM>
584 bsl::size_t srcIndex,
585 bsl::size_t numElements);
599 void remove(bsl::size_t dstIndex);
606 void remove(bsl::size_t dstIndex, bsl::size_t numElements);
627 bsl::size_t srcIndex,
628 bsl::size_t numElements);
664 void resize(bsl::size_t numElements);
688 template <
class STREAM>
710 bsl::size_t
length()
const;
723 bsl::ostream&
print(bsl::ostream& stream,
725 int spacesPerLevel = 4)
const;
1004template <
class TYPE>
1013template <
class TYPE>
1021template <
class TYPE>
1029template <
class TYPE>
1047template <
class TYPE>
1054 static const bsl::size_t k_MAX_BYTES_PER_ELEMENT = 8;
1123 bsl::size_t srcIndex,
1124 bsl::size_t numElements);
1136 template <
class STREAM>
1143 void insert(bsl::size_t dstIndex, TYPE value);
1168 bsl::size_t srcIndex,
1169 bsl::size_t numElements);
1190 void remove(bsl::size_t dstIndex, bsl::size_t numElements);
1220 bsl::size_t srcIndex,
1221 bsl::size_t numElements);
1283 template <
class STREAM>
1336 bsl::ostream&
print(bsl::ostream& stream,
1338 int spacesPerLevel = 4)
const;
1348template <
class TYPE>
1356template <
class TYPE>
1365template <
class TYPE>
1374template <
class TYPE>
1380template <
class HASHALG,
class TYPE>
1391template <
class STREAM>
1396 variable =
static_cast<bsl::int8_t
>(v);
1399template <
class STREAM>
1401 bsl::int16_t& variable)
1405 variable =
static_cast<bsl::int16_t
>(v);
1408template <
class STREAM>
1410 bsl::int32_t& variable)
1414 variable =
static_cast<bsl::int32_t
>(v);
1417template <
class STREAM>
1419 bsl::int64_t& variable)
1423 variable =
static_cast<bsl::int64_t
>(v);
1426template <
class STREAM>
1429 stream.putInt8(
static_cast<int>(value));
1432template <
class STREAM>
1435 stream.putInt16(
static_cast<int>(value));
1438template <
class STREAM>
1441 stream.putInt32(
static_cast<int>(value));
1444template <
class STREAM>
1454template <
class STREAM>
1456 bsl::uint8_t& variable)
1460 variable =
static_cast<bsl::uint8_t
>(v);
1463template <
class STREAM>
1465 bsl::uint16_t& variable)
1468 stream.getUint16(v);
1469 variable =
static_cast<bsl::uint16_t
>(v);
1472template <
class STREAM>
1474 bsl::uint32_t& variable)
1477 stream.getUint32(v);
1478 variable =
static_cast<bsl::uint32_t
>(v);
1481template <
class STREAM>
1483 bsl::uint64_t& variable)
1486 stream.getUint64(v);
1487 variable =
static_cast<bsl::uint64_t
>(v);
1490template <
class STREAM>
1493 stream.putUint8(
static_cast<unsigned int>(value));
1496template <
class STREAM>
1499 stream.putUint16(
static_cast<unsigned int>(value));
1502template <
class STREAM>
1505 stream.putUint32(
static_cast<unsigned int>(value));
1508template <
class STREAM>
1519template <
class STORAGE>
1526 static const bsl::size_t k_TOP_CAPACITY = k_MAX_CAPACITY / 3 * 2 - 3;
1533 while (value < minValue) {
1534 value += (value + 3) / 2;
1541template <
class STORAGE>
1543char *PackedIntArrayImp<STORAGE>::address()
const
1545 return static_cast<char *
>(d_storage_p);
1549template <
class STORAGE>
1557template <
class STORAGE>
1562 append(srcArray, 0, srcArray.d_length);
1565template <
class STORAGE>
1566template <
class STREAM>
1573 int tmpBytesPerElement;
1577 tmpBytesPerElement =
static_cast<int>(v);
1579 if ( 1 != tmpBytesPerElement
1580 && 2 != tmpBytesPerElement
1581 && 4 != tmpBytesPerElement
1582 && 8 != tmpBytesPerElement) {
1583 stream.invalidate();
1586 bsl::size_t tmpLength;
1589 stream.getLength(v);
1590 tmpLength =
static_cast<bsl::size_t
>(v);
1593 bsl::size_t numBytes = tmpBytesPerElement * tmpLength;
1594 if (numBytes > d_capacityInBytes) {
1597 bsl::size_t requiredCapacityInBytes =
1598 nextCapacityGE(numBytes, d_capacityInBytes);
1602 d_allocator_p->allocate(requiredCapacityInBytes);
1606 d_allocator_p->deallocate(d_storage_p);
1611 d_capacityInBytes = requiredCapacityInBytes;
1616 d_bytesPerElement = tmpBytesPerElement;
1617 d_length = tmpLength;
1621 switch (d_bytesPerElement) {
1623 typename STORAGE::OneByteStorageType *s =
1624 static_cast<typename STORAGE::OneByteStorageType *
>
1626 for (bsl::size_t i = 0; i < d_length; ++i) {
1627 STORAGE::bdexGet8(stream, s[i]);
1631 typename STORAGE::TwoByteStorageType *s =
1632 static_cast<typename STORAGE::TwoByteStorageType *
>
1634 for (bsl::size_t i = 0; i < d_length; ++i) {
1635 STORAGE::bdexGet16(stream, s[i]);
1639 typename STORAGE::FourByteStorageType *s =
1640 static_cast<typename STORAGE::FourByteStorageType *
>
1642 for (bsl::size_t i = 0; i < d_length; ++i) {
1643 STORAGE::bdexGet32(stream, s[i]);
1647 typename STORAGE::EightByteStorageType *s =
1648 static_cast<typename STORAGE::EightByteStorageType *
>
1650 for (bsl::size_t i = 0; i < d_length; ++i) {
1651 STORAGE::bdexGet64(stream, s[i]);
1659 stream.invalidate();
1666template <
class STORAGE>
1669 bsl::size_t dstIndex,
1674 insert(dstIndex, srcArray, 0, srcArray.
length());
1677template <
class STORAGE>
1686template <
class STORAGE>
1693template <
class STORAGE>
1699 remove(dstIndex, 1);
1702template <
class STORAGE>
1705 bsl::size_t numElements)
1711 d_length -= numElements;
1714 bsl::memmove(address() + dstIndex * d_bytesPerElement,
1715 address() + (dstIndex + numElements) * d_bytesPerElement,
1716 (d_length - dstIndex) * d_bytesPerElement);
1720template <
class STORAGE>
1725 d_bytesPerElement = 1;
1728template <
class STORAGE>
1733 BSLS_ASSERT(k_MAX_CAPACITY / d_bytesPerElement >= numElements);
1735 size_t requiredCapacityInBytes = d_bytesPerElement * numElements;
1736 if (requiredCapacityInBytes > d_capacityInBytes) {
1737 reserveCapacityImp(requiredCapacityInBytes);
1741template <
class STORAGE>
1748 int requiredBytesPerElement = d_bytesPerElement;
1750 int rbpe = STORAGE::requiredBytesPerElement(maxValue);
1751 if (rbpe > requiredBytesPerElement) {
1752 requiredBytesPerElement = rbpe;
1756 BSLS_ASSERT(k_MAX_CAPACITY / requiredBytesPerElement >= numElements);
1758 size_t requiredCapacityInBytes = requiredBytesPerElement * numElements;
1760 if (requiredCapacityInBytes > d_capacityInBytes) {
1761 reserveCapacityImp(requiredCapacityInBytes);
1771 int requiredBytesPerElement = d_bytesPerElement;
1774 if (rbpe > requiredBytesPerElement) {
1775 requiredBytesPerElement = rbpe;
1779 BSLS_ASSERT(k_MAX_CAPACITY / requiredBytesPerElement >= numElements);
1781 size_t requiredCapacityInBytes = requiredBytesPerElement * numElements;
1783 if (requiredCapacityInBytes > d_capacityInBytes) {
1784 reserveCapacityImp(requiredCapacityInBytes);
1788template <
class STORAGE>
1796 int requiredBytesPerElement = d_bytesPerElement;
1798 int rbpe = STORAGE::requiredBytesPerElement(maxValue);
1799 if (rbpe > requiredBytesPerElement) {
1800 requiredBytesPerElement = rbpe;
1803 rbpe = STORAGE::requiredBytesPerElement(minValue);
1804 if (rbpe > requiredBytesPerElement) {
1805 requiredBytesPerElement = rbpe;
1809 BSLS_ASSERT(k_MAX_CAPACITY / requiredBytesPerElement >= numElements);
1811 size_t requiredCapacityInBytes = requiredBytesPerElement * numElements;
1813 if (requiredCapacityInBytes > d_capacityInBytes) {
1814 reserveCapacityImp(requiredCapacityInBytes);
1818template <
class STORAGE>
1822 if (numElements > d_length) {
1823 reserveCapacity(numElements);
1824 bsl::memset(address() + d_length * d_bytesPerElement,
1826 (numElements - d_length) * d_bytesPerElement);
1828 d_length = numElements;
1831template <
class STORAGE>
1835 BSLS_ASSERT(d_allocator_p == other.d_allocator_p);
1844template <
class STORAGE>
1848 return d_allocator_p;
1851template <
class STORAGE>
1852template <
class STREAM>
1860 stream.putInt8(d_bytesPerElement);
1861 stream.putLength(
static_cast<int>(d_length));
1862 switch (d_bytesPerElement) {
1864 typename STORAGE::OneByteStorageType *s =
1865 static_cast<typename STORAGE::OneByteStorageType *
>
1867 for (bsl::size_t i = 0; i < d_length; ++i) {
1868 STORAGE::bdexPut8(stream, s[i]);
1872 typename STORAGE::TwoByteStorageType *s =
1873 static_cast<typename STORAGE::TwoByteStorageType *
>
1875 for (bsl::size_t i = 0; i < d_length; ++i) {
1876 STORAGE::bdexPut16(stream, s[i]);
1880 typename STORAGE::FourByteStorageType *s =
1881 static_cast<typename STORAGE::FourByteStorageType *
>
1883 for (bsl::size_t i = 0; i < d_length; ++i) {
1884 STORAGE::bdexPut32(stream, s[i]);
1888 typename STORAGE::EightByteStorageType *s =
1889 static_cast<typename STORAGE::EightByteStorageType *
>
1891 for (bsl::size_t i = 0; i < d_length; ++i) {
1892 STORAGE::bdexPut64(stream, s[i]);
1898 stream.invalidate();
1905template <
class STORAGE>
1908 return d_bytesPerElement;
1911template <
class STORAGE>
1914 return d_capacityInBytes / d_bytesPerElement;
1917template <
class STORAGE>
1920 return 0 == d_length;
1923template <
class STORAGE>
1928 if (d_length == other.d_length) {
1929 if (0 == d_length) {
1932 else if (d_bytesPerElement == other.d_bytesPerElement) {
1933 return 0 == bsl::memcmp(d_storage_p,
1935 d_length * d_bytesPerElement);
1938 return isEqualImp(other);
1944template <
class STORAGE>
1956template <
class TYPE>
1959 const ImpType *array,
1968template <
class TYPE>
1976template <
class TYPE>
1980: d_array_p(original.d_array_p)
1981, d_index(original.d_index)
1986template <
class TYPE>
1991 d_array_p = rhs.d_array_p;
1992 d_index = rhs.d_index;
1996template <
class TYPE>
2008template <
class TYPE>
2020template <
class TYPE>
2031 || d_array_p->length() - d_index >= bsl::size_t(offset));
2037template <
class TYPE>
2048 || d_array_p->length() - d_index >= bsl::size_t(-offset));
2055template <
class TYPE>
2062 return static_cast<TYPE
>((*d_array_p)[d_index]);
2065template <
class TYPE>
2075template <
class TYPE>
2085 || d_array_p->length() - d_index > bsl::size_t(offset));
2087 return static_cast<TYPE
>((*d_array_p)[d_index + offset]);
2090template <
class TYPE>
2101 || d_array_p->length() - d_index >= bsl::size_t(offset));
2107template <
class TYPE>
2118 || d_array_p->length() - d_index >= bsl::size_t(-offset));
2126template <
class TYPE>
2129 PackedIntArrayConstIterator<TYPE>& iter,
2135 const PackedIntArrayConstIterator<TYPE> curr = iter;
2140template <
class TYPE>
2143 PackedIntArrayConstIterator<TYPE>& iter,
2149 const PackedIntArrayConstIterator<TYPE> curr = iter;
2154template <
class TYPE>
2157 const PackedIntArrayConstIterator<TYPE>& rhs)
2159 return lhs.d_array_p == rhs.d_array_p && lhs.d_index == rhs.d_index;
2162template <
class TYPE>
2165 const PackedIntArrayConstIterator<TYPE>& rhs)
2167 return lhs.d_array_p != rhs.d_array_p || lhs.d_index != rhs.d_index;
2170template <
class TYPE>
2172bsl::ptrdiff_t
bdlc::operator-(
const PackedIntArrayConstIterator<TYPE>& lhs,
2173 const PackedIntArrayConstIterator<TYPE>& rhs)
2178 lhs.d_index >= rhs.d_index
2179 ? lhs.d_index - rhs.d_index <=
2180 bsl::size_t(bsl::numeric_limits<bsl::ptrdiff_t>::max())
2181 : rhs.d_index - lhs.d_index <=
2182 bsl::size_t(
bsl::numeric_limits<
bsl::ptrdiff_t>::min()));
2184 return static_cast<bsl::ptrdiff_t
>(lhs.d_index - rhs.d_index);
2187template <
class TYPE>
2190 const PackedIntArrayConstIterator<TYPE>& rhs)
2194 return lhs.d_index < rhs.d_index;
2197template <
class TYPE>
2200 const PackedIntArrayConstIterator<TYPE>& rhs)
2204 return lhs.d_index <= rhs.d_index;
2207template <
class TYPE>
2210 const PackedIntArrayConstIterator<TYPE>& rhs)
2214 return lhs.d_index > rhs.d_index;
2217template <
class TYPE>
2220 const PackedIntArrayConstIterator<TYPE>& rhs)
2224 return lhs.d_index >= rhs.d_index;
2234template <
class TYPE>
2238 return ImpType::maxSupportedBdexVersion(serializationVersion);
2242template <
class TYPE>
2245: d_imp(basicAllocator)
2249template <
class TYPE>
2255 static_cast<typename
ImpType::ElementType>(value),
2260template <
class TYPE>
2265: d_imp(original.d_imp, basicAllocator)
2269template <
class TYPE>
2276template <
class TYPE>
2285template <
class TYPE>
2289 d_imp.append(
static_cast<typename ImpType::ElementType
>(value));
2292template <
class TYPE>
2296 d_imp.append(srcArray.d_imp);
2299template <
class TYPE>
2302 bsl::size_t srcIndex,
2303 bsl::size_t numElements)
2310 d_imp.append(srcArray.d_imp, srcIndex, numElements);
2313template <
class TYPE>
2314template <
class STREAM>
2318 return d_imp.bdexStreamIn(stream, version);
2321template <
class TYPE>
2327 d_imp.insert(dstIndex,
static_cast<typename ImpType::ElementType
>(value));
2330template <
class TYPE>
2335 insert(dst.d_index, value);
2339template <
class TYPE>
2346 d_imp.insert(dstIndex, srcArray.d_imp);
2349template <
class TYPE>
2353 bsl::size_t srcIndex,
2354 bsl::size_t numElements)
2363 d_imp.insert(dstIndex, srcArray.d_imp, srcIndex, numElements);
2366template <
class TYPE>
2375template <
class TYPE>
2379 d_imp.push_back(
static_cast<typename ImpType::ElementType
>(value));
2382template <
class TYPE>
2388 d_imp.remove(dstIndex);
2391template <
class TYPE>
2394 bsl::size_t numElements)
2400 d_imp.remove(dstIndex, numElements);
2403template <
class TYPE>
2410 remove(dstFirst.d_index, dstLast.d_index - dstFirst.d_index);
2414template <
class TYPE>
2421template <
class TYPE>
2427 d_imp.replace(dstIndex,
static_cast<typename ImpType::ElementType
>(value));
2430template <
class TYPE>
2434 bsl::size_t srcIndex,
2435 bsl::size_t numElements)
2446 d_imp.replace(dstIndex, srcArray.d_imp, srcIndex, numElements);
2449template <
class TYPE>
2455 ImpType::k_MAX_CAPACITY / k_MAX_BYTES_PER_ELEMENT >= numElements);
2457 d_imp.reserveCapacityImp(numElements * k_MAX_BYTES_PER_ELEMENT);
2460template <
class TYPE>
2468 d_imp.reserveCapacity(numElements, maxValue);
2471template <
class TYPE>
2479 d_imp.reserveCapacity(numElements, minValue, maxValue);
2482template <
class TYPE>
2486 d_imp.resize(numElements);
2489template <
class TYPE>
2495 d_imp.swap(other.d_imp);
2499template <
class TYPE>
2505 return static_cast<TYPE
>(d_imp[index]);
2508template <
class TYPE>
2512 return d_imp.allocator();
2515template <
class TYPE>
2521 return static_cast<TYPE
>(d_imp[length() - 1]);
2524template <
class TYPE>
2525template <
class STREAM>
2529 return d_imp.bdexStreamOut(stream, version);
2532template <
class TYPE>
2540template <
class TYPE>
2544 return d_imp.bytesPerElement();
2547template <
class TYPE>
2551 return d_imp.capacity();
2554template <
class TYPE>
2561template <
class TYPE>
2567 return static_cast<TYPE
>(d_imp[0]);
2570template <
class TYPE>
2574 return d_imp.isEmpty();
2577template <
class TYPE>
2581 return d_imp.isEqual(other.d_imp);
2584template <
class TYPE>
2588 return d_imp.length();
2591template <
class TYPE>
2594 int spacesPerLevel)
const
2596 return d_imp.print(stream, level, spacesPerLevel);
2602template <
class TYPE>
2605 const PackedIntArray<TYPE>& array)
2607 return array.
print(stream);
2610template <
class TYPE>
2613 const PackedIntArray<TYPE>& rhs)
2615 return lhs.isEqual(rhs);
2618template <
class TYPE>
2621 const PackedIntArray<TYPE>& rhs)
2623 return !(lhs == rhs);
2627template <
class TYPE>
2628void bdlc::swap(PackedIntArray<TYPE>& a, PackedIntArray<TYPE>& b)
2630 if (a.allocator() == b.allocator()) {
2636 PackedIntArray<TYPE> futureA(b, a.allocator());
2637 PackedIntArray<TYPE> futureB(a, b.allocator());
2644template <
class HASHALG,
class TYPE>
2648 using ::BloombergLP::bslh::hashAppend;
2649 typedef typename PackedIntArray<TYPE>::const_iterator ci_t;
2651 for (ci_t b = input.begin(), e = input.end(); b != e; ++b) {
2662template <
class STORAGE>
2666template <
class TYPE>
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlc_packedintarray.h:770
friend bsl::ptrdiff_t operator-(const PackedIntArrayConstIterator &, const PackedIntArrayConstIterator &)
PackedIntArrayConstIterator & operator=(const PackedIntArrayConstIterator &rhs)
Definition bdlc_packedintarray.h:1989
PackedIntArrayConstIterator & operator-=(bsl::ptrdiff_t offset)
Definition bdlc_packedintarray.h:2040
TYPE value_type
Definition bdlc_packedintarray.h:831
bsl::ptrdiff_t difference_type
Definition bdlc_packedintarray.h:818
TYPE operator*() const
Definition bdlc_packedintarray.h:2057
TYPE operator[](bsl::ptrdiff_t offset) const
Definition bdlc_packedintarray.h:2077
friend PackedIntArrayConstIterator operator--(PackedIntArrayConstIterator &, int)
PackedIntArrayConstIterator & operator+=(bsl::ptrdiff_t offset)
Definition bdlc_packedintarray.h:2023
PackedIntArrayConstIterator operator+(bsl::ptrdiff_t offset) const
Definition bdlc_packedintarray.h:2093
bsl::size_t size_type
Definition bdlc_packedintarray.h:824
void * pointer
Definition bdlc_packedintarray.h:836
friend PackedIntArrayConstIterator operator++(PackedIntArrayConstIterator &, int)
~PackedIntArrayConstIterator()=default
TYPE operator->() const
Definition bdlc_packedintarray.h:2067
TYPE & reference
Definition bdlc_packedintarray.h:841
PackedIntArrayConstIterator()
Definition bdlc_packedintarray.h:1970
Definition bdlc_packedintarray.h:404
bool isEqual(const PackedIntArrayImp &other) const
Definition bdlc_packedintarray.h:1925
~PackedIntArrayImp()
Destroy this object.
PackedIntArrayImp(bslma::Allocator *basicAllocator=0)
void swap(PackedIntArrayImp &other)
Definition bdlc_packedintarray.h:1833
bsl::size_t length() const
Return number of elements in this array.
Definition bdlc_packedintarray.h:1946
void append(const PackedIntArrayImp &srcArray, bsl::size_t srcIndex, bsl::size_t numElements)
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlc_packedintarray.h:1568
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlc_packedintarray.h:1854
void insert(bsl::size_t dstIndex, ElementType value)
bslma::Allocator * allocator() const
Return the allocator used by this array to supply memory.
Definition bdlc_packedintarray.h:1846
PackedIntArrayImp & operator=(const PackedIntArrayImp &rhs)
PackedIntArrayImp(const PackedIntArrayImp &original, bslma::Allocator *basicAllocator=0)
static int maxSupportedBdexVersion(int serializationVersion)
Definition bdlc_packedintarray.h:1551
bsl::size_t capacity() const
Definition bdlc_packedintarray.h:1913
void reserveCapacity(bsl::size_t numElements)
Definition bdlc_packedintarray.h:1730
void reserveCapacityImp(bsl::size_t requiredCapacityInBytes)
void insert(bsl::size_t dstIndex, const PackedIntArrayImp &srcArray, bsl::size_t srcIndex, bsl::size_t numElements)
void replace(bsl::size_t dstIndex, const PackedIntArrayImp &srcArray, bsl::size_t srcIndex, bsl::size_t numElements)
void pop_back()
Definition bdlc_packedintarray.h:1679
static const bsl::size_t k_MAX_CAPACITY
Definition bdlc_packedintarray.h:411
void append(ElementType value)
int bytesPerElement() const
Definition bdlc_packedintarray.h:1907
void remove(bsl::size_t dstIndex)
Definition bdlc_packedintarray.h:1695
void push_back(ElementType value)
Definition bdlc_packedintarray.h:1688
void replace(bsl::size_t dstIndex, ElementType value)
bool isEmpty() const
Definition bdlc_packedintarray.h:1919
void resize(bsl::size_t numElements)
Definition bdlc_packedintarray.h:1820
ElementType operator[](bsl::size_t index) const
void removeAll()
Definition bdlc_packedintarray.h:1722
STORAGE::EightByteStorageType ElementType
Definition bdlc_packedintarray.h:408
PackedIntArrayImp(bsl::size_t numElements, ElementType value=0, bslma::Allocator *basicAllocator=0)
Definition bdlc_packedintarray.h:1048
const_iterator end() const
Definition bdlc_packedintarray.h:2556
void pop_back()
Definition bdlc_packedintarray.h:2368
void append(const PackedIntArray &srcArray)
Definition bdlc_packedintarray.h:2294
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdlc_packedintarray.h:2527
const_iterator begin() const
Definition bdlc_packedintarray.h:2535
void reserveCapacity(bsl::size_t numElements, TYPE maxValue)
Definition bdlc_packedintarray.h:2462
bool isEmpty() const
Definition bdlc_packedintarray.h:2572
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdlc_packedintarray.h:2316
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bdlc_packedintarray.h:2592
bsl::size_t capacity() const
Definition bdlc_packedintarray.h:2549
void replace(bsl::size_t dstIndex, const PackedIntArray &srcArray, bsl::size_t srcIndex, bsl::size_t numElements)
Definition bdlc_packedintarray.h:2432
void swap(PackedIntArray &other)
Definition bdlc_packedintarray.h:2491
void append(const PackedIntArray &srcArray, bsl::size_t srcIndex, bsl::size_t numElements)
Definition bdlc_packedintarray.h:2301
void insert(bsl::size_t dstIndex, const PackedIntArray &srcArray, bsl::size_t srcIndex, bsl::size_t numElements)
Definition bdlc_packedintarray.h:2351
PackedIntArray(bslma::Allocator *basicAllocator=0)
Definition bdlc_packedintarray.h:2244
void removeAll()
Definition bdlc_packedintarray.h:2416
PackedIntArrayConstIterator< TYPE > const_iterator
Definition bdlc_packedintarray.h:1064
void resize(bsl::size_t numElements)
Definition bdlc_packedintarray.h:2484
static int maxSupportedBdexVersion(int serializationVersion)
Definition bdlc_packedintarray.h:2236
bsl::size_t length() const
Return number of elements in this array.
Definition bdlc_packedintarray.h:2586
TYPE back() const
Definition bdlc_packedintarray.h:2517
void reserveCapacity(bsl::size_t numElements)
Definition bdlc_packedintarray.h:2451
void push_back(TYPE value)
Definition bdlc_packedintarray.h:2377
TYPE front() const
Definition bdlc_packedintarray.h:2563
PackedIntArray(const PackedIntArray &original, bslma::Allocator *basicAllocator=0)
Definition bdlc_packedintarray.h:2262
void insert(bsl::size_t dstIndex, const PackedIntArray &srcArray)
Definition bdlc_packedintarray.h:2341
PackedIntArray(bsl::size_t numElements, TYPE value=0, bslma::Allocator *basicAllocator=0)
Definition bdlc_packedintarray.h:2251
~PackedIntArray()
Destroy this object.
Definition bdlc_packedintarray.h:2271
void append(TYPE value)
Definition bdlc_packedintarray.h:2287
TYPE value_type
Definition bdlc_packedintarray.h:1062
void insert(bsl::size_t dstIndex, TYPE value)
Definition bdlc_packedintarray.h:2323
const_iterator remove(const_iterator dstFirst, const_iterator dstLast)
Definition bdlc_packedintarray.h:2406
PackedIntArray & operator=(const PackedIntArray &rhs)
Definition bdlc_packedintarray.h:2278
bslma::Allocator * allocator() const
Return the allocator used by this array to supply memory.
Definition bdlc_packedintarray.h:2510
void remove(bsl::size_t dstIndex)
Definition bdlc_packedintarray.h:2384
TYPE operator[](bsl::size_t index) const
Definition bdlc_packedintarray.h:2501
int bytesPerElement() const
Definition bdlc_packedintarray.h:2542
const_iterator insert(const_iterator dst, TYPE value)
Definition bdlc_packedintarray.h:2333
void remove(bsl::size_t dstIndex, bsl::size_t numElements)
Definition bdlc_packedintarray.h:2393
void replace(bsl::size_t dstIndex, TYPE value)
Definition bdlc_packedintarray.h:2423
bool isEqual(const PackedIntArray &other) const
Definition bdlc_packedintarray.h:2579
void reserveCapacity(bsl::size_t numElements, TYPE minValue, TYPE maxValue)
Definition bdlc_packedintarray.h:2473
static void swap(T *a, T *b)
Definition bslalg_swaputil.h:194
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
void hashAppend(HASH_ALGORITHM &hashAlg, const baljsn::EncoderTestAddress &object)
Definition baljsn_encoder_testtypes.h:9236
Definition bdlc_bitarray.h:503
CompactedArray_ConstIterator< TYPE > operator--(CompactedArray_ConstIterator< TYPE > &, int)
void hashAppend(HASHALG &hashAlg, const CompactedArray< TYPE > &input)
Pass the specified input to the specified hashAlg.
void swap(BitArray &a, BitArray &b)
bool operator>(const CompactedArray_ConstIterator< TYPE > &, const CompactedArray_ConstIterator< TYPE > &)
bool operator<=(const CompactedArray_ConstIterator< TYPE > &, const CompactedArray_ConstIterator< TYPE > &)
bool operator==(const BitArray &lhs, const BitArray &rhs)
bool operator>=(const CompactedArray_ConstIterator< TYPE > &, const CompactedArray_ConstIterator< TYPE > &)
bool operator!=(const BitArray &lhs, const BitArray &rhs)
bool operator<(const CompactedArray_ConstIterator< TYPE > &, const CompactedArray_ConstIterator< TYPE > &)
BitArray operator-(const BitArray &lhs, const BitArray &rhs)
CompactedArray_ConstIterator< TYPE > operator++(CompactedArray_ConstIterator< TYPE > &, int)
BitArray operator<<(const BitArray &array, bsl::size_t numBits)
Definition bdlb_printmethods.h:283
Definition balxml_encoderoptions.h:68
Definition bdlc_packedintarray.h:737
bsl::conditional< bsl::is_same< TYPE, unsignedchar >::value||bsl::is_same< TYPE, unsignedshort >::value||bsl::is_same< TYPE, unsignedint >::value||bsl::is_same< TYPE, unsignedlongint >::value||bsl::is_same< TYPE, bsls::Types::Uint64 >::value||bsl::is_same< TYPE, bsl::uint8_t >::value||bsl::is_same< TYPE, bsl::uint16_t >::value||bsl::is_same< TYPE, bsl::uint32_t >::value||bsl::is_same< TYPE, bsl::uint64_t >::value, PackedIntArrayImp< PackedIntArrayImp_Unsigned >, PackedIntArrayImp< PackedIntArrayImp_Signed > >::type Type
Definition bdlc_packedintarray.h:751
Definition bdlc_packedintarray.h:273
bsl::int8_t OneByteStorageType
Definition bdlc_packedintarray.h:276
static void bdexPut16(STREAM &stream, bsl::int16_t value)
Definition bdlc_packedintarray.h:1433
bsl::int64_t EightByteStorageType
Definition bdlc_packedintarray.h:279
static void bdexGet64(STREAM &stream, bsl::int64_t &variable)
Definition bdlc_packedintarray.h:1418
static void bdexGet16(STREAM &stream, bsl::int16_t &variable)
Definition bdlc_packedintarray.h:1400
static void bdexGet32(STREAM &stream, bsl::int32_t &variable)
Definition bdlc_packedintarray.h:1409
bsl::int16_t TwoByteStorageType
Definition bdlc_packedintarray.h:277
static void bdexGet8(STREAM &stream, bsl::int8_t &variable)
Definition bdlc_packedintarray.h:1392
static int requiredBytesPerElement(EightByteStorageType value)
Return the required number of bytes to store the specified value.
static void bdexPut32(STREAM &stream, bsl::int32_t value)
Definition bdlc_packedintarray.h:1439
static void bdexPut64(STREAM &stream, bsl::int64_t value)
Definition bdlc_packedintarray.h:1445
bsl::int32_t FourByteStorageType
Definition bdlc_packedintarray.h:278
static void bdexPut8(STREAM &stream, bsl::int8_t value)
Definition bdlc_packedintarray.h:1427
Definition bdlc_packedintarray.h:337
static void bdexGet16(STREAM &stream, bsl::uint16_t &variable)
Definition bdlc_packedintarray.h:1464
bsl::uint8_t OneByteStorageType
Definition bdlc_packedintarray.h:340
static void bdexGet64(STREAM &stream, bsl::uint64_t &variable)
Definition bdlc_packedintarray.h:1482
bsl::uint16_t TwoByteStorageType
Definition bdlc_packedintarray.h:341
static void bdexPut16(STREAM &stream, bsl::uint16_t value)
Definition bdlc_packedintarray.h:1497
static void bdexGet8(STREAM &stream, bsl::uint8_t &variable)
Definition bdlc_packedintarray.h:1455
static void bdexPut32(STREAM &stream, bsl::uint32_t value)
Definition bdlc_packedintarray.h:1503
static void bdexGet32(STREAM &stream, bsl::uint32_t &variable)
Definition bdlc_packedintarray.h:1473
bsl::uint32_t FourByteStorageType
Definition bdlc_packedintarray.h:342
bsl::uint64_t EightByteStorageType
Definition bdlc_packedintarray.h:343
static int requiredBytesPerElement(EightByteStorageType value)
Return the required number of bytes to store the specified value.
static void bdexPut8(STREAM &stream, bsl::uint8_t value)
Definition bdlc_packedintarray.h:1491
static void bdexPut64(STREAM &stream, bsl::uint64_t value)
Definition bdlc_packedintarray.h:1509
Definition bslmf_conditional.h:120
Definition bslmf_integralconstant.h:244
Definition bslmf_issame.h:146
Definition bslma_usesbslmaallocator.h:343
unsigned long long Uint64
Definition bsls_types.h:137
long long Int64
Definition bsls_types.h:132