#include <region.h>
Collaboration diagram for gutk::Region:
Any set of objects of class Point can form a region. Internally this class is implemented as a doubly-linked list.
Public Member Functions | |
Region (void) | |
Default constructor. | |
Region (const Region &r) | |
Copy constructor. | |
~Region () | |
Destroyer If the region has only one reference, then destroyer deletes the region memory is. | |
void | addPoint (const gutk::Point &p) |
Adds a Point to the Region. | |
void | addPoint (double n, double m) |
Adds a Point (n, m) to the Region. | |
void | pop (void) |
Pops a point from the list. | |
gutk::Point | getPoint (void) |
Returns the current Point of the list. | |
void | refresh (void) |
Sets the current-point pointer of the list to the first-point pointer in the list. | |
int | getSize (void) |
Returns the size of the list. | |
gutk::Point | getLastPoint (void) |
Returns the last Point object in the list. | |
void | destroy (void) |
Destroys the current object. | |
void | operator= (const Region &r) |
Overloaded assignment operator. |
|
Default constructor. Does nothing and only the skeletal memory is initialised. |
|
Copy constructor. This is leads to an initialisation only by reference. The original object and the new object share the same data. But the user should keep in mind that passing an empty object to a function would result in a call by value, where as passing a non-empty object would result in call by reference. The user should also keep in mind that empty objects will not be copied by reference. i.e. copy construction using an empty object followed by data creation would lead to objects have different data-space in memory.
After the above code snippet is executed, size of r1 is 1, where as size of r2 is still 0. |
|
Destroyer If the region has only one reference, then destroyer deletes the region memory is. If the region has more than one reference, then the destroyer just decrements the reference count by 1. |
|
Adds a Point (n, m) to the Region. The pointed added is pushed on the list. i.e, the point added to a list of size 'n' will be the '(n+1)th' point in the list. |
|
The pointed added is pushed on the list. i.e, the point added to a list of size 'n' will be the '(n+1)th' point in the list. |
|
Destroys the current object.
|
|
Returns the last
|
|
Returns the current Point of the list. Returns (0, 0) if the list is empty or if the current-point pointer has reached the end of the list. |
|
Returns the size of the list.
|
|
Overloaded assignment operator. It is only a reference copier. i.e., the lvalue and the rvalue of the assignment operator will share the same data in memory. |
|
Pops a point from the list.
This function does nothing if the list is empty. |
|
Sets the current-point pointer of the list to the first-point pointer in the list. The current-point pointer will point to NULL if the list is empty. |