AMOS::BankStream_t Class Reference

Provides stream functionality for an AMOS data bank. More...

#include <BankStream_AMOS.hh>

Inheritance diagram for AMOS::BankStream_t:

[legend]
Collaboration diagram for AMOS::BankStream_t:
[legend]
List of all members.

Public Types

 BEGIN
 CURR
 END
enum  bankseekdir { BEGIN, CURR, END }
typedef int64_t bankstreamoff
 64-bit stream offset for largefiles

Public Member Functions

 BankStream_t (NCode_t type)
 Constructs an empty BankStream_t of objects with a certain NCode.
 BankStream_t (const std::string &type)
 ~BankStream_t ()
void append (IBankable_t &obj)
 Appends a Bankable object to the bank.
void assignEID (ID_t iid, const std::string &eid)
 Assigns an EID to an existing object.
void assignIID (const std::string &eid, ID_t iid)
 Assigns an object a new IID.
void clean ()
void clear ()
 Clears a bank by erasing all it's objects and its ID map.
void close ()
 Closes a bank on disk.
void concat (BankStream_t &source)
void create (const std::string &dir, BankMode_t mode=B_READ|B_WRITE)
 Forcibly creates and opens a bank on disk.
void destroy ()
 Closes and removes a bank from disk.
bool eof () const
 Checks if the end of stream flag has been set.
void fetch (ID_t iid, IBankable_t &obj)
 Fetches a Bankable object from the bank by its IID.
void fetch (const std::string &eid, IBankable_t &obj)
 Fetches a Bankable object from the bank by its EID.
void fetchFix (ID_t iid, IBankable_t &obj)
 Fetches the fixed length part of a Bankable object by its IID.
void fetchFix (const std::string &eid, IBankable_t &obj)
 Fetches the fixed length part of a Bankable object by its EID.
BankStream_tignore (bankstreamoff n)
 Ignores the next n stream objects.
void open (const std::string &dir, BankMode_t mode=B_READ|B_WRITE)
 Opens a bank on disk.
void remove (ID_t iid)
void remove (const std::string &eid)
 Removes an object from the bank by its EID.
void removeByBID (ID_t bid)
void replace (ID_t iid, IBankable_t &obj)
 Replaces an object in the bank by its IID.
void replace (const std::string &eid, IBankable_t &obj)
 Replaces an object in the bank by its EID.
void replaceByBID (ID_t bid, IBankable_t &obj)
void setFixedStoreOnly (bool onlyFixed)
 Controls if operator>> should read the fixed store only or with variable store.
BankStream_tseekg (bankstreamoff off, bankseekdir dir)
 Seeks to a different position in the BankStream.
BankStream_tseekg (ID_t pos)
 Seeks to a different position in the BankStream.
ID_t tellg () const
 Return the current position of the get pointer.
ID_t tellp () const
 Return the current position of the put pointer.
 operator bool () const
 Cast the BankStream to a bool reflecting the state of !eof().
bool operator! () const
 Evaluate eof() and return.
BankStream_toperator>> (IBankable_t &obj)
 Fetch the next object in the BankStream.
BankStream_toperator<< (IBankable_t &obj)
 Append a new object to the BankStream.
void concat (Bank_t &source)
 Concatenates another bank to the end of this bank.
bool empty () const
 Returns true if bank is empty.
bool exists (const std::string &dir) const
 Checks for the existence of a another bank with similar type.
bool existsEID (const std::string &eid) const
 Returns true if EID exists in the bank.
bool existsIID (ID_t iid) const
 Returns true if IID exists in the bank.
const IDMap_tgetIDMap () const
 Get the current (IID <-> EID) -> BID map for the bank.
Size_t getIDMapSize () const
 Get the number of objects in the Bank with and IID or EID.
Size_t getIndexSize () const
 Get the number of indices used by the bank.
ID_t getMaxIID () const
 Searches through the bank for the largest IID.
ID_t getMaxBID () const
 Searches through the bank for the largest BID.
Size_t getSize () const
 Get the size of the bank, i.e. the number of stored records.
signed char getStatus () const
 Get the bank status.
NCode_t getType () const
 Get the unique bank type identifier.
bool isOpen () const
 Check the bank's open status.
ID_t lookupBID (ID_t iid) const
 Converts an IID to a BID, throw exception on failure.
ID_t lookupBID (const std::string &eid) const
 Converts an EID to a BID, throw exception on failure.
const std::string & lookupEID (ID_t iid) const
 Converts an IID to an EID.
ID_t lookupIID (const std::string &eid) const
 Converts an EID to an IID.
void setStatus (signed char status)
 Set the bank status.

Static Public Attributes

static const std::string BANK_VERSION = "2.8"
 current bank version
static const std::string IFO_STORE_SUFFIX = ".ifo"
 the informational store
static const std::string MAP_STORE_SUFFIX = ".map"
 the ID map store
static const std::string LCK_STORE_SUFFIX = ".lck"
 the ifo store file lock
static const std::string FIX_STORE_SUFFIX = ".fix"
 the fixed length stores
static const std::string VAR_STORE_SUFFIX = ".var"
 the variable length stores
static const std::string TMP_STORE_SUFFIX = ".tmp"
 the temporary store
static const char WRITE_LOCK_CHAR = 'w'
 write lock char
static const char READ_LOCK_CHAR = 'r'
 read lock char

Protected Types

 I_OPEN
 I_CREATE
 I_CLOSE
enum  IFOMode_t { I_OPEN, I_CREATE, I_CLOSE }

Protected Member Functions

void init ()
 Initializes the stream variables.
bool inrange ()
void addPartition (bool create)
 Adds a new partition to the partition list.
void appendBID (IBankable_t &obj)
 Append an object, thus assigning it the last BID.
void fetchBID (ID_t bid, IBankable_t &obj)
 Fetch an object by BID.
void fetchBIDFix (ID_t iid, IBankable_t &obj)
 Fetch the fixed record for an object by BID.
BankPartition_t * getPartition (ID_t id)
 Returns the requested BankPartition, opening it if necessary.
BankPartition_t * getLastPartition ()
 Same as getPartition, but returns the current final partition.
BankPartition_t * localizeBID (ID_t &bid)
 Gets the partition and local identifier.
void lockIFO ()
 Obtains a file lock on the info store of the current bank.
BankPartition_t * openPartition (ID_t id)
 Do not use this function, use getPartition instead.
void removeBID (ID_t bid)
 Remove an object by BID.
void replaceBID (ID_t bid, IBankable_t &obj)
 Replace an object by BID.
void setMode (BankMode_t mode)
 validates and sets the BankMode
void syncIFO (IFOMode_t mode)
 Syncs the IFO store with in-memory data.
void touchFile (const std::string &path, int mode, bool create)
 Opens or creates a file, throwing exception on failure.
void unlockIFO ()
 Releases the file lock on the info store of the current bank.

Protected Attributes

bool fixed_store_only_m
 Just fetch from fixed store.
bool eof_m
 eof error flag
ID_t curr_bid_m
 BID to be returned on next get.
bool ate_m
 put pointers at end of bank
std::vector< const IDMap_t::HashTriple_t * > triples_m
 BID,EID,IID map.
BankPartition_t * oldPartition_m
NCode_t banktype_m
 the type of objects stored in this bank
Size_t buffer_size_m
 size of the I/O buffer
Size_t max_partitions_m
 maximum number of open partitions
bool is_open_m
 open status of the bank
signed char status_m
 bank status
BankMode_t mode_m
 mode of the bank, B_READ|B_WRITE|B_SPY
std::string store_dir_m
 the disk store directory
std::string store_pfx_m
 the disk store prefix (including dir)
Size_t fix_size_m
 size of entire fixed length record
