#include <communicatable.h>
|
| ConcreteCommunicatable (COMMUNICATEE &communicatee) |
|
std::size_t | size (ConstSpan< CellID > indices) const override |
| Get serialized size for data at locations indices
|
|
std::size_t | serialize (ConstSpan< CellID > indices, std::uint8_t *buffer) const override |
| Serialize data at locations indices to buffer
|
|
std::size_t | deserialize (ConstSpan< CellID > indices, const std::uint8_t *buffer) override |
| Deserialize data at locations indices to buffer
|
|
std::size_t | size () const |
| ADDITIONAL NON OVERWITTEN CALLS: Removing the necessity to provide indices.
|
|
std::size_t | serialize (std::uint8_t *buffer) const |
| Serialize complete data.
|
|
std::size_t | deserialize (const std::uint8_t *buffer) |
| Deserialize complete data.
|
|
virtual | ~Communicatable () |
|
template<typename COMMUNICATEE>
class olb::ConcreteCommunicatable< COMMUNICATEE >
Definition at line 90 of file communicatable.h.
◆ ConcreteCommunicatable()
template<typename COMMUNICATEE >
◆ deserialize() [1/2]
template<typename COMMUNICATEE >
Deserialize complete data.
Definition at line 182 of file communicatable.h.
183 {
184 std::size_t noI = std::tuple_size<COMMUNICATEE>::value;
185 if (meta::is_aligned<typename COMMUNICATEE::value_type>(buffer)) {
186 const auto* source = reinterpret_cast<const typename COMMUNICATEE::value_type*>(buffer);
187 for (
CellID index=0; index<noI; ++index) {
188 _communicatee[index] = *(source++);
189 }
190 } else {
191 const std::uint8_t* source = buffer;
192 for (
CellID index=0; index<noI; ++index) {
193 std::memcpy(reinterpret_cast<void*>(&_communicatee[index]),
194 source,
195 sizeof(typename COMMUNICATEE::value_type));
196 source += sizeof(typename COMMUNICATEE::value_type);
197 }
198 }
199 return noI * sizeof(typename COMMUNICATEE::value_type);
200 }
std::uint32_t CellID
Type for sequential block-local cell indices.
◆ deserialize() [2/2]
template<typename COMMUNICATEE >
Deserialize data at locations indices
to buffer
Implements olb::Communicatable.
Definition at line 126 of file communicatable.h.
128 {
129 if (meta::is_aligned<typename COMMUNICATEE::value_type>(buffer)) {
130 const auto* source = reinterpret_cast<const typename COMMUNICATEE::value_type*>(buffer);
131 for (
CellID index : indices) {
132 _communicatee[index] = *(source++);
133 }
134 } else {
135 const std::uint8_t* source = buffer;
136 for (
CellID index : indices) {
137 std::memcpy(reinterpret_cast<void*>(&_communicatee[index]),
138 source,
139 sizeof(typename COMMUNICATEE::value_type));
140 source += sizeof(typename COMMUNICATEE::value_type);
141 }
142 }
143 return indices.size() * sizeof(typename COMMUNICATEE::value_type);
144 }
References olb::ConstSpan< T >::size().
◆ serialize() [1/2]
template<typename COMMUNICATEE >
Serialize data at locations indices
to buffer
Implements olb::Communicatable.
Definition at line 105 of file communicatable.h.
107 {
108 if (meta::is_aligned<typename COMMUNICATEE::value_type>(buffer)) {
109 auto* target = reinterpret_cast<typename COMMUNICATEE::value_type*>(buffer);
110 for (
CellID index : indices) {
111 *(target++) = _communicatee[index];
112 }
113 } else {
114 std::uint8_t* target = buffer;
115 for (
CellID index : indices) {
116 std::memcpy(target,
117 reinterpret_cast<const void*>(&_communicatee[index]),
118 sizeof(typename COMMUNICATEE::value_type));
119 target += sizeof(typename COMMUNICATEE::value_type);
120 }
121 }
122 return indices.size() * sizeof(typename COMMUNICATEE::value_type);
123 }
References olb::ConstSpan< T >::size().
◆ serialize() [2/2]
template<typename COMMUNICATEE >
Serialize complete data.
Definition at line 161 of file communicatable.h.
162 {
163 std::size_t noI = std::tuple_size<COMMUNICATEE>::value;
164 if (meta::is_aligned<typename COMMUNICATEE::value_type>(buffer)) {
165 auto* target = reinterpret_cast<typename COMMUNICATEE::value_type*>(buffer);
166 for (
CellID index=0; index<noI; ++index) {
167 *(target++) = _communicatee[index];
168 }
169 } else {
170 std::uint8_t* target = buffer;
171 for (
CellID index=0; index<noI; ++index) {
172 std::memcpy(target,
173 reinterpret_cast<const void*>(&_communicatee[index]),
174 sizeof(typename COMMUNICATEE::value_type));
175 target += sizeof(typename COMMUNICATEE::value_type);
176 }
177 }
178 return noI * sizeof(typename COMMUNICATEE::value_type);
179 }
◆ size() [1/2]
template<typename COMMUNICATEE >
ADDITIONAL NON OVERWITTEN CALLS: Removing the necessity to provide indices.
- Here, intendet to be used for std::array (for which std::tuple_size works), for other COMMUNICATEE types, a different static size retrieval should be implemented.
- Actually, vector might also work here, however is unfortunately rather passed to ConcreteCommunicatable<std::vector<COLUMN>>
- TODO: Include properly into complete framework, if found usefull. Get serialized size for complete data
Definition at line 155 of file communicatable.h.
156 {
157 return std::tuple_size<COMMUNICATEE>::value * sizeof(typename COMMUNICATEE::value_type);
158 }
◆ size() [2/2]
template<typename COMMUNICATEE >
The documentation for this class was generated from the following file: