 |
helics
2.8.1
|
Go to the documentation of this file.
10 #include "helics/helics-config.h"
42 explicit data_block(
size_t blockSize) { m_data.resize(blockSize); }
44 data_block(
size_t blockSize,
char init): m_data(blockSize, init) {}
57 data_block(std::string&& str) noexcept: m_data(std::move(str)) {}
67 m_data(reinterpret_cast<const char*>(vdata.
data()), vdata.
size() * sizeof(X))
77 m_data = std::move(str);
95 void append(
const char* s,
size_t len) { m_data.append(s, len); }
97 void append(
const std::string& str) { m_data.append(str); }
101 bool operator==(
const std::string& str)
const {
return m_data == str; }
107 char*
data() {
return &(m_data.front()); }
109 const char*
data()
const {
return &(m_data.front()); }
112 bool empty() const noexcept {
return m_data.empty(); }
114 size_t size()
const {
return m_data.length(); }
116 void resize(
size_t newSize) { m_data.resize(newSize); }
118 void resize(
size_t newSize,
char T) { m_data.resize(newSize, T); }
120 void reserve(
size_t space) { m_data.reserve(space); }
128 auto begin() {
return m_data.begin(); }
130 auto end() {
return m_data.end(); }
132 auto cbegin()
const {
return m_data.cbegin(); }
134 auto cend()
const {
return m_data.cend(); }
136 void push_back(
char newchar) { m_data.push_back(newchar); }
142 return !(db1 == db2);
165 std::swap(
time, m2.time);
166 std::swap(
flags, m2.flags);
209 virtual std::unique_ptr<Message>
process(std::unique_ptr<Message> message) = 0;
211 virtual std::vector<std::unique_ptr<Message>>
processVector(std::unique_ptr<Message> message)
213 std::vector<std::unique_ptr<Message>> ret;
214 auto res =
process(std::move(message));
216 ret.push_back(std::move(res));
222 std::unique_ptr<Message>
operator()(std::unique_ptr<Message> message)
224 return process(std::move(message));
237 virtual std::unique_ptr<Message>
process(std::unique_ptr<Message> message)
override
248 template<
class sizeType,
class SizedDataType>
251 return ((testSize >= sizeType(0)) && (testSize <
static_cast<sizeType
>(vec.size())));
bool operator!=(const data_block &db1, const data_block &db2)
Definition: core-data.hpp:140
constexpr Time timeZero
Definition: helics-time.hpp:31
bool isValid() const noexcept
Definition: core-data.hpp:176
data_block & assign(const char *s, size_t len)
Definition: core-data.hpp:87
void append(const char *s, size_t len)
Definition: core-data.hpp:95
const std::string & to_string() const
Definition: core-data.hpp:181
data_block & operator=(std::string str)
Definition: core-data.hpp:75
bool operator==(const std::string &str) const
Definition: core-data.hpp:101
bool operator==(const data_block &db) const
Definition: core-data.hpp:99
Definition: core-data.hpp:31
void reserve(size_t space)
Definition: core-data.hpp:120
std::int32_t messageID
the messageID for a message
Definition: core-data.hpp:151
void resize(size_t newSize)
Definition: core-data.hpp:116
void resize(size_t newSize, char T)
Definition: core-data.hpp:118
void * backReference
back referencing pointer not used by helics
Definition: core-data.hpp:158
char * data()
Definition: core-data.hpp:107
std::unique_ptr< Message > operator()(std::unique_ptr< Message > message)
Definition: core-data.hpp:222
virtual ~FilterOperator()=default
data_block & operator=(const char *s)
Definition: core-data.hpp:81
data_block(std::string &&str) noexcept
Definition: core-data.hpp:57
TimeRepresentation< count_time< 9 > > Time
Definition: helics-time.hpp:27
data_block & operator=(const data_block &db)=default
Definition: ActionMessage.hpp:29
std::string source
the most recent source of the message
Definition: core-data.hpp:154
virtual bool isMessageGenerating() const
Definition: core-data.hpp:228
data_block data
the data packet for the message
Definition: core-data.hpp:152
Definition: data_view.hpp:22
virtual std::unique_ptr< Message > process(std::unique_ptr< Message > message) override
Definition: core-data.hpp:237
data_block(const std::vector< char > &vdata)
Definition: core-data.hpp:62
std::int32_t counter
indexing counter not used directly by helics
Definition: core-data.hpp:157
bool empty() const noexcept
Definition: core-data.hpp:112
char operator[](int index) const
Definition: core-data.hpp:126
data_block(size_t blockSize)
Definition: core-data.hpp:42
data_block(const char *s, size_t len)
Definition: core-data.hpp:59
data_block(const char *s)
Definition: core-data.hpp:51
std::string original_dest
the original destination of a message
Definition: core-data.hpp:156
std::uint16_t messageValidation
extra field for user object usage, not used by HELICS
Definition: core-data.hpp:150
Time time
the event time the message is sent
Definition: core-data.hpp:148
void clear()
Definition: core-data.hpp:183
data_block(const std::vector< X > &vdata)
Definition: core-data.hpp:66
std::string original_source
the original source of the message
Definition: core-data.hpp:155
Definition: core-data.hpp:202
void append(const std::string &str)
Definition: core-data.hpp:97
data_block(const std::string &str)
Definition: core-data.hpp:54
void push_back(char newchar)
Definition: core-data.hpp:136
size_t size() const
Definition: core-data.hpp:114
bool operator<(const data_block &db) const
Definition: core-data.hpp:103
std::uint16_t flags
message flags
Definition: core-data.hpp:149
void swap(data_block &db2) noexcept
Definition: core-data.hpp:93
auto begin()
Definition: core-data.hpp:128
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
const std::string & to_string() const
Definition: core-data.hpp:122
bool operator>(const data_block &db) const
Definition: core-data.hpp:105
void swap(Message &m2) noexcept
Definition: core-data.hpp:163
virtual std::unique_ptr< Message > process(std::unique_ptr< Message > message)=0
virtual std::vector< std::unique_ptr< Message > > processVector(std::unique_ptr< Message > message)
Definition: core-data.hpp:211
auto cend() const
Definition: core-data.hpp:134
auto cbegin() const
Definition: core-data.hpp:132
NullFilterOperator()=default
Definition: core-data.hpp:233
const char * data() const
Definition: core-data.hpp:109
std::string dest
the destination of the message
Definition: core-data.hpp:153
data_block(size_t blockSize, char init)
Definition: core-data.hpp:44
auto end()
Definition: core-data.hpp:130
Definition: core-data.hpp:146
bool isValidIndex(sizeType testSize, const SizedDataType &vec)
Definition: core-data.hpp:249
char & operator[](int index)
Definition: core-data.hpp:124