Size_t partition_size_m
 records per disk store partition
ID_t last_bid_m
 the last bank bid (1 based)
ID_t max_bid_m
 maximum bid given the current partitioning
ID_t nbids_m
 number of non-deleted bids
Size_t npartitions_m
 number of partitions
std::deque< BankPartition_t * > opened_m
 opened partitions
std::vector< BankPartition_t * > partitions_m
 all partitions
IDMap_t idmap_m
 the IDMap IID <-> EID to BID

Static Protected Attributes

static const Size_t DEFAULT_BUFFER_SIZE = 1024
 IO buffer size.
static const Size_t MAX_OPEN_PARTITIONS = 2
 Allowable simultaneously open partitions (one for >>, one for <<).
static const Size_t DEFAULT_PARTITION_SIZE = 1000000
 records per partition

Detailed Description

Provides stream functionality for an AMOS data bank.

Allows input and output streaming of an AMOS data bank. This provides a way to iterate through object without IID or EID tags, since every object in the bank will be streamed in order regardless of its IDs. It is assumed that this class will be used to stream many consecutive objects, thus certain optimizations are made for this use case. For random access and frequent switches between fetch and append operations, the Bank_t class is more efficient. For fetching every object in a bank in order, or writing a large number of objects to a bank, this class is more efficient.

Definition at line 34 of file BankStream_AMOS.hh.


Member Typedef Documentation

typedef int64_t AMOS::Bank_t::bankstreamoff [inherited]

64-bit stream offset for largefiles

Definition at line 617 of file Bank_AMOS.hh.


Member Enumeration Documentation

enum AMOS::BankStream_t::bankseekdir

Enumerator:
BEGIN 
CURR 
END 

Definition at line 77 of file BankStream_AMOS.hh.

enum AMOS::Bank_t::IFOMode_t [protected, inherited]

Enumerator:
I_OPEN 
I_CREATE 
I_CLOSE 

Definition at line 342 of file Bank_AMOS.hh.


Constructor & Destructor Documentation

AMOS::BankStream_t::BankStream_t ( NCode_t  type  )  [inline]

Constructs an empty BankStream_t of objects with a certain NCode.

Initializes members and sets BankStream type to the supplied value. All future operations on this bank must be made with a Bankable type that is compatibile with the supplied NCode.

Once a BankStream is created with a certain NCode, only objects compatible with that NCode can be used with that Bank. For instance, if a BankStream is constructed with 'BankStream_t mybank (Read::NCODE);', only Read_t objects could be used with mybank. Also, if a static NCode member is not available 'BankStream_t mybank (Encode("RED"));' will also work.

Parameters:
type The type of Bank to construct

Definition at line 101 of file BankStream_AMOS.hh.

References AMOS::Bank_t::buffer_size_m, DEFAULT_BUFFER_SIZE, init(), MAX_OPEN_PARTITIONS, AMOS::Bank_t::max_partitions_m, AMOS::NULL_ID, and triples_m.

AMOS::BankStream_t::BankStream_t ( const std::string &  type  )  [inline]

Definition at line 112 of file BankStream_AMOS.hh.

References AMOS::Bank_t::buffer_size_m, DEFAULT_BUFFER_SIZE, init(), MAX_OPEN_PARTITIONS, AMOS::Bank_t::max_partitions_m, AMOS::NULL_ID, and triples_m.

AMOS::BankStream_t::~BankStream_t (  )  [inline]

Definition at line 123 of file BankStream_AMOS.hh.

References close(), and AMOS::Bank_t::is_open_m.


Member Function Documentation

void Bank_t::addPartition ( bool  create  )  [protected, inherited]

Adds a new partition to the partition list.

Simply appends a new partition to the list, and leaves it unopened. Will throw an exception if unable to create/open partition. If the create flag is set, new files will be created and truncated to zero, otherwise its contents will be left undisturbed.

Parameters:
create Create new file or truncate existing
Precondition:
There are adequate permissions in the bank directory
Postcondition:
npartitions_m and max_iid_m reflect new partitioning
Exceptions:
IOException_t 
Returns:
void

Definition at line 60 of file Bank_AMOS.cc.

References AMOS::Bank_t::buffer_size_m, AMOS::Bank_t::DEFAULT_PARTITION_SIZE, FILE_MODE, AMOS::Bank_t::BankPartition_t::fix_name, AMOS::Bank_t::FIX_STORE_SUFFIX, AMOS::Bank_t::max_bid_m, AMOS::Bank_t::npartitions_m, AMOS::NULL_STRING, AMOS::Bank_t::partition_size_m, AMOS::Bank_t::partitions_m, AMOS::Bank_t::store_pfx_m, AMOS::Bank_t::touchFile(), AMOS::Bank_t::BankPartition_t::var_name, and AMOS::Bank_t::VAR_STORE_SUFFIX.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::clean(), AMOS::Bank_t::concat(), operator<<(), and AMOS::Bank_t::syncIFO().

void AMOS::BankStream_t::append ( IBankable_t obj  )  [inline]

Appends a Bankable object to the bank.

Appends a Bankable object to the bank. The modified and removed flags of the object are cleared, because the object is newly appended. If the object has a non-empty IID/EID value, the bank will include the IID/EID in the IDMap to allow for future IID <-> EID conversions. Note that an object can be appended with a NULL IID and EID, but this will make it accessible only by iteration via a BankStream_t.

Parameters:
obj The Bankable object to append
Precondition:
The bank is open for writing

obj is compatible with the current NCode bank type

There is no IID/EID of this object already in the bank

Postcondition:
obj's modified and removed flags are cleared

obj IID/EID and assigned BID are added to the IDMap

Exceptions:
IOException_t 
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 131 of file BankStream_AMOS.hh.

References operator<<().

void Bank_t::appendBID ( IBankable_t obj  )  [protected, inherited]

Append an object, thus assigning it the last BID.

Definition at line 114 of file Bank_AMOS.cc.

References AMOS::Bank_t::addPartition(), AMOS_THROW_ARGUMENT, AMOS_THROW_IO, AMOS::B_WRITE, AMOS::Bank_t::banktype_m, AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::fix_size_m, AMOS::IBankable_t::flags_m, AMOS::Bank_t::getLastPartition(), AMOS::IBankable_t::getNCode(), AMOS::BankFlags_t::is_modified, AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::last_bid_m, AMOS::Bank_t::max_bid_m, AMOS::Bank_t::mode_m, AMOS::Bank_t::nbids_m, AMOS::Bank_t::BankPartition_t::var, AMOS::writeLE(), and AMOS::IBankable_t::writeRecord().

Referenced by AMOS::Bank_t::append().

void AMOS::BankStream_t::assignEID ( ID_t  iid,
const std::string &  eid 
)

Assigns an EID to an existing object.

Assigns an EID to an object that currently has only an IID. Only affects the IDMap and is therefore much more efficient than the replace method. Will throw an exception if the IID does not exist or if the new EID already exists.

Parameters:
iid The IID of the existing object
eid The EID to assign to the object
Precondition:
The bank is open for read/writing

The specified IID exists in the bank

The new EID does not exist in the bank

Exceptions:
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

void AMOS::BankStream_t::assignIID ( const std::string &  eid,
ID_t  iid 
)

Assigns an object a new IID.

Assigns an IID to an object that currently has only an EID. Only affects the IDMap and is therefore much more efficient than the replace method. Will throw an exception if the IID does not exist or if the new EID already exists.

Parameters:
eid The EID of the existing object
iid The IID to assign to the object
Precondition:
The bank is open for read/writing

The specified EID exists in the bank

The new IID does not exist in the bank

Exceptions:
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

void BankStream_t::clean (  ) 

Postcondition:
Stream reset to the beginning

Invalidates all bankstreamoff's and BID's

