BWAPI
|
Holds a set of moving points and creates notifications when changes occur. More...
#include <Active_objects_vector.h>
Classes | |
struct | Get_key |
struct | Is_ok |
Public Types | |
typedef CGAL::Label< Value_t > | Key |
typedef Value_t | Data |
typedef CGAL::Filter_iterator < typename Storage::const_iterator, Is_ok > | Fiterator |
An iterator to iterate through all the keys. | |
typedef boost::transform_iterator < Get_key, Fiterator > | Key_iterator |
typedef std::vector< Key > ::const_iterator | Changed_iterator |
An iterator for iterating through changed objects. | |
typedef std::vector< Key > ::const_iterator | Inserted_iterator |
An iterator for iterating through added objects. | |
typedef std::vector< Key > ::const_iterator | Erased_iterator |
An iterator for iterating through deleted objects. | |
Public Member Functions | |
Active_objects_vector () | |
default constructor | |
~Active_objects_vector () | |
const Data & | operator[] (Key key) const |
access a point | |
const Data & | at (Key key) const |
non operator based method to access a point. | |
void | set_is_editing (bool is_e) |
Set the editing state of the object. | |
bool | is_editing () const |
return the editing state | |
void | set (Key key, const Data &new_value) |
change one point. | |
Key | insert (const Data &ob) |
Insert a new object into the table. | |
void | erase (Key key) |
Delete an object from the table. | |
void | clear () |
Clear all points. | |
Key_iterator | keys_begin () const |
Begin iterating through the keys. | |
Key_iterator | keys_end () const |
End iterating through the keys. | |
Changed_iterator | changed_begin () const |
Changed_iterator | changed_end () const |
Inserted_iterator | inserted_begin () const |
The begin iterator for new objects. | |
Inserted_iterator | inserted_end () const |
The past-end iterator for new objects. | |
Erased_iterator | erased_begin () const |
The begin iterator for deleted objects. | |
Erased_iterator | erased_end () const |
The past end iterator for deleted objects. | |
unsigned int | size () const |
The number of objects in the table. | |
std::ostream & | write (std::ostream &out) const |
std::istream & | read (std::istream &in) |
Protected Types | |
typedef Active_objects_vector < Value_t > | This |
Convenience. | |
typedef std::pair< Key, Value_t > | Storage_item |
typedef std::vector< Storage_item > | Storage |
Protected Member Functions | |
CGAL_KINETIC_MULTILISTENER1 (IS_EDITING) | |
Protected Attributes | |
Storage | storage_ |
std::vector< bool > | valid_ |
std::vector< Key > | changed_objects_ |
std::vector< Key > | deleted_objects_ |
std::vector< Key > | new_objects_ |
bool | editing_ |
int | num_valid_ |
Holds a set of moving points and creates notifications when changes occur.
This container holds a set of objects of a particular type. It creates notifications using the standard CGAL::Multi_listener interface when a primitive changes or is added or deleted. Objects which are listening for events can then ask which primitives changed.
There is one type of notification Moving_object_table::Listener_core::IS_EDITING which occurs when the editing mode is set to false.
As an optimization, the change methods can be called without setting the editing state to true, this acts as if it were set to true for that one function call.
Objects are stored in a vector. This means that access is constant time, but storage is not generally freed. The only way to be sure is to remove all reference counts for the table or to call clear().
typedef std::vector<Key>::const_iterator Active_objects_vector< Value_t >::Changed_iterator |
An iterator for iterating through changed objects.
The list of objects accessed through this iterator is only those changed in the last session.
typedef Value_t Active_objects_vector< Value_t >::Data |
typedef std::vector<Key>::const_iterator Active_objects_vector< Value_t >::Erased_iterator |
An iterator for iterating through deleted objects.
The list of objects accessed through this iterator is only those deleted in the last session.
typedef CGAL::Filter_iterator<typename Storage::const_iterator, Is_ok> Active_objects_vector< Value_t >::Fiterator |
An iterator to iterate through all the keys.
typedef std::vector<Key>::const_iterator Active_objects_vector< Value_t >::Inserted_iterator |
An iterator for iterating through added objects.
The list of objects accessed through this iterator is only those added in the last session.
typedef CGAL::Label<Value_t> Active_objects_vector< Value_t >::Key |
typedef boost::transform_iterator<Get_key, Fiterator> Active_objects_vector< Value_t >::Key_iterator |
typedef std::vector<Storage_item > Active_objects_vector< Value_t >::Storage [protected] |
typedef std::pair<Key, Value_t> Active_objects_vector< Value_t >::Storage_item [protected] |
typedef Active_objects_vector<Value_t> Active_objects_vector< Value_t >::This [protected] |
Convenience.
Reimplemented from Ref_counted< Active_objects_vector< Value_t > >.
Active_objects_vector< Value_t >::Active_objects_vector | ( | ) | [inline] |
default constructor
Active_objects_vector< Value_t >::~Active_objects_vector | ( | ) | [inline] |
const Data& Active_objects_vector< Value_t >::at | ( | Key | key | ) | const [inline] |
non operator based method to access a point.
Active_objects_vector< Value_t >::CGAL_KINETIC_MULTILISTENER1 | ( | IS_EDITING | ) | [protected] |
Changed_iterator Active_objects_vector< Value_t >::changed_begin | ( | ) | const [inline] |
Changed_iterator Active_objects_vector< Value_t >::changed_end | ( | ) | const [inline] |
void Active_objects_vector< Value_t >::clear | ( | ) | [inline] |
Clear all points.
void Active_objects_vector< Value_t >::erase | ( | Key | key | ) | [inline] |
Delete an object from the table.
The object with Key key must already be in the table.
This does not necessarily decrease the amount of storage used at all. In fact, it is unlikely to do so.
See Data_table::set_object() for an explainating of how the editing modes are used.
Erased_iterator Active_objects_vector< Value_t >::erased_begin | ( | ) | const [inline] |
The begin iterator for deleted objects.
Erased_iterator Active_objects_vector< Value_t >::erased_end | ( | ) | const [inline] |
The past end iterator for deleted objects.
Key Active_objects_vector< Value_t >::insert | ( | const Data & | ob | ) | [inline] |
Insert a new object into the table.
See Data_table::set_object() for an explainating of how the editing modes are used.
Inserted_iterator Active_objects_vector< Value_t >::inserted_begin | ( | ) | const [inline] |
Inserted_iterator Active_objects_vector< Value_t >::inserted_end | ( | ) | const [inline] |
bool Active_objects_vector< Value_t >::is_editing | ( | ) | const [inline] |
return the editing state
Key_iterator Active_objects_vector< Value_t >::keys_begin | ( | ) | const [inline] |
Begin iterating through the keys.
Key_iterator Active_objects_vector< Value_t >::keys_end | ( | ) | const [inline] |
End iterating through the keys.
const Data& Active_objects_vector< Value_t >::operator[] | ( | Key | key | ) | const [inline] |
access a point
std::istream& Active_objects_vector< Value_t >::read | ( | std::istream & | in | ) | [inline] |
void Active_objects_vector< Value_t >::set | ( | Key | key, |
const Data & | new_value | ||
) | [inline] |
change one point.
The position at the current time should not be different from the previous current position. However, at the moment I do not check this as there is no reference to time in the Data_table.
If Data_table::editing() is not true, then it is as if the calls
void Active_objects_vector< Value_t >::set_is_editing | ( | bool | is_e | ) | [inline] |
Set the editing state of the object.
A notification is sent when the editing state is set to false after it has been true, i.e. the editing session is finished. This allows changes to be batched together.
unsigned int Active_objects_vector< Value_t >::size | ( | ) | const [inline] |
std::ostream& Active_objects_vector< Value_t >::write | ( | std::ostream & | out | ) | const [inline] |
std::vector<Key> Active_objects_vector< Value_t >::changed_objects_ [protected] |
std::vector<Key> Active_objects_vector< Value_t >::deleted_objects_ [protected] |
bool Active_objects_vector< Value_t >::editing_ [protected] |
std::vector<Key> Active_objects_vector< Value_t >::new_objects_ [protected] |
int Active_objects_vector< Value_t >::num_valid_ [protected] |
Storage Active_objects_vector< Value_t >::storage_ [protected] |
std::vector<bool> Active_objects_vector< Value_t >::valid_ [protected] |