libdoclone
0.8.0
|
Interface of the library. More...
#include <Clone.h>
Public Member Functions | |
~Clone () | |
Deletes all the objects in the vector of operations and clears it. | |
void | create () throw (Exception) |
Creates an image of a device. More... | |
void | restore () throw (Exception) |
Restores an image in a device. More... | |
void | send () throw (Exception) |
Sends an image or a device to the network. More... | |
void | receive () throw (Exception) |
Receives an image or a device to the network. More... | |
void | chainOrigin () throw (Exception) |
Sends an image or a device to the network in link mode. More... | |
void | chainLink () throw (Exception) |
Receives an image or a device to the network in link mode. More... | |
bool | getEmpty () const |
void | setEmpty (bool empty) |
Sets the no-data mode on/off. | |
unsigned int | getNodesNumber () const |
void | setNodesNumber (unsigned int nodesNum) |
Sets the number of receivers in the network. More... | |
const std::string & | getDevice () const |
void | setDevice (const std::string &device) |
Sets the device on which work. More... | |
const std::string & | getImage () const |
void | setImage (const std::string &image) |
Sets the image on which work. More... | |
const std::string & | getAddress () const |
void | setAddress (const std::string &address) |
Sets the IP address of the server in unicast/multicast mode. More... | |
const std::string & | getInterface () const |
void | setInterface (const std::string &interface) |
Sets the IP address of the network interface to be used in the link mode. More... | |
bool | getForce () const |
void | setForce (bool force) |
Sets the force mode on/off. More... | |
void | addOperation (Operation *op) |
Adds a pending operation to the vector. More... | |
void | markCompleted (dcOperationType type, const std::string &target) |
Marks one operation as completed. More... | |
Operation * | getOperation (dcOperationType type, const std::string &target) |
Gets the operation required using its type and target to identify it. More... | |
void | triggerEvent (dcEvent event, const std::string &target) |
Used by the library to trigger a general event. | |
Static Public Member Functions | |
static Clone * | getInstance () |
Returns a pointer to a Doclone::Clone object. More... | |
Protected Member Functions | |
Clone () | |
Private constructor for singleton pattern. More... | |
Protected Attributes | |
std::string | _image |
Image path entered by the user. | |
std::string | _device |
Device path entered by the user. | |
std::string | _address |
Ip address entered by the user. | |
std::string | _interface |
Ip address of the interface to be used in the link mode. | |
unsigned int | _nodesNumber |
Number of receivers entered by the user. | |
bool | _empty |
Empty mode enabled/disabled. | |
bool | _force |
Mode force enabled/disabled. | |
std::vector< Operation * > | _operations |
Vector with the state of the execution. | |
Interface of the library.
This class provides an interface for a library user, such as a frontend or a controller, to interact with the library and read its state. This program has 4 main uses:
All the network operations can be performed using the unicast/multicast mode (Recommended) or the link mode.
For use it, first at all, the library user must set the parameters, like image path, device path, no-data, etc.
After, the library user must call to the proper function.
During the execution, the state of the execution can be read by using the function getOperations(), that returns a vector with a list of all the operations that must be performed, and the current state of them.
Also during the execution, the library user can call to the function getTransferredBytes() to know how much data has been written/read at until the moment.
This class is singleton.
|
protected |
Private constructor for singleton pattern.
Initializes gettext, signal handlers and some attributes of this class.
void Doclone::Clone::addOperation | ( | Operation * | op | ) |
Adds a pending operation to the vector.
op | Operation that will be added. |
Operation * Doclone::Clone::getOperation | ( | dcOperationType | type, |
const std::string & | target | ||
) |
Gets the operation required using its type and target to identify it.
type | The type of the operation. |
target | The target of the operation. |
void Doclone::Clone::markCompleted | ( | dcOperationType | type, |
const std::string & | target | ||
) |
Marks one operation as completed.
The parameters are necessary to identify the operation to be marked.
type | The type of the operation. |
target | The target of the operation. |