PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | List of all members
Arp::Plc::Domain::Commons::DualDomain< T > Class Template Reference

This class adapts a domain structure, which shall be doubled for supporting download-changes. More...

#include <DualDomain.hxx>

Public Types

using Domain = T
 

Public Member Functions

template<class ... Args>
 DualDomain (Args &&... args)
 Constructs an DualDomain instance. More...
 
T & Get (bool backgroundDomain)
 Gets a reference to one of the domain instances. More...
 
const T & Get (bool backgroundDomain) const
 Gets a reference of one of the domain instances. More...
 
void SwapDomains (bool simulate)
 Swaps the domains, so that the foreground domain becomes the background domain and vice versa. More...
 

Detailed Description

template<class T>
class Arp::Plc::Domain::Commons::DualDomain< T >

This class adapts a domain structure, which shall be doubled for supporting download-changes.

Template Parameters
TThe type of the domain to be doubled. This type shall derive from DomainBase.

Constructor & Destructor Documentation

◆ DualDomain()

template<class T >
template<class ... Args>
Arp::Plc::Domain::Commons::DualDomain< T >::DualDomain ( Args &&...  args)
inlineexplicit

Constructs an DualDomain instance.

Parameters
...argsThe constructor arguments, which shall be passed to the adapted domain.

The arguments are passed to the foreground domain as well as to the background domain.

There is no perfect forwarding of the arguments here. They have to be passed to both domains. Using std::forward on both would to lead to pass moved-from objects to domain2. Using std::forward only on domain2 might call different constructors on domain1 and domain2. So no std::forward ist used and only lvalues are passed to both domains.

Member Function Documentation

◆ Get() [1/2]

template<class T >
T & Arp::Plc::Domain::Commons::DualDomain< T >::Get ( bool  backgroundDomain)
inline

Gets a reference to one of the domain instances.

Parameters
backgroundDomaintrue if the background domain shall be returned, otherwise false.
Returns
One of the domain instances depending on the boolean parameter.

◆ Get() [2/2]

template<class T >
const T & Arp::Plc::Domain::Commons::DualDomain< T >::Get ( bool  backgroundDomain) const
inline

Gets a reference of one of the domain instances.

Parameters
backgroundDomaintrue if the background domain shall be returned, otherwise false.
Returns
One of the domain instances depending on the boolean parameter.

◆ SwapDomains()

template<class T >
void Arp::Plc::Domain::Commons::DualDomain< T >::SwapDomains ( bool  simulate)
inline

Swaps the domains, so that the foreground domain becomes the background domain and vice versa.

Parameters
simulateIf true the swap is just simulated to measure the duration.

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