#include <ContactRegistry.h>
Public Member Functions | |
| ~ContactRegistry (void) | |
| ContactRegistry (const unsigned capacity=1000) | |
| Contact * | get_contacts () const |
| unsigned | get_capacity () const |
| unsigned | get_number () const |
| void | set_capacity (const unsigned capacity) |
| void | clear () |
| Contact * | add_indirectly () |
| unsigned | add (const Contact &contact) |
| unsigned | add (const Contact *contacts, const unsigned count) |
Class to store 2d particle contacts generated by contact generators. The capacity -- the maximum number of contacts it can hold -- may be specified individually (the default capacity is 1000).
| bl7::particles2::ContactRegistry::~ContactRegistry | ( | void | ) |
Destructor.
| bl7::particles2::ContactRegistry::ContactRegistry | ( | const unsigned | capacity = 1000 |
) |
Explicit constructor. Automatically creates a new array for contact generation with a maximum capacity as specified.
| unsigned bl7::particles2::ContactRegistry::add | ( | const Contact & | contact | ) |
Adds a given contact to the list. If there is no free capacity, the contact is not added and the function returns 0. Otherwise, if the contact could be added successfully, the function returns 1.
| unsigned bl7::particles2::ContactRegistry::add | ( | const Contact * | contacts, | |
| const unsigned | count | |||
| ) |
Adds a given number of contacts to the list. If the desired number of contacts to add exceeds the free capacity of the list, not all contacts will be added. However, the function returns the number of contacts actually added.
| Contact * bl7::particles2::ContactRegistry::add_indirectly | ( | ) |
Adds a contact indirectly to the list. Therefore, the number of contacts is increased and a pointer to the first free contact is returned, that then can be defined later. If there is no free capacity, the contact is not added and the function returns NULL. To avoid null pointer exceptions check whether there is enough capacity in advance.
| void bl7::particles2::ContactRegistry::clear | ( | ) | [inline] |
Clears the contact list.
| unsigned bl7::particles2::ContactRegistry::get_capacity | ( | ) | const [inline] |
Returns the maximum number of contacts (the capacity of the array).
| Contact* bl7::particles2::ContactRegistry::get_contacts | ( | ) | const [inline] |
Returns the array of generated contacts.
| unsigned bl7::particles2::ContactRegistry::get_number | ( | ) | const [inline] |
Returns the current number of contacts stored.
| void bl7::particles2::ContactRegistry::set_capacity | ( | const unsigned | capacity | ) |
Sets the maximum number of contacts (the capacity of the array). Existing contacts generated earlier will be lost.
1.7.1