void CIdentifierStorage::requestIdentifier(ObjectCallback callback) { checkIdentifier(callback.type); checkIdentifier(callback.name); assert(!callback.localScope.empty()); if (state != FINISHED) // enqueue request if loading is still in progress scheduledRequests.push_back(callback); else // execute immediately for "late" requests resolveIdentifier(callback); }
void CIdentifierStorage::finalize() { bool errorsFound = false; for(const ObjectCallback & request : scheduledRequests) { errorsFound |= !resolveIdentifier(request); } if (errorsFound) { for(auto object : registeredObjects) { logGlobal->traceStream() << object.first << " -> " << object.second.id; } logGlobal->errorStream() << "All known identifiers were dumped into log file"; } assert(errorsFound == false); }
void CIdentifierStorage::finalize() { state = FINALIZING; bool errorsFound = false; //Note: we may receive new requests during resolution phase -> end may change -> range for can't be used for(auto it = scheduledRequests.begin(); it != scheduledRequests.end(); it++) { errorsFound |= !resolveIdentifier(*it); } if (errorsFound) { for(auto object : registeredObjects) { logGlobal->traceStream() << object.second.scope << " : " << object.first << " -> " << object.second.id; } logGlobal->errorStream() << "All known identifiers were dumped into log file"; } assert(errorsFound == false); state = FINISHED; }