A multi-threaded data streamer to disk. More...
#include <Devices/DiskDataStream.H>
Classes | |
struct | Impl |
Public Member Functions | |
DiskDataStream (OptionManager &mgr, const std::string &descrName="Disk Data Stream", const std::string &tagName="DiskDataStream") | |
Constructor. | |
~DiskDataStream () | |
Destructor. | |
virtual void | setConfigInfo (const std::string &path) |
Override from FrameOstream; just calls setSavePath(). | |
virtual void | writeFrame (const GenericFrame &frame, const std::string &shortname, const FrameInfo &auxinfo=defaultInfo) |
Push a data object for asynchronous saving to disk. | |
void | setSavePath (const std::string &path) |
Specify a comma-separated list of output prefixes. | |
virtual void | closeStream (const std::string &shortname) |
Reset the in and out frame numbers for shortname to 0. | |
Protected Member Functions | |
virtual void | start2 () |
start our worker thread | |
virtual void | stop1 () |
join our worker thread |
A multi-threaded data streamer to disk.
This class implements a cache to allow asynchronous streaming of series of data objects to disk. Users push their data objects as they become available in the main processing thread, and the class' internal thread will attempt to save them to disk as quickly as possible.
Definition at line 58 of file DiskDataStream.H.
DiskDataStream::DiskDataStream | ( | OptionManager & | mgr, | |
const std::string & | descrName = "Disk Data Stream" , |
|||
const std::string & | tagName = "DiskDataStream" | |||
) |
Constructor.
Definition at line 98 of file DiskDataStream.C.
DiskDataStream::~DiskDataStream | ( | ) |
Destructor.
Definition at line 113 of file DiskDataStream.C.
void DiskDataStream::closeStream | ( | const std::string & | shortname | ) | [virtual] |
Reset the in and out frame numbers for shortname to 0.
Implements FrameOstream.
Definition at line 236 of file DiskDataStream.C.
void DiskDataStream::setConfigInfo | ( | const std::string & | path | ) | [virtual] |
Override from FrameOstream; just calls setSavePath().
Reimplemented from FrameOstream.
Definition at line 119 of file DiskDataStream.C.
References setSavePath().
void DiskDataStream::setSavePath | ( | const std::string & | path | ) |
Specify a comma-separated list of output prefixes.
The string should contain a comma-separated list of filename stems for where to save files; e.g., 'dir0/pfx0,dir1/pfx1' will save even-numbered files with the prefix 'dir0/pfx0' and will save odd-numbered files with the prefix 'dir1/pfx1'
Definition at line 129 of file DiskDataStream.C.
References ASSERT, and split().
Referenced by setConfigInfo(), and start2().
void DiskDataStream::start2 | ( | ) | [protected, virtual] |
start our worker thread
Reimplemented from ModelComponent.
Definition at line 150 of file DiskDataStream.C.
References ASSERT, OModelParam< T >::getVal(), WorkThreadServer::setCheckpointPeriod(), setSavePath(), WorkThreadServer::setSleepUsecs(), and OModelParam< T >::setVal().
void DiskDataStream::stop1 | ( | ) | [protected, virtual] |
join our worker thread
Reimplemented from ModelComponent.
Definition at line 175 of file DiskDataStream.C.
References WorkThreadServer::size().
void DiskDataStream::writeFrame | ( | const GenericFrame & | frame, | |
const std::string & | shortname, | |||
const FrameInfo & | auxinfo = defaultInfo | |||
) | [virtual] |
Push a data object for asynchronous saving to disk.
This version makes an initial copy of the data, so that it can be destroyed immediately upon return.
Implements FrameOstream.
Definition at line 196 of file DiskDataStream.C.
References ASSERT, GenericFrame::deepCopyOf(), WorkThreadServer::enqueueJob(), dummy_namespace_to_avoid_gcc411_bug_DiskDataStream_C::DiskDumpStreamData::frameNumberIn, dummy_namespace_to_avoid_gcc411_bug_DiskDataStream_C::DiskDumpStreamData::frameNumberOut, OModelParam< T >::getVal(), and sformat().