Ignore:
Timestamp:
02/07/13 16:45:59 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented the set operations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/client/c/hu/varadiistvan/xplra/xplra.cc

    r24 r25  
    505505//------------------------------------------------------------------------------
    506506
     507extern "C" int xplra_set_int(int connectionID, const char* name, int value)
     508{
     509    Connection* connection = Slot::getConnection(connectionID);
     510    if (connection==0) return 0;
     511    try {
     512        connection->setInt(name, value);
     513        return 0;
     514    } catch (...) {
     515        connection->handleException();
     516        return -1;
     517    }
     518}
     519
     520//------------------------------------------------------------------------------
     521
     522extern "C" int xplra_set_float(int connectionID, const char* name, float value)
     523{
     524    Connection* connection = Slot::getConnection(connectionID);
     525    if (connection==0) return 0;
     526    try {
     527        connection->setFloat(name, value);
     528        return 0;
     529    } catch (...) {
     530        connection->handleException();
     531        return -1;
     532    }
     533}
     534
     535//------------------------------------------------------------------------------
     536
     537extern "C" int xplra_set_double(int connectionID, const char* name,
     538                                double value)
     539{
     540    Connection* connection = Slot::getConnection(connectionID);
     541    if (connection==0) return 0;
     542    try {
     543        connection->setDouble(name, value);
     544        return 0;
     545    } catch (...) {
     546        connection->handleException();
     547        return -1;
     548    }
     549}
     550
     551/*----------------------------------------------------------------------------*/
     552
     553extern "C" int xplra_set_float_array(int connectionID, const char* name,
     554                                     const float* values,
     555                                     size_t length, size_t offset)
     556{
     557    Connection* connection = Slot::getConnection(connectionID);
     558    if (connection==0) return 0;
     559    try {
     560        connection->setFloatArray(name, values, length, offset);
     561        return 0;
     562    } catch (...) {
     563        connection->handleException();
     564        return -1;
     565    }
     566}
     567
     568/*----------------------------------------------------------------------------*/
     569
     570extern "C" int xplra_set_int_array(int connectionID, const char* name,
     571                                   const int32_t* values,
     572                                   size_t length, size_t offset)
     573{
     574    Connection* connection = Slot::getConnection(connectionID);
     575    if (connection==0) return 0;
     576    try {
     577        connection->setIntArray(name, values, length, offset);
     578        return 0;
     579    } catch (...) {
     580        connection->handleException();
     581        return -1;
     582    }
     583}
     584
     585/*----------------------------------------------------------------------------*/
     586
     587extern "C" int xplra_set_byte_array(int connectionID, const char* name,
     588                                    const void* values,
     589                                    size_t length, size_t offset)
     590{
     591    Connection* connection = Slot::getConnection(connectionID);
     592    if (connection==0) return 0;
     593    try {
     594        connection->setByteArray(name, reinterpret_cast<const uint8_t*>(values),
     595                                 length, offset);
     596        return 0;
     597    } catch (...) {
     598        connection->handleException();
     599        return -1;
     600    }
     601}
     602
     603/*----------------------------------------------------------------------------*/
     604
     605extern "C" int xplra_set_string(int connectionID, const char* name,
     606                                const char* value,
     607                                size_t length, size_t offset)
     608{
     609    Connection* connection = Slot::getConnection(connectionID);
     610    if (connection==0) return 0;
     611    try {
     612        connection->setString(name, value, length, offset);
     613        return 0;
     614    } catch (...) {
     615        connection->handleException();
     616        return -1;
     617    }
     618}
     619
     620//------------------------------------------------------------------------------
     621
    507622extern "C" int xplra_disconnect(int connectionID)
    508623{
Note: See TracChangeset for help on using the changeset viewer.