MCPcopy Create free account
hub / github.com/assimp/assimp / detachStream

Method detachStream

code/Common/DefaultLogger.cpp:344–373  ·  view source on GitHub ↗

---------------------------------------------------------------------------------- Detach a stream

Source from the content-addressed store, hash-verified

342// ----------------------------------------------------------------------------------
343// Detach a stream
344bool DefaultLogger::detachStream(LogStream *pStream, unsigned int severity) {
345 if (nullptr == pStream) {
346 return false;
347 }
348
349 if (0 == severity) {
350 severity = SeverityAll;
351 }
352
353#ifndef ASSIMP_BUILD_SINGLETHREADED
354 std::lock_guard<std::mutex> lock(m_arrayMutex);
355#endif
356
357 bool res(false);
358 for (StreamIt it = m_StreamArray.begin(); it != m_StreamArray.end(); ++it) {
359 if ((*it)->m_pStream == pStream) {
360 (*it)->m_uiErrorSeverity &= ~severity;
361 if ((*it)->m_uiErrorSeverity == 0) {
362 // don't delete the underlying stream 'cause the caller gains ownership again
363 (**it).m_pStream = nullptr;
364 delete *it;
365 m_StreamArray.erase(it);
366 res = true;
367 break;
368 }
369 return true;
370 }
371 }
372 return res;
373}
374
375// ----------------------------------------------------------------------------------
376// Constructor

Callers 3

TEST_FFunction · 0.80
aiDetachLogStreamFunction · 0.80
aiDetachAllLogStreamsFunction · 0.80

Calls 3

eraseMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected