18 #include "gsl/gsl-lite.hpp"
35 virtual void resize(std::size_t newSize) = 0;
39 virtual void resize(std::size_t newSize, gsl::span<char> &fillValue) = 0;
54 template <
typename DataType>
71 void resize(std::size_t newSize, gsl::span<char> &fillValue)
override {
72 gsl::span<DataType> fv_span(
reinterpret_cast<DataType *
>(fillValue.data()), 1);
81 if (data.size() > 0) {
82 std::size_t numObjects = data.size() /
sizeof(DataType);
83 gsl::span<DataType> d_span(
reinterpret_cast<DataType *
>(data.data()), numObjects);
100 std::size_t datumLen =
sizeof(DataType);
102 if (data.size() > 0) {
103 gsl::span<char> c_span(
104 const_cast<char *
>(
reinterpret_cast<const char *
>(
var_attr_data_.data())), numChars);
111 for (std::size_t i = 0; i < datumLen; ++i) {
112 data[m_indx + i] = c_span[f_indx + i];
138 void resize(std::size_t newSize, gsl::span<char> &fillValue)
override {
141 gsl::span<char *> fv_span(
reinterpret_cast<char **
>(fillValue.data()), 1);
152 if (data.size() > 0) {
153 std::size_t numObjects = data.size() /
sizeof(
char *);
154 gsl::span<char *> d_span(
reinterpret_cast<char **
>(data.data()), numObjects);
155 std::vector<char *> inStrings(numObjects);
156 for (std::size_t i = 0; i < numObjects; ++i) {
157 inStrings[i] = d_span[i];
178 if (data.size() > 0) {
179 std::vector<const char *> outStrings(numObjects);
180 for (std::size_t i = 0; i < numObjects; ++i) {
184 std::size_t datumLen =
sizeof(
char *);
185 std::size_t numChars = outStrings.size() * datumLen;
186 gsl::span<char> c_span(
reinterpret_cast<char *
>(outStrings.data()), numChars);
193 for (std::size_t i = 0; i < datumLen; ++i) {
194 data[m_indx + i] = c_span[f_indx + i];
245 throw Exception(
"Unrecognized data type encountered during "
246 "Attribute object construnction",
ioda_Here());
Functions for ObsStore Selection.
Functions for ObsStore type markers.
The ioda exception class.
bool end_lin_indx() const
returns true when at the end of the linear memory indices
void init_lin_indx()
initializes iterator for walking through linear memory indices
std::size_t next_lin_indx()
returns next linear memory index
void read(gsl::span< char > data, Selection &m_select, Selection &f_select) const override
transfer data from data storage vector
void resize(std::size_t newSize, gsl::span< char > &fillValue) override
resizes memory allocated for data storage (vector)
void resize(std::size_t newSize) override
resizes memory allocated for data storage (vector)
std::vector< std::string > var_attr_data_
data storage mechanism (vector)
void write(gsl::span< char > data, Selection &m_select, Selection &f_select) override
transfer data to data storage vector
virtual void write(gsl::span< char > data, Selection &m_select, Selection &f_select)=0
transfer data to data storage vector
virtual void resize(std::size_t newSize, gsl::span< char > &fillValue)=0
resizes memory allocated for data storage (vector)
virtual void resize(std::size_t newSize)=0
resizes memory allocated for data storage (vector)
virtual void read(gsl::span< char > data, Selection &m_select, Selection &f_select) const =0
transfer data from data storage vector
virtual ~VarAttrStore_Base()
std::vector< DataType > var_attr_data_
data storage mechanism (vector)
void resize(std::size_t newSize) override
resizes memory allocated for data storage (vector)
void resize(std::size_t newSize, gsl::span< char > &fillValue) override
resizes memory allocated for data storage (vector)
void read(gsl::span< char > data, Selection &m_select, Selection &f_select) const override
transfer data from data storage vector
void write(gsl::span< char > data, Selection &m_select, Selection &f_select) override
transfer data to data storage vector
@ ObsStore
ObsStore in-memory.
VarAttrStore_Base * createVarAttrStore(ObsTypes dtype)
factory style function to create a new templated object
ObsTypes
ObsStore data type markers.