mimic++ v10.0.1
Loading...
Searching...
No Matches
mimicpp::expectation::Registry Class Reference

Central management type for all expectations. More...

#include <Registry.hpp>

Public Types

using Ptr = std::shared_ptr<Registry>

Public Member Functions

 Registry (Registry const &)=delete
 Deleted copy-constructor.
Registry & operator= (Registry const &)=delete
 Deleted copy-assignment-operator.
 Registry (Registry &&)=delete
 Deleted move-constructor.
Registry & operator= (Registry &&)=delete
 Deleted move-assignment-operator.
 ~Registry ()=default
 Defaulted destructor.
 Registry ()=default
 Defaulted default constructor.
template<typename... Args>
requires std::constructible_from<Expectation, Args...>
Expectation create (Args &&... args)
 Creates a new expectation from the given arguments.
void remove (Expectation const &expectation)
 Removes the given expectation from the internal storage.
template<typename Signature>
signature_return_type_t< Signature > handle_call (reporting::TargetReport target, call::info_for_signature_t< Signature > call)
 Handles the incoming call.

Detailed Description

Central management type for all expectations.

This type is responsible for actually creating expectations and needs to be informed about incoming calls. Eventually, it needs to get notified when expectations are no longer valid candidates and shall be removed.

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ Registry() [1/3]

mimicpp::expectation::Registry::Registry ( Registry const & )
delete

Deleted copy-constructor.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Registry() [2/3]

mimicpp::expectation::Registry::Registry ( Registry && )
nodiscarddelete

Deleted move-constructor.

Here is the call graph for this function:

◆ ~Registry()

mimicpp::expectation::Registry::~Registry ( )
default

Defaulted destructor.

◆ Registry() [3/3]

mimicpp::expectation::Registry::Registry ( )
nodiscarddefault

Defaulted default constructor.

Member Function Documentation

◆ create()

template<typename... Args>
requires std::constructible_from<Expectation, Args...>
Expectation mimicpp::expectation::Registry::create ( Args &&... args)
inlinenodiscard

Creates a new expectation from the given arguments.

Parameters
argsThe expectation construction arguments.

◆ handle_call()

template<typename Signature>
signature_return_type_t< Signature > mimicpp::expectation::Registry::handle_call ( reporting::TargetReport target,
call::info_for_signature_t< Signature > call )
inlinenodiscard

Handles the incoming call.

Parameters
targetThe mock-target, which received the call.
callThe call to be handled.
Returns
Returns an appropriate result from the matched expectation.

This function queries all stored expectations, whether they accept the call. If multiple matches are possible, the best match is selected and a "matched"-report is emitted. If no matches are found, "no matched"-report is emitted and the call is aborted (e.g. by throwing an exception or terminating). If matches are possible, but all expectations are saturated, an "inapplicable match"-report is emitted.

Here is the call graph for this function:

◆ operator=() [1/2]

Registry & mimicpp::expectation::Registry::operator= ( Registry && )
delete

Deleted move-assignment-operator.

Here is the call graph for this function:

◆ operator=() [2/2]

Registry & mimicpp::expectation::Registry::operator= ( Registry const & )
delete

Deleted copy-assignment-operator.

Here is the call graph for this function:

◆ remove()

void mimicpp::expectation::Registry::remove ( Expectation const & expectation)
inline

Removes the given expectation from the internal storage.

Parameters
expectationThe expectation to be removed.

This function also checks whether the removed expectation is satisfied. If not, an unfulfilled expectation- report is emitted.

Attention
Removing an expectation, which is not an element of this Registry, is undefined behavior.

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