EDoc::PersistenceIFace Class Reference

#include <include/EDoc/PersistenceIFace.h>

Inheritance diagram for EDoc::PersistenceIFace:

EDoc::BinaryPersistence EDoc::Persistence EDoc::TextPersistence

Detailed Description

Defines an interface for reading/writing various types of primitive data.

This interface defines primitives for reading/writing certain integer and string types to/from files. Each primitive has an associated key which it is necessary for the user to provide but may not necessarily be used by the underlying implementation. For example the text implementation of this interface will validate the key and the data type are correct, whereas the binary interface will just assume that the data it is reading is correct.

Definition at line 38 of file PersistenceIFace.h.

Public Member Functions

 PersistenceIFace ()
 Constructor.
virtual ~PersistenceIFace ()
 Destructor.
virtual void Open ()=0
 Open the file associated with this instance preparing it for reading or writing.
virtual void Close ()=0
 Close the file associated with this instance.
virtual std::string ReadString (const char *key)=0
 Read a string primitive.
virtual bool ReadBoolean (const char *key)=0
 Read a boolean primitive.
virtual uint8_t ReadUInt8 (const char *key)=0
 Read a uint8_t primitive.
virtual int32_t ReadInt32 (const char *key)=0
 Read a int32_t primitive.
virtual uint32_t ReadUInt32 (const char *key)=0
 Read a uint32_t primitive.
virtual uint8_t ReadRecordType ()=0
 Read a record type primitive.
virtual void WriteString (const char *key, std::string value)=0
 Write a string primitive.
virtual void WriteBoolean (const char *key, bool value)=0
 Write a boolean primitive.
virtual void WriteUInt8 (const char *key, uint8_t value)=0
 Write a uint8_t primitive.
virtual void WriteInt32 (const char *key, int32_t value)=0
 Write a int32_t primitive.
virtual void WriteUInt32 (const char *key, uint32_t value)=0
 Write a uint32_t primitive.
virtual void WriteUInt32Debug (const char *key, uint32_t value, std::string debug_text)=0
 Write a uint32_t primitive with additional debug string.
virtual void WriteInt32Debug (const char *key, int32_t value, std::string debug_text)=0
 Write a int32_t primitive with additional debug string.
virtual void WriteRecordType (uint8_t value)=0
 Writes a primitive to the file indicating the type of record data that follows.

Data Fields

int ref_count
 Is a integer that can be used for reference counting.


Constructor & Destructor Documentation

EDoc::PersistenceIFace::PersistenceIFace (  )  [inline]

Constructor.

Note:
EDoc++ data included.

Definition at line 45 of file PersistenceIFace.h.

EDoc::PersistenceIFace::~PersistenceIFace (  )  [inline, virtual]

Destructor.

Note:
EDoc++ data included.

Definition at line 52 of file PersistenceIFace.h.


Member Function Documentation

EDoc::PersistenceIFace::Open (  )  [pure virtual]

Open the file associated with this instance preparing it for reading or writing.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Persistence::Open().

EDoc::PersistenceIFace::Close (  )  [pure virtual]

Close the file associated with this instance.

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Persistence::Close().

EDoc::PersistenceIFace::ReadString ( const char *  key  )  [pure virtual]

Read a string primitive.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Type::Read(), EDoc::FunctionType::Read(), EDoc::Function::Read(), EDoc::File::Read(), EDoc::Dictionary::Read(), and EDoc::Persistence::ReadString().

EDoc::PersistenceIFace::ReadBoolean ( const char *  key  )  [pure virtual]

Read a boolean primitive.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Type::Read(), EDoc::FunctionType::Read(), EDoc::Function::Read(), and EDoc::Persistence::ReadBoolean().

EDoc::PersistenceIFace::ReadUInt8 ( const char *  key  )  [pure virtual]

Read a uint8_t primitive.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Dictionary::Read(), and EDoc::Persistence::ReadUInt8().

EDoc::PersistenceIFace::ReadInt32 ( const char *  key  )  [pure virtual]

Read a int32_t primitive.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Persistence::ReadInt32().

EDoc::PersistenceIFace::ReadUInt32 ( const char *  key  )  [pure virtual]