Reimplemented from AMOS::Bank_t.

Definition at line 57 of file BankStream_AMOS.cc.

References AMOS::Bank_t::clean(), AMOS::IDMap_t::end(), AMOS::Bank_t::getIDMap(), init(), AMOS::Bank_t::last_bid_m, and triples_m.

void AMOS::BankStream_t::clear (  )  [inline]

Clears a bank by erasing all it's objects and its ID map.

Erases all the objects in a bank, but keeps the bank open at the current location. Only throws an exception if the bank is not open for writing. Won't complain if some of the partitions won't unlink etc. Has no effect on a closed bank.

Precondition:
The bank is open for writing
Exceptions:
IOException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 153 of file BankStream_AMOS.hh.

References AMOS::Bank_t::clear(), and init().

void AMOS::BankStream_t::close (  )  [inline]

Closes a bank on disk.

Flushes all files, closes all files and re-initializes members. Has no effect on a closed bank.

Exceptions:
IOException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 161 of file BankStream_AMOS.hh.

References AMOS::Bank_t::close(), and init().

Referenced by ~BankStream_t().

void Bank_t::concat ( Bank_t source  )  [inherited]

Concatenates another bank to the end of this bank.

Conceptually performs an append operation on every object in the source bank, but with more efficiency. As a side effect, incoming source records are cleaned (see Bank_t::clean() method), therefore removing all objects waiting for deletion. The two banks must have entirely disjoint IDMaps.

Note:
The source bank is unchanged by this operation, however it cannot be made a const because of I/O open/close operations.
Parameters:
source The bank to concat to the end of the current bank
Precondition:
The bank is open for writing

The source bank is open for reading

source is compatible with the current NCode bank type

The current and source IDMaps are disjoint

Postcondition:
The source bank is unaffected
Exceptions:
IOException_t 
ArgumentException_t 
Returns:
void

Definition at line 305 of file Bank_AMOS.cc.

References AMOS::Bank_t::addPartition(), AMOS_THROW_ARGUMENT, AMOS_THROW_IO, AMOS::B_READ, AMOS::B_WRITE, AMOS::Bank_t::banktype_m, AMOS::IDMap_t::begin(), AMOS::IDMap_t::HashTriple_t::eid, AMOS::IDMap_t::end(), AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::fix_size_m, AMOS::Bank_t::getIDMap(), AMOS::Bank_t::getLastPartition(), AMOS::Bank_t::getPartition(), AMOS::Bank_t::idmap_m, AMOS::IDMap_t::HashTriple_t::iid, AMOS::IDMap_t::insert(), AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::last_bid_m, AMOS::Bank_t::max_bid_m, AMOS::Bank_t::mode_m, AMOS::Bank_t::nbids_m, AMOS::Bank_t::npartitions_m, AMOS::readLE(), AMOS::IDMap_t::remove(), AMOS::SafeMalloc(), AMOS::SafeRealloc(), AMOS::Bank_t::BankPartition_t::var, and AMOS::writeLE().

Referenced by AMOS::Bank_t::clean(), and concat().

void BankStream_t::concat ( BankStream_t source  ) 

Postcondition:
Invalidates all source bankstreamoff's and BID's

Definition at line 72 of file BankStream_AMOS.cc.

References AMOS::Bank_t::concat(), AMOS::IDMap_t::end(), eof_m, AMOS::Bank_t::getIDMap(), inrange(), AMOS::Bank_t::last_bid_m, oldPartition_m, and triples_m.

void AMOS::BankStream_t::create ( const std::string &  dir,
BankMode_t  mode = B_READ|B_WRITE 
) [inline]

Forcibly creates and opens a bank on disk.

Forcibly creates and opens a bank. Any pre-existing bank of this type will be destroyed and any conflicting files will be overwritten if permissions allow. If you wish not to overwrite an existing bank, use the exists method to first check for a conflicting bank of this type. An open bank will first be closed before the new one is created.

Parameters:
dir The directory in which to create the bank
mode The mode of the bank (B_READ | B_WRITE)
Precondition:
mode includes B_WRITE

sufficient read/write/exe permissions for dir and bank files

Exceptions:
IOException_t 
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 175 of file BankStream_AMOS.hh.

References AMOS::Bank_t::create(), and init().

void AMOS::BankStream_t::destroy (  )  [inline]

Closes and removes a bank from disk.

Closes the bank and unlinks all files and empty directories. Only throws an exception if the bank is not open for writing. Won't complain if some of the partitions won't unlink etc.

Precondition:
The bank is open for writing
Exceptions:
IOException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 183 of file BankStream_AMOS.hh.

References AMOS::Bank_t::destroy(), and init().

bool AMOS::Bank_t::empty (  )  const [inline, inherited]

Returns true if bank is empty.

Definition at line 845 of file Bank_AMOS.hh.

References AMOS::Bank_t::getSize().

bool AMOS::BankStream_t::eof (  )  const [inline]

Checks if the end of stream flag has been set.

Returns true if a previous IO operation set the end of stream flag, returns false if there have been no previous end of stream failures. The eof flag only applies to fetch operations, append operations will never raise the eof flag. Will return true if bank is closed.

Returns:
true if eof flag has been set, false otherwise

Definition at line 200 of file BankStream_AMOS.hh.

References eof_m, and AMOS::Bank_t::is_open_m.

Referenced by operator bool(), operator!(), and operator>>().

bool AMOS::Bank_t::exists ( const std::string &  dir  )  const [inherited]

Checks for the existence of a another bank with similar type.

Only checks for the existence and readability of the info store, does not perform any validity checking on the other partitions. Can be called while a bank is open or closed.

Parameters:
dir The directory in which to look
Returns:
true if IFO store exists with read permissions, else false

Referenced by AMOS::Bank_t::existsEID(), and AMOS::Bank_t::existsIID().

bool AMOS::Bank_t::existsEID ( const std::string &  eid  )  const [inline, inherited]

Returns true if EID exists in the bank.

Definition at line 867 of file Bank_AMOS.hh.

References AMOS::Bank_t::exists(), and AMOS::Bank_t::idmap_m.

bool AMOS::Bank_t::existsIID ( ID_t  iid  )  const [inline, inherited]

Returns true if IID exists in the bank.

Definition at line 876 of file Bank_AMOS.hh.

References AMOS::Bank_t::exists(), and AMOS::Bank_t::idmap_m.

void AMOS::BankStream_t::fetch ( const std::string &  eid,
IBankable_t obj 
) [inline]

Fetches a Bankable object from the bank by its EID.

Reimplemented from AMOS::Bank_t.

Definition at line 214 of file BankStream_AMOS.hh.

References AMOS::Bank_t::fetch(), and oldPartition_m.

void AMOS::BankStream_t::fetch ( ID_t  iid,
IBankable_t obj 
) [inline]

Fetches a Bankable object from the bank by its IID.

Retrieves an object from the bank by its IID and stores it in a bankable object.

Parameters:
iid The IID of the object to fetch
obj A Bankable object to store the data
Precondition:
The bank is open for reading

The requested IID exists in the bank

obj is compatible with the current NCode bank type

Postcondition:
The desired object data will be loaded into obj
Exceptions:
IOException_t 
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 207 of file BankStream_AMOS.hh.

References AMOS::Bank_t::fetch(), and oldPartition_m.

void Bank_t::fetchBID ( ID_t  bid,
IBankable_t obj 
) [protected, inherited]

Fetch an object by BID.

Definition at line 500 of file Bank_AMOS.cc.

