// Add an object to the table, optionally specifying an ID. Returns a // unique ID for the object. ASSERTs and throws exception if object is // already in table or the ID is already taken. int cSerRefCountTable::Add(iSerRefCountObj* pObj, int id) { if (Lookup(pObj) != 0) { // this should be a programming error, but we will throw just to be safe... ThrowAndAssert(eInternal(_T("cSerRefCountTable::Add() passed object already in table."))); } if (id == 0) { id = mIDToObjTbl.empty() ? 1 : mIDToObjTbl.rbegin()->first + 1; ASSERT(Lookup(id) == NULL); } else if (Lookup(id) != NULL) { // this should be a programming error, but we will throw just to be safe... ThrowAndAssert(eInternal(_T("cSerRefCountTable::Add() passed ID already in table."))); } mIDToObjTbl.insert( MapIDTObj::value_type(id, pObj)); mObjToIdTbl.insert( MapObjIDT::value_type(pObj, id)); return id; }
#include "archive.h" #include "error.h" #include "unixexcept.h" #include "fsservices.h" #include "serializer.h" #include "cmdlineparser.h" #include "twlocale.h" #include "codeconvert.h" #include "ntmbs.h" #include "displayencoder.h" TSS_BEGIN_ERROR_REGISTRATION( core ) /// Internal TSS_REGISTER_ERROR( eInternal(), _T("Internal error.") ) /// General TSS_REGISTER_ERROR( eErrorGeneral(), _T("General Error") ); TSS_REGISTER_ERROR( eOpen(), _T("File could not be opened.") ); TSS_REGISTER_ERROR( eOpenRead(), _T("File could not be opened for reading.") ); TSS_REGISTER_ERROR( eOpenWrite(), _T("File could not be opened for writing.") ); TSS_REGISTER_ERROR( eBadModeSwitch(), _T("Unknown mode specified.") ); TSS_REGISTER_ERROR( eBadCmdLine(), _T("Command line error.") ); /// Archive TSS_REGISTER_ERROR( eArchive(), _T("Archive error.") )