9 #include "../core/core-data.hpp"
10 #include "../core/helicsTime.hpp"
11 #include "helics/helics-config.h"
16 #include <string_view>
24 std::string_view dblock;
25 std::shared_ptr<const SmallBuffer>
34 dblock(dt->
to_string()), ref(std::move(dt)) {}
42 typename T = std::enable_if_t<std::is_constructible_v<std::string_view, U>>>
43 data_view(U&& u) noexcept: dblock(std::forward<U>(u))
47 data_view(
const char* dt,
size_t len) noexcept: dblock(dt, len) {}
53 dblock(dvec.data(), dvec.size()) {}
55 data_view(
const std::vector<double>& dvec) noexcept:
56 dblock(
reinterpret_cast<const char*
>(dvec.data()), dvec.size() *
sizeof(
double))
65 ref = std::move(dv.ref);
72 dblock = dt->to_string();
79 dblock = dt.to_string();
103 dblock.
swap(dv2.dblock);
107 const char*
data() const noexcept {
return dblock.data(); }
109 const std::byte*
bytes() const noexcept
111 return reinterpret_cast<const std::byte*
>(dblock.data());
114 size_t size() const noexcept {
return dblock.length(); }
116 bool empty() const noexcept {
return dblock.empty(); }
120 std::string
string()
const {
return std::string(dblock); }
126 auto begin() {
return dblock.begin(); }
128 auto end() {
return dblock.end(); }
130 auto cbegin()
const {
return dblock.cbegin(); }
132 auto cend()
const {
return dblock.cend(); }
135 constexpr
auto bvecstr =
"block_vector";
138 inline const char* typeNameString<std::vector<SmallBuffer>>()
Definition: SmallBuffer.hpp:25
Definition: data_view.hpp:22
data_view & operator=(const char *s) noexcept
Definition: data_view.hpp:91
auto cend() const
Definition: data_view.hpp:132
std::string_view string_view() const
Definition: data_view.hpp:122
size_t size() const noexcept
Definition: data_view.hpp:114
data_view(const data_view &dt) noexcept=default
auto cbegin() const
Definition: data_view.hpp:130
const char * data() const noexcept
Definition: data_view.hpp:107
const std::byte * bytes() const noexcept
Definition: data_view.hpp:109
data_view & operator=(const data_view &dv) noexcept=default
data_view(const SmallBuffer &dt) noexcept
Definition: data_view.hpp:36
data_view(const char *dt, size_t len) noexcept
Definition: data_view.hpp:47
data_view(std::shared_ptr< const SmallBuffer > dt)
Definition: data_view.hpp:33
data_view(const std::vector< char > &dvec) noexcept
Definition: data_view.hpp:52
data_view & operator=(const SmallBuffer &dt) noexcept
Definition: data_view.hpp:77
char operator[](int index) const
Definition: data_view.hpp:124
void swap(data_view &dv2) noexcept
Definition: data_view.hpp:101
auto end()
Definition: data_view.hpp:128
bool empty() const noexcept
Definition: data_view.hpp:116
std::string string() const
Definition: data_view.hpp:120
data_view(SmallBuffer &&sb)
Definition: data_view.hpp:49
auto begin()
Definition: data_view.hpp:126
data_view & operator=(const std::string_view &str) noexcept
Definition: data_view.hpp:84
data_view & operator=(std::shared_ptr< const SmallBuffer > dt) noexcept
Definition: data_view.hpp:70
SmallBuffer to_buffer() const
Definition: data_view.hpp:98
data_view(data_view &&dv) noexcept
Definition: data_view.hpp:40
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
std::string to_string(CoreType type)
Definition: typeOperations.cpp:13