BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlm_instancecount

Detailed Description

Outline

Purpose

Provide a type specific instance count.

Deprecated:
This component is not ready for public use.

Classes

Description

This component provides a mechanism, bdlm::InstanceCount, for providing type specific instance counts.

Thread Safety

This class is thread-safe (see {bsldoc_glossary |Thread-Safe}).

Usage

This section illustrates intended use of this component.

Example 1: Using bdlm::InstanceCount

This example demonstrates the usage of bdlm::InstanceCount to obtain type specific instance counts.

First, we obtain and verify the instance counts for a few types:

assert(1 == bdlm::InstanceCount::nextInstanceNumber<char>());
assert(1 == bdlm::InstanceCount::nextInstanceNumber<int>());
assert(1 == bdlm::InstanceCount::nextInstanceNumber<double>());

Then, we obtain and verify the instance counts for the previous types and some new types:

assert(2 == bdlm::InstanceCount::nextInstanceNumber<char>());
assert(2 == bdlm::InstanceCount::nextInstanceNumber<int>());
assert(1 == bdlm::InstanceCount::nextInstanceNumber<unsigned>());
assert(1 == bdlm::InstanceCount::nextInstanceNumber<float>());
assert(2 == bdlm::InstanceCount::nextInstanceNumber<double>());

Finally, we obtain and verify the next instance counts for these types:

assert(3 == bdlm::InstanceCount::nextInstanceNumber<char>());
assert(3 == bdlm::InstanceCount::nextInstanceNumber<int>());
assert(2 == bdlm::InstanceCount::nextInstanceNumber<unsigned>());
assert(2 == bdlm::InstanceCount::nextInstanceNumber<float>());
assert(3 == bdlm::InstanceCount::nextInstanceNumber<double>());