Rudiments
Public Member Functions | List of all members
dictionarycollection< keytype, valuetype > Class Template Referenceabstract

#include <dictionarycollection.h>

Inherits collection.

Inherited by dictionary< keytype, valuetype >.

Public Member Functions

virtual const chargetType ()
 
virtual bool getTrackInsertionOrder ()=0
 
virtual void setValue (keytype key, valuetype value)=0
 
virtual void setValues (keytype *key, valuetype *value)=0
 
virtual void setValues (keytype const *key, valuetype const *value)=0
 
virtual void setValues (keytype *key, valuetype *value, uint64_t count)=0
 
virtual void setValues (keytype const *key, valuetype const *value, uint64_t count)=0
 
virtual bool getValue (keytype key, valuetype *value)=0
 
virtual valuetype getValue (keytype key)=0
 
virtual bool getKey (keytype key, keytype *k)=0
 
virtual keytype getKey (keytype key)=0
 
virtual linkedlist< keytype > * getKeys ()=0
 
virtual bool remove (keytype key)=0
 
virtual ssize_t write ()
 
virtual ssize_t write (output *out)
 
virtual ssize_t writeJson ()
 
virtual ssize_t writeJson (bool indent)
 
virtual ssize_t writeJson (output *out)
 
virtual ssize_t writeJson (output *out, bool indent)
 
- Public Member Functions inherited from collection
 collection ()
 
 collection (collection &c)
 
collectionoperator= (collection &c)
 
virtual ~collection ()
 
virtual uint64_t getCount ()=0
 
comparatorgetComparator ()
 
void setComparator (comparator *newcomp)
 
virtual bool isReadOnly ()
 
virtual bool isBlockBased ()
 
virtual uint64_t getBlockSize ()
 
virtual bool isSequentialAccess ()
 
virtual void setManageValues (bool manage)
 
virtual bool getManageValues ()
 
virtual void setManageArrayValues (bool manage)
 
virtual bool getManageArrayValues ()
 
virtual void setManageKeys (bool manage)
 
virtual bool getManageKeys ()
 
virtual void setManageArrayKeys (bool manage)
 
virtual bool getManageArrayKeys ()
 
virtual bool clear ()=0
 
- Public Member Functions inherited from object
virtual ~object ()
 

Detailed Description

template<class keytype, class valuetype>
class dictionarycollection< keytype, valuetype >

The dictionarycollection class is the parent class for all rudiments dictionary collections.

Member Function Documentation

◆ getKey() [1/2]

template<class keytype , class valuetype >
virtual keytype dictionarycollection< keytype, valuetype >::getKey ( keytype key)
pure virtual

Returns the value associated with "key" or NULL if "key" wasn't found. Note that there is no way to distinguish between failure to find "key" and a valid value of NULL associated with "key".

Implemented in dictionary< keytype, valuetype >.

◆ getKey() [2/2]

template<class keytype , class valuetype >
virtual bool dictionarycollection< keytype, valuetype >::getKey ( keytype key,
keytype * k )
pure virtual

Sets "k" to the key associated with "key". Returns true on success or false if "key" wasn't found.

Implemented in dictionary< keytype, valuetype >.

◆ getKeys()

template<class keytype , class valuetype >
virtual linkedlist< keytype > * dictionarycollection< keytype, valuetype >::getKeys ( )
pure virtual

Returns a list of the keys in the dictionary.

Implemented in dictionary< keytype, valuetype >.

◆ getTrackInsertionOrder()

template<class keytype , class valuetype >
virtual bool dictionarycollection< keytype, valuetype >::getTrackInsertionOrder ( )
pure virtual

Returns "true" if insertion order tracking is enabled and false otherwise.

If getTrackInsertionOrder() is true then the order of key insertion is tracked and getKeys() returns a list of keys in the order that they were inserted.

If getTrackInsertionOrder() is false then the order of key insertion is not tracked and getKeys() returns a list of keys in ascending order.

Implemented in dictionary< keytype, valuetype >.

◆ getType()

template<class keytype , class valuetype >
const char * dictionarycollection< keytype, valuetype >::getType ( )
inlinevirtual

Returns "dictionary".

Implements collection.

◆ getValue() [1/2]

template<class keytype , class valuetype >
virtual valuetype dictionarycollection< keytype, valuetype >::getValue ( keytype key)
pure virtual

Returns the value associated with "key" or NULL if "key" wasn't found. Note that there is no way to distinguish between failure to find "key" and a valid value of NULL associated with "key".