References AMOS_THROW_ARGUMENT, AMOS_THROW_IO, AMOS::B_READ, AMOS::Bank_t::banktype_m, AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::fix_size_m, AMOS::IBankable_t::flags_m, AMOS::IBankable_t::getNCode(), AMOS::Bank_t::is_open_m, AMOS::Bank_t::localizeBID(), AMOS::Bank_t::mode_m, AMOS::readLE(), AMOS::IBankable_t::readRecord(), and AMOS::Bank_t::BankPartition_t::var.

Referenced by AMOS::Bank_t::fetch().

void Bank_t::fetchBIDFix ( ID_t  iid,
IBankable_t obj 
) [protected, inherited]

Fetch the fixed record for an object by BID.

Definition at line 524 of file Bank_AMOS.cc.

References AMOS_THROW_ARGUMENT, AMOS_THROW_IO, AMOS::B_READ, AMOS::Bank_t::banktype_m, AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::fix_size_m, AMOS::IBankable_t::flags_m, AMOS::IBankable_t::getNCode(), AMOS::Bank_t::is_open_m, AMOS::Bank_t::localizeBID(), AMOS::Bank_t::mode_m, AMOS::readLE(), and AMOS::IBankable_t::readRecordFix().

Referenced by AMOS::Bank_t::fetchFix().

void AMOS::BankStream_t::fetchFix ( const std::string &  eid,
IBankable_t obj 
) [inline]

Fetches the fixed length part of a Bankable object by its EID.

Reimplemented from AMOS::Bank_t.

Definition at line 228 of file BankStream_AMOS.hh.

References AMOS::Bank_t::fetchFix(), and oldPartition_m.

void AMOS::BankStream_t::fetchFix ( ID_t  iid,
IBankable_t obj 
) [inline]

Fetches the fixed length part of a Bankable object by its IID.

Reimplemented from AMOS::Bank_t.

Definition at line 221 of file BankStream_AMOS.hh.

References AMOS::Bank_t::fetchFix(), and oldPartition_m.

const IDMap_t& AMOS::Bank_t::getIDMap (  )  const [inline, inherited]

Get the current (IID <-> EID) -> BID map for the bank.

Access to the bank's IDMap. One may iterate through the IDMap for a list of IDs in the bank. Users may not however directly modify the IDMap, because the bank will automatically update the IDMap based on the IDs of the objects appended to it. See IDMap_t API for more available methods.

Returns:
A const reference to the bank's IDMap

Definition at line 949 of file Bank_AMOS.hh.

References AMOS::Bank_t::idmap_m.

Referenced by clean(), concat(), AMOS::Bank_t::concat(), and open().

Size_t AMOS::Bank_t::getIDMapSize (  )  const [inline, inherited]

Get the number of objects in the Bank with and IID or EID.

Returns the total number of ID'ed objects stored in the bank. This number only includes object which have an associated IID or EID. Use getSize() to get the total number of objects in the bank.

Returns:
The number of ID'ed objects stored in the bank

Definition at line 964 of file Bank_AMOS.hh.

References AMOS::Bank_t::getSize(), and AMOS::Bank_t::idmap_m.

Size_t AMOS::Bank_t::getIndexSize (  )  const [inline, inherited]

Get the number of indices used by the bank.

Returns the number of BIDs (bank indices) being used by the bank. If we imagine the bank as an array, this would be the size of the array. In a perfect world, index size would equal the size of the bank (i.e. number of records in the bank), however when objects are deleted, instead of resizing the entire 'array' the index positions are ignored until a clean is issued. Thus, depending on the number of remove operations performed, the index size will be greater than or equal to the size of the bank. The bigger the gap, the more empty indices there will be and the more efficiency problems the bank will suffer. A clean operation will fix all this, and make index-size equal size.

Returns:
The number of indices being used

Definition at line 986 of file Bank_AMOS.hh.

References AMOS::Bank_t::last_bid_m.

BankPartition_t* AMOS::Bank_t::getLastPartition (  )  [inline, protected, inherited]

Same as getPartition, but returns the current final partition.

Definition at line 452 of file Bank_AMOS.hh.

References AMOS::Bank_t::getPartition(), and AMOS::Bank_t::npartitions_m.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::concat(), and operator<<().

ID_t Bank_t::getMaxBID (  )  const [inherited]

Searches through the bank for the largest BID.

Note:
O(n) time complexity
Returns:
The maximum BID in the bank

Definition at line 560 of file Bank_AMOS.cc.

References AMOS::IDMap_t::begin(), AMOS::IDMap_t::end(), AMOS::Bank_t::idmap_m, and AMOS::NULL_ID.

ID_t Bank_t::getMaxIID (  )  const [inherited]

Searches through the bank for the largest IID.

Note:
O(n) time complexity
Returns:
The maximum IID in the bank

Definition at line 548 of file Bank_AMOS.cc.

References AMOS::IDMap_t::begin(), AMOS::IDMap_t::end(), AMOS::Bank_t::idmap_m, and AMOS::NULL_ID.

BankPartition_t* AMOS::Bank_t::getPartition ( ID_t  id  )  [inline, protected, inherited]

Returns the requested BankPartition, opening it if necessary.

Returns the requested (pre-existing) partition, opening it if necessary.

Parameters:
id The ID of the requested partition
Precondition:
There are adequate permissions in the bank directory

The requested partition is within range (not checked)

Postcondition:
The requested partition is open and on the queue

A previously opened partition may have been closed to make room

Exceptions:
IOException_t 
ArgumentException_t 
Returns:
The requested, opened partition

Definition at line 436 of file Bank_AMOS.hh.

References AMOS::Bank_t::openPartition(), and AMOS::Bank_t::partitions_m.

Referenced by AMOS::Bank_t::concat(), AMOS::Bank_t::getLastPartition(), and AMOS::Bank_t::localizeBID().

Size_t AMOS::Bank_t::getSize (  )  const [inline, inherited]

Get the size of the bank, i.e. the number of stored records.

This method returns the total number of objects stored in the bank, including anonymous objects which have no associated IID or EID.

Returns:
The size of the bank, or 0 if the bank is empty

Definition at line 1021 of file Bank_AMOS.hh.

References AMOS::Bank_t::nbids_m.

Referenced by AMOS::Bank_t::empty(), and AMOS::Bank_t::getIDMapSize().

signed char AMOS::Bank_t::getStatus (  )  const [inline, inherited]

Get the bank status.

Currently the status is set by the user and not written to the bank. So don't expect any interesting return values from this method. Status is set to zero on object initialization and then left untouched.

Returns:
Return the status of the bank

Definition at line 1036 of file Bank_AMOS.hh.

References AMOS::Bank_t::status_m.

NCode_t AMOS::Bank_t::getType (  )  const [inline, inherited]

Get the unique bank type identifier.

Is equivalent to the NCode of the objects stored in the bank.

Returns:
The unique bank type identifier

Definition at line 1049 of file Bank_AMOS.hh.

References AMOS::Bank_t::banktype_m.

BankStream_t & BankStream_t::ignore ( bankstreamoff  n  ) 

Ignores the next n stream objects.

Only slightly more efficient than fetching n records. Seeking past the end of stream will set the eof flag.

Precondition:
The bank is open for reading
Parameters:
n The number of objects to skip in the stream
Exceptions:
IOException_t 
Returns:
The updated BankStream

Definition at line 89 of file BankStream_AMOS.cc.

References AMOS_THROW_IO, AMOS::B_READ, curr_bid_m, eof_m, AMOS::Bank_t::fix_size_m, inrange(), AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::localizeBID(), AMOS::Bank_t::mode_m, oldPartition_m, and AMOS::readLE().

Referenced by seekg().

void AMOS::BankStream_t::init (  )  [inline, protected]

Initializes the stream variables.

Reimplemented from AMOS::Bank_t.

Definition at line 49 of file BankStream_AMOS.hh.

References ate_m, curr_bid_m, eof_m, fixed_store_only_m, oldPartition_m, and triples_m.

Referenced by BankStream_t(), clean(), clear(), close(), create(), destroy(), and open().

bool AMOS::BankStream_t::inrange (  )  [inline, protected]

Definition at line 61 of file BankStream_AMOS.hh.

References curr_bid_m, and AMOS::Bank_t::last_bid_m.

Referenced by concat(), ignore(), operator>>(), and seekg().

bool AMOS::Bank_t::isOpen (  )  const [inline, inherited]

Check the bank's open status.

Returns:
true if open, false if closed

Definition at line 1060 of file Bank_AMOS.hh.

References AMOS::Bank_t::is_open_m.

Referenced by AMOS::Bank_t::clean().

BankPartition_t* AMOS::Bank_t::localizeBID ( ID_t bid  )  [inline, protected, inherited]

Gets the partition and local identifier.

Parameters:
bid Lookup the location of this BID (1 based index))
Precondition:
bid is within range (not checked)
Postcondition:
bid will be adjusted to reference the returned partition
Returns:
The opened bank partition

Definition at line 472 of file Bank_AMOS.hh.

References AMOS::Bank_t::getPartition(), and AMOS::Bank_t::partition_size_m.

Referenced by AMOS::Bank_t::fetchBID(), AMOS::Bank_t::fetchBIDFix(), ignore(), operator>>(), AMOS::Bank_t::removeBID(), and AMOS::Bank_t::replaceBID().

void Bank_t::lockIFO (  )  [protected, inherited]

Obtains a file lock on the info store of the current bank.

Obtains a file lock on the info store of the current bank. Will throw an exception if the lock failed either because the info store does not exist or it took too long to obtain the lock. Has no effect if BankMode is set to B_SPY.

Postcondition:
The info store is locked
Exceptions:
IOException_t 
Returns:
void

Definition at line 620 of file Bank_AMOS.cc.

References AMOS_THROW_IO, AMOS::B_SPY, AMOS::Bank_t::IFO_STORE_SUFFIX, AMOS::Bank_t::LCK_STORE_SUFFIX, LOCK_TIME, AMOS::Bank_t::mode_m, and AMOS::Bank_t::store_pfx_m.

Referenced by AMOS::Bank_t::syncIFO().

ID_t AMOS::Bank_t::lookupBID ( const std::string &  eid  )  const [inherited]

Converts an EID to a BID, throw exception on failure.

Exceptions:
ArgumentException_t 
Returns:
The BID of the specified EID

ID_t Bank_t::lookupBID ( ID_t  iid  )  const [inherited]

Converts an IID to a BID, throw exception on failure.

Exceptions:
ArgumentException_t 
Returns:
The BID of the specified IID

Definition at line 587 of file Bank_AMOS.cc.

References AMOS_THROW_ARGUMENT, AMOS::Bank_t::idmap_m, AMOS::Bank_t::last_bid_m, AMOS::IDMap_t::lookupBID(), and AMOS::NULL_ID.

Referenced by AMOS::Bank_t::fetch(), AMOS::Bank_t::fetchFix(), remove(), AMOS::Bank_t::remove(), replace(), and AMOS::Bank_t::replace().

const std::string& AMOS::Bank_t::lookupEID ( ID_t  iid  )  const [inline, inherited]

Converts an IID to an EID.

Returns:
Returns the EID of the IID or empty string on failure

Definition at line 1089 of file Bank_AMOS.hh.

References AMOS::Bank_t::idmap_m.

Referenced by AMOS::Bank_t::fetch(), and AMOS::Bank_t::fetchFix().

ID_t AMOS::Bank_t::lookupIID ( const std::string &  eid  )  const [inline, inherited]

Converts an EID to an IID.

Returns:
Returns the IID of the EID or NULL_ID on failure

Definition at line 1100 of file Bank_AMOS.hh.

References AMOS::Bank_t::idmap_m.

Referenced by AMOS::Bank_t::fetch(), and AMOS::Bank_t::fetchFix().

void BankStream_t::open ( const std::string &  dir,
BankMode_t  mode = B_READ|B_WRITE 
)

Opens a bank on disk.

Opens a bank on disk, allowing modification/access operations like append and fetch to be performed. An open bank will first be closed before the new one is opened. Check for the existence of a bank (with the exists method) before opening to avoid an exception. If the B_SPY mode is activated, only read access to the banks is required, otherwise both read and write access is required.

Parameters:
dir The resident directory of the bank
mode The mode of the bank (B_READ | B_WRITE | B_SPY)
Precondition:
At least one of the modes is specified

The specified directory contains a bank of this type

sufficient read/write/exe permissions for dir and bank files

Exceptions:
IOException_t 
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 125 of file BankStream_AMOS.cc.

References AMOS::IDMap_t::end(), AMOS::Bank_t::getIDMap(), init(), AMOS::Bank_t::last_bid_m, AMOS::Bank_t::open(), and triples_m.

Bank_t::BankPartition_t * Bank_t::openPartition ( ID_t  id  )  [protected, inherited]

Do not use this function, use getPartition instead.

Definition at line 676 of file Bank_AMOS.cc.

References AMOS_THROW_IO, AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::BankPartition_t::fix_name, AMOS::Bank_t::max_partitions_m, AMOS::Bank_t::mode_m, AMOS::Bank_t::opened_m, AMOS::Bank_t::partitions_m, AMOS::Bank_t::BankPartition_t::var, and AMOS::Bank_t::BankPartition_t::var_name.

Referenced by AMOS::Bank_t::getPartition().

AMOS::BankStream_t::operator bool (  )  const [inline]

Cast the BankStream to a bool reflecting the state of !eof().

Returns:
The evaluation of !eof()

Definition at line 439 of file BankStream_AMOS.hh.

References eof().

bool AMOS::BankStream_t::operator! (  )  const [inline]

Evaluate eof() and return.

Returns:
The evaluation of eof()

Definition at line 450 of file BankStream_AMOS.hh.

References eof().

BankStream_t & BankStream_t::operator<< ( IBankable_t obj  ) 

Append a new object to the BankStream.

Precondition:
The bank is open for writing

obj is compatible with the banktype

Exceptions:
ArgumentException_t 
IOException_t 
Returns:
The modified BankStream

Definition at line 222 of file BankStream_AMOS.cc.

References AMOS::Bank_t::addPartition(), AMOS_THROW_ARGUMENT, AMOS_THROW_IO, ate_m, AMOS::B_WRITE, AMOS::Bank_t::banktype_m, AMOS::IBankable_t::eid_m, AMOS::Bank_t::fix_size_m, AMOS::IBankable_t::flags_m, AMOS::Bank_t::getLastPartition(), AMOS::IBankable_t::getNCode(), AMOS::Bank_t::idmap_m, AMOS::IBankable_t::iid_m, AMOS::IDMap_t::insert(), AMOS::BankFlags_t::is_modified, AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::last_bid_m, AMOS::Bank_t::max_bid_m, AMOS::Bank_t::mode_m, AMOS::Bank_t::nbids_m, oldPartition_m, AMOS::IDMap_t::remove(), triples_m, AMOS::writeLE(), and AMOS::IBankable_t::writeRecord().

Referenced by append().

BankStream_t & BankStream_t::operator>> ( IBankable_t obj  ) 

Fetch the next object in the BankStream.

If the operation fails, obj will be unaltered and the eof flag will be set, thus the resulting stream will return true for eof(). To iterate through all objects in the bank, 'while ( bankstream >> obj )' will suffice since the stream returned from the fetch will be cast to a bool reflecting the success/failure of the operation.

When called after setFixedStoreOnly(true), then only read the fixed store information. For example, reads store clear ranges, lengths, and other meta data in the fixed store, and sequences and quality values in the variable store.

Precondition:
The bank is open for reading

obj is compatible with the banktype

The eof flag is not set

Exceptions:
ArgumentException_t 
IOException_t 
Returns:
The modified BankStream

Definition at line 140 of file BankStream_AMOS.cc.

References AMOS_THROW_ARGUMENT, AMOS_THROW_IO, AMOS::B_READ, AMOS::Bank_t::banktype_m, curr_bid_m, AMOS::IDMap_t::HashTriple_t::eid, AMOS::IBankable_t::eid_m, eof(), eof_m, AMOS::Bank_t::fix_size_m, fixed_store_only_m, AMOS::IBankable_t::flags_m, AMOS::IBankable_t::getNCode(), AMOS::IDMap_t::HashTriple_t::iid, AMOS::IBankable_t::iid_m, inrange(), AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::localizeBID(), AMOS::Bank_t::mode_m, AMOS::NULL_ID, oldPartition_m, AMOS::readLE(), AMOS::IBankable_t::readRecord(), AMOS::IBankable_t::readRecordFix(), and triples_m.

void AMOS::BankStream_t::remove ( const std::string &  eid  )  [inline]

Removes an object from the bank by its EID.

Reimplemented from AMOS::Bank_t.

Definition at line 271 of file BankStream_AMOS.hh.

References ate_m, AMOS::Bank_t::idmap_m, AMOS::Bank_t::lookupBID(), oldPartition_m, remove(), AMOS::Bank_t::removeBID(), and triples_m.

void AMOS::BankStream_t::remove ( ID_t  iid  )  [inline]

Postcondition:
Invalidates only the BID of the removed object

Reimplemented from AMOS::Bank_t.

Definition at line 257 of file BankStream_AMOS.hh.

References ate_m, AMOS::Bank_t::idmap_m, AMOS::Bank_t::lookupBID(), oldPartition_m, AMOS::Bank_t::removeBID(), and triples_m.

Referenced by remove().

void Bank_t::removeBID ( ID_t  bid  )  [protected, inherited]

Remove an object by BID.

Definition at line 717 of file Bank_AMOS.cc.

References AMOS_THROW_IO, AMOS::B_READ, AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::fix_size_m, AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::localizeBID(), AMOS::Bank_t::mode_m, AMOS::Bank_t::nbids_m, AMOS::readLE(), AMOS::Bank_t::BankPartition_t::var, and AMOS::writeLE().

Referenced by remove(), AMOS::Bank_t::remove(), and removeByBID().

void AMOS::BankStream_t::removeByBID ( ID_t  bid  )  [inline]

Definition at line 284 of file BankStream_AMOS.hh.

References AMOS_THROW_IO, ate_m, AMOS::Bank_t::idmap_m, AMOS::Bank_t::last_bid_m, oldPartition_m, AMOS::IDMap_t::remove(), AMOS::Bank_t::removeBID(), and triples_m.

void AMOS::BankStream_t::replace ( const std::string &  eid,
IBankable_t obj 
)

Replaces an object in the bank by its EID.

Reimplemented from AMOS::Bank_t.

void BankStream_t::replace ( ID_t  iid,
IBankable_t obj 
)

Replaces an object in the bank by its IID.

Replaces an object in the bank with a given IID. EID/IID pair of the replaced object will be removed from the IDMap and the new pair will be added. Replaced object will not be fetchable or restoreable, it will be overwritten by the new object. The removed flag of the object will be cleared but the modified flag will be set. The disk space of the replaced object is not freed, therefore an eventual clean operation may be necessary to reduce the physical size of the bank.

Parameters:
iid The IID of the object to replace
obj The Bankable object to replace old object
Precondition:
The bank is open for read/writing

The specified IID exists in the bank

obj is compatible with the current NCode bank type

The new object EID does not exist in the bank

Postcondition:
obj will replace the object with the given IID

obj's is_modified flag is set

Exceptions:
IOException_t 
ArgumentException_t 
Returns:
void

Reimplemented from AMOS::Bank_t.

Definition at line 290 of file BankStream_AMOS.cc.

References ate_m, AMOS::IBankable_t::eid_m, AMOS::Bank_t::idmap_m, AMOS::IBankable_t::iid_m, AMOS::IDMap_t::insert(), AMOS::Bank_t::lookupBID(), AMOS::IDMap_t::lookupEID(), oldPartition_m, AMOS::IDMap_t::remove(), AMOS::Bank_t::replaceBID(), and triples_m.

Referenced by replaceByBID().

void Bank_t::replaceBID ( ID_t  bid,
IBankable_t obj 
) [protected, inherited]

Replace an object by BID.

Definition at line 793 of file Bank_AMOS.cc.

References AMOS_THROW_ARGUMENT, AMOS_THROW_IO, AMOS::B_READ, AMOS::Bank_t::banktype_m, AMOS::Bank_t::BankPartition_t::fix, AMOS::Bank_t::fix_size_m, AMOS::IBankable_t::flags_m, AMOS::IBankable_t::getNCode(), AMOS::BankFlags_t::is_modified, AMOS::Bank_t::is_open_m, AMOS::BankFlags_t::is_removed, AMOS::Bank_t::localizeBID(), AMOS::Bank_t::mode_m, AMOS::Bank_t::BankPartition_t::var, AMOS::writeLE(), and AMOS::IBankable_t::writeRecord().

Referenced by replace(), AMOS::Bank_t::replace(), and replaceByBID().

void BankStream_t::replaceByBID ( ID_t  bid,
IBankable_t obj 
)

Definition at line 348 of file BankStream_AMOS.cc.

References AMOS_THROW_IO, ate_m, AMOS::IBankable_t::eid_m, AMOS::Bank_t::idmap_m, AMOS::IBankable_t::iid_m, AMOS::IDMap_t::insert(), AMOS::Bank_t::last_bid_m, oldPartition_m, replace(), AMOS::Bank_t::replaceBID(), and triples_m.

BankStream_t& AMOS::BankStream_t::seekg ( ID_t  pos  )  [inline]

Seeks to a different position in the BankStream.

This function is constant time. Seeking past the end of stream will set the eof flag. The get pointer is the bank index (BID) of the next object to be fetched.

Precondition:
The bank is open for reading
Parameters:
pos The stream position to seek to (1 based bank index)
Exceptions:
IOException_t 
Returns:
The updated BankStream

Definition at line 385 of file BankStream_AMOS.hh.

References AMOS_THROW_IO, AMOS::B_READ, curr_bid_m, eof_m, inrange(), AMOS::Bank_t::is_open_m, AMOS::Bank_t::mode_m, and oldPartition_m.

BankStream_t& AMOS::BankStream_t::seekg ( bankstreamoff  off,
bankseekdir  dir 
) [inline]

Seeks to a different position in the BankStream.

Seek to a position + offest. bankseekdir's are defined as BEGIN,CURR,END. Where BEGIN is the start of the stream, CURR is the current position in the stream and END is one past the last record in the stream. Only slightly more efficient than fetching the same number of records. Seeking past the end of stream will set the eof flag.

Precondition:
The bank is open for reading
Parameters:
off Number of records to offset from dir
dir The position from which to begin offest
Exceptions:
IOException_t 
Returns:
The updated BankStream

Definition at line 354 of file BankStream_AMOS.hh.

References AMOS_THROW, AMOS_THROW_IO, AMOS::B_READ, BEGIN, CURR, curr_bid_m, END, ignore(), AMOS::Bank_t::is_open_m, AMOS::Bank_t::last_bid_m, AMOS::Bank_t::mode_m, and oldPartition_m.

void AMOS::BankStream_t::setFixedStoreOnly ( bool  onlyFixed  )  [inline]

Controls if operator>> should read the fixed store only or with variable store.

Controls if operator>> should read the fixed store only, or also read the variable store information as well. By default read both stores.

Parameters:
onlyFixed If only the fixed store should be read

Definition at line 333 of file BankStream_AMOS.hh.

References fixed_store_only_m.

void AMOS::Bank_t::setMode ( BankMode_t  mode  )  [inline, protected, inherited]

validates and sets the BankMode

Parameters:
mode BankMode_t to check and set
Precondition:
mode is a valid BankMode_t
Exceptions:
ArgumentException_t 
Returns:
void

Definition at line 521 of file Bank_AMOS.hh.

References AMOS_THROW_ARGUMENT, AMOS::B_READ, AMOS::B_SPY, AMOS::B_WRITE, and AMOS::Bank_t::mode_m.

void AMOS::Bank_t::setStatus ( signed char  status  )  [inline, inherited]

Set the bank status.

Currently the status is set by the user and not written to the bank. Status is set to zero on object initialization and then left untouched.

Returns:
void

Definition at line 1202 of file Bank_AMOS.hh.

References AMOS::Bank_t::status_m.

void Bank_t::syncIFO ( IFOMode_t  mode  )  [protected, inherited]

Syncs the IFO store with in-memory data.

Locks the IFO store if needed, then syncs the IFO store with in-memory data. Either as an open, update or close depending on the IFOMode. Use I_OPEN if opening the IFO store for the first time, I_CREATE if creating a new IFO store or I_CLOSE if ready to close the IFO store. Only I_OPEN will have an effect if bank is in B_SPY mode. Will throw an exception if any of the bank locks are violated.

Precondition:
The bank is open
Parameters:
mode I_OPEN, I_CREATE or I_CLOSE (cannot OR these together)
Exceptions:
IOException_t 
Returns:
void

Definition at line 823 of file Bank_AMOS.cc.

References AMOS::Bank_t::addPartition(), AMOS_THROW_IO, AMOS::B_READ, AMOS::B_SPY, AMOS::Bank_t::BANK_VERSION, AMOS::Bank_t::banktype_m, AMOS::Decode(), AMOS::Bank_t::fix_size_m, AMOS::Bank_t::I_CLOSE, AMOS::Bank_t::I_OPEN, AMOS::Bank_t::IFO_STORE_SUFFIX, AMOS::Bank_t::last_bid_m, AMOS::Bank_t::lockIFO(), AMOS::Bank_t::mode_m, AMOS::Bank_t::nbids_m, AMOS::Bank_t::npartitions_m, AMOS::NULL_CHAR, AMOS::Bank_t::partition_size_m, AMOS::Bank_t::partitions_m, AMOS::Bank_t::READ_LOCK_CHAR, AMOS::Bank_t::store_pfx_m, AMOS::Bank_t::unlockIFO(), and AMOS::Bank_t::WRITE_LOCK_CHAR.

Referenced by AMOS::Bank_t::close().

ID_t AMOS::BankStream_t::tellg (  )  const [inline]

Return the current position of the get pointer.

Returns the current position of the get pointer. The get pointer is the bank index (BID) of the next object to be fetched. Note that the difference between two stream positions does NOT tell you how many objects are in between because some of them may be deleted.

Returns:
The current position of the get pointer

Definition at line 412 of file BankStream_AMOS.hh.

References curr_bid_m.

ID_t AMOS::BankStream_t::tellp (  )  const [inline]

Return the current position of the put pointer.

Returns the current position of the put pointer. The put pointer is the bank index (BID) of the next object to be appended. Note that the difference between two stream positions does NOT tell you how many objects are in between because some of them may be deleted.

Returns:
The current position of the put pointer

Definition at line 428 of file BankStream_AMOS.hh.

References AMOS::Bank_t::last_bid_m.

void AMOS::Bank_t::touchFile ( const std::string &  path,
int  mode,
bool  create 
) [protected, inherited]

Opens or creates a file, throwing exception on failure.

Referenced by AMOS::Bank_t::addPartition().

void Bank_t::unlockIFO (  )  [protected, inherited]

Releases the file lock on the info store of the current bank.

Releases the file lock on the info store of the current bank. Will throw an exception if the unlock failed either because the lock did not exist or could not be released. Has no effect if BankMode is set to B_SPY.

Precondition:
The bank is open

The info store is currently locked

Exceptions:
IOException_t 
Returns:
void

Definition at line 1048 of file Bank_AMOS.cc.

References AMOS_THROW_IO, AMOS::Bank_t::LCK_STORE_SUFFIX, AMOS::Bank_t::mode_m, and AMOS::Bank_t::store_pfx_m.

Referenced by AMOS::Bank_t::syncIFO().


Member Data Documentation

bool AMOS::BankStream_t::ate_m [protected]

put pointers at end of bank

Definition at line 70 of file BankStream_AMOS.hh.

Referenced by init(), operator<<(), remove(), removeByBID(), replace(), and replaceByBID().

const string Bank_t::BANK_VERSION = "2.8" [static, inherited]

current bank version

Definition at line 619 of file Bank_AMOS.hh.

Referenced by AMOS::PrintBankVersion(), and AMOS::Bank_t::syncIFO().

NCode_t AMOS::Bank_t::banktype_m [protected, inherited]

the type of objects stored in this bank

Definition at line 591 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::concat(), AMOS::Bank_t::fetchBID(), AMOS::Bank_t::fetchBIDFix(), AMOS::Bank_t::getType(), AMOS::Bank_t::init(), operator<<(), operator>>(), AMOS::Bank_t::replaceBID(), and AMOS::Bank_t::syncIFO().

Size_t AMOS::Bank_t::buffer_size_m [protected, inherited]

size of the I/O buffer

Definition at line 593 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition(), AMOS::Bank_t::Bank_t(), and BankStream_t().

ID_t AMOS::BankStream_t::curr_bid_m [protected]

BID to be returned on next get.

Definition at line 69 of file BankStream_AMOS.hh.

Referenced by ignore(), init(), inrange(), operator>>(), seekg(), and tellg().

const Size_t BankStream_t::DEFAULT_BUFFER_SIZE = 1024 [static, protected]

IO buffer size.

Reimplemented from AMOS::Bank_t.

Definition at line 40 of file BankStream_AMOS.hh.

Referenced by BankStream_t().

const Size_t Bank_t::DEFAULT_PARTITION_SIZE = 1000000 [static, protected, inherited]

records per partition

Definition at line 339 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition().

bool AMOS::BankStream_t::eof_m [protected]

eof error flag

Definition at line 68 of file BankStream_AMOS.hh.

Referenced by concat(), eof(), ignore(), init(), operator>>(), and seekg().

Size_t AMOS::Bank_t::fix_size_m [protected, inherited]

size of entire fixed length record

Definition at line 602 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::clean(), AMOS::Bank_t::concat(), AMOS::Bank_t::fetchBID(), AMOS::Bank_t::fetchBIDFix(), ignore(), AMOS::Bank_t::init(), operator<<(), operator>>(), AMOS::Bank_t::removeBID(), AMOS::Bank_t::replaceBID(), and AMOS::Bank_t::syncIFO().

const string Bank_t::FIX_STORE_SUFFIX = ".fix" [static, inherited]

the fixed length stores

Definition at line 625 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition().

bool AMOS::BankStream_t::fixed_store_only_m [protected]

Just fetch from fixed store.

Definition at line 67 of file BankStream_AMOS.hh.

Referenced by init(), operator>>(), and setFixedStoreOnly().

IDMap_t AMOS::Bank_t::idmap_m [protected, inherited]

the IDMap IID <-> EID to BID

