Purpose:
|
Defines a wrapper for
ENTITY_LIST that is an
ENTITY, with full support for save/restore and rollback.
|
|
Derivation:
|
EE_LIST : ENTITY : ACIS_OBJECT : -
|
|
SAT Identifier:
|
"eelist"
|
|
Filename:
|
kern/kernel/kerndata/lists/eelists.hxx
|
|
Description:
|
A wrapper for
ENTITY_LIST that is an
ENTITY, with full support for save/restore and rollback. We do this for
ENTITY_LIST specifically and not for
VOID_LIST because save/restore and rollback of arbitrary types is too hard.
|
|
|
For best performance in loops that step through this list, have the loops increment rather than decrement the index counter. Internal operations for methods like
operator[] and
remove store the index counter from the previous operation allowing faster access to the next indexed item when indexing up.
|
|
References:
|
KERN
|
ENTITY, ENTITY_LIST
|
|
by KERN
|
ENTITY_LIST
|
|
Constructor:
|
public: EE_LIST::EE_LIST
(
|
|
|
logical oe
|
// flag for output entity
|
|
|
|
= TRUE
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments. Applications should call this constructor only with the overloaded
new operator, because this reserves the memory on the heap, a requirement to support roll back and history management.
|
|
|
|
|
|
|
public: EE_LIST::EE_LIST
(
|
|
|
ENTITY* owner,
|
// pointer to owner
|
|
|
logical oe
|
// flag for output entity
|
|
|
|
= TRUE
|
|
|
);
|
|
|
C++ initialize constructor requests memory for this object and populates it with the data supplied as arguments.
|
|
|
|
|
Destructor:
|
public: virtual void EE_LIST::lose
();
|
|
|
Posts a delete bulletin to the bulletin board indicating the instance is no longer used in the active model. The
lose methods for attached attributes are also called.
|
|
|
|
|
|
|
protected: virtual EE_LIST::~EE_LIST
();
|
|
|
This
C++ destructor should never be called directly. Instead, applications should use the overloaded
lose method inherited from the
ENTITY class, because this supports history management. (For example,
x=new EE_LIST(...) then later
x->lose.)
|
|
|
|
Methods:
|
public: int EE_LIST::add
(
|
|
|
ENTITY*
|
// entity to add
|
|
|
);
|
|
|
Adds an entity to the
EE_LIST if not already there. It always returns the index.
|
|
|
|
|
|
|
public: void EE_LIST::add
();
|
|
|
virtual void ENTITY::add() is hidden by
add(ENTITY*). Expose it again by defining a pass through here.
|
|
|
|
|
|
|
public: void EE_LIST::clear
();
|
|
|
Empties a list ready for construction of a new one.
|
|
|
|
|
|
|
public: int EE_LIST::count
() const;
|
|
|
Returns the number of entities in the list.
|
|
|
|
|
|
|
public: virtual void EE_LIST::debug_ent
(
|
|
|
FILE*
|
// output file pointer
|
|
|
) const;
|
|
|
Outputs the entity debug information to the specified file.
|
|
|
|
|
|
|
public: virtual logical EE_LIST::deletable
() const;
|
|
|
Returns whether or not the list can be deleted.
|
|
|
|
|
|
|
public: virtual int EE_LIST::identity
(
|
|
|
int
|
|
// level
|
|
|
|
= 0
|
|
|
) const;
|
|
|
If
level is unspecified or 0, returns the type identifier
ATTRIB_SYS_TYPE. If
level is specified, returns
ATTRIB_SYS_TYPE for that level of derivation from
ENTITY. The level of this class is defined as
ATTRIB_SYS_LEVEL.
|
|
|
|
|
|
|
public: void EE_LIST::init
() const;
|
|
|
Returns entities in list order, ignoring deleted items. Call
init once, then
next repeatedly until it returns
NULL. Note that
next returns the undeleted item most closely following the one most recently returned by
next or
operator[], except that if that value was NULL the value of
next is undefined.
|
|
|
|
|
|
|
public: virtual logical EE_LIST::is_deepcopyable
(
|
|
|
) const;
|
|
|
Returns
TRUE if this can be deep copied.
|
|
|
|
|
|
|
public: int EE_LIST::iteration_count
() const;
|
|
|
Counts how many entities there are in the list not including deleted entries. Uses the iterator.
|
|
|
|
|
|
|
public: ENTITY* EE_LIST::next
() const;
|
|
|
Returns entities in list order, ignoring deleted items. Call
init once, then
next repeatedly until it returns
NULL. Note that
next returns the undeleted item most closely following the one most recently returned by
next or
operator[], except that if that value was NULL the value of
next is undefined.
|
|
|
|
|
|
|
public: ENTITY* EE_LIST::next_from
(
|
|
|
int& i,
|
// index
|
|
|
);
|
|
|
Returns the next non-deleted entry after the index given without affecting the member variables used by
init and
next. This allows clients to create iterators that can be multiply instantiated and which run independently of each other. This is accomplished simply by giving the user the appropriate variables to save themselves.
|
|
|
|
|
|
|
public: ENTITY* EE_LIST::operator[]
(
|
|
|
int i
|
// index into list
|
|
|
) const;
|
|
|
Returns the indexed entity,
NULL if the index is out of range, or
LIST_ENTRY_DELETED if the indexed entry has been deleted.
|
|
|
|
|
|
|
public: virtual ENTITY* EE_LIST::owner
() const;
|
|
|
If this list is "owned" by another, this provides a back pointer to it.
|
|
|
|
|
|
|
public: int EE_LIST::remove
(
|
|
|
ENTITY const*
|
// entity to remove
|
|
|
);
|
|
|
Deletes an entity from the list. This does not free space and leaves a tombstone in the linear list which
count and
operator[] will notice. But,
lookup will not find this entity, nor will
init or
next. The return value is the
lookup value of the old entry.
|
|
|
|
|
|
|
public: void EE_LIST::remove
(
|
|
|
int i
|
// index value
|
|
|
);
|
|
|
virtual void ENTITY::remove(int) is hidden by remove(ENTITY const*). Expose it again by defining a pass through here.
|
|
|
|
|
|
|
public: int EE_LIST::remove_index
(
|
|
|
int
|
|
// index value
|
|
|
);
|
|
|
Deletes an entity from the list. This is another removal method that is more efficient if the entity's index value is already known.
|
|
|
|
|
|
|
public: void EE_LIST::restore_common
();
|
|
|
The
RESTORE_DEF macro expands to the
restore_common method, which is used in reading information from a SAT file. This method is never called directly. It is called by a higher hierarchical function if an item in the SAT file is determined to be of this class type. An instance of this class will already have been created through the allocation constructor. This method then populates the class instance with the appropriate data from the SAT file.
|
|
|
if ( restore_version_number >= EELIST_OWNER_VERSION) {
|
|
|
set_owner( read_ptr() );
|
// owner
|
|
|
read_logical
|
// own entries or not
|
|
read_int
|
// count of entities
|
|
while(i < count){
|
// for each entity
|
|
|
read_ptr
|
// entity pointer
|
|
if ( restore_version_number < EELIST_OWNER_VERSION) {
|
|
|
read_int
|
// count of items to add
|
|
|
for(i = 0; i < count; i++) {
|
// for each item
|
|
|
|
read_ptr
|
// add to list
|
|
|
read_int
|
// count of items to remove
|
|
|
for(i = 0; i < count; i++) {
|
// for each item
|
|
|
|
|
|
|
read_ptr
|
|
// remove from list
|
|
|
|
|
|
|
public: void EE_LIST::set_owner
(
|
|
|
ENTITY* o
|
// owning entity
|
|
|
);
|
|
|
Specifies the owning entity for this list.
|
|
|
|
|
|
|
public: virtual const char*
|
|
|
EE_LIST::type_name () const;
|
|
|
Returns the string "eelist".
|
|
Internal Use:
|
save, save_common, full_size
|
|
|
|
|
Related Fncs:
|
is_EE_LIST
|