BusBricks: /Users/felixschulke/Developement/Arduino/Modbus_RTU/Modbus_RTU/Modbus-RTU/lib/Service/Content.h Source File
BusBricks  0.1
Customize bus-communication
Loading...
Searching...
No Matches
Content.h
Go to the documentation of this file.
1
25#ifndef CONTENT_H
26#define CONTENT_H
27#ifdef ARDUINO
28 #include <Arduino.h> // include Arduino-Library for platformIO-build
29#else
30 #include <mockArduino.h>
31 using namespace arduinoMocking;
32 #include <cstring>
33#endif
34
44template<typename content_type, typename representation_type>
45class Content {
46public:
52 Content(content_type content) : content(content) {}
53
60
66 representation_type* get_representation() {
67 return &representation;
68 }
69
75 content_type* get_content() {
76 return &content;
77 }
78
85 bool isValid(){
86 return ((content!=content_type()) & (representation!=representation_type()));
87 };
88
89protected:
91 content_type content;
92
94 representation_type representation;
95
96 // Convert the representation-attribute to the content-attribute,
97 // the function has to be called in the constructor of the derived class
98
107 virtual void rep_to_content() = 0;
108
117 virtual void content_to_rep() = 0;
118};
119
120#endif // CONTENT_H
The cascading of processing information and the rules applied to it lead to the concept of content- a...
Definition Content.h:45
Content(representation_type representation)
Construct a new Content object from it's representation from type representation_type.
Definition Content.h:59
virtual void content_to_rep()=0
Defines the mapping from Content to Representation. Convert the class-attribute "content"to the class...
representation_type * get_representation()
Get the address of the informations representation of type representation-type.
Definition Content.h:66
Content(content_type content)
Construct a new Content object from an instance from type content_type (content itself)
Definition Content.h:52
content_type content
Content of an information (view on information (content) closer to Service-Layer)
Definition Content.h:91
content_type * get_content()
Get the address of the informations content of type content_type.
Definition Content.h:75
bool isValid()
Representation and Content of the object are existent (not default)
Definition Content.h:85
representation_type representation
Representation of an information (view on information (content) closer to physical layer)
Definition Content.h:94
virtual void rep_to_content()=0
Defines the mapping from Representation to Content. Convert the class-attribute "representation" to t...
Provides mock implementations of Arduino framework functions and classes for native builds.
Definition mockArduino.cpp:28