8 #include <epicsStdio.h> 9 #include <epicsExport.h> 12 int MRFVersion::compare(
const MRFVersion& o)
const 16 else if(m_major>o.m_major)
18 else if(m_minor<o.m_minor)
20 else if(m_minor>o.m_minor)
26 std::string MRFVersion::str()
const 28 std::ostringstream strm;
33 std::ostream&
operator<<(std::ostream& strm,
const MRFVersion& ver)
35 strm<<std::hex<<ver.firmware()
36 <<std::hex<<std::setfill(
'0')<<std::setw(2)<<ver.revision()
38 <<((ver.subrelease()<0) ?
"-" :
"")
39 <<abs(ver.subrelease());
46 throw std::range_error(
"Value not finite");
49 throw std::range_error(
"Negative value not allowed");
54 throw std::range_error(
"Value too large");
56 return (epicsUInt32)val;
61 char *mem = (
char*)calloc(1, N);
63 throw std::bad_alloc();
69 epicsVsnprintf(mem, N, fmt, args);
78 #if (EPICS_VERSION_INT < VERSION_INT(3,15,0,2)) 82 epicsParseULong(
const char *str,
unsigned long *to,
int base,
char **units)
88 while ((c = *str) && isspace(c))
92 value = strtoul(str, &endp, base);
101 while ((c = *endp) && isspace(c))
116 int status = epicsParseULong(str, &value, base, units);
121 #if (ULONG_MAX > 0xffffffffULL) 122 if (value > 0xffffffffUL && value <= ~0xffffffffUL)
126 *to = (epicsUInt32) value;
int epicsParseUInt32(const char *str, epicsUInt32 *to, int base, char **units)
std::ostream & operator<<(std::ostream &strm, const MRFVersion &ver)
char * allocSNPrintf(size_t N, const char *fmt,...)
#define S_stdlib_noConversion
#define S_stdlib_overflow
epicsUInt32 roundToUInt(double val, epicsUInt32 max)
#define S_stdlib_extraneous