Remove runtime inference of unrecognized SFields

This commit is contained in:
Scott Schurr
2019-02-13 14:08:55 -08:00
committed by Nik Bougalis
parent 9279a3fee7
commit 57fe197d3e
6 changed files with 241 additions and 169 deletions

View File

@@ -28,18 +28,20 @@ void SOTemplate::push_back (SOElement const& r)
//
if (mIndex.empty ())
{
// Unmapped indices will be set to -1
// Unmapped indices are initialized to -1
//
mIndex.resize (SField::getNumFields () + 1, -1);
}
// Make sure the field's index is in range
//
assert (r.e_field.getNum () < mIndex.size ());
if (r.e_field.getNum() <= 0 || r.e_field.getNum() >= mIndex.size())
Throw<std::runtime_error> ("Invalid field index for SOTemplate.");
// Make sure that this field hasn't already been assigned
//
assert (getIndex (r.e_field) == -1);
if (getIndex (r.e_field) != -1)
Throw<std::runtime_error> ("Duplicate field index for SOTemplate.");
// Add the field to the index mapping table
//