![]() |
GM6000 Digital Heater Controller Branch: main
SDX-1330
|
This template class extends the implementation of Numeric<> class to support the pointers instead of integers. More...
This template class extends the implementation of Numeric<> class to support the pointers instead of integers.
NOTES: 1) All methods in this class are NOT thread Safe unless explicitly documented otherwise.
#include <Numeric.h>
Public Member Functions | |
void | setJSONVal (JsonDocument &doc) noexcept |
See Cpl::Dm::Point. | |
bool | fromJSON_ (JsonVariant &src, Cpl::Dm::ModelPoint::LockRequest_T lockRequest, uint16_t &retSequenceNumber, Cpl::Text::String *errorMsg) noexcept |
See Cpl::Dm::Point. | |
![]() | |
bool | read (size_t &dstData, uint16_t *seqNumPtr=0) const noexcept |
Type safe read. See Cpl::Dm::ModelPoint. | |
uint16_t | write (size_t newValue, Cpl::Dm::ModelPoint::LockRequest_T lockRequest=Cpl::Dm::ModelPoint::eNO_REQUEST) noexcept |
Type safe write. See Cpl::Dm::ModelPoint. | |
uint16_t | increment (size_t incSize=1, Cpl::Dm::ModelPoint::LockRequest_T lockRequest=Cpl::Dm::ModelPoint::eNO_REQUEST) noexcept |
Atomic increment. | |
uint16_t | decrement (size_t decSize=1, Cpl::Dm::ModelPoint::LockRequest_T lockRequest=Cpl::Dm::ModelPoint::eNO_REQUEST) noexcept |
Atomic decrement. | |
uint16_t | copyFrom (const MPTYPE &src, LockRequest_T lockRequest=Cpl::Dm::ModelPoint::eNO_REQUEST) noexcept |
Updates the MP with the valid-state/data from 'src'. Note: the src.lock state is NOT copied. | |
void | attach (Cpl::Dm::Subscriber< MPTYPE > &observer, uint16_t initialSeqNumber=SEQUENCE_NUMBER_UNKNOWN) noexcept |
Type safe register observer. | |
void | detach (Cpl::Dm::Subscriber< MPTYPE > &observer) noexcept |
Type safe un-register observer. | |
bool | readAndSync (size_t &dstData, SubscriberApi &observerToSync) |
See Cpl::Dm::ModelPointCommon. | |
![]() | |
const char * | getName () const noexcept |
See Cpl::Dm::ModelPoint. | |
size_t | getSize () const noexcept |
See Cpl::Dm::ModelPoint. This method IS thread safe. | |
uint16_t | getSequenceNumber () const noexcept |
See Cpl::Dm::ModelPoint. | |
uint16_t | touch () noexcept |
See Cpl::Dm::ModelPoint. | |
uint16_t | setInvalid (LockRequest_T lockRequest=eNO_REQUEST) noexcept |
See Cpl::Dm::ModelPoint. | |
bool | isNotValid (uint16_t *seqNumPtr=0) const noexcept |
See Cpl::Dm::ModelPoint. | |
bool | isLocked () const noexcept |
See Cpl::Dm::ModelPoint. | |
uint16_t | setLockState (LockRequest_T lockRequest) noexcept |
See Cpl::Dm::ModelPoint. | |
size_t | getExternalSize (bool includeLockedState=false) const noexcept |
See Cpl::Dm::ModelPoint. | |
size_t | exportData (void *dstDataStream, size_t maxDstLength, uint16_t *retSequenceNumber=0, bool includeLockedState=false) const noexcept |
See Cpl::Dm::ModelPoint. Note: The implementation does NOT account for Endianess, i.e. assumes the 'platform' is the same for export/import. | |
size_t | importData (const void *srcDataStream, size_t srcLength, uint16_t *retSequenceNumber=0, bool includeLockedState=false) noexcept |
See Cpl::Dm::ModelPoint. Note: The implementation does NOT account for Endianess, i.e. assumes the 'platform' is the same for export/import. | |
void | genericAttach (SubscriberApi &observer, uint16_t initialSeqNumber=SEQUENCE_NUMBER_UNKNOWN) noexcept |
See Cpl::Dm::ModelPoint. | |
void | genericDetach (SubscriberApi &observer) noexcept |
See Cpl::Dm::ModelPoint. | |
bool | toJSON (char *dst, size_t dstSize, bool &truncated, bool verbose=true, bool pretty=false) noexcept |
See Cpl::Dm::ModelPoint. | |
bool | isNotValidAndSync (SubscriberApi &observerToSync) |
This method is used to test the validate state of the MP and synchronize the observer with the current MP contents. | |
void | processSubscriptionEvent_ (SubscriberApi &subscriber, Event_T event) noexcept |
See Cpl::Dm::ModelPoint. | |
![]() | |
virtual const char * | getTypeAsText () const noexcept=0 |
This method returns a string identifier for the Model Point's data type. | |
uint16_t | removeLock () noexcept |
Short hand for unconditionally removing the lock from the MP. | |
uint16_t | applyLock () noexcept |
Short hand for putting the MP into the locked state. | |
virtual bool | exportMetadata_ (void *dstDataStream, size_t &bytesAdded) const noexcept |
This method has PACKAGE Scope, i.e. | |
virtual bool | importMetadata_ (const void *srcDataStream, size_t &bytesConsumed) noexcept |
This method has PACKAGE Scope, i.e. | |
virtual | ~ModelPoint () |
Virtual destructor to make the compiler happy. | |
![]() | |
bool | insert_ (void *newContainerPtr) |
Helper method to trap when inserting an item in multiple containers. | |
bool | isInContainer_ (const void *containerPtr) const noexcept |
Returns 'true' if the instance is in the specified container. | |
Protected Member Functions | |
Pointer_ (Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName) | |
Constructor. Invalid MP. | |
Pointer_ (Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName, void *initialValue) | |
Constructor. Valid MP. Requires an initial value. | |
![]() | |
Numeric (Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName) | |
Constructor: Invalid MP. | |
Numeric (Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName, size_t initialValue) | |
Constructor: Valid MP (requires initial value) | |
![]() | |
ModelPointCommon_ (ModelDatabase &myModelBase, const char *symbolicName, void *myDataPtr, size_t dataSizeInBytes, bool isValid=false) | |
Constructor. | |
bool | readAndSync (void *dstData, size_t dstSize, SubscriberApi &observerToSync) |
This method is used to read the MP contents and synchronize the observer with the current MP contents. | |
bool | readData (void *dstData, size_t dstSize, uint16_t *seqNumPtr=0) const noexcept |
See Cpl::Dm::ModelPoint. | |
uint16_t | writeData (const void *srcData, size_t srcSize, LockRequest_T lockRequest=eNO_REQUEST) noexcept |
See Cpl::Dm::ModelPoint. | |
virtual uint16_t | copyDataAndStateFrom (const ModelPointCommon_ &src, LockRequest_T lockRequest) noexcept |
Updates the MP with the valid-state/data from 'src'. Note: the src.lock state is NOT copied. | |
void | attachSubscriber (SubscriberApi &observer, uint16_t initialSeqNumber=SEQUENCE_NUMBER_UNKNOWN) noexcept |
See Cpl::Dm::ModelPoint. | |
void | detachSubscriber (SubscriberApi &observer) noexcept |
See Cpl::Dm::ModelPoint. | |
void | copyDataTo_ (void *dstData, size_t dstSize) const noexcept |
See Cpl::Dm::ModelPoint. | |
void | copyDataFrom_ (const void *srcData, size_t srcSize) noexcept |
See Cpl::Dm::ModelPoint. | |
bool | isDataEqual_ (const void *otherData) const noexcept |
See Cpl::Dm::ModelPoint. Note: This implementation does NOT work if the any of the data content are floats/double data types. | |
const void * | getImportExportDataPointer_ () const noexcept |
See Cpl::Dm::ModelPoint. | |
size_t | getInternalDataSize_ () const noexcept |
See Cpl::Dm::ModelPoint. | |
virtual void | processDataUpdated () noexcept |
Internal helper method that completes the data update process as well as ensuring any change notifications get generated. | |
virtual void | processChangeNotifications () noexcept |
Internal helper method that handles generating change notifications when the Model Point's data/state has changed. | |
virtual void | advanceSequenceNumber () noexcept |
Internal helper method that advances/updates the Model Point's sequence number. | |
virtual bool | testAndUpdateLock (LockRequest_T lockRequest) noexcept |
Internal helper method that manages testing and updating the locked state. | |
virtual void | transitionToNotifyPending (SubscriberApi &subscriber) noexcept |
Helper FSM method. | |
virtual void | transitionToSubscribed (SubscriberApi &subscriber) noexcept |
Helper FSM method. | |
virtual JsonDocument & | beginJSON (bool isValid, bool locked, uint16_t seqnum, bool verbose=true) noexcept |
Helper method when converting MP to a JSON string. | |
virtual void | endJSON (char *dst, size_t dstSize, bool &truncated, bool verbose=true, bool pretty=false) noexcept |
Helper method when converting MP to a JSON string. | |
virtual void | hookSetInvalid () noexcept |
Helper method that a child a class can override to change behavior when an MP is set to the invalid state. | |
![]() | |
Item () | |
Constructor. | |
Item (const char *) | |
Constructor used ONLY with the child class MapItem: -->special constructor to allow a Map to be statically allocated. | |
Additional Inherited Members | |
![]() | |
enum | LockRequest_T { eNO_REQUEST , eLOCK , eUNLOCK } |
Options related to the Model Point's locked state. More... | |
enum | Event_T { eATTACH , eDETACH , eDATA_CHANGED , eNOTIFYING , eNOTIFY_COMPLETE } |
Subscriber events. More... | |
![]() | |
static void | remove_ (Item *itemPtr) noexcept |
Helper method to do the proper 'clean-up' for the multiple-containers-error-trap when removing an item from a container. | |
![]() | |
void * | m_nextPtr_ |
The link field. | |
void * | m_inListPtr_ |
Debug field. | |
![]() | |
static const uint16_t | SEQUENCE_NUMBER_UNKNOWN |
Magic value to use when registering for a change notification and application does not 'know' the current sequence number value of the Model Point. | |
![]() | |
size_t | m_data |
The element's value. | |
![]() | |
Cpl::Container::DList< SubscriberApi > | m_subscribers |
List of Active Subscribers. | |
const char * | m_name |
The model point's symbolic name. | |
ModelDatabase & | m_modelDatabase |
Reference to the containing Model Base. | |
void * | m_dataPtr |
Reference to my Data. | |
size_t | m_dataSize |
Size of my data. | |
uint16_t | m_seqNum |
Sequence number used for tracking changes in the Point data. | |
bool | m_locked |
Locked state. | |
bool | m_valid |
valid/invalid state | |
|
inlineprotected |
Constructor. Invalid MP.
|
inlineprotected |
Constructor. Valid MP. Requires an initial value.
|
inlinevirtualnoexcept |
See Cpl::Dm::Point.
Reimplemented from Cpl::Dm::Mp::Numeric< size_t, MPTYPE >.
|
inlinevirtualnoexcept |
See Cpl::Dm::Point.
Reimplemented from Cpl::Dm::Mp::Numeric< size_t, MPTYPE >.