Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Related Pages

Sct::Archive::IOManagerStreamerVersioned Class Reference

Abstract IOManager to be used in archival, makes use of streamer versioning. More...

#include <IOManagerStreamerVersioned.h>

Inheritance diagram for Sct::Archive::IOManagerStreamerVersioned:

Inheritance graph
[legend]
Collaboration diagram for Sct::Archive::IOManagerStreamerVersioned:

Collaboration graph
[legend]

Public Member Functions

virtual StreamergetStreamer (const string &className) const
 Over-ride of getStreamer returns appropriate version of streamer if in read mode, otherwise default IOManager::getStreamer.

virtual void readImpl (IStream &in, Streamable &ob, bool bReadClassName) const
 over-ride readImpl to read classnames and versions

virtual shared_ptr< StreamablereadImpl (IStream &in) const
 over-ride readImpl to read classnames and versions

virtual shared_ptr< StreamablereadImpl (IStream &in, const std::string &className) const
 over-ride readImpl to read classnames and versions

virtual void writeImpl (OStream &out, const Streamable &ob, bool bWriteClassName) const
 over-ride writeImpl to write classname and version

virtual void readImpl (IStream &in, Streamable &ob, const std::string &className) const
 over-ride readImpl to read classnames and versions

virtual void writeImpl (OStream &out, const Streamable &ob, const std::string &className) const
 over-ride writeImpl to write classname and version


Protected Types

typedef std::map< std::string,
unsigned > 
VersionMap

Protected Member Functions

 IOManagerStreamerVersioned ()
 Public access is through instance().

virtual void writeClassName (OStream &, const string &classname) const
 override to write class and version to OStream uses writeClassName

virtual std::string readClassName (IStream &) const
 override to read version from IStream and put in map.

boost::recursive_mutex & getMutex () const
 concrete implimentations must lock this mutex when doing read or write, so that read or write mode cannot be changed by other threads.

void setReadMode (bool mode) const
 set read mode to true when reading, false when writing.

bool readMode () const
 get read mode - true if reading, false if writing.


Static Protected Member Functions

VersionMap & getReadVersionMap ()
 Map of streamer versions to use for each classname.


Private Attributes

boost::recursive_mutex m_access
 access must be locked for thread-safeness.

bool m_read_mode
 if true will use its own verion map to get appropriate streamers.


Detailed Description

Abstract IOManager to be used in archival, makes use of streamer versioning.

When writing, the appropriate (i.e. current) streamer versions are written out. When reading the file, the streamer versions are first read, and then the getStreamer() method overriden to return the historic streamers. In write mode the most recent (default) streamers are always returned. Concrete versions must get a lock on the mutex, and setReadMode(true) at start of read. Similarly they must get a lock on the mutex and setReadMode(false) at the start of a write.

Definition at line 22 of file IOManagerStreamerVersioned.h.


Constructor & Destructor Documentation

Sct::Archive::IOManagerStreamerVersioned::IOManagerStreamerVersioned  )  [protected]
 

Public access is through instance().

Definition at line 12 of file IOManagerStreamerVersioned.cpp.


Member Function Documentation

boost::recursive_mutex & Sct::Archive::IOManagerStreamerVersioned::getMutex  )  const [protected]
 

concrete implimentations must lock this mutex when doing read or write, so that read or write mode cannot be changed by other threads.

Definition at line 135 of file IOManagerStreamerVersioned.cpp.

References m_access.

Referenced by SctArchiving::IOManagerDB::read(), readMode(), Sct::Archive::IOManagerArchive::setCompressionLevel(), setReadMode(), SctArchiving::IOManagerDB::write(), and Sct::Archive::IOManagerArchiveFile::write().

IOManagerStreamerVersioned::VersionMap & Sct::Archive::IOManagerStreamerVersioned::getReadVersionMap  )  [static, protected]
 

Map of streamer versions to use for each classname.

Definition at line 15 of file IOManagerStreamerVersioned.cpp.

Referenced by getStreamer(), SctArchiving::IOManagerDB::read(), Sct::Archive::IOManagerArchiveFile::read(), and readClassName().

Streamer & Sct::Archive::IOManagerStreamerVersioned::getStreamer const string &  className  )  const [virtual]
 

Over-ride of getStreamer returns appropriate version of streamer if in read mode, otherwise default IOManager::getStreamer.

Reimplemented from Sct::IOManager.

Definition at line 101 of file IOManagerStreamerVersioned.cpp.

References getReadVersionMap(), and readMode().

Referenced by readImpl(), and writeImpl().

Here is the call graph for this function:

string Sct::Archive::IOManagerStreamerVersioned::readClassName IStream  )  const [protected, virtual]
 

override to read version from IStream and put in map.

uses readClassName

Returns:
classname

