30#define VRPN_EC_TRACE(X) \
32 std::cerr << " [EC " << this << (needsCompact_ ? "*" : " ") << "] " \
36#define VRPN_EC_TRACE(X) ((void)0)
41 template <
typename T>
struct EndpointCloser {
43 void operator()(T *obj)
46 obj->drop_connection();
50 fprintf(stderr,
"EndpointCloser: delete failed\n");
67 : needsCompact_(false)
80 if (container_.empty()) {
85 ::std::for_each(begin_(), end_(), EndpointCloser<T>());
89 void EndpointContainer::compact_()
92 raw_iterator it = std::remove(begin_(), end_(), getNullEndpoint());
93 container_.resize(it - begin_());
94 needsCompact_ =
false;
111 raw_iterator it = std::find(begin_(), end_(), endpoint);
113 needsCompact_ =
true;
119 fprintf(stderr,
"EndpointContainer::destroy: delete failed\n");
130 if (NULL != endpoint) {
134 container_.push_back(endpoint);
size_type get_full_container_size() const
Get size of container including NULL elements that haven't been compacted yet.
bool full() const
Can we no longer accommodate a new endpoint?
bool destroy(base_pointer endpoint)
Destroys the contained endpoint by address.
void clear()
Tells each held endpoint in turn to drop the connection then deletes it.
~EndpointContainer()
Destructor - includes a call to clear()
EndpointContainer()
Constructor of empty container.
container_type::size_type size_type
Encapsulation of the data and methods for a single IP-based connection to take care of one part of ma...
Encapsulation of the data and methods for a single generic connection to take care of one part of man...
const int vrpn_MAX_ENDPOINTS
Number of endpoints that a server connection can have. Arbitrary limit.