BWAPI
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes
Active_objects_vector< Value_t > Class Template Reference

Holds a set of moving points and creates notifications when changes occur. More...

#include <Active_objects_vector.h>

Inheritance diagram for Active_objects_vector< Value_t >:
Inheritance graph
[legend]
Collaboration diagram for Active_objects_vector< Value_t >:
Collaboration graph
[legend]

List of all members.

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 Dataoperator[] (Key key) const
 access a point
const Dataat (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_itemStorage

Protected Member Functions

 CGAL_KINETIC_MULTILISTENER1 (IS_EDITING)

Protected Attributes

Storage storage_
std::vector< bool > valid_
std::vector< Keychanged_objects_
std::vector< Keydeleted_objects_
std::vector< Keynew_objects_
bool editing_
int num_valid_

Detailed Description

template<class Value_t>
class Active_objects_vector< Value_t >

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().


Member Typedef Documentation

template<class Value_t>
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.

template<class Value_t>
typedef Value_t Active_objects_vector< Value_t >::Data
template<class Value_t>
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.

template<class Value_t>
typedef CGAL::Filter_iterator<typename Storage::const_iterator, Is_ok> Active_objects_vector< Value_t >::Fiterator

An iterator to iterate through all the keys.

template<class Value_t>
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.

template<class Value_t>
typedef CGAL::Label<Value_t> Active_objects_vector< Value_t >::Key
template<class Value_t>
typedef boost::transform_iterator<Get_key, Fiterator> Active_objects_vector< Value_t >::Key_iterator
template<class Value_t>
typedef std::vector<Storage_item > Active_objects_vector< Value_t >::Storage [protected]
template<class Value_t>
typedef std::pair<Key, Value_t> Active_objects_vector< Value_t >::Storage_item [protected]
template<class Value_t>
typedef Active_objects_vector<Value_t> Active_objects_vector< Value_t >::This [protected]

Convenience.

Reimplemented from Ref_counted< Active_objects_vector< Value_t > >.


Constructor & Destructor Documentation

template<class Value_t>
Active_objects_vector< Value_t >::Active_objects_vector ( ) [inline]

default constructor

template<class Value_t>
Active_objects_vector< Value_t >::~Active_objects_vector ( ) [inline]

Member Function Documentation

template<class Value_t>
const Data& Active_objects_vector< Value_t >::at ( Key  key) const [inline]

non operator based method to access a point.

Here is the call graph for this function:

template<class Value_t>
Active_objects_vector< Value_t >::CGAL_KINETIC_MULTILISTENER1 ( IS_EDITING  ) [protected]
template<class Value_t>
Changed_iterator Active_objects_vector< Value_t >::changed_begin ( ) const [inline]

Here is the caller graph for this function:

template<class Value_t>
Changed_iterator Active_objects_vector< Value_t >::changed_end ( ) const [inline]

Here is the caller graph for this function:

template<class Value_t>
void Active_objects_vector< Value_t >::clear ( ) [inline]

Clear all points.

Here is the call graph for this function:

template<class Value_t>
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.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Value_t>
Erased_iterator Active_objects_vector< Value_t >::erased_begin ( ) const [inline]

The begin iterator for deleted objects.

template<class Value_t>
Erased_iterator Active_objects_vector< Value_t >::erased_end ( ) const [inline]

The past end iterator for deleted objects.

template<class Value_t>
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.

Here is the caller graph for this function:

template<class Value_t>
Inserted_iterator Active_objects_vector< Value_t >::inserted_begin ( ) const [inline]

The begin iterator for new objects.

Here is the caller graph for this function:

template<class Value_t>
Inserted_iterator Active_objects_vector< Value_t >::inserted_end ( ) const [inline]

The past-end iterator for new objects.

Here is the caller graph for this function:

template<class Value_t>
bool Active_objects_vector< Value_t >::is_editing ( ) const [inline]

return the editing state

template<class Value_t>
Key_iterator Active_objects_vector< Value_t >::keys_begin ( ) const [inline]

Begin iterating through the keys.

Here is the caller graph for this function:

template<class Value_t>
Key_iterator Active_objects_vector< Value_t >::keys_end ( ) const [inline]

End iterating through the keys.

Here is the caller graph for this function:

template<class Value_t>
const Data& Active_objects_vector< Value_t >::operator[] ( Key  key) const [inline]

access a point

Here is the caller graph for this function:

template<class Value_t>
std::istream& Active_objects_vector< Value_t >::read ( std::istream &  in) [inline]

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Value_t>
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

  • set_editing(true)
  • set_object(key, value)
  • set_editing(false) Were made. If it is true, then no notifications are created.
Todo:
check continuity.
template<class Value_t>
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.

Here is the caller graph for this function:

template<class Value_t>
unsigned int Active_objects_vector< Value_t >::size ( ) const [inline]

The number of objects in the table.

The objects are stored in a vector, so this could be large than (additions- deletions) as non-consecutive blank objects not at the back are still counted. In general, deleting an object doesn't do much for storage, just provides notifications.

template<class Value_t>
std::ostream& Active_objects_vector< Value_t >::write ( std::ostream &  out) const [inline]

Member Data Documentation

template<class Value_t>
std::vector<Key> Active_objects_vector< Value_t >::changed_objects_ [protected]
template<class Value_t>
std::vector<Key> Active_objects_vector< Value_t >::deleted_objects_ [protected]
template<class Value_t>
bool Active_objects_vector< Value_t >::editing_ [protected]
template<class Value_t>
std::vector<Key> Active_objects_vector< Value_t >::new_objects_ [protected]
template<class Value_t>
int Active_objects_vector< Value_t >::num_valid_ [protected]
template<class Value_t>
Storage Active_objects_vector< Value_t >::storage_ [protected]
template<class Value_t>
std::vector<bool> Active_objects_vector< Value_t >::valid_ [protected]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines