|
FreeNOS
|
Associatives are containers that provide a mapping of keys to values. More...
#include <Associative.h>
Public Member Functions | |
| virtual bool | insert (const K &key, const V &item) |
| Inserts the given item to the Assocation. More... | |
| virtual bool | append (const K &key, const V &item) |
| Append the given item to the Association. More... | |
| virtual int | remove (const K &key) |
| Removes all items associated with the given key. More... | |
| virtual void | clear () |
| Removes all items from the Association. More... | |
| virtual List< K > | keys () const =0 |
| Retrieve all keys inside the Association. More... | |
| virtual List< K > | keys (const V &value) const =0 |
| Retrieve list of Keys for the given value. More... | |
| virtual bool | contains (const K &key) const |
| Check if the given key exists. More... | |
| virtual List< V > | values () const =0 |
| Retrieve all values inside the Association. More... | |
| virtual List< V > | values (const K &key) const =0 |
| Retrieve values for the given key inside the Association. More... | |
| virtual const V * | get (const K &key) const =0 |
| Returns the first value for the given key. More... | |
| virtual const V & | at (const K &key) const =0 |
| Returns a reference to the first value for the given key. More... | |
| virtual const V | value (const K &key, const V defaultValue=V()) const =0 |
| Return the first value for the given key. More... | |
| virtual int | compareTo (const Associative< K, V > &a) const |
| Compare this instance to another instance. More... | |
| virtual bool | equals (const Associative< K, V > &a) const |
| Test if an Associative is equal to an other Associative. More... | |
| const V & | operator[] (K key) const |
| Returns the first value for the given key. More... | |
Public Member Functions inherited from Container | |
| Container () | |
| Constructor. More... | |
| virtual | ~Container () |
| Destructor. More... | |
| virtual Size | size () const =0 |
| Returns the maximum size of this Container. More... | |
| virtual Size | count () const =0 |
| Returns the number of items inside the Container. More... | |
| virtual bool | isEmpty () const |
| Check if the Container is empty. More... | |
| virtual bool | reserve (Size size) |
| Ensure that at least the given size is available. More... | |
| virtual bool | shrink (Size size) |
| Shrink the container size by the given amount of items. More... | |
| virtual Size | squeeze () |
| Try to minimize the memory required in the Container. More... | |
| virtual bool | resize (Size size) |
| Change the size of the Container. More... | |
Public Member Functions inherited from Comparable< Associative< K, V > > | |
| virtual | ~Comparable () |
| Class destructor. More... | |
Associatives are containers that provide a mapping of keys to values.
Definition at line 39 of file Associative.h.
|
inlinevirtual |
Append the given item to the Association.
| key | The key of the item to insert |
| item | The item to insert |
Reimplemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, FileCache * >, HashTable< String, Argument * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< ProcessID, Channel * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
Definition at line 66 of file Associative.h.
|
pure virtual |
Returns a reference to the first value for the given key.
This function assumes the key exists.
| key | Key to find. |
Implemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, Argument * >, HashTable< String, FileCache * >, HashTable< ProcessID, Channel * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
Referenced by Associative< String, FileCache * >::operator[]().
|
inlinevirtual |
Removes all items from the Association.
Implements Container.
Definition at line 86 of file Associative.h.
|
inlinevirtual |
Compare this instance to another instance.
| a | Other instance to compare to |
Implements Comparable< Associative< K, V > >.
Definition at line 169 of file Associative.h.
Referenced by Associative< String, FileCache * >::equals().
|
inlinevirtual |
Check if the given key exists.
Definition at line 111 of file Associative.h.
Referenced by FileSystemServer::findFileCache(), LinnFileSystem::getInode(), and FileSystemServer::lookupFile().
|
inlinevirtual |
Test if an Associative is equal to an other Associative.
| a | Associative instance. |
Implements Comparable< Associative< K, V > >.
Definition at line 198 of file Associative.h.
|
pure virtual |
Returns the first value for the given key.
| key | Key to find. |
Implemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, Argument * >, HashTable< String, FileCache * >, HashTable< ProcessID, Channel * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
|
inlinevirtual |
Inserts the given item to the Assocation.
If an item exists for the given key, its value will be replaced.
| key | The key of the item to insert |
| item | The item to insert |
Reimplemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, FileCache * >, HashTable< String, Argument * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< ProcessID, Channel * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
Definition at line 53 of file Associative.h.
|
pure virtual |
Retrieve all keys inside the Association.
Implemented in HashTable< K, V >, HashTable< u32, LinnInode * >, HashTable< IPV4::Address, ARP::ARPCache * >, HashTable< u32, File * >, HashTable< String, ShellCommand * >, HashTable< u16, UDPSocket * >, HashTable< ProcessID, Channel * >, HashTable< String, Argument * >, HashTable< ProcessID, HashTable< String, Address > * >, and HashTable< String, FileCache * >.
Referenced by Associative< String, FileCache * >::clear().
|
pure virtual |
Retrieve list of Keys for the given value.
Implemented in HashTable< K, V >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< u32, LinnInode * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< String, FileCache * >, HashTable< u32, File * >, HashTable< ProcessID, Channel * >, HashTable< IPV4::Address, ARP::ARPCache * >, and HashTable< String, Argument * >.
|
inline |
Returns the first value for the given key.
If there are multiple values for the key, the first value is returned.
| key | The key of the item to return. |
Definition at line 213 of file Associative.h.
|
inlinevirtual |
Removes all items associated with the given key.
| key | The key to remove items for. |
Reimplemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, Argument * >, HashTable< String, FileCache * >, HashTable< ProcessID, Channel * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
Definition at line 78 of file Associative.h.
Referenced by Associative< String, FileCache * >::clear().
|
pure virtual |
Return the first value for the given key.
If the key is not found, the default value is returned.
| key | Key to find value for |
| defaultValue | Return this default value if not found |
Implemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, FileCache * >, HashTable< String, Argument * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< ProcessID, Channel * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
|
pure virtual |
Retrieve all values inside the Association.
Implemented in HashTable< K, V >, HashTable< u32, LinnInode * >, HashTable< IPV4::Address, ARP::ARPCache * >, HashTable< u32, File * >, HashTable< String, ShellCommand * >, HashTable< u16, UDPSocket * >, HashTable< ProcessID, Channel * >, HashTable< String, Argument * >, HashTable< ProcessID, HashTable< String, Address > * >, and HashTable< String, FileCache * >.
Referenced by Associative< String, FileCache * >::compareTo(), and Associative< String, FileCache * >::contains().
|
pure virtual |
Retrieve values for the given key inside the Association.
Implemented in HashTable< u32, LinnInode * >, HashTable< u32, File * >, HashTable< u16, UDPSocket * >, HashTable< String, ShellCommand * >, HashTable< String, Argument * >, HashTable< String, FileCache * >, HashTable< ProcessID, Channel * >, HashTable< ProcessID, HashTable< String, Address > * >, HashTable< K, V >, and HashTable< IPV4::Address, ARP::ARPCache * >.
1.8.17