#include <IDMap_AMOS.hh>
Inheritance diagram for AMOS::IDMap_t:
Public Member Functions | |
| IDMap_t () | |
| Contstructs an empty IDMap_t object. | |
| IDMap_t (Size_t buckets) | |
| Contstructs an empty IDMap_t object. | |
| IDMap_t (const IDMap_t &source) | |
| Copy constructor. | |
| ~IDMap_t () | |
| Destroys a IDMap_t object. | |
| const_iterator | begin () const |
| Returns an IDMap_t::const_iterator to the beginning of the map. | |
| const_iterator | end () const |
| Returns an IDMap_t::const_iterator to the end of the map. | |
| void | clear () |
| Clears all object data. | |
| void | concat (const IDMap_t &source) |
| Concatenate another IDMap onto this one. | |
| bool | empty () const |
| Returns true if the map is empty. | |
| bool | exists (const std::string &key) const |
| Check if a certain EID exists in the map. | |
| bool | exists (ID_t key) const |
| Check if a certain IID exists in the map. | |
| Size_t | getBuckets () const |
| Returns the current number of buckets being used. | |
| virtual NCode_t | getNCode () const |
| Get the AMOS NCode type identifier. | |
| Size_t | getSize () const |
| Get the number of value triples in the map. | |
| NCode_t | getType () const |
| The type of IDs stored in the map. | |
| const HashTriple_t * | insert (ID_t iid, const std::string &eid, ID_t bid=NULL_ID) |
| Insert a new EID/IID keyed value into the map. | |
| const HashTriple_t * | insert (const std::string &eid, ID_t bid=NULL_ID) |
| Insert a new EID keyed value into the map. | |
| const HashTriple_t * | insert (ID_t iid, ID_t bid=NULL_ID) |
| Insert a new IID keyed value into the map. | |
| ID_t | lookupBID (const std::string &key) const |
| Lookup the BID associated with an EID key. | |
| ID_t | lookupBID (ID_t key) const |
| Lookup the BID associated with an IID key. | |
| const std::string & | lookupEID (ID_t key) const |
| Lookup the EID associated with an IID key. | |
| ID_t | lookupIID (const std::string &key) const |
| Lookup the IID associated with an EID key. | |
| IDMap_t & | operator= (const IDMap_t &source) |
| Assignment (copy) operator. | |
| virtual void | readMessage (const Message_t &msg) |
| Reads in data from a Message object. | |
| void | remove (ID_t key) |
| Remove an existing value triple from the map by IID key. | |
| void | remove (const std::string &key) |
| Remove an existing value triple from the map by EID key. | |
| void | resize (Size_t min) |
| Resize the hash table. | |
| virtual void | writeMessage (Message_t &msg) const |
| Writes data to a Message object. | |
| void | read (const std::string &path) |
| Read a tab-delimited IDMap record. | |
| void | setType (NCode_t type) |
| Set the type of the mapped IDs. | |
| void | write (std::ostream &out) const |
| Write a tab-delimited IDMap record. | |
Static Public Attributes | |
| static const NCode_t | NCODE = M_IDMAP |
| The NCode type identifier for this object. | |
Classes | |
| class | const_iterator |
| const_iterator for moving through the map More... | |
| struct | HashNode_t |
| HashNode for IDMap. | |
| struct | HashTriple_t |
| HashTriple for IDMap. More... | |
| class | iterator |
| iterator for moving through the map | |
A double hash of IIDs and EIDs to each other and BIDs. Users may lookup an EID or BID via an IID, or may lookup an IID or BID via an EID.
A quick review of the identifier nomenclature: BID is a bank index, EID is an external ID, and IID is an internal AMOS ID. BIDs are physical bank indices; useful only for debugging purposes. IIDs are interger IDs used by AMOS for object links and identification, e.g. retrieving an object from a bank. EIDs are string indentifiers of unlimited length, e.g. sequence names. The empty string is used as an equivalent for NULL EID.
Definition at line 36 of file IDMap_AMOS.hh.
| AMOS::IDMap_t::IDMap_t | ( | ) | [inline] |
Contstructs an empty IDMap_t object.
Definition at line 305 of file IDMap_AMOS.hh.
References resize().
| AMOS::IDMap_t::IDMap_t | ( | Size_t | buckets | ) | [inline] |
Contstructs an empty IDMap_t object.
| buckets | Minimum number of hash table buckets to start with |
Definition at line 317 of file IDMap_AMOS.hh.
References resize().
| AMOS::IDMap_t::IDMap_t | ( | const IDMap_t & | source | ) | [inline] |
| AMOS::IDMap_t::~IDMap_t | ( | ) | [inline] |
| const_iterator AMOS::IDMap_t::begin | ( | ) | const [inline] |
Returns an IDMap_t::const_iterator to the beginning of the map.
Constant iterator on all the HashTriple_t values in the map. Will go NULL when at end of list. Test for validity just as you would test a pointer: for ( myitr = mymap.begin( ); mitr; ++ mitr )
Definition at line 350 of file IDMap_AMOS.hh.
| void IDMap_t::clear | ( | ) |
Clears all object data.
Clears data, but does not resize the hash table.
Definition at line 62 of file IDMap_AMOS.cc.
References AMOS::NULL_NCODE.
Referenced by AMOS::Bank_t::clear(), AMOS::Bank_t::init(), operator=(), read(), readMessage(), resize(), writeMessage(), and ~IDMap_t().
| void IDMap_t::concat | ( | const IDMap_t & | source | ) |
Concatenate another IDMap onto this one.
Has no effect if source is the same IDMap as this one.
Definition at line 181 of file IDMap_AMOS.cc.
References getSize(), insert(), and resize().
Referenced by operator=().
| bool AMOS::IDMap_t::empty | ( | ) | const [inline] |
Returns true if the map is empty.
Definition at line 395 of file IDMap_AMOS.hh.
Referenced by remove().
| const_iterator AMOS::IDMap_t::end | ( | ) | const [inline] |
Returns an IDMap_t::const_iterator to the end of the map.
Constant iterator on all the HashTriple_t values in the map. Usage similar to STL iterators, i.e. for ( itr = map.begin( ); itr != map.end( ); ++ itr )
Definition at line 363 of file IDMap_AMOS.hh.
| bool AMOS::IDMap_t::exists | ( | ID_t | key | ) | const [inline] |
Check if a certain IID exists in the map.
Returns true if the IID exists, otherwise false. Will always return false if key is NULL_ID.
| key | The IID key to check |
Definition at line 426 of file IDMap_AMOS.hh.
| bool AMOS::IDMap_t::exists | ( | const std::string & | key | ) | const [inline] |
Check if a certain EID exists in the map.
Returns true if the EID exists, otherwise false. Will always return false if key is NULL.
| key | The EID key to check |
Definition at line 410 of file IDMap_AMOS.hh.
Referenced by readMessage().
| Size_t AMOS::IDMap_t::getBuckets | ( | ) | const [inline] |
Returns the current number of buckets being used.
Definition at line 438 of file IDMap_AMOS.hh.
Referenced by resize().
| virtual NCode_t AMOS::IDMap_t::getNCode | ( | ) | const [inline, virtual] |
Get the AMOS NCode type identifier.
Implements AMOS::IMessagable_t.
Definition at line 445 of file IDMap_AMOS.hh.
References NCODE.
| Size_t AMOS::IDMap_t::getSize | ( | ) | const [inline] |
Get the number of value triples in the map.
Definition at line 456 of file IDMap_AMOS.hh.
Referenced by concat().
| NCode_t AMOS::IDMap_t::getType | ( | ) | const [inline] |
The type of IDs stored in the map.
Definition at line 467 of file IDMap_AMOS.hh.
| const HashTriple_t* AMOS::IDMap_t::insert | ( | ID_t | iid, | |
| ID_t | bid = NULL_ID | |||
| ) | [inline] |
Insert a new IID keyed value into the map.
Inserts a new BID into the map via an IID key. Has no effect if IID is NULL_ID, but BID is permitted to be NULL_ID.
| iid | The IID key | |
| bid | The bank index value |
| ArgumentException_t |
Definition at line 527 of file IDMap_AMOS.hh.
References insert(), and AMOS::NULL_STRING.
| const HashTriple_t* AMOS::IDMap_t::insert | ( | const std::string & | eid, | |
| ID_t | bid = NULL_ID | |||
| ) | [inline] |
Insert a new EID keyed value into the map.
Inserts a new BID into the map via an EID key. Has no effect if EID is NULL, but BID is permitted to be NULL_ID.
| eid | The EID key | |
| bid | The bank index value |
The EID does not already exist in the map
| ArgumentException_t |
Definition at line 509 of file IDMap_AMOS.hh.
References insert(), and AMOS::NULL_ID.
| const HashTriple_t* AMOS::IDMap_t::insert | ( | ID_t | iid, | |
| const std::string & | eid, | |||
| ID_t | bid = NULL_ID | |||
| ) |
Insert a new EID/IID keyed value into the map.
Inserts a new BID into the map via both an EID and IID key. Has no effect if *both* EID and IID are NULL, but *one* of them and BID are permitted to be NULL. If EID is NULL but IID is not, then a triple will be inserted into the map, keyed only by the IID. If IID is NULL but EID is not, then a triple will be inserted, keyed only by EID. If neither is NULL, then the triple will be keyed by both. If both are NULL, there is no effect.
| iid | The IID key | |
| eid | The EID key | |
| bid | The bank index value |
The EID does not already exist in the map
| ArgumentException_t |
Referenced by AMOS::Bank_t::append(), concat(), AMOS::Bank_t::concat(), insert(), AMOS::BankStream_t::operator<<(), read(), readMessage(), AMOS::BankStream_t::replace(), AMOS::Bank_t::replace(), and AMOS::BankStream_t::replaceByBID().
Lookup the BID associated with an IID key.
| key | The IID key of the BID to lookup |
Definition at line 562 of file IDMap_AMOS.hh.
References AMOS::NULL_ID.
| ID_t AMOS::IDMap_t::lookupBID | ( | const std::string & | key | ) | const [inline] |
Lookup the BID associated with an EID key.
| key | The EID key of the BID to lookup |
Definition at line 543 of file IDMap_AMOS.hh.
References AMOS::NULL_ID.
Referenced by AMOS::Bank_t::lookupBID().
| const std::string& AMOS::IDMap_t::lookupEID | ( | ID_t | key | ) | const [inline] |
Lookup the EID associated with an IID key.
| key | The IID key of the EID to lookup |
Definition at line 581 of file IDMap_AMOS.hh.
References AMOS::NULL_STRING.
Referenced by AMOS::BankStream_t::replace(), and AMOS::Bank_t::replace().
| ID_t AMOS::IDMap_t::lookupIID | ( | const std::string & | key | ) | const [inline] |
Lookup the IID associated with an EID key.
| key | The EID key of the IID to lookup |
Definition at line 600 of file IDMap_AMOS.hh.
References AMOS::NULL_ID.
Assignment (copy) operator.
Simply clears the current map and calls insert on everything in source. Does not guarantee that getBuckets( ) will equal source.getBuckets( ) after the assignment. Throws an exception if copy failed due to corrupt source map.
| source | The map to copy |
| ArgumentException_t |
Definition at line 483 of file IDMap_AMOS.cc.
| void IDMap_t::read | ( | const std::string & | path | ) |
Read a tab-delimited IDMap record.
IDMap NCode and size listed on the first line separated by a single space, followed by one tab-delimited triple per line in the order: bid, iid, eid. One of the stream's error bits will be set on failure. The EID strings cannot contain any whitespace
| in | The stream to read the IDMap from |
Definition at line 497 of file IDMap_AMOS.cc.
References AMOS_THROW_IO, clear(), AMOS::Encode(), insert(), MAX_EID_LENGTH, and resize().
| void IDMap_t::readMessage | ( | const Message_t & | msg | ) | [virtual] |
Reads in data from a Message object.
Reads the data contained in a Message object and stores it in the Messagable object. Will not complain if incoming message is of the wrong type, will only try and suck out the fields it recognizes. All previous data in the Messagable object will be cleared or overwritten.
| msg | The Message to read from |
| ArgumentException_t |
Implements AMOS::IMessagable_t.
Definition at line 243 of file IDMap_AMOS.cc.
References AMOS_THROW_ARGUMENT, clear(), AMOS::Encode(), exists(), AMOS::F_MAP, AMOS::F_OBJECT, AMOS::F_SIZE, insert(), AMOS::NCODE_SIZE, and resize().
| void AMOS::IDMap_t::remove | ( | const std::string & | key | ) |
Remove an existing value triple from the map by EID key.
Removes an existsing value triple from the map. Has no effect if the key does not exist or is NULL. If EID is associated with an IID, the IID key will also be removed.
| key | The EID key of the triple to remove |
| void IDMap_t::remove | ( | ID_t | key | ) |
Remove an existing value triple from the map by IID key.
Removes an existsing value triple from the map. Has no effect if the key does not exist or is NULL_ID. If IID is associated with an EID, the EID key will also be removed.
| key | The IID key of the triple to remove |
Definition at line 303 of file IDMap_AMOS.cc.
References empty(), and AMOS::NULL_ID.
Referenced by AMOS::Bank_t::append(), AMOS::Bank_t::concat(), AMOS::BankStream_t::operator<<(), AMOS::BankStream_t::removeByBID(), AMOS::BankStream_t::replace(), and AMOS::Bank_t::replace().
| void IDMap_t::resize | ( | Size_t | min | ) |
Resize the hash table.
This will cause the hash to reorganize itself and is not recommended as a frequent operation. If request is larger than max number of buckets the max number of buckets will be used. Otherwise, the resulting number of buckets is only guaranteed to be greater than request.
Number of buckets will automatically increase whenever an insert operation causes the number of elements to be >= than number of buckets.
| min | Minimum number of buckets to use |
Definition at line 383 of file IDMap_AMOS.cc.
References AMOS_THROW, clear(), and getBuckets().
Referenced by concat(), IDMap_t(), read(), and readMessage().
| void AMOS::IDMap_t::setType | ( | NCode_t | type | ) | [inline] |
Set the type of the mapped IDs.
| type | The NCode type of the mapped IDs |
Definition at line 695 of file IDMap_AMOS.hh.
Referenced by AMOS::Bank_t::clear(), and AMOS::Bank_t::init().
| void AMOS::IDMap_t::write | ( | std::ostream & | out | ) | const |
Write a tab-delimited IDMap record.
IDMap NCode and size listed on the first line separated by a single space, followed by one tab-delimited triple per line in the order: bid, iid, eid. One of the stream's error bits will be set on failure.
| out | The stream to write the IDMap to |
Referenced by AMOS::Bank_t::close().
| void IDMap_t::writeMessage | ( | Message_t & | msg | ) | const [virtual] |
Writes data to a Message object.
Writes the data contained in a Messagable object to a Message object. All previous data in the Message will be cleared or overwritten.
| msg | The Message to write to |
Implements AMOS::IMessagable_t.
Definition at line 442 of file IDMap_AMOS.cc.
References clear(), AMOS::Decode(), AMOS::F_MAP, AMOS::F_OBJECT, AMOS::F_SIZE, AMOS::NL_CHAR, AMOS::NULL_NCODE, and AMOS::NULL_STRING.
const NCode_t IDMap_t::NCODE = M_IDMAP [static] |
The NCode type identifier for this object.
Definition at line 265 of file IDMap_AMOS.hh.
Referenced by getNCode().
1.4.7