mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-10-05 09:59:12 +00:00
66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
//============================================================================
|
|
// Copyright (c) Kitware, Inc.
|
|
// All rights reserved.
|
|
// See LICENSE.txt for details.
|
|
//
|
|
// This software is distributed WITHOUT ANY WARRANTY; without even
|
|
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
// PURPOSE. See the above copyright notice for more information.
|
|
//============================================================================
|
|
#include <vtkm/rendering/raytracing/Logger.h>
|
|
|
|
namespace vtkm
|
|
{
|
|
namespace rendering
|
|
{
|
|
namespace raytracing
|
|
{
|
|
|
|
Logger* Logger::Instance = nullptr;
|
|
|
|
Logger::Logger() {}
|
|
|
|
Logger::~Logger()
|
|
{
|
|
Stream.str("");
|
|
}
|
|
|
|
Logger* Logger::GetInstance()
|
|
{
|
|
if (Instance == nullptr)
|
|
{
|
|
Instance = new Logger();
|
|
}
|
|
return Instance;
|
|
}
|
|
|
|
std::stringstream& Logger::GetStream()
|
|
{
|
|
return Stream;
|
|
}
|
|
|
|
void Logger::Clear()
|
|
{
|
|
Stream.str("");
|
|
while (!Entries.empty())
|
|
{
|
|
Entries.pop();
|
|
}
|
|
}
|
|
|
|
void Logger::OpenLogEntry(const std::string& entryName)
|
|
{
|
|
Stream << entryName << " "
|
|
<< "<\n";
|
|
Entries.push(entryName);
|
|
}
|
|
void Logger::CloseLogEntry(const vtkm::Float64& entryTime)
|
|
{
|
|
this->Stream << "total_time " << entryTime << "\n";
|
|
this->Stream << this->Entries.top() << " >\n";
|
|
Entries.pop();
|
|
}
|
|
}
|
|
}
|
|
} // namespace vtkm::renderng::raytracing
|