DUDS
Distributed Update of Data from Something
duds::hardware::interface::DigitalPinAccessBase Class Reference

The base class for the digital pin access classes. More...

#include <DigitalPinAccessBase.hpp>

Inheritance diagram for duds::hardware::interface::DigitalPinAccessBase:
Collaboration diagram for duds::hardware::interface::DigitalPinAccessBase:

Classes

union  PortData
 A type for holding arbitrary port-specific data within a DigitalPinAccess or DigitalPinSetAccess object. More...
 

Public Member Functions

DigitalPortport () const
 Returns a pointer to the port that controls the pin(s) that are operated through this object. More...
 

Protected Member Functions

 DigitalPinAccessBase ()
 Cannot be constructed using this base class, but allows the construction of a useless access object without a DigitalPort. More...
 
 DigitalPinAccessBase (DigitalPort *port)
 Initializes the port pointer. More...
 
 ~DigitalPinAccessBase ()=default
 Cannot be destructed using this base class to avoid the need for a virtual destructor. More...
 
DigitalPinAccessBaseoperator= (DigitalPinAccessBase &&old) noexcept
 Allows moving access objects. More...
 
void reset ()
 Loses the pointer to the DigitalPort rendering the access object useless. More...
 

Protected Attributes

PortData portdata
 Port specific information. More...
 

Private Attributes

friend DigitalPort
 
DigitalPortdp
 A pointer to the port object handling the pin(s). More...
 

Detailed Description

The base class for the digital pin access classes.

This base class stores a pointer to the DigitalPort handling the pins. A shared pointer is not used to speed up the creation and destruction of the access objects.

Note
Outside of DigitalPort, this class should not be used directly.
Author
Jeff Jackowski

Definition at line 27 of file DigitalPinAccessBase.hpp.

Constructor & Destructor Documentation

◆ DigitalPinAccessBase() [1/2]

duds::hardware::interface::DigitalPinAccessBase::DigitalPinAccessBase ( )
inlineprotected

Cannot be constructed using this base class, but allows the construction of a useless access object without a DigitalPort.

Definition at line 73 of file DigitalPinAccessBase.hpp.

◆ DigitalPinAccessBase() [2/2]

duds::hardware::interface::DigitalPinAccessBase::DigitalPinAccessBase ( DigitalPort port)
inlineprotected

Initializes the port pointer.

Definition at line 77 of file DigitalPinAccessBase.hpp.

◆ ~DigitalPinAccessBase()

duds::hardware::interface::DigitalPinAccessBase::~DigitalPinAccessBase ( )
protecteddefault

Cannot be destructed using this base class to avoid the need for a virtual destructor.

There is no point to keeping objects of this base class.

Referenced by DigitalPinAccessBase().

Member Function Documentation

◆ operator=()

DigitalPinAccessBase & duds::hardware::interface::DigitalPinAccessBase::operator= ( DigitalPinAccessBase &&  old)
protectednoexcept

Allows moving access objects.

The port specific data and the DigitalPort pointer is copied.

Definition at line 14 of file DigitalPinAccessBase.cpp.

Referenced by DigitalPinAccessBase(), duds::hardware::interface::DigitalPinAccess::operator=(), and duds::hardware::interface::DigitalPinSetAccess::operator=().

◆ port()

DigitalPort* duds::hardware::interface::DigitalPinAccessBase::port ( ) const
inline

Returns a pointer to the port that controls the pin(s) that are operated through this object.

The result will be nullptr if the access object was constructed without a DigitalPort. During the life of this object, the result must never change, and must remain valid. These requirements allow the use of the pointer without checking for validity. Further, the pin itslef must remain available. This allows some operations to occur without thread synchronization. The result is relatively fast access to the port and the pin.

Todo:
Throw if dp is null?

Definition at line 106 of file DigitalPinAccessBase.hpp.

Referenced by duds::hardware::interface::DigitalPort::access(), duds::hardware::interface::DigitalPinAccess::capabilities(), duds::hardware::interface::DigitalPinSetAccess::capabilities(), duds::hardware::interface::DigitalPinAccess::configuration(), duds::hardware::interface::DigitalPinSetAccess::configuration(), duds::hardware::interface::DigitalPinSetAccess::globalId(), duds::hardware::interface::DigitalPinSetAccess::globalIds(), duds::hardware::interface::DigitalPinAccess::havePin(), duds::hardware::interface::DigitalPinSetAccess::havePins(), duds::hardware::interface::DigitalPinSetAccess::independentConfig(), duds::hardware::interface::DigitalPinAccess::input(), duds::hardware::interface::DigitalPinSetAccess::input(), duds::hardware::interface::DigitalPinAccess::localId(), duds::hardware::interface::DigitalPinAccess::modifyConfig(), duds::hardware::interface::DigitalPinSetAccess::modifyConfig(), duds::hardware::interface::DigitalPinAccess::output(), duds::hardware::interface::DigitalPinSetAccess::output(), duds::hardware::interface::DigitalPinAccess::proposeConfig(), duds::hardware::interface::DigitalPinSetAccess::proposeConfig(), duds::hardware::interface::DigitalPinAccess::retire(), duds::hardware::interface::DigitalPinSetAccess::retire(), duds::hardware::interface::DigitalPinSetAccess::simultaneousOperations(), duds::hardware::interface::DigitalPort::updateAccess(), and duds::hardware::interface::DigitalPinSetAccess::write().

◆ reset()

void duds::hardware::interface::DigitalPinAccessBase::reset ( )
inlineprotected

Loses the pointer to the DigitalPort rendering the access object useless.

Definition at line 92 of file DigitalPinAccessBase.hpp.

Referenced by duds::hardware::interface::DigitalPinAccess::retire(), and duds::hardware::interface::DigitalPinSetAccess::retire().

Member Data Documentation

◆ DigitalPort

friend duds::hardware::interface::DigitalPinAccessBase::DigitalPort
private

Definition at line 62 of file DigitalPinAccessBase.hpp.

◆ dp

DigitalPort* duds::hardware::interface::DigitalPinAccessBase::dp
private

A pointer to the port object handling the pin(s).

Definition at line 61 of file DigitalPinAccessBase.hpp.

Referenced by operator=(), and port().

◆ portdata


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