/////////////READ///////////////////////////////////////// // void SpatialConvex::read(std::istream &in) { size_t nconstr; SpatialConstraint constr; in.setf(std::ios::skipws); while(in.peek() == COMMENT) // ignore comments in.ignore(10000,'\n'); in >> nconstr ; in.ignore(); // ignore "\n" if(!in.good()) throw SpatialFailure("SpatialConvex:read: Could not read constraint"); for(size_t i = 0; i < nconstr; i++) { if(in.eof()) throw SpatialFailure("SpatialConvex:read: Premature end-of-file"); in >> constr; if(!in.good()) throw SpatialFailure("SpatialConvex:read: Could not read constraint"); add(constr); } }
// get an integer out of the command string float64 htmInterface::getFloat() { if(!t_) throw SpatialFailure("htmInterface:getFloat: No command to parse"); // parse incoming string. expect to have an integer. const VarStr &token = t_->next(); if(!isFloat(token)) throw SpatialInterfaceError("htmInterface:getFloat: Expected float at first position of Command. ",cmd_.data()); return atof(token.data()); }
// get an integer out of the command string int32 htmInterface::getInteger() { if(t_ == NULL) throw SpatialFailure("htmInterface:getInteger: No command to parse"); // parse incoming string. expect to have an integer. const StdStr &token = t_->next(); if(!isInteger(token)) throw SpatialInterfaceError("htmInterface:getInteger: Expected integer at first position of Command. ",cmd_.data()); return atoi(token.data()); }
/////////////READ///////////////////////////////////////// // void SpatialConstraint::read(std::istream &in) { in.setf(std::ios::skipws); while(in.peek() == COMMENT) // ignore comments in.ignore(10000,'\n'); in >> a_ >> d_ ; if(!in.good()) throw SpatialFailure("SpatialConstraint:read: Could not read constraint"); a_.normalize(); s_ = acos(d_); if (d_ <= -gEpsilon) sign_ = nEG; else if(d_ >= gEpsilon) sign_ = pOS; else sign_ = zERO; }
// get an integer out of the command string uint64 htmInterface::getInt64() { if(!t_) throw SpatialFailure("htmInterface:getInt64: No command to parse"); // parse incoming string. expect to have an integer. const VarStr &token = t_->next(); if(!isInteger(token)) throw SpatialInterfaceError("htmInterface:getInt64: Expected integer at first position of Command. ",cmd_.data()); #ifdef SpatialWinNT return _atoi64(token.data()); #elif defined(SpatialDigitalUnix) return atol(token.data()); #else return atoll(token.data()); #endif }