Definition at line 612 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::append(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::close(), AMOS::Bank_t::concat(), AMOS::Bank_t::existsEID(), AMOS::Bank_t::existsIID(), AMOS::Bank_t::fetch(), AMOS::Bank_t::fetchFix(), AMOS::Bank_t::getIDMap(), AMOS::Bank_t::getIDMapSize(), AMOS::Bank_t::getMaxBID(), AMOS::Bank_t::getMaxIID(), AMOS::Bank_t::init(), AMOS::Bank_t::lookupBID(), AMOS::Bank_t::lookupEID(), AMOS::Bank_t::lookupIID(), operator<<(), remove(), AMOS::Bank_t::remove(), removeByBID(), replace(), AMOS::Bank_t::replace(), and replaceByBID().

const string Bank_t::IFO_STORE_SUFFIX = ".ifo" [static, inherited]

the informational store

Definition at line 621 of file Bank_AMOS.hh.

Referenced by AMOS::BankExists(), AMOS::Bank_t::destroy(), AMOS::Bank_t::lockIFO(), and AMOS::Bank_t::syncIFO().

bool AMOS::Bank_t::is_open_m [protected, inherited]

open status of the bank

Definition at line 596 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::close(), AMOS::Bank_t::concat(), AMOS::Bank_t::destroy(), eof(), AMOS::Bank_t::fetchBID(), AMOS::Bank_t::fetchBIDFix(), ignore(), AMOS::Bank_t::init(), AMOS::Bank_t::isOpen(), operator<<(), operator>>(), AMOS::Bank_t::removeBID(), AMOS::Bank_t::replaceBID(), seekg(), AMOS::Bank_t::~Bank_t(), and ~BankStream_t().

ID_t AMOS::Bank_t::last_bid_m [protected, inherited]

the last bank bid (1 based)

Definition at line 605 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::append(), AMOS::Bank_t::appendBID(), clean(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), concat(), AMOS::Bank_t::concat(), AMOS::Bank_t::getIndexSize(), AMOS::Bank_t::init(), inrange(), AMOS::Bank_t::lookupBID(), open(), operator<<(), removeByBID(), replaceByBID(), seekg(), AMOS::Bank_t::syncIFO(), and tellp().

const string Bank_t::LCK_STORE_SUFFIX = ".lck" [static, inherited]

the ifo store file lock

Definition at line 623 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::destroy(), AMOS::Bank_t::lockIFO(), and AMOS::Bank_t::unlockIFO().

const string Bank_t::MAP_STORE_SUFFIX = ".map" [static, inherited]

the ID map store

Definition at line 622 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::close(), and AMOS::Bank_t::destroy().

ID_t AMOS::Bank_t::max_bid_m [protected, inherited]

maximum bid given the current partitioning

Definition at line 606 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition(), AMOS::Bank_t::appendBID(), AMOS::Bank_t::clear(), AMOS::Bank_t::concat(), AMOS::Bank_t::init(), and operator<<().

const Size_t BankStream_t::MAX_OPEN_PARTITIONS = 2 [static, protected]

Allowable simultaneously open partitions (one for >>, one for <<).

Reimplemented from AMOS::Bank_t.

Definition at line 43 of file BankStream_AMOS.hh.

Referenced by BankStream_t().

Size_t AMOS::Bank_t::max_partitions_m [protected, inherited]

maximum number of open partitions

Definition at line 594 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::Bank_t(), BankStream_t(), and AMOS::Bank_t::openPartition().

BankMode_t AMOS::Bank_t::mode_m [protected, inherited]

mode of the bank, B_READ|B_WRITE|B_SPY

Definition at line 598 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::close(), AMOS::Bank_t::concat(), AMOS::Bank_t::destroy(), AMOS::Bank_t::fetchBID(), AMOS::Bank_t::fetchBIDFix(), ignore(), AMOS::Bank_t::lockIFO(), AMOS::Bank_t::openPartition(), operator<<(), operator>>(), AMOS::Bank_t::removeBID(), AMOS::Bank_t::replaceBID(), seekg(), AMOS::Bank_t::setMode(), AMOS::Bank_t::syncIFO(), and AMOS::Bank_t::unlockIFO().

ID_t AMOS::Bank_t::nbids_m [protected, inherited]

number of non-deleted bids

Definition at line 607 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::concat(), AMOS::Bank_t::getSize(), AMOS::Bank_t::init(), operator<<(), AMOS::Bank_t::removeBID(), and AMOS::Bank_t::syncIFO().

Size_t AMOS::Bank_t::npartitions_m [protected, inherited]

number of partitions

Definition at line 608 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::close(), AMOS::Bank_t::concat(), AMOS::Bank_t::getLastPartition(), AMOS::Bank_t::init(), and AMOS::Bank_t::syncIFO().

BankPartition_t* AMOS::BankStream_t::oldPartition_m [protected]

Definition at line 73 of file BankStream_AMOS.hh.

Referenced by concat(), fetch(), fetchFix(), ignore(), init(), operator<<(), operator>>(), remove(), removeByBID(), replace(), replaceByBID(), and seekg().

std::deque<BankPartition_t *> AMOS::Bank_t::opened_m [protected, inherited]

opened partitions

Definition at line 609 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::clear(), AMOS::Bank_t::init(), and AMOS::Bank_t::openPartition().

Size_t AMOS::Bank_t::partition_size_m [protected, inherited]

records per disk store partition

Definition at line 603 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::init(), AMOS::Bank_t::localizeBID(), and AMOS::Bank_t::syncIFO().

std::vector<BankPartition_t *> AMOS::Bank_t::partitions_m [protected, inherited]

all partitions

Definition at line 610 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition(), AMOS::Bank_t::clean(), AMOS::Bank_t::clear(), AMOS::Bank_t::close(), AMOS::Bank_t::getPartition(), AMOS::Bank_t::init(), AMOS::Bank_t::openPartition(), and AMOS::Bank_t::syncIFO().

const char Bank_t::READ_LOCK_CHAR = 'r' [static, inherited]

read lock char

Definition at line 631 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::syncIFO().

signed char AMOS::Bank_t::status_m [protected, inherited]

bank status

Definition at line 597 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::Bank_t(), AMOS::Bank_t::getStatus(), and AMOS::Bank_t::setStatus().

std::string AMOS::Bank_t::store_dir_m [protected, inherited]

the disk store directory

Definition at line 600 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::destroy(), and AMOS::Bank_t::init().

std::string AMOS::Bank_t::store_pfx_m [protected, inherited]

the disk store prefix (including dir)

Definition at line 601 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition(), AMOS::Bank_t::clean(), AMOS::Bank_t::close(), AMOS::Bank_t::destroy(), AMOS::Bank_t::init(), AMOS::Bank_t::lockIFO(), AMOS::Bank_t::syncIFO(), and AMOS::Bank_t::unlockIFO().

const string Bank_t::TMP_STORE_SUFFIX = ".tmp" [static, inherited]

the temporary store

Definition at line 628 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::clean().

std::vector<const IDMap_t::HashTriple_t *> AMOS::BankStream_t::triples_m [protected]

BID,EID,IID map.

Definition at line 71 of file BankStream_AMOS.hh.

Referenced by BankStream_t(), clean(), concat(), init(), open(), operator<<(), operator>>(), remove(), removeByBID(), replace(), and replaceByBID().

const string Bank_t::VAR_STORE_SUFFIX = ".var" [static, inherited]

the variable length stores

Definition at line 626 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::addPartition().

const char Bank_t::WRITE_LOCK_CHAR = 'w' [static, inherited]

write lock char

Definition at line 630 of file Bank_AMOS.hh.

Referenced by AMOS::Bank_t::syncIFO().


The documentation for this class was generated from the following files:
Generated on Mon Feb 22 17:36:35 2010 for libAMOS by  doxygen 1.4.7