Implemented in dictionary< keytype, valuetype >.

◆ getValue() [2/2]

template<class keytype , class valuetype >
virtual bool dictionarycollection< keytype, valuetype >::getValue ( keytype key,
valuetype * value )
pure virtual

Sets "value" to the value associated with "key". Returns true on success or false if "key" wasn't found.

Implemented in dictionary< keytype, valuetype >.

◆ remove()

template<class keytype , class valuetype >
virtual bool dictionarycollection< keytype, valuetype >::remove ( keytype key)
pure virtual

Removes the key-value pair associated with "key". Returns true on success or false if "key" wasn't found.

Implemented in dictionary< keytype, valuetype >.

◆ setValue()

template<class keytype , class valuetype >
virtual void dictionarycollection< keytype, valuetype >::setValue ( keytype key,
valuetype value )
pure virtual

Sets the value associated with "key" to "value". If "key" already exists, the value currently accociated with it is replaced with "value".

Implemented in dictionary< keytype, valuetype >.

◆ setValues() [1/4]

template<class keytype , class valuetype >
virtual void dictionarycollection< keytype, valuetype >::setValues ( keytype * key,
valuetype * value )
pure virtual

Sets the value associated with each key in the "keys" array to the corresponding value in the "values" array. Assumes that keys is NULL terminated. If "key" already exists, the value currently accociated with it is replaced with "value".

Implemented in dictionary< keytype, valuetype >.

◆ setValues() [2/4]

template<class keytype , class valuetype >
virtual void dictionarycollection< keytype, valuetype >::setValues ( keytype * key,
valuetype * value,
uint64_t count )
pure virtual

Sets the value associated with each of "count" keys in the "keys" array to the corresponding value in the "values" array. If "key" already exists, the value currently accociated with it is replaced with "value".

Implemented in dictionary< keytype, valuetype >.

◆ setValues() [3/4]

template<class keytype , class valuetype >
virtual void dictionarycollection< keytype, valuetype >::setValues ( keytype const * key,
valuetype const * value )
pure virtual

Sets the value associated with each key in the "keys" array to the corresponding value in the "values" array. Assumes that keys is NULL terminated. If "key" already exists, the value currently accociated with it is replaced with "value".

Implemented in dictionary< keytype, valuetype >.

◆ setValues() [4/4]

template<class keytype , class valuetype >
virtual void dictionarycollection< keytype, valuetype >::setValues ( keytype const * key,
valuetype const * value,
uint64_t count )
pure virtual

Sets the value associated with each of "count" keys in the "keys" array to the corresponding value in the "values" array. If "key" already exists, the value currently accociated with it is replaced with "value".

Implemented in dictionary< keytype, valuetype >.

◆ write() [1/2]

template<class keytype , class valuetype >
ssize_t dictionarycollection< keytype, valuetype >::write ( )
inlinevirtual

Writes a representation of the dictionarycollection to standard output.

Implements collection.

◆ write() [2/2]

template<class keytype , class valuetype >
ssize_t dictionarycollection< keytype, valuetype >::write ( output * out)
inlinevirtual

Writes a representation of the dictionarycollection to "out".

Implements collection.

◆ writeJson() [1/4]

template<class keytype , class valuetype >
ssize_t dictionarycollection< keytype, valuetype >::writeJson ( )
inlinevirtual

Writes a JSON representation of the dictionarycollection to standard output.

Implements collection.

◆ writeJson() [2/4]

template<class keytype , class valuetype >
ssize_t dictionarycollection< keytype, valuetype >::writeJson ( bool indent)
inlinevirtual

Writes a JSON representation of the dictionarycollection to standard output.

If "indent" is true, then the output is automatically indented. If "indent" is false, then the tree is written without indentation.

Implements collection.

◆ writeJson() [3/4]

template<class keytype , class valuetype >
ssize_t dictionarycollection< keytype, valuetype >::writeJson ( output * out)
inlinevirtual

Writes a JSON representation of the dictionarycollection to "out".

Implements collection.

◆ writeJson() [4/4]

template<class keytype , class valuetype >
ssize_t dictionarycollection< keytype, valuetype >::writeJson ( output * out,
bool indent )
inlinevirtual

Writes a JSON representation of the dictionarycollection to "out".

If "indent" is true, then the output is automatically indented. If "indent" is false, then the tree is written without indentation.

Implements collection.