ISLEman
Classes | Public Member Functions | List of all members
Store Class Reference

The Store is a file based memory manager. More...

#include <store.h>

Inheritance diagram for Store:
StorageIntf

Public Member Functions

 Store ()
 
 ~Store ()
 
int open (const char *name)
 
portable_off_t alloc ()
 
int write (const char *buf, uint size)
 
void end ()
 
void release (portable_off_t handle)
 
void close ()
 
void seek (portable_off_t handle)
 
int read (char *buf, uint size)
 
void printStats ()
 
portable_off_t pos () const
 
void dumpBlock (portable_off_t start, portable_off_t end)
 
- Public Member Functions inherited from StorageIntf
virtual ~StorageIntf ()
 

Detailed Description

The Store is a file based memory manager.

You can open the store using open(). Then obtain a handle via alloc() followed by a sequence of write() commands to store information, and finalize it using end().

Later on you locate the information with seek() using the handle obtained with alloc(), and then use a sequence of read() calls to read the information back.

If no longer needed the storage space can be freed using release().

The store will dynamically grow the file on disk if needed.

Constructor & Destructor Documentation

§ Store()

Store::Store ( )

Creates a store.

§ ~Store()

Store::~Store ( )

Releases the store object. Will close the underlying file if opened.

Member Function Documentation

§ alloc()

portable_off_t Store::alloc ( )

Allocates a handle to write to and read from.

§ close()

void Store::close ( )

Closes the store

§ end()

void Store::end ( )

Ends the sequence of writes.

Note
After this call, first alloc() has to be called before new writes can be done.

§ open()

int Store::open ( const char *  name)

Opens the file underlying the store using name as the file name. Returns 0 upon success, or -1 otherwise.

§ read()

int Store::read ( char *  buf,
uint  size 
)
virtual

Reads size bytes from the store into the array pointed to be buf.

Note
Before reading seek() has to be called to set the right start of the store.

Implements StorageIntf.

§ release()

void Store::release ( portable_off_t  handle)

Releases the memory corresponding to the handle returned with alloc()

§ seek()

void Store::seek ( portable_off_t  handle)

Goes to the start of information corresponding to handle pos

§ write()

int Store::write ( const char *  buf,
uint  size 
)
virtual

Writes size bytes in array buf to the store. First alloc() has to be called.

Note
The information can only be read after end() has been called.

Implements StorageIntf.


The documentation for this class was generated from the following files: