Chai returns bool instead of int

Issue #65 resolved
Fabian Gerlinghaus created an issue
    \return Return 0 if no error occurred.
*/
//==============================================================================
int cHapticDeviceHandler::getDevice(cGenericHapticDevice*& a_hapticDevice, 
                                    unsigned int a_index)
{
    printf("\n\n ********************* \n\n Num devices = %d \n\n *************", static_cast<int>(m_numDevices));
    if (a_index < m_numDevices)
    {
        printf("\n\n ********************* \n\n SUCCESS Num devices = %d \n\n *************", static_cast<int>(m_numDevices));
        a_hapticDevice = m_devices[a_index];
        return 0;
    }
    else
    {
        printf("\n\n ********************* \n\n FAILURE Num devices = %d \n\n *************", static_cast<int>(m_numDevices));
        a_hapticDevice = m_nullHapticDevice;
        return (C_ERROR);
    }
}

Comments (3)

  1. Fabian Gerlinghaus reporter

    Also CChaiHaptics.cpp has an incorrect return var.

    // 2. Open a connection to the haptic device.
            bool hflag = tmp_haptic_device->open();
            if (false == hflag)
            {
              std::stringstream ss; ss<<"Could not connect to haptic device: "<<i;
              throw(std::runtime_error(ss.str()));
            }
            else
            { std::cout << "\nConnected to haptic device: "<< i << std::flush; }
    
  2. Log in to comment