libdoclone
0.8.0
|
C++ API for libdoclone. More...
Functions | |
static Clone * | Doclone::Clone::getInstance () |
Returns a pointer to a Doclone::Clone object. More... | |
void | Doclone::Clone::create () throw (Exception) |
Creates an image of a device. More... | |
void | Doclone::Clone::restore () throw (Exception) |
Restores an image in a device. More... | |
void | Doclone::Clone::send () throw (Exception) |
Sends an image or a device to the network. More... | |
void | Doclone::Clone::receive () throw (Exception) |
Receives an image or a device to the network. More... | |
void | Doclone::Clone::chainOrigin () throw (Exception) |
Sends an image or a device to the network in link mode. More... | |
void | Doclone::Clone::chainLink () throw (Exception) |
Receives an image or a device to the network in link mode. More... | |
void | Doclone::Clone::setEmpty (bool empty) |
Sets the no-data mode on/off. | |
void | Doclone::Clone::setNodesNumber (unsigned int nodesNum) |
Sets the number of receivers in the network. More... | |
void | Doclone::Clone::setDevice (const std::string &device) |
Sets the device on which work. More... | |
void | Doclone::Clone::setImage (const std::string &image) |
Sets the image on which work. More... | |
void | Doclone::Clone::setAddress (const std::string &address) |
Sets the IP address of the server in unicast/multicast mode. More... | |
void | Doclone::Clone::setInterface (const std::string &interface) |
Sets the IP address of the network interface to be used in the link mode. More... | |
void | Doclone::Clone::setForce (bool force) |
Sets the force mode on/off. More... | |
C++ API for libdoclone.
This class provides a way for calling the methods of libdoclone from a C++ program. To create an object, the static method getInstance() must be called by this way:
It is possible to subscribe the events of the library. These can be used to know the operations progress and possible incidences. To do this, some functions must be implemented with the proper prototype.
First of all, These are the four kinds of libdoclone events:
Subscribing to any of these events can be performed by extending the Doclone::AbstractObserver class and overriding all its notify() methods:
For example:
The next step is to set all the doclone object required properties before performing the work. These are:
These are some setters for configuring the properties:
The last step is to call one of the methods that perform the work:
All this methods raise an exception if anything goes wrong. The library has two kinds of exceptions, the Warning Exceptions and the Error Exceptions. The Warning Exceptions don't stop the execution and are captured in the library, but their messages are sent to the views. These messages are received by the views with "void notify(const std::string &str)" method override. The Error Exceptions are defined for severe errors, these ones always stop the execution and are raised to the caller. The library user must decide what to do with them.
These are some examples of use:
void Doclone::Clone::chainLink | ( | ) | ||
throw | ( | Exception | ||
) |
Receives an image or a device to the network in link mode.
Image or device path must be set before calling this function.
void Doclone::Clone::chainOrigin | ( | ) | ||
throw | ( | Exception | ||
) |
Sends an image or a device to the network in link mode.
Image or device path must be set before calling this function.
void Doclone::Clone::create | ( | ) | ||
throw | ( | Exception | ||
) |
Creates an image of a device.
Both image an device path must be set before calling this function.
|
static |
Returns a pointer to a Doclone::Clone object.
void Doclone::Clone::receive | ( | ) | ||
throw | ( | Exception | ||
) |
Receives an image or a device to the network.
Server's IP and either image or device path must be set before calling this function.
void Doclone::Clone::restore | ( | ) | ||
throw | ( | Exception | ||
) |
Restores an image in a device.
Both image an device path must be set before calling this function.
void Doclone::Clone::send | ( | ) | ||
throw | ( | Exception | ||
) |
Sends an image or a device to the network.
The number of receivers and either image or device path must be set before calling this function.
void Doclone::Clone::setAddress | ( | const std::string & | address | ) |
Sets the IP address of the server in unicast/multicast mode.
address | IP Address |
void Doclone::Clone::setDevice | ( | const std::string & | device | ) |
Sets the device on which work.
device | Device path |
void Doclone::Clone::setForce | ( | bool | force | ) |
Sets the force mode on/off.
force | true = on; false = off |
void Doclone::Clone::setImage | ( | const std::string & | image | ) |
Sets the image on which work.
image | Image path |
void Doclone::Clone::setInterface | ( | const std::string & | interface | ) |
Sets the IP address of the network interface to be used in the link mode.
interface | IP Address of the interface |
void Doclone::Clone::setNodesNumber | ( | unsigned int | nodesNumber | ) |
Sets the number of receivers in the network.
nodesNumber | Number of nodes |