本文整理汇总了C++中orcaice::Context::tag方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::tag方法的具体用法?C++ Context::tag怎么用?C++ Context::tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类orcaice::Context
的用法示例。
在下文中一共展示了Context::tag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: elementType
void
loadElementsFromConfigFile( orcaqgemv::GuiElementModel &guiElementModel,
const orcaice::Context &context )
{
// create a map of types
const string typePrefix = context.tag() + ".Config.Element.Type";
std::map<string,string> typeMap = context.properties()->getPropertiesForPrefix(typePrefix);
// create a map of descriptions
const string descriptionPrefix = context.tag() + ".Config.Element.Description";
std::map<string,string> descriptionMap = context.properties()->getPropertiesForPrefix(descriptionPrefix);
// debug output
for ( map<string,string>::iterator it=typeMap.begin(); it!=typeMap.end(); ++it )
{
stringstream ss;
ss << "it->first: " << it->first << endl;
ss << "it->second: " << it->second << endl;
context.tracer().debug( ss.str(), 5 );
}
// create elements based on Type entries
for ( map<string,string>::iterator it = typeMap.begin(); it != typeMap.end(); ++it )
{
// extract the key: e.g. for Config.Element.TypeXX the key is XX
QString elementType( it->second.c_str() );
string key = it->first.substr( typePrefix.size() );
stringstream ss; ss << "Extracted key is: " << key;
context.tracer().debug( ss.str(), 5 );
// find the corresponding entry in the descriptionMap
map<string,string>::iterator descriptionMapIt = descriptionMap.find( context.tag() + ".Config.Element.Description" + key );
if ( descriptionMapIt==descriptionMap.end() )
{
ss.str(""); ss << "'Description' entry with key " << key << " expected. Check your config file!";
context.tracer().warning( ss.str() );
continue;
}
// found an entry
ss.str(""); ss << "Found Description entry: " << descriptionMapIt->second;
context.tracer().debug( ss.str(), 5 );
//
// assemble all pieces to create the GUI element
//
QString elementDescription( descriptionMapIt->second.c_str() );
QString uniqueId = extractUniqueId( elementDescription );
QString platformName = extractPlatformName( elementDescription );
guiElementModel.createGuiElement( elementType, elementDescription, platformName, uniqueId );
}
}
示例2: readFromProperties
void readFromProperties( orcaice::Context context, VfhAlgorithmConfig &c )
{
Ice::PropertiesPtr prop = context.properties();
std::string prefix = context.tag();
prefix += ".Config.Vfh.";
c.cellSize = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"CellSize", 0.1 );
c.gridWidthInCells = orcaice::getPropertyAsIntWithDefault( prop, prefix+"GridWidthInCells", 61 );
c.sectorAngle = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"SectorAngle", 5.0 )*M_PI/180.0;
// c.robotRadius = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"RobotRadius", 0.3 );
c.safetyDist0ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"SafetyDist0ms", 0.1 );
c.safetyDist1ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"SafetyDist1ms", 0.1 );
c.maxSpeed = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MaxSpeed", 0.2 );
c.maxSpeedNarrowOpening = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MaxSpeedNarrowOpening", 0.2 );
c.maxSpeedWideOpening = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MaxSpeedWideOpening", 0.2 );
c.maxAcceleration = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MaxAcceleration", 0.2 );
c.maxTurnrate0ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MaxTurnrate0ms", 40.0 )*M_PI/180.0;
c.maxTurnrate1ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MaxTurnrate1ms", 40.0 )*M_PI/180.0;
c.absoluteMaxTurnrate = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"AbsoluteMaxTurnrate", 60.0 )*M_PI/180.0;
c.minTurnRadiusSafetyFactor = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"MinTurnRadiusSafetyFactor", 1.10 );
c.freeSpaceCutoff0ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"FreeSpaceCutoff0ms", 2e6 );
c.freeSpaceCutoff1ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"FreeSpaceCutoff1ms", 2e6 );
c.obsCutoff0ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"ObsCutoff0ms", 2e6 );
c.obsCutoff1ms = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"ObsCutoff1ms", 2e6 );
c.weightDesiredDir = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"WeightDesiredDir", 5.0 );
c.weightCurrentDir = orcaice::getPropertyAsDoubleWithDefault( prop, prefix+"WeightCurrentDir", 3.0 );
}