#include <amorph.h>


Public Member Functions | |
| amorph (int elements=0) | |
| constructs an amorph capable of holding "elements" pointers. | |
| ~amorph () | |
| int | elements () const |
| the maximum number of elements currently allowed in this amorph. | |
| int | valid_fields () const |
| Returns the number of fields that have non-NIL contents. | |
| void | adjust (int new_max) |
| Changes the maximum number of elements for this amorph. | |
| void | reset (int new_maximum=0) |
| like adjust but doesn't keep existing contents. | |
| basis::outcome | put (int field, const contents *data) |
| Enters an object into the field at index "field" in the amorph. | |
| basis::outcome | append (const contents *data) |
| puts "data" on the end of this amorph. | |
| basis::outcome | operator+= (const contents *data) |
| a synonym for append. | |
| const contents * | get (int field) const |
| Returns a constant pointer to the information at the index "field". | |
| contents * | borrow (int field) |
| Returns a pointer to the information at the index "field". | |
| const contents * | operator[] (int field) const |
| synonym for get. | |
| contents * | operator[] (int field) |
| synonym for borrow. | |
| contents * | acquire (int field) |
| Retrieves a "field" from the amorph, taking responsibility for it back. | |
| basis::outcome | clear (int field) |
| Clears the contents of the field specified. | |
| void | clear_all () |
| Clears every field in the amorph. | |
| basis::outcome | zap (int start, int end) |
| Removes a range of indices from the amorph. | |
| basis::outcome | insert (int position, int lines_to_add) |
| Adds "lines_to_add" indices to the amorph at the index "position". | |
| int | find_empty (basis::outcome &o) const |
| Returns the index of a free field if there are any. | |
| const contents * | next_valid (int &field) const |
| Returns the contents of the next valid element at or after "field". | |
| int | find (const contents *to_locate, basis::outcome &o) |
| Searches the amorph for the contents specified. | |
| void | swap_contents (amorph< contents > &other) |
| Exchanges the contents of "this" and "other". | |
Definition at line 22 of file amorph.h.
| structures::amorph< contents >::amorph | ( | int | elements = 0 |
) | [inline] |
| structures::amorph< contents >::~amorph | ( | ) | [inline] |
| contents * structures::amorph< contents >::acquire | ( | int | field | ) | [inline] |
Retrieves a "field" from the amorph, taking responsibility for it back.
This function is similar to get, except that the contents are pulled out of the amorph. The contents will no longer be destroyed when the amorph is destroyed. To store the modified contents again, use put, and then the amorph will take over management of the contents again. Note that the index is not zapped with this function; the acquired "field" will simply hold a null pointer.
Definition at line 380 of file amorph.h.
References AMO_ALERT, CHECK_FIELDS, structures::amorph< contents >::elements(), and FUNCDEF.
| void structures::amorph< contents >::adjust | ( | int | new_max | ) | [inline] |
Changes the maximum number of elements for this amorph.
If the new number is smaller than the original, then the fields at index "new_maximum" and upwards are thrown away. existing fields are kept.
Definition at line 282 of file amorph.h.
References CHECK_FIELDS, structures::amorph< contents >::clear_all(), and FUNCDEF.
| basis::outcome structures::amorph< contents >::append | ( | const contents * | data | ) | [inline] |
puts "data" on the end of this amorph.
adds an element to the end of the amorph by increasing the amorph size (with "adjust") and putting the element into the new spot (with "put").
Definition at line 264 of file amorph.h.
References NIL.
Referenced by octopi::entity_data_bin::acquire_for_entity().
| contents * structures::amorph< contents >::borrow | ( | int | field | ) | [inline] |
Returns a pointer to the information at the index "field".
Also returns NIL for invalid indexes. DO NOT destroy the returned pointer; it is still owned by the amorph.
Definition at line 409 of file amorph.h.
References CHECK_FIELDS, FUNCDEF, NIL, and structures::amorph< contents >::put().
Referenced by synchronic::list_manager::clean(), and synchronic::list_manager::update().
| basis::outcome structures::amorph< contents >::clear | ( | int | field | ) | [inline] |
| void structures::amorph< contents >::clear_all | ( | ) | [inline] |
Clears every field in the amorph.
Definition at line 256 of file amorph.h.
References CHECK_FIELDS, and FUNCDEF.
Referenced by structures::amorph< contents >::adjust().
| int structures::amorph< contents >::elements | ( | ) | const [inline] |
the maximum number of elements currently allowed in this amorph.
Definition at line 26 of file amorph.h.
Referenced by structures::amorph< contents >::acquire(), structures::amorph_assign(), filesystem::heavy_file_operations::buffer_files(), synchronic::list_manager::clean(), filesystem::directory_tree::compare_trees(), synchronic::list_manager::entries(), structures::amorph< contents >::find(), filesystem::filename_list::operator=(), cromp::cromp_common::pack_and_ship(), synchronic::list_manager::reset(), synchronic::list_manager::retrieve(), and structures::amorph< contents >::zap().
| int structures::amorph< contents >::find | ( | const contents * | to_locate, | |
| basis::outcome & | o | |||
| ) | [inline] |
Searches the amorph for the contents specified.
Since only pointers to the contents are maintained, the search is based on finding a pointer in the amorph that is identical to "to_locate". if "o" is OKAY, then the index of the entry is returned. If "o" is NOT_FOUND, then the contents are not present.
Definition at line 393 of file amorph.h.
References bounds_return, CHECK_FIELDS, structures::amorph< contents >::elements(), FUNCDEF, structures::amorph< contents >::get(), and NIL.
| int structures::amorph< contents >::find_empty | ( | basis::outcome & | o | ) | const [inline] |
| const contents * structures::amorph< contents >::get | ( | int | field | ) | const [inline] |
Returns a constant pointer to the information at the index "field".
If no information is stored or the field is out range, then NIL is returned.
Reimplemented from basis::array< contents * >.
Definition at line 273 of file amorph.h.
Referenced by structures::amorph_assign(), filesystem::heavy_file_operations::buffer_files(), synchronic::list_manager::clone_object(), structures::amorph< contents >::find(), filesystem::filename_list::operator=(), and synchronic::list_manager::retrieve().
| basis::outcome structures::amorph< contents >::insert | ( | int | position, | |
| int | lines_to_add | |||
| ) | [inline] |
Adds "lines_to_add" indices to the amorph at the index "position".
If "lines_to_add" is non-positive, the request is ignored. Inserting at a position beyond the bounds of the array is ignored, but a position AT elements() is allowed (it is an append...).
Reimplemented from basis::array< contents * >.
| const contents * structures::amorph< contents >::next_valid | ( | int & | field | ) | const [inline] |
| basis::outcome structures::amorph< contents >::operator+= | ( | const contents * | data | ) | [inline] |
| contents* structures::amorph< contents >::operator[] | ( | int | field | ) | [inline] |
synonym for borrow.
Reimplemented from basis::array< contents * >.
| const contents* structures::amorph< contents >::operator[] | ( | int | field | ) | const [inline] |
synonym for get.
Reimplemented from basis::array< contents * >.
| basis::outcome structures::amorph< contents >::put | ( | int | field, | |
| const contents * | data | |||
| ) | [inline] |
Enters an object into the field at index "field" in the amorph.
If "data" is NIL, then the field is cleared. The amorph considers the pointer "data" to be its own property after put is invoked; "data" should not be destructed since the amorph will automatically do so. This restriction does not hold if the object is checked back out of the amorph with acquire().
Definition at line 331 of file amorph.h.
Referenced by structures::amorph< contents >::borrow().
| void structures::amorph< contents >::reset | ( | int | new_maximum = 0 |
) | [inline] |
like adjust but doesn't keep existing contents.
Definition at line 247 of file amorph.h.
References CHECK_FIELDS, and FUNCDEF.
Referenced by octopi::entity_data_bin::acquire_for_entity(), filesystem::directory_tree::compare_trees(), filesystem::directory_tree::current(), octopi::octopus::expunge(), octopi::file_transfer_tentacle::get_differences(), synchronic::list_manager::retrieve(), and filesystem::filename_tree::~filename_tree().
| void structures::amorph< contents >::swap_contents | ( | amorph< contents > & | other | ) | [inline] |
| int structures::amorph< contents >::valid_fields | ( | ) | const [inline] |
| basis::outcome structures::amorph< contents >::zap | ( | int | start, | |
| int | end | |||
| ) | [inline] |
Removes a range of indices from the amorph.
This does not just clear the field associated with the specified index as "clear" does, it actually changes the number of total elements by removing the indices from the amorph. The new amorph contains the old elements up to just before the "start" and from the "end" + 1 through the end of the amorph. AMORPH_BAD_INDEX is returned if either index is out of range. If the zap succeeds, then AMORPH_OKAY is returned, even if the "end" is less than the "start".
Reimplemented from basis::array< contents * >.
Definition at line 318 of file amorph.h.
References CHECK_FIELDS, structures::amorph< contents >::elements(), and FUNCDEF.
Referenced by synchronic::list_manager::clean(), filesystem::directory_tree::remove_path(), synchronic::list_manager::reset(), and synchronic::list_manager::zap().
1.6.3