vrpn 07.35
Virtual Reality Peripheral Network
|
Container for endpoints, held by pointer. More...
#include <vrpn_EndpointContainer.h>
Public Types | |
typedef vrpn_Endpoint_IP | T |
typedef T & | reference |
typedef T * | pointer |
typedef vrpn_Endpoint * | base_pointer |
typedef container_type::size_type | size_type |
typedef EndpointIterator | iterator |
typedef EndpointIterator | const_iterator |
Public Member Functions | |
EndpointContainer () | |
Constructor of empty container. | |
~EndpointContainer () | |
Destructor - includes a call to clear() | |
void | clear () |
Tells each held endpoint in turn to drop the connection then deletes it. | |
pointer | front () const |
Shorthand for get_by_index(0) | |
template<typename T > | |
T * | acquire (T *endpoint) |
Given the result of an endpoint allocator, if it's non-NULL, takes ownership of it. | |
void | compact () |
Goes through and gets rid of the NULL entries. | |
bool | full () const |
Can we no longer accommodate a new endpoint? | |
bool | is_valid (size_type i) const |
Checks to see if an index is both in-range and pointing to a still-extant object. | |
bool | destroy (base_pointer endpoint) |
Destroys the contained endpoint by address. | |
pointer | get_by_index (size_type i) const |
size_type | get_full_container_size () const |
Get size of container including NULL elements that haven't been compacted yet. | |
iterator | begin () const |
Get an iterator to the beginning that skips nulls. Invalidated by compacting. | |
iterator | end () const |
Get an iterator suitable only for testing to see if we're "done". | |
Container for endpoints, held by pointer.
To check if we have room, use this: if (d_endpoints.full()) {}
instead of the old code looking like this: if (which_end >= vrpn_MAX_ENDPOINTS)
Usage example for iteration:
Definition at line 55 of file vrpn_EndpointContainer.h.
Definition at line 60 of file vrpn_EndpointContainer.h.
Definition at line 68 of file vrpn_EndpointContainer.h.
Definition at line 67 of file vrpn_EndpointContainer.h.
typedef T* vrpn::EndpointContainer::pointer |
Definition at line 59 of file vrpn_EndpointContainer.h.
typedef T& vrpn::EndpointContainer::reference |
Definition at line 58 of file vrpn_EndpointContainer.h.
typedef container_type::size_type vrpn::EndpointContainer::size_type |
Definition at line 66 of file vrpn_EndpointContainer.h.
Definition at line 57 of file vrpn_EndpointContainer.h.
vrpn::EndpointContainer::EndpointContainer | ( | ) |
Constructor of empty container.
Definition at line 66 of file vrpn_EndpointContainer.C.
References VRPN_EC_TRACE.
vrpn::EndpointContainer::~EndpointContainer | ( | ) |
Destructor - includes a call to clear()
Definition at line 72 of file vrpn_EndpointContainer.C.
References clear(), and VRPN_EC_TRACE.
Given the result of an endpoint allocator, if it's non-NULL, takes ownership of it.
Definition at line 86 of file vrpn_EndpointContainer.h.
Referenced by vrpn_Connection_IP::connect_to_client(), vrpn_Connection_IP::server_check_for_incoming_connections(), vrpn_Connection::vrpn_Connection(), and vrpn_Connection::vrpn_Connection().
|
inline |
Get an iterator to the beginning that skips nulls. Invalidated by compacting.
Definition at line 352 of file vrpn_EndpointContainer.h.
Referenced by vrpn_Connection::connected(), vrpn_Connection::doing_okay(), vrpn_Connection_IP::mainloop(), vrpn_Connection::pack_message(), vrpn_Connection::pack_sender_description(), vrpn_Connection::pack_type_description(), vrpn_Connection::register_log_filter(), vrpn_Connection::register_message_type(), vrpn_Connection::register_sender(), vrpn_Connection::save_log_so_far(), and vrpn_Connection_IP::send_pending_reports().
void vrpn::EndpointContainer::clear | ( | ) |
Tells each held endpoint in turn to drop the connection then deletes it.
Definition at line 78 of file vrpn_EndpointContainer.C.
References VRPN_EC_TRACE.
Referenced by ~EndpointContainer(), vrpn_Connection::~vrpn_Connection(), and vrpn_Connection_IP::~vrpn_Connection_IP().
|
inline |
Goes through and gets rid of the NULL entries.
Definition at line 345 of file vrpn_EndpointContainer.h.
Referenced by vrpn_Connection::compact_endpoints().
bool vrpn::EndpointContainer::destroy | ( | EndpointContainer::base_pointer | endpoint | ) |
Destroys the contained endpoint by address.
Definition at line 106 of file vrpn_EndpointContainer.C.
References VRPN_EC_TRACE.
Referenced by vrpn_Connection::delete_endpoint(), and vrpn_Connection::vrpn_Connection().
|
inline |
Get an iterator suitable only for testing to see if we're "done".
Definition at line 357 of file vrpn_EndpointContainer.h.
Referenced by vrpn_Connection::connected(), vrpn_Connection::doing_okay(), vrpn_Connection_IP::mainloop(), vrpn_Connection::pack_message(), vrpn_Connection::pack_sender_description(), vrpn_Connection::pack_type_description(), vrpn_Connection::register_log_filter(), vrpn_Connection::register_message_type(), vrpn_Connection::register_sender(), vrpn_Connection::save_log_so_far(), and vrpn_Connection_IP::send_pending_reports().
|
inline |
Shorthand for get_by_index(0)
Definition at line 81 of file vrpn_EndpointContainer.h.
References get_by_index().
Referenced by vrpn_Connection::get_log_names(), vrpn_File_Connection::playone_to_filetime(), vrpn_File_Connection::read_cookie(), vrpn_File_Connection::reset(), vrpn_File_Connection::send_pending_reports(), and vrpn_File_Connection::vrpn_File_Connection().
bool vrpn::EndpointContainer::full | ( | ) | const |
Can we no longer accommodate a new endpoint?
Definition at line 99 of file vrpn_EndpointContainer.C.
References get_full_container_size(), and vrpn_MAX_ENDPOINTS.
Referenced by vrpn_Connection_IP::connect_to_client(), and vrpn_Connection_IP::server_check_for_incoming_connections().
|
inline |
Definition at line 329 of file vrpn_EndpointContainer.h.
References is_valid().
Referenced by front().
|
inline |
Get size of container including NULL elements that haven't been compacted yet.
Definition at line 338 of file vrpn_EndpointContainer.h.
Referenced by full(), and is_valid().
|
inline |
Checks to see if an index is both in-range and pointing to a still-extant object.
Definition at line 323 of file vrpn_EndpointContainer.h.
References get_full_container_size().
Referenced by get_by_index(), vrpn_File_Connection::read_cookie(), and vrpn_File_Connection::vrpn_File_Connection().