GM6000 Digital Heater Controller Branch: main
SDX-1330
MpStaticScreenApiPtr.h
Go to the documentation of this file.
1#ifndef Ajax_ScreenMgr_MpStaticScreenApiPtr_h_
2#define Ajax_ScreenMgr_MpStaticScreenApiPtr_h_
3/*-----------------------------------------------------------------------------
4* This file is part of the Colony.Core Project. The Colony.Core Project is an
5* open source project with a BSD type of licensing agreement. See the license
6* agreement (license.txt) in the top/ directory or on the Internet at
7* http://integerfox.com/colony.core/license.txt
8*
9* Copyright (c) 2014-2022 John T. Taylor
10*
11* Redistributions of the source code must retain the above copyright notice.
12*----------------------------------------------------------------------------*/
13/** @file */
14
15
16#include "Cpl/Dm/Mp/Numeric.h"
17
18///
19namespace Ajax {
20///
21namespace ScreenMgr {
22
23/** Forward reference for a ScreenApi pointer (breaks undesired dependencies)
24 */
25class StaticScreenApi;
26
27
28/** This class provides a concrete implementation for a Point who's data is a
29 StaticScreenApi pointer.
30
31 The toJSON()/fromJSON format is:
32 \code
33
34 { name:"<mpname>", type:"<mptypestring>", valid:true|false, seqnum:nnnn, locked:true|false, val:"<hexvalue>" }
35
36 \endcode
37
38 NOTE: All methods in this class ARE thread Safe unless explicitly
39 documented otherwise.
40 */
41class MpStaticScreenApiPtr : public Cpl::Dm::Mp::Pointer_<MpStaticScreenApiPtr>
42{
43public:
44 /// Constructor. Invalid MP.
45 MpStaticScreenApiPtr( Cpl::Dm::ModelDatabase& myModelBase, const char* symbolicName )
46 :Pointer_<MpStaticScreenApiPtr>( myModelBase, symbolicName )
47 {
48 }
49
50 /// Constructor. Valid MP. Requires an initial value
51 MpStaticScreenApiPtr( Cpl::Dm::ModelDatabase& myModelBase, const char* symbolicName, void* initialValue )
52 : Pointer_<MpStaticScreenApiPtr>( myModelBase, symbolicName, initialValue )
53 {
54 }
55
56
57public:
58 /// Type safe read. See Cpl::Dm::ModelPoint
59 inline bool read( StaticScreenApi*& dstData, uint16_t* seqNumPtr = 0 ) const noexcept
60 {
61 return readData( &dstData, sizeof( void* ), seqNumPtr );
62 }
63
64 /// Type safe write. See Cpl::Dm::ModelPoint
66 {
67 return writeData( &newValue, sizeof( void* ), lockRequest );
68 }
69
70public:
71 /// Type safe subscriber
73
74 /// See Cpl::Dm::ModelPointCommon
75 inline bool readAndSync( StaticScreenApi*& dstData, Cpl::Dm::SubscriberApi& observerToSync )
76 {
77 return ModelPointCommon_::readAndSync( &dstData, sizeof( void* ), observerToSync );
78 }
79
80 /// See Cpl::Dm::ModelPoint.
81 const char* getTypeAsText() const noexcept
82 {
83 return "Ajax::ScreenMgr::MpStaticScreenApiPtr";
84 }
85};
86
87
88
89} // end namespaces
90}
91#endif // end header latch
This class provides a concrete implementation for a Point who's data is a StaticScreenApi pointer.
Definition MpStaticScreenApiPtr.h:42
const char * getTypeAsText() const noexcept
See Cpl::Dm::ModelPoint.
Definition MpStaticScreenApiPtr.h:81
bool readAndSync(StaticScreenApi *&dstData, Cpl::Dm::SubscriberApi &observerToSync)
See Cpl::Dm::ModelPointCommon.
Definition MpStaticScreenApiPtr.h:75
MpStaticScreenApiPtr(Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName, void *initialValue)
Constructor. Valid MP. Requires an initial value.
Definition MpStaticScreenApiPtr.h:51
uint16_t write(StaticScreenApi *newValue, Cpl::Dm::ModelPoint::LockRequest_T lockRequest=Cpl::Dm::ModelPoint::eNO_REQUEST) noexcept
Type safe write. See Cpl::Dm::ModelPoint.
Definition MpStaticScreenApiPtr.h:65
Cpl::Dm::Subscriber< MpStaticScreenApiPtr > Observer
Type safe subscriber.
Definition MpStaticScreenApiPtr.h:72
bool read(StaticScreenApi *&dstData, uint16_t *seqNumPtr=0) const noexcept
Type safe read. See Cpl::Dm::ModelPoint.
Definition MpStaticScreenApiPtr.h:59
MpStaticScreenApiPtr(Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName)
Constructor. Invalid MP.
Definition MpStaticScreenApiPtr.h:45
This class defines interface for Screens that only contain static data.
Definition StaticScreenApi.h:31
This concrete class implements a simple Model Database.
Definition ModelDatabase.h:56
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.
LockRequest_T
Options related to the Model Point's locked state.
Definition ModelPoint.h:50
@ eNO_REQUEST
No change in the MP's lock state is requested.
Definition ModelPoint.h:51
This template class extends the implementation of Numeric<> class to support the pointers instead of ...
Definition Numeric.h:310
Pointer_(Cpl::Dm::ModelDatabase &myModelBase, const char *symbolicName)
Constructor. Invalid MP.
Definition Numeric.h:313
This abstract class defines the Subscriber interface - for change notifications - to a Model Points d...
Definition SubscriberApi.h:34
This template class defines a type safe Subscriber.
Definition Subscriber.h:82
The 'Ajax' namespace is the root name space all GM6000 application specific source code.