BaseXMLReader::ProcessElement PlannerBase::PlannerParameters::startElement(const std::string& name, const AttributesList& atts) { _ss.str(""); // have to clear the string if( !!__pcurreader ) { if( __pcurreader->startElement(name, atts) == PE_Support ) { return PE_Support; } return PE_Ignore; } if( __processingtag.size() > 0 ) { return PE_Ignore; } if( name=="plannerparameters" ) { _plannerparametersdepth++; return PE_Support; } if( name == "_postprocessing" ) { _sslocal.reset(new std::stringstream()); _sPostProcessingPlanner=""; _sPostProcessingParameters=""; FOREACHC(itatt,atts) { if( itatt->first == "planner" ) { _sPostProcessingPlanner = itatt->second; } } __pcurreader.reset(new DummyXMLReader(name,GetXMLId(),_sslocal)); return PE_Support; }
bool InterfaceBase::SendCommand(ostream& sout, istream& sinput) { string cmd; sinput >> cmd; if( !sinput ) { throw openrave_exception("invalid command",ORE_InvalidArguments); } boost::shared_ptr<InterfaceCommand> interfacecmd; { boost::shared_lock< boost::shared_mutex > lock(_mutexInterface); CMDMAP::iterator it = __mapCommands.find(cmd); if( it == __mapCommands.end() ) { throw openrave_exception(str(boost::format("failed to find command '%s' in interface %s\n")%cmd.c_str()%GetXMLId()),ORE_CommandNotSupported); } interfacecmd = it->second; } if( !interfacecmd->fn(sout,sinput) ) { RAVELOG_VERBOSE(str(boost::format("command failed in interface %s: %s\n")%GetXMLId()%cmd)); return false; } return true; }