Read a uint32_t primitive.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::TypeLoc::Read(), EDoc::Type::Read(), EDoc::TryBlock::Read(), EDoc::FunctionTypeLoc::Read(), EDoc::FunctionType::Read(), EDoc::FunctionLoc::Read(), EDoc::Function::Read(), EDoc::Dictionary::Read(), EDoc::CodeBlock::Read(), and EDoc::Persistence::ReadUInt32().

EDoc::PersistenceIFace::ReadRecordType (  )  [pure virtual]

Read a record type primitive.

Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Dictionary::Read(), and EDoc::Persistence::ReadRecordType().

EDoc::PersistenceIFace::WriteString ( const char *  key,
std::string  value 
) [pure virtual]

Write a string primitive.

Exceptions:
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Type::Write(), EDoc::FunctionType::Write(), EDoc::Function::Write(), EDoc::File::Write(), EDoc::Dictionary::Write(), and EDoc::Persistence::WriteString().

EDoc::PersistenceIFace::WriteBoolean ( const char *  key,
bool  value 
) [pure virtual]

Write a boolean primitive.

Exceptions:
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Type::Write(), EDoc::FunctionType::Write(), EDoc::Function::Write(), and EDoc::Persistence::WriteBoolean().

EDoc::PersistenceIFace::WriteUInt8 ( const char *  key,
uint8_t  value 
) [pure virtual]

Write a uint8_t primitive.

Exceptions:
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Dictionary::Write(), and EDoc::Persistence::WriteUInt8().

EDoc::PersistenceIFace::WriteInt32 ( const char *  key,
int32_t  value 
) [pure virtual]

Write a int32_t primitive.

Exceptions:
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Persistence::WriteInt32().

EDoc::PersistenceIFace::WriteUInt32 ( const char *  key,
uint32_t  value 
) [pure virtual]

Write a uint32_t primitive.

Exceptions:
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Type::Write(), EDoc::TryBlock::Write(), EDoc::FunctionType::Write(), EDoc::Function::Write(), EDoc::Dictionary::Write(), EDoc::CodeBlock::Write(), and EDoc::Persistence::WriteUInt32().

EDoc::PersistenceIFace::WriteUInt32Debug ( const char *  key,
uint32_t  value,
std::string  debug_text 
) [pure virtual]

Write a uint32_t primitive with additional debug string.

The debug string is a small string that can be written to text files to help the user understand what the uint32_t value might represent or be an index for. This is entirely for debugging purposes and is not accessible with the associated read interface.

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::TypeLoc::Write(), EDoc::Type::Write(), EDoc::FunctionTypeLoc::Write(), EDoc::FunctionLoc::Write(), EDoc::Function::Write(), and EDoc::Persistence::WriteUInt32Debug().

EDoc::PersistenceIFace::WriteInt32Debug ( const char *  key,
int32_t  value,
std::string  debug_text 
) [pure virtual]

Write a int32_t primitive with additional debug string.

The debug string is a small string that can be written to text files to help the user understand what the uint32_t value might represent or be an index for. This is entirely for debugging purposes and is not accessible with the associated read interface.

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Persistence::WriteInt32Debug().

EDoc::PersistenceIFace::WriteRecordType ( uint8_t  value  )  [pure virtual]

Writes a primitive to the file indicating the type of record data that follows.

Exceptions:
EDoc::FileIOException 

Implemented in EDoc::BinaryPersistence, EDoc::Persistence, and EDoc::TextPersistence.

Referenced by EDoc::Dictionary::Write(), and EDoc::Persistence::WriteRecordType().


Field Documentation

int EDoc::PersistenceIFace::ref_count

Is a integer that can be used for reference counting.

The Persistence class shares instances of PersistenceIFace implementations. To enable this we use a small "hacked" shared pointer which will allow this class to be reference counted.

Definition at line 161 of file PersistenceIFace.h.

Referenced by EDoc::Persistence::DecRef(), and EDoc::Persistence::IncRef().


The documentation for this class was generated from the following files:
Generated on Tue Jan 20 18:26:09 2009 for EDoc-0.2.1 by  doxygen 1.5.1