36 #define DOUBLE2STREAM(d) \ 38 (os) << std::setw(12); \ 39 (os) << (((d) != 0. && ABS(d) < 0.001) ? std::scientific : std::fixed);\ 42 #define INT2STREAM(i) \ 43 if (withFormat) os << std::setw(20); \ 94 if (this->
type != checkingType)
125 #define MDOBJECT_INIT() this->label = label; this->type = MDL::labelType(label); this->failed = false; this->chr = _SPACE; 298 const auto size = vv.size();
300 for (
size_t i = 0;
i < size; ++
i) {
308 const auto size = vv.size();
310 for (
size_t i = 0;
i < size; ++
i) {
381 size_t size = vectorDouble.size();
382 for (
size_t i = 0;
i < size;
i++)
384 double v = vectorDouble[
i];
397 size_t size = vector.size();
398 for (
size_t i = 0;
i < size;
i++)
399 os << vector[
i] <<
" ";
405 if (escape) os <<
_QUOT;
407 if (escape) os <<
_QUOT;
418 std::stringstream ss;
419 toStream(ss, withFormat, isSql, isSql);
475 s = s.substr(1, s.size() - 1);
476 while (s.find_last_of(chr) == String::npos)
481 s = s.substr(0, s.size() - 1);
488 is.ignore(256,
_QUOT);
497 is.ignore(256,
_QUOT);
502 is.ignore(256,
_QUOT);
511 is.ignore(256,
_QUOT);
525 std::stringstream ss(str);
531 std::stringstream ss(szChar);
536 return this->
eq(obj, 0);
545 throw std::logic_error(
"MDObject: cannot compare == objects of different type");
547 switch (this->
type) {
575 throw std::logic_error(
"MDObject: unknown data type");
592 throw std::logic_error(
"MDObject: cannot compare this type on <=");
596 return !(*
this ==
obj);
600 return (!(*
this <= obj) || (*
this == obj));
604 return ((*
this <= obj) && (*
this != obj));
608 return ((*
this >= obj) && (*
this != obj));
611 double MDObject::safeDouble(
const double v)
const {
615 std::cerr <<
"Warning: trying to work with NaN in MDObject with label " <<
MDL::label2Str(this->
label)
616 <<
". Using std::numeric_limits<double>::min() instead for backward compatilibity.\n";
622 float MDObject::safeFloat(
const float v)
const {
626 std::cerr <<
"Warning: trying to work with NaN in MDObject with label " <<
MDL::label2Str(this->
label)
627 <<
". Using std::numeric_limits<float>::min() instead for backward compatilibity.\n";
void labelTypeCheck(MDLabelType checkingType) const
void min(Image< double > &op1, const Image< double > &op2)
std::vector< size_t > * vectorValueLong
const int & getValue2(int) const
#define REPORT_ERROR(nerr, ErrormMsg)
static String labelType2Str(MDLabelType type)
void abs(Image< double > &op)
bool operator>=(const MDObject &obj) const
bool operator<(const MDObject &obj) const
bool eq(const MDObject &obj, double epsilon) const
void copy(const MDObject &obj)
bool operator>(const MDObject &obj) const
bool fromStream(std::istream &is, bool fromString=false)
static MDLabelType labelType(const MDLabel label)
MDObject(const MDObject &obj)
friend std::istream & operator>>(std::istream &is, MDObject &value)
std::vector< double > * vectorValue
bool fromString(const String &str)
bool operator!=(const MDObject &obj) const
bool fromChar(const char *str)
bool operator<=(const MDObject &obj) const
basic_istream< char, std::char_traits< char > > istream
String toString(bool withFormat=false, bool isSql=false) const
std::vector< float > * vectorValueFloat
String formatString(const char *format,...)
void setValue(const int &iv)
void toStream(std::ostream &os, bool withFormat=false, bool isSql=false, bool escape=true) const
bool operator==(const MDObject &obj) const
static String label2Str(const MDLabel &label)
friend std::ostream & operator<<(std::ostream &is, const MDObject &value)
MDObject & operator=(const MDObject &obj)