Example #1
0
 void validate(param_descrs const & p) {
     svector<params::entry>::iterator it  = m_entries.begin();  
     svector<params::entry>::iterator end = m_entries.end();
     symbol suffix, prefix;
     for (; it != end; ++it) {                                
         param_kind expected = p.get_kind_in_module(it->first);
         if (expected == CPK_INVALID) {
             std::stringstream strm;
             strm << "unknown parameter '" << it->first.str() << "'\n";    
             strm << "Legal parameters are:\n";
             p.display(strm, 2, false, false);
             throw default_exception(strm.str());
         }
         if (it->second.m_kind != expected && 
             !(it->second.m_kind == CPK_UINT && expected == CPK_NUMERAL)) {
             std::stringstream strm;
             strm << "Parameter " << it->first.str() << " was given argument of type ";
             strm << it->second.m_kind << ", expected " << expected;                
             throw default_exception(strm.str());
         }
     }
 }