void Item::extractVariables( VariableSet &vs ) const { ItemPtr i = getParent(); if ( i ) i->extractVariables( vs ); for ( auto x = myVariables.begin(); x != myVariables.end(); ++x ) vs.emplace( std::make_pair( x->first, x->second ) ); }
void Item::extractVariablesExcept( VariableSet &vs, const std::set<std::string> &vl ) const { ItemPtr i = getParent(); if ( i ) i->extractVariablesExcept( vs, vl ); for ( auto x = myVariables.begin(); x != myVariables.end(); ++x ) { if ( vl.find( x->first ) == vl.end() ) vs.emplace( std::make_pair( x->first, x->second ) ); } }
void merge( VariableSet &vs, const VariableSet &other ) { if ( vs.empty() ) vs = other; else { for ( auto i: other ) { auto cur = vs.find( i.first ); if ( cur == vs.end() ) { vs.emplace( std::make_pair( i.first, i.second ) ); } else cur->second.merge( i.second ); } } }