20#ifndef _OPENMBV_IVSCREENANNOTATION_H_
21#define _OPENMBV_IVSCREENANNOTATION_H_
24#include <hdf5serie/vectorserie.h>
65 xercesc::DOMElement* writeXMLFile(xercesc::DOMNode *parent)
override;
66 void setScale1To1(
bool scale1To1_);
79 std::vector<double> getScale1To1At();
82 void setIvFileName(std::string ivFileName_) { ivContent=
""; ivFileName=std::move(ivFileName_); }
83 std::string getIvFileName() {
return ivFileName; }
85 void setIvContent(std::string ivContent_) { ivFileName=
""; ivContent=std::move(ivContent_); }
86 const std::string& getIvContent() {
return ivContent; }
88 void setColumnLabels(
const std::vector<std::string> &columnLabels_);
89 void addColumnLabel(
const std::string &columnLabel_);
90 const std::vector<std::string>& getColumnLabels()
const;
91 void setColumnIntLabels(
const std::vector<std::string> &columnIntLabels_);
92 void addColumnIntLabel(
const std::string &columnIntLabel_);
93 const std::vector<std::string>& getColumnIntLabels()
const;
94 void setColumnStrLabels(
const std::vector<std::string> &columnStrLabels_);
95 void addColumnStrLabel(
const std::string &columnStrLabel_);
96 const std::vector<std::string>& getColumnStrLabels()
const;
97 void setFixedStrSize(
int fss) { fixedStrSize = fss; }
98 int getFixedStrSize() {
return fixedStrSize; }
100 void createHDF5File()
override;
101 void openHDF5File()
override;
104 void append(
const T& row) {
105 if(data==
nullptr)
throw std::runtime_error(
"IvScreenAnnotation: Cannot append data to an environment object");
106 if(row.size()!=1+columnLabels.size())
throw std::runtime_error(
"IvScreenAnnotation: The dimension does not match (append: "+
107 std::to_string(row.size())+
", columns: "+std::to_string(1+columnLabels.size())+
")");
108 data->
append(&row[0], row.size());
112 void appendInt(
const T& row) {
113 if(dataInt==
nullptr)
throw std::runtime_error(
"IvScreenAnnotation: Cannot append dataInt to an environment object");
114 if(row.size()!=columnIntLabels.size())
throw std::runtime_error(
"IvScreenAnnotation: The dimension does not match (appendInt: "+
115 std::to_string(row.size())+
", columns: "+std::to_string(columnIntLabels.size())+
")");
116 dataInt->
append(&row[0], row.size());
120 void appendStr(
const T& row) {
121 if(dataStr==
nullptr)
throw std::runtime_error(
"IvScreenAnnotation: Cannot append dataStr to an environment object");
122 if(row.size()!=columnStrLabels.size())
throw std::runtime_error(
"IvScreenAnnotation: The dimension does not match (append: "+
123 std::to_string(row.size())+
", columns: "+std::to_string(columnStrLabels.size())+
")");
124 dataStr->
append(&row[0], row.size());
128 std::vector<Float>
getRow(
int i)
override {
130 return std::vector<Float>(1+columnLabels.size());
132 auto row = data->
getRow(i);
135 if(columnLabels.size() == row.size()) {
136 std::vector<Float> ret(1+row.size());
138 for(
size_t i = 0; i < row.size(); ++i)
146 std::vector<int> getRowInt(
int i) {
148 return std::vector<int>(columnIntLabels.size());
149 return dataInt->
getRow(i);
152 std::vector<std::string> getRowStr(
int i) {
154 return std::vector<std::string>(columnStrLabels.size());
155 return dataStr->
getRow(i);
158 IvScreenAnnotation();
159 ~IvScreenAnnotation()
override =
default;
160 bool scale1To1 {
false };
161 std::vector<double> scale1To1Center;
162 std::string ivFileName;
163 std::string ivContent;
164 int fixedStrSize { -1 };
165 std::vector<std::string> columnLabels;
166 std::vector<std::string> columnIntLabels;
167 std::vector<std::string> columnStrLabels;
void getRow(int row, size_t size, T data[])
void append(const T data[], size_t size)
Definition: ivscreenannotation.h:61
void setScale1To1At(const std::vector< double > &scale1To1Center_)
Definition: ivscreenannotation.cc:122
void initializeUsingXML(xercesc::DOMElement *element) override
Definition: ivscreenannotation.cc:60
void setIvFileName(std::string ivFileName_)
Definition: ivscreenannotation.h:82
int getRows() override
Definition: ivscreenannotation.h:127
std::vector< Float > getRow(int i) override
Definition: ivscreenannotation.h:128
Definition: objectfactory.h:38