本文整理汇总了C++中NameSet::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ NameSet::begin方法的具体用法?C++ NameSet::begin怎么用?C++ NameSet::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameSet
的用法示例。
在下文中一共展示了NameSet::begin方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
// **************************************************************************
// Function: LoadParameterList
// Purpose: Loads the current list of parameters from a parameter file
// It does NOT load system critical dynamic parameters (e.g., ports,
// IP addresses)
// Parameters: char *filename - filename of the parameterlist
// nonexisting - if true, load parameters, even if they currently do
// not exist in the list
// Returns: true - successful
// false - error
// **************************************************************************
bool
ParamList::Load( const string& inFileName, bool inImportNonexisting )
{
ifstream file( inFileName.c_str() );
ParamList paramsFromFile;
file >> paramsFromFile;
if( file.fail() )
return false;
// If desired, exclude parameters missing from the main parameter list.
typedef set<string> NameSet;
NameSet unwantedParams;
if( !inImportNonexisting )
for( int i = 0; i < paramsFromFile.Size(); ++i )
if( !Exists( paramsFromFile[i].Name() ) )
unwantedParams.insert( paramsFromFile[i].Name() );
for( NameSet::const_iterator i = unwantedParams.begin(); i != unwantedParams.end(); ++i )
paramsFromFile.Delete( *i );
for( int i = 0; i < paramsFromFile.Size(); ++i )
{
Param &p = paramsFromFile[i], &q = ByName( p.Name() );
if( !q.Readonly() )
q.AssignValues( p, true );
}
return true;
}
示例2: inters
void
EnvironmentBase::RangeCheckParams( const ParamList* inParamList, const NameSet& inCheck )
{
for( NameSetMap::const_iterator i = OwnedParams().begin(); i != OwnedParams().end(); ++i )
{
vector<string> inters( inCheck.size() );
vector<string>::iterator inters_end = set_intersection(
inCheck.begin(), inCheck.end(),
i->second.begin(), i->second.end(),
inters.begin(), Param::NameCmp()
);
for( vector<string>::const_iterator j = inters.begin(); j != inters_end; ++j )
{
const Param& p = ( *inParamList )[ *j ];
const string& lowRangeStr = p.LowRange(),
& highRangeStr = p.HighRange();
bool checkLowRange = ( !lowRangeStr.empty() ),
checkHighRange = ( !highRangeStr.empty() );
if( checkLowRange )
{
double lowRange = ::atof( lowRangeStr.c_str() );
for( int j = 0; j < p.NumRows(); ++j )
for( int k = 0; k < p.NumColumns(); ++k )
{
double value = ::atof( p.Value( j, k ).ToString().c_str() );
if( value < lowRange )
bcierr__ << DescribeValue( p, j, k )
<< " is "
<< value << ", exceeds lower range (" << lowRange << ")";
}
}
if( checkHighRange )
{
double highRange = ::atof( highRangeStr.c_str() );
for( int j = 0; j < p.NumRows(); ++j )
for( int k = 0; k < p.NumColumns(); ++k )
{
double value = ::atof( p.Value( j, k ).ToString().c_str() );
if( value > highRange )
bcierr__ << DescribeValue( p, j, k )
<< " is "
<< value << ", exceeds high range (" << highRange << ")";
}
}
if( checkLowRange || checkHighRange )
ParamsRangeChecked().insert( p.Name() );
}
}
}
示例3: cleanInvalidUpdateMorph
void AnimationCleanerVisitor::cleanInvalidUpdateMorph() {
// Removes unused UpdateMorph targets (i.e. name does not match any MorphGeometry target)
for(AnimationUpdateCallBackMap::iterator update = _updates.begin() ; update != _updates.end() ; ++ update) {
osgAnimation::UpdateMorph *updateMorph = dynamic_cast<osgAnimation::UpdateMorph*>(update->first.get());
if(!updateMorph) continue;
NameSet toRemove;
for(unsigned int i = 0, numTarget = updateMorph->getNumTarget(); i < numTarget; ++i) {
const std::string& name = updateMorph->getTargetName(i);
if(_morphTargets.count(name) == 0) {
toRemove.insert(name);
}
}
for(NameSet::iterator targetName = toRemove.begin(); targetName != toRemove.end(); ++targetName) {
updateMorph->removeTarget(*targetName);
}
}
// Removes empty UpdateMorphCallback
for(AnimationUpdateCallBackMap::iterator update = _updates.begin() ; update != _updates.end() ; ) {
osgAnimation::UpdateMorph *updateMorph = dynamic_cast<osgAnimation::UpdateMorph*>(update->first.get());
if(!updateMorph || updateMorph->getNumTarget() != 0) {
++ update;
}
else {
osg::Callback *callBack = update->second.get()->getUpdateCallback();
if(callBack) {
if(callBack == updateMorph)
update->second.get()->setUpdateCallback(callBack->getNestedCallback());
else
callBack->removeNestedCallback(updateMorph);
}
_updates.erase(update ++);
}
}
}
示例4: file
// **************************************************************************
// Function: LoadParameterList
// Purpose: Loads the current list of parameters from a parameter file
// It does NOT load system critical dynamic parameters (e.g., ports,
// IP addresses)
// Parameters: char *filename - filename of the parameterlist
// nonexisting - if true, load parameters, even if they currently do
// not exist in the list
// Returns: true - successful
// false - error
// **************************************************************************
bool
ParamList::Load( const string& inFileName, bool inImportNonexisting )
{
ifstream file( inFileName.c_str() );
ParamList paramsFromFile;
file >> paramsFromFile;
if( file.fail() )
return false;
typedef set<string> NameSet;
NameSet unwantedParams;
// Exclude parameters from unwanted sections.
const char* unwantedSections[] = { "System", };
for( size_t j = 0; j < sizeof( unwantedSections ) / sizeof( *unwantedSections ); ++j )
for( ParamContainer::const_iterator i = paramsFromFile.mParams.begin();
i != paramsFromFile.mParams.end(); ++i )
if( Param::strciequal( i->Param.Section(), unwantedSections[ j ] ) )
unwantedParams.insert( i->Param.mName );
// If desired, exclude parameters missing from the main parameter list.
if( !inImportNonexisting )
for( ParamContainer::const_iterator i = paramsFromFile.mParams.begin();
i != paramsFromFile.mParams.end(); ++i )
if( mNameIndex.find( i->Param.mName ) == mNameIndex.end() )
unwantedParams.insert( i->Param.mName );
for( NameSet::const_iterator i = unwantedParams.begin(); i != unwantedParams.end(); ++i )
paramsFromFile.Delete( *i );
for( ParamContainer::const_iterator i = paramsFromFile.mParams.begin();
i != paramsFromFile.mParams.end(); ++i )
( *this )[ i->Param.mName ].AssignValues( i->Param );
return true;
}
示例5: setDependentParameterNameSet
/*! \todo
*/
void Parameter::setDependentParameterNameSet(const NameSet& inNameSet) throw()
{
mDependentParameterNameSet.clear();
for(NameSet::const_iterator lItr = inNameSet.begin(); lItr != inNameSet.end(); lItr++)
mDependentParameterNameSet.insert(lItr->c_str());
}