distortos  v0.4.0
object-oriented C++ RTOS for microcontrollers
distortos::test::OperationCountingType Class Reference

#include <OperationCountingType.hpp>

Public Types

using Value = unsigned int
 type used for OperationCountingType's "value" More...
 

Public Member Functions

 OperationCountingType (const Value value={})
 OperationCountingType's constructor. More...
 
 OperationCountingType (const OperationCountingType &other)
 OperationCountingType's copy constructor. More...
 
 OperationCountingType (OperationCountingType &&other)
 OperationCountingType's move constructor. More...
 
 ~OperationCountingType ()
 OperationCountingType's destructor. More...
 
OperationCountingTypeoperator= (const OperationCountingType &other)
 OperationCountingType's copy assignment. More...
 
OperationCountingTypeoperator= (OperationCountingType &&other)
 OperationCountingType's move assignment. More...
 
Value getValue () const
 

Static Public Member Functions

static bool checkCounters (size_t constructed, size_t copyConstructed, size_t moveConstructed, size_t destructed, size_t copyAssigned, size_t moveAssigned, size_t swapped)
 Checks value of counters. More...
 
static void resetCounters ()
 Resets value of all counters. More...
 

Private Attributes

Value value_
 value held by object More...
 

Static Private Attributes

static size_t constructed_
 counter of constructor calls since last resetCounters() call More...
 
static size_t copyConstructed_
 counter of copy constructor calls since last resetCounters() call More...
 
static size_t moveConstructed_
 counter of move constructor calls since last resetCounters() call More...
 
static size_t destructed_
 counter of destructor calls since last resetCounters() call More...
 
static size_t copyAssigned_
 counter of copy assignment calls since last resetCounters() call More...
 
static size_t moveAssigned_
 counter of move assignment calls since last resetCounters() call More...
 
static size_t swapped_
 counter of swap calls since last resetCounters() call More...
 

Friends

void swap (OperationCountingType &left, OperationCountingType &right)
 OperationCountingType's swap overload. More...
 
bool operator== (const OperationCountingType &left, const OperationCountingType &right)
 Equality comparison operator for OperationCountingType. More...
 

Detailed Description

OperationCountingType class counts important operations (construction, destruction, assignment, swap) in static variables; counting is not thread-safe!

Member Typedef Documentation

◆ Value

type used for OperationCountingType's "value"

Constructor & Destructor Documentation

◆ OperationCountingType() [1/3]

distortos::test::OperationCountingType::OperationCountingType ( const Value  value = {})
inlineexplicit

OperationCountingType's constructor.

Parameters
[in]valueis the value held by object, default - zero

◆ OperationCountingType() [2/3]

distortos::test::OperationCountingType::OperationCountingType ( const OperationCountingType other)
inline

OperationCountingType's copy constructor.

Parameters
[in]otheris a reference to OperationCountingType object used as source of copy

◆ OperationCountingType() [3/3]

distortos::test::OperationCountingType::OperationCountingType ( OperationCountingType &&  other)
inline

OperationCountingType's move constructor.

Parameters
[in]otheris a rvalue reference to OperationCountingType object used as source of move

◆ ~OperationCountingType()

distortos::test::OperationCountingType::~OperationCountingType ( )
inline

OperationCountingType's destructor.

Member Function Documentation

◆ checkCounters()

bool distortos::test::OperationCountingType::checkCounters ( size_t  constructed,
size_t  copyConstructed,
size_t  moveConstructed,
size_t  destructed,
size_t  copyAssigned,
size_t  moveAssigned,
size_t  swapped 
)
static

Checks value of counters.

Parameters
[in]constructedis expected number of constructor calls since last resetCounters() call
[in]copyConstructedis expected number of copy constructor calls since last resetCounters() call
[in]moveConstructedis expected number of move constructor calls since last resetCounters() call
[in]destructedis expected number of destructor calls since last resetCounters() call
[in]copyAssignedis expected number of copy assignment calls since last resetCounters() call
[in]moveAssignedis expected number of move assignment calls since last resetCounters() call
[in]swappedis expected number of swap calls since last resetCounters() call
Returns
true if counters match expected values, false otherwise
Here is the caller graph for this function:

◆ getValue()

Value distortos::test::OperationCountingType::getValue ( ) const
inline
Returns
value held by object
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

OperationCountingType& distortos::test::OperationCountingType::operator= ( const OperationCountingType other)
inline

OperationCountingType's copy assignment.

Parameters
[in]otheris a reference to OperationCountingType object used as source of copy assignment
Returns
reference to this

◆ operator=() [2/2]

OperationCountingType& distortos::test::OperationCountingType::operator= ( OperationCountingType &&  other)
inline

OperationCountingType's move assignment.

Parameters
[in]otheris a rvalue reference to OperationCountingType object used as source of move assignment
Returns
reference to this

◆ resetCounters()

void distortos::test::OperationCountingType::resetCounters ( )
static

Resets value of all counters.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator==

bool operator== ( const OperationCountingType left,
const OperationCountingType right 
)
friend

Equality comparison operator for OperationCountingType.

Parameters
[in]leftis a reference to left operand of equality comparison
[in]rightis a reference to right operand of equality comparison
Returns
true if operands are equal, false otherwise

◆ swap

void swap ( OperationCountingType left,
OperationCountingType right 
)
friend

OperationCountingType's swap overload.

Parameters
[in]leftis a reference to first OperationCountingType object
[in]rightis a reference to second OperationCountingType object

Member Data Documentation

◆ constructed_

size_t distortos::test::OperationCountingType::constructed_
staticprivate

counter of constructor calls since last resetCounters() call

◆ copyAssigned_

size_t distortos::test::OperationCountingType::copyAssigned_
staticprivate

counter of copy assignment calls since last resetCounters() call

◆ copyConstructed_

size_t distortos::test::OperationCountingType::copyConstructed_
staticprivate

counter of copy constructor calls since last resetCounters() call

◆ destructed_

size_t distortos::test::OperationCountingType::destructed_
staticprivate

counter of destructor calls since last resetCounters() call

◆ moveAssigned_

size_t distortos::test::OperationCountingType::moveAssigned_
staticprivate

counter of move assignment calls since last resetCounters() call

◆ moveConstructed_

size_t distortos::test::OperationCountingType::moveConstructed_
staticprivate

counter of move constructor calls since last resetCounters() call

◆ swapped_

size_t distortos::test::OperationCountingType::swapped_
staticprivate

counter of swap calls since last resetCounters() call

◆ value_

Value distortos::test::OperationCountingType::value_
private

value held by object


The documentation for this class was generated from the following files: