13 #ifndef ML_IMAGE_FORMAT_TAG_H
14 #define ML_IMAGE_FORMAT_TAG_H
51 const std::string &value) :
95 inline const std::string &
getName()
const {
return _name; }
98 inline const std::string &
getValue()
const {
return _value; }
101 inline void setName(
const std::string &newName){ _name = newName; }
119 snprintf(strBuf, 127,
"%lld", newVal);
127 char bufferStr[512]=
"";
130 snprintf(frmt, 255,
"%%.%dg", DBL_DIG);
133 snprintf(bufferStr, 511, frmt, newVal);
141 char bufferStr[512]=
"";
144 snprintf(frmt, 255,
"%%.%dLg", LDBL_DIG);
147 snprintf(bufferStr, 511, frmt, newVal);
154 return _name.size() + _value.size() + 2;
162 const size_t nameSize = _name .size();
163 const size_t valueSize = _value.size();
164 memcpy(memPos , _name .c_str(), nameSize ); memPos[nameSize ] =
'\0';
165 memcpy(memPos+nameSize+1, _value.c_str(), valueSize); memPos[nameSize+1+valueSize] =
'\0';
189 const char * bufSeek = mem;
193 const char *firstTerm =
nullptr;
194 const char *secondTerm =
nullptr;
195 for (; (bufSeek <= lastValidMemByte) && (numTerms < 2); ++bufSeek){
203 if (firstTerm && !secondTerm){ secondTerm = bufSeek; }
204 if (!firstTerm ){ firstTerm = bufSeek; }
210 if ((2 == numTerms) && firstTerm && secondTerm){
212 _value = firstTerm+1;
237 int numRead = sscanf(_value.c_str(),
"%lld", &intVal);
238 return (numRead == 1) ? intVal : 0;
246 int numRead = sscanf(_value.c_str(),
"%lf", &dblVal);
247 return (numRead == 1) ? dblVal : 0;
255 int numRead = sscanf(_value.c_str(),
"%Lf", &ldblVal);
256 return (numRead == 1) ? ldblVal : 0;
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
bool operator==(const MLImageFormatTag &tag1, const MLImageFormatTag &tag2)
Equality operator.
bool operator!=(const MLImageFormatTag &tag1, const MLImageFormatTag &tag2)
Inequality operator.