API for external clients. This class provides a client-side API for the SimDB system. It provides functions that a generic C++ program can use to comunicate as a client with a SimDB server.
More...
#include <Client.h>
|
bool | insertDataSet (const std::string &dssName, std::map< std::string, std::string > &sdFields, const std::map< std::string, std::string > &dataItems) |
|
bool | removeDataSet (const std::string &sequenceNumber, const std::string &dssName) |
|
bool | getDataSet (const std::string &sequenceNumber, const std::string &dssName) |
|
bool | searchDataSet (const std::string &dssName, std::map< std::string, std::string > &sdQueryFields) |
|
bool | listDss () |
|
bool | sendExtendedCommand (const std::string &command) |
|
void | setServerAddress (const std::string &address) |
|
bool | setServerPort (const std::string &port) |
|
void | setDataDirectory (const std::string &dataDir) |
|
API for external clients. This class provides a client-side API for the SimDB system. It provides functions that a generic C++ program can use to comunicate as a client with a SimDB server.
bool simdb::Client::getDataSet |
( |
const std::string & |
sequenceNumber, |
|
|
const std::string & |
dssName |
|
) |
| |
Send a GET command to the server. The received data is saved in the data directory.
- Parameters
-
sequenceNumber | The SN of the DataSet to be retrieved. |
dssName | The DSS name in the command. |
- Returns
- true if the operation succeeds, false otherwise.
bool simdb::Client::insertDataSet |
( |
const std::string & |
dssName, |
|
|
std::map< std::string, std::string > & |
sdFields, |
|
|
const std::map< std::string, std::string > & |
dataItems |
|
) |
| |
Send an INSERT command to the server.
- Parameters
-
dssName | The DSS name in the command. |
sdFields | The list of SetDescriptor fields, as a <key, value> map. |
dataItems | The list of DataItems and their instance files, as an <item, instance> map. |
- Returns
- true if the operation succeeds, false otherwise.
Send a SPECLIST command to the server.
- Returns
- true if the operation succeeds, false otherwise.
bool simdb::Client::removeDataSet |
( |
const std::string & |
sequenceNumber, |
|
|
const std::string & |
dssName |
|
) |
| |
Send a REMOVE command to the server.
- Parameters
-
sequenceNumber | The SN of the DataSet to be removed. |
dssName | The DSS name in the command. |
- Returns
- true if the operation succeeds, false otherwise.
bool simdb::Client::searchDataSet |
( |
const std::string & |
dssName, |
|
|
std::map< std::string, std::string > & |
sdQueryFields |
|
) |
| |
Send a SEARCH command to the server.
- Parameters
-
dssName | The DSS name in the command. |
sdQueryFields | The list of SetDescriptor fields in the query, as a <key, value> map. It can be empty. |
- Returns
- true if the operation succeeds, false otherwise.
bool Client::sendExtendedCommand |
( |
const std::string & |
command | ) |
|
Send an extended command to the server. The command is parsed to understand its type.
- Parameters
-
commands | The string with the command message to be sent. |
- Returns
- true if the operation succeeds, false otherwise.
void Client::setDataDirectory |
( |
const std::string & |
dataDir | ) |
|
Set a custom data directory different from the default one. If the given directory doesn't exists it is created.
- Parameters
-
dataDir | An absolute directory path. |
void Client::setServerAddress |
( |
const std::string & |
address | ) |
|
Set a custom server address different from the default one.
- Parameters
-
address | A custom IPv4 server address in the "dotted" format (e.g. "192.168.0.1"). |
bool Client::setServerPort |
( |
const std::string & |
port | ) |
|
Set a custom server port different from the default one. The given string is converted into an unsigned short.
- Parameters
-
port | A custom server port; it must be an integer greather than 1024, while integers greather than 65535 are treated as 65535. |
- Returns
- true if the port is valid, false otherwise.
The documentation for this class was generated from the following files: