Changeset 17144 for trunk/Mars/mcore


Ignore:
Timestamp:
09/07/13 17:25:39 (11 years ago)
Author:
tbretz
Message:
Added the possibility to check for the array size in SetPtrAddress
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/fits.h

    r17141 r17144  
    973973    }
    974974
    975     bool SetPtrAddress(const string &name, void *ptr)
     975    bool SetPtrAddress(const string &name, void *ptr, size_t cnt=0)
    976976    {
    977977        if (fTable.cols.count(name)==0)
     
    979979            ostringstream str;
    980980            str <<"SetPtrAddress('" << name << "') - Column not found." << endl;
     981#ifdef __EXCEPTIONS
     982            throw runtime_error(str.str());
     983#else
     984            gLog << ___err___ << "ERROR - " << str.str() << endl;
     985            return false;
     986#endif
     987        }
     988
     989        if (cnt && cnt!=fTable.cols[name].num)
     990        {
     991            ostringstream str;
     992            str << "SetPtrAddress('" << name << "') - Element count mismatch: expected "
     993                << fTable.cols[name].num << " from header, got " << cnt << endl;
    981994#ifdef __EXCEPTIONS
    982995            throw runtime_error(str.str());
Note: See TracChangeset for help on using the changeset viewer.