Reimplemented from Sct::IOManager.

Definition at line 28 of file IOManagerStreamerVersioned.cpp.

References getReadVersionMap(), and setReadMode().

Referenced by readImpl().

Here is the call graph for this function:

void Sct::Archive::IOManagerStreamerVersioned::readImpl IStream in,
Streamable ob,
const std::string &  className
const [virtual]
 

over-ride readImpl to read classnames and versions

Definition at line 44 of file IOManagerStreamerVersioned.cpp.

References getStreamer(), Sct::Streamer::read(), readClassName(), and setReadMode().

Here is the call graph for this function:

virtual shared_ptr<Streamable> Sct::Archive::IOManagerStreamerVersioned::readImpl IStream in,
const std::string &  className
const [virtual]
 

over-ride readImpl to read classnames and versions

shared_ptr< Streamable > Sct::Archive::IOManagerStreamerVersioned::readImpl IStream in  )  const [virtual]
 

over-ride readImpl to read classnames and versions

Reimplemented from Sct::IOManager.

Definition at line 87 of file IOManagerStreamerVersioned.cpp.

References getStreamer(), Sct::Streamer::read(), readClassName(), and setReadMode().

Here is the call graph for this function:

void Sct::Archive::IOManagerStreamerVersioned::readImpl IStream in,
Streamable ob,
bool  bReadClassName
const [virtual]
 

over-ride readImpl to read classnames and versions

Reimplemented from Sct::IOManager.

Definition at line 61 of file IOManagerStreamerVersioned.cpp.

References Sct::Streamable::getClassName(), getStreamer(), Sct::Streamer::read(), readClassName(), and setReadMode().

Referenced by SctArchiving::IOManagerDB::read(), and Sct::Archive::IOManagerArchiveFile::read().

Here is the call graph for this function:

bool Sct::Archive::IOManagerStreamerVersioned::readMode  )  const [protected]
 

get read mode - true if reading, false if writing.

nothrow.

Definition at line 131 of file IOManagerStreamerVersioned.cpp.

References getMutex(), and m_read_mode.

Referenced by getStreamer().

Here is the call graph for this function:

void Sct::Archive::IOManagerStreamerVersioned::setReadMode bool  mode  )  const [protected]
 

set read mode to true when reading, false when writing.

nothrow

Definition at line 126 of file IOManagerStreamerVersioned.cpp.

References getMutex(), and m_read_mode.

Referenced by SctArchiving::IOManagerDB::read(), Sct::Archive::IOManagerArchiveFile::read(), readClassName(), readImpl(), SctArchiving::IOManagerDB::write(), Sct::Archive::IOManagerArchiveFile::write(), writeClassName(), and writeImpl().

Here is the call graph for this function:

void Sct::Archive::IOManagerStreamerVersioned::writeClassName OStream ,
const string &  classname
const [protected, virtual]
 

override to write class and version to OStream uses writeClassName

Reimplemented from Sct::IOManager.

Definition at line 20 of file IOManagerStreamerVersioned.cpp.

References setReadMode().

Referenced by writeImpl().

Here is the call graph for this function:

void Sct::Archive::IOManagerStreamerVersioned::writeImpl OStream out,
const Streamable ob,
const std::string &  className
const [virtual]
 

over-ride writeImpl to write classname and version

Definition at line 55 of file IOManagerStreamerVersioned.cpp.

References getStreamer(), setReadMode(), Sct::Streamer::write(), and writeClassName().

Here is the call graph for this function:

void Sct::Archive::IOManagerStreamerVersioned::writeImpl OStream out,
const Streamable ob,
bool  bWriteClassName
const [virtual]
 

over-ride writeImpl to write classname and version

Reimplemented from Sct::IOManager.

Definition at line 94 of file IOManagerStreamerVersioned.cpp.

References Sct::Streamable::getClassName(), getStreamer(), setReadMode(), Sct::Streamer::write(), and writeClassName().

Referenced by SctArchiving::IOManagerDB::prepareInsertion(), and Sct::Archive::IOManagerArchiveFile::write().

Here is the call graph for this function:


Field Documentation

boost::recursive_mutex Sct::Archive::IOManagerStreamerVersioned::m_access [mutable, private]
 

access must be locked for thread-safeness.

Definition at line 84 of file IOManagerStreamerVersioned.h.

Referenced by getMutex().

bool Sct::Archive::IOManagerStreamerVersioned::m_read_mode [mutable, private]
 

if true will use its own verion map to get appropriate streamers.

Definition at line 85 of file IOManagerStreamerVersioned.h.

Referenced by readMode(), and setReadMode().


The documentation for this class was generated from the following files:
Generated on Thu Jul 15 09:51:40 2004 for SCT DAQ/DCS Software - C++ by doxygen 1.3.5