#include <dictionary.hpp>
Type T can be any type; type I must implement '<', '>' and '=='.
Currently implemented by means of a simple unbalanced binary tree.
Definition at line 65 of file dictionary.hpp.
Public Member Functions | |
dictionary (const dictionary &) | |
dictionary () | |
virtual bool | is_empty () const |
Returns true if the collection is empty. | |
dictionary & | operator= (const dictionary &) |
T & | operator[] (const I &index) |
const T & | operator[] (const I &index) const |
virtual | ~dictionary () |
Other Useful Functions | |
virtual void | append (const iterable< T, IBase > &) |
Append all members of a collection to this one. | |
virtual iterator | find_value (const T &) |
virtual const_iterator | find_value (const T &) const |
A generic find function that iterates over the collection to find a particular value. | |
Iterable Implementation | |
virtual void | append (const T &item) |
Add an item to the end of the collection. | |
virtual void | insert (const iterator &i, const T &item) |
Insert an item before the one specified by the iterator. | |
virtual void | remove (const iterator &i) |
Remove the item specified by the iterator. | |
Countable Implementation | |
virtual void | clear () |
Clears the contents of the collection. | |
virtual gsgl::index_t | size () |
Indexable Implementation | |
virtual bool | contains_index (const I &index) const |
virtual T & | item (const I &index) |
virtual const T & | item (const I &index) const |
Iterators | |
iterator | iter () |
const_iterator | iter () const |
Dictionary Functionality | |
bool | operator== (const dictionary< T, I > &) const |
virtual void | remove (const I &index) |
Countable Implementation | |
virtual gsgl::index_t | size () const |
A generic count function that iterates over the collection. | |
Private Member Functions | |
dict_node * | find_node (const I &index, dict_node ***link) |
T & | get_item (const I &index, bool create_new=true) |
void | remove_node (dict_node *cur, dict_node **link) |
Private Attributes | |
gsgl::index_t | count |
dict_node * | root |
Classes | |
struct | dict_node |
dictionary | ( | ) | [inline] |
Definition at line 162 of file dictionary.hpp.
dictionary | ( | const dictionary< T, I > & | d | ) | [inline] |
Definition at line 170 of file dictionary.hpp.
References dictionary::dict_node::copy(), and dictionary::root.
~dictionary | ( | ) | [inline, virtual] |
void append | ( | const T & | ) | [inline, virtual] |
Add an item to the end of the collection.
Implements iterable.
Definition at line 225 of file dictionary.hpp.
void clear | ( | ) | [inline, virtual] |
Clears the contents of the collection.
Implements countable.
Definition at line 216 of file dictionary.hpp.
References dictionary::count, and dictionary::root.
Referenced by dictionary::operator=(), cache::~cache(), and dictionary::~dictionary().
bool contains_index | ( | const I & | index | ) | const [inline, virtual] |
Implements indexable.
Definition at line 271 of file dictionary.hpp.
References dictionary::find_node(), and dictionary::root.
Referenced by cache::contains_index(), gsgl::data::global_register_resource_aux(), and gsgl::data::global_unregister_resource_aux().
dictionary< T, I >::dict_node * find_node | ( | const I & | index, | |
dict_node *** | link | |||
) | [inline, private] |
Definition at line 321 of file dictionary.hpp.
References dictionary::dict_node::index, dictionary::dict_node::left, and dictionary::dict_node::right.
Referenced by dictionary::contains_index(), dictionary::get_item(), and dictionary::remove().
iterable< T, IBase >::const_iterator find_value | ( | const T & | item | ) | const [inline, virtual, inherited] |
A generic find function that iterates over the collection to find a particular value.
Definition at line 153 of file iterable.hpp.
References iterable::const_iterator::is_valid().
Referenced by gsgl::data::global_unregister_resource_aux().
T & get_item | ( | const I & | index, | |
bool | create_new = true | |||
) | [inline, private] |
Definition at line 297 of file dictionary.hpp.
References assert, dictionary::count, dictionary::find_node(), dictionary::dict_node::item, and dictionary::root.
Referenced by dictionary::item().
void insert | ( | const iterator & | , | |
const T & | ||||
) | [inline, virtual] |
Insert an item before the one specified by the iterator.
Implements iterable.
Definition at line 232 of file dictionary.hpp.
virtual bool is_empty | ( | ) | const [inline, virtual, inherited] |
Returns true if the collection is empty.
Definition at line 59 of file countable.hpp.
Referenced by application::application(), broker_creator::broker_creator(), config_variable< gsgl::platform::color >::config_variable(), file::file(), font_impl::font_impl(), config_record::from_stream(), application::get_config_overrides(), node::get_name(), brokered_object::get_type_name(), event_map::load_keyboard_events(), application::load_scenery(), model_part::model_part(), package::package(), physics_frame::physics_frame(), solar_system::solar_system(), stellar_db::stellar_db(), and vehicle::vehicle().
T & item | ( | const I & | index | ) | [inline, virtual] |
Implements indexable.
Definition at line 288 of file dictionary.hpp.
References dictionary::get_item().
const T & item | ( | const I & | index | ) | const [inline, virtual] |
Implements indexable.
Definition at line 281 of file dictionary.hpp.
References dictionary::get_item().
iterator iter | ( | ) | [inline, inherited] |
Definition at line 101 of file iterable.hpp.
const_iterator iter | ( | ) | const [inline, inherited] |
Definition at line 100 of file iterable.hpp.
Referenced by config_variable::assign_from_string(), treebox::clear_tree_nodes(), keplerian_element_propagator::get_array(), config_record::get_child(), satellite_element_propagator::get_elements(), application::load_scenery(), list::operator==(), dictionary::operator==(), config_record::override_with(), vector::parse(), transform::parse(), application::remove_viewpoint_nodes(), config_record::to_stream(), vector::vector(), application::~application(), and cache::~cache().
dictionary< T, I > & operator= | ( | const dictionary< T, I > & | d | ) | [inline] |
Definition at line 180 of file dictionary.hpp.
References dictionary::clear(), dictionary::dict_node::copy(), dictionary::count, and dictionary::root.
bool operator== | ( | const dictionary< T, I > & | d | ) | const [inline] |
Definition at line 198 of file dictionary.hpp.
References iterable::const_iterator::is_valid(), and iterable::iter().
T& operator[] | ( | const I & | index | ) | [inline, inherited] |
Definition at line 58 of file indexable.hpp.
const T& operator[] | ( | const I & | index | ) | const [inline, inherited] |
Definition at line 57 of file indexable.hpp.
void remove | ( | const I & | index | ) | [inline, virtual] |
Definition at line 248 of file dictionary.hpp.
References dictionary::find_node(), dictionary::remove_node(), and dictionary::root.
void remove | ( | const iterator & | ) | [inline, virtual] |
Remove the item specified by the iterator.
Implements iterable.
Definition at line 239 of file dictionary.hpp.
Referenced by gsgl::data::global_unregister_resource_aux().
Definition at line 348 of file dictionary.hpp.
References assert, dictionary::count, dictionary::dict_node::index, dictionary::dict_node::item, dictionary::dict_node::left, and dictionary::dict_node::right.
Referenced by dictionary::remove().
gsgl::index_t size | ( | ) | const [inline, virtual, inherited] |
A generic count function that iterates over the collection.
Implements countable.
Reimplemented in simple_array, list, pqueue, string, simple_array< gsgl::string * >, simple_array< gsgl::platform::buffer_pool::bucket * >, simple_array< gsgl::framework::treebox_node * >, simple_array< float >, simple_array< gsgl::scenegraph::model_part * >, simple_array< unsigned int >, simple_array< gsgl::framework::widget * >, simple_array< gsgl::scenegraph::light * >, simple_array< gsgl::physics::vehicle_module * >, simple_array< unsigned char >, simple_array< gsgl::scenegraph::model * >, simple_array< wchar_t >, simple_array< gsgl::scenegraph::node * >, simple_array< char >, simple_array< gsgl::scenegraph::submesh * >, simple_array< gsgl::data::pair * >, simple_array< I >, simple_array< gsgl::platform::buffer_pool::object_record >, simple_array< gsgl::data::dictionary< T, I >::dict_node * >, list< gsgl::framework::treebox_node * >, list< gsgl::data::log_target * >, list< gsgl::io::file >, list< gsgl::string >, list< gsgl::framework::pkg_scenery * >, list< gsgl::platform::shader_base * >, list< gsgl::framework::pkg_library * >, list< gsgl::data::config_record >, list< gsgl::data_object * >, list< gsgl::io::directory >, list< gsgl::scenegraph::node * >, list< gsgl::platform::vertex_buffer * >, list< gsgl::framework::tabbox::tab_rec >, list< gsgl::framework::pkg_vehicle * >, list< gsgl::framework::package * >, pqueue< gsgl::scenegraph::light *, float >, and pqueue< gsgl::scenegraph::node *, float >.
Definition at line 135 of file iterable.hpp.
virtual gsgl::index_t size | ( | ) | [inline, virtual] |
Definition at line 98 of file dictionary.hpp.
gsgl::index_t count [private] |
Definition at line 88 of file dictionary.hpp.
Referenced by dictionary::clear(), dictionary::get_item(), dictionary::operator=(), dictionary::remove_node(), and dictionary< float, wchar_t >::size().
Definition at line 87 of file dictionary.hpp.
Referenced by dictionary::clear(), dictionary::contains_index(), dictionary::dictionary(), dictionary::get_item(), dictionary::operator=(), and dictionary::remove().