Ignore:
Timestamp:
12/15/22 19:26:40 (17 months ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Modernized the exception specifications in the C++ client

File:
1 edited

Legend:

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

    r66 r107  
    5454inline MultiBuffer::DataRef::DataRef(const string& name, uint8_t type,
    5555                                     const DataRef* previous,
    56                                      size_t length, size_t offset) throw() :
     56                                     size_t length, size_t offset) noexcept :
    5757    name(name),
    5858    type(type),
     
    7171//------------------------------------------------------------------------------
    7272
    73 inline size_t MultiBuffer::DataRef::getSize() const throw()
     73inline size_t MultiBuffer::DataRef::getSize() const noexcept
    7474{
    7575    switch (type) {
     
    9393//------------------------------------------------------------------------------
    9494
    95 inline size_t MultiBuffer::DataRef::getAlignment() const throw()
     95inline size_t MultiBuffer::DataRef::getAlignment() const noexcept
    9696{
    9797    switch (type) {
     
    112112//------------------------------------------------------------------------------
    113113
    114 bool MultiBuffer::DataRef::isArray() const throw()
     114bool MultiBuffer::DataRef::isArray() const noexcept
    115115{
    116116    return
     
    124124inline size_t
    125125MultiBuffer::DataRef::getCopyLength(size_t userLength, size_t userOffset)
    126     const throw()
     126    const noexcept
    127127{
    128128    size_t maxLength =
     
    134134//------------------------------------------------------------------------------
    135135
    136 inline void MultiBuffer::unfinalize() throw()
     136inline void MultiBuffer::unfinalize() noexcept
    137137{
    138138    delete data; data = 0;
     
    141141//------------------------------------------------------------------------------
    142142
    143 void MultiBuffer::forgetRegistration() throw()
     143void MultiBuffer::forgetRegistration() noexcept
    144144{
    145145    registeredID = -1;
     
    148148//------------------------------------------------------------------------------
    149149
    150 inline const MultiBuffer::DataRef* MultiBuffer::getLastDataRef() const throw()
     150inline const MultiBuffer::DataRef* MultiBuffer::getLastDataRef() const noexcept
    151151{
    152152    return dataRefs.empty() ? 0 : &(dataRefs.back());
     
    156156
    157157inline const MultiBuffer::DataRef& MultiBuffer::getDataRef(size_t id, uint8_t type) const
    158     throw(InvalidIDException, TypeMismatchException)
    159158{
    160159    if (id>=dataRefs.size()) throw InvalidIDException();
     
    167166
    168167inline void* MultiBuffer::getData(size_t id, uint8_t type)
    169     throw(InvalidIDException, TypeMismatchException)
    170168{
    171169    const DataRef& dataRef = getDataRef(id, type);
     
    177175
    178176inline const void* MultiBuffer::getData(size_t id, uint8_t type) const
    179     throw(InvalidIDException, TypeMismatchException)
    180177{
    181178    const DataRef& dataRef = getDataRef(id, type);
     
    189186inline MultiBuffer::setArray(size_t id, const T* value,
    190187                             size_t length, size_t offset)
    191     throw(InvalidIDException, TypeMismatchException)
    192188{
    193189    const DataRef& dataRef = getDataRef(id, type);
     
    209205inline size_t MultiBuffer::getArray(size_t id, T* value,
    210206                                    size_t length, size_t offset) const
    211     throw(InvalidIDException, TypeMismatchException)
    212207{
    213208    const DataRef& dataRef = getDataRef(id, type);
     
    228223template <typename T, uint8_t type>
    229224inline const T* MultiBuffer::getArray(size_t id, size_t offset) const
    230     throw(InvalidIDException, TypeMismatchException)
    231225{
    232226    const DataRef& dataRef = getDataRef(id, type);
     
    240234
    241235MultiBuffer::MultiBuffer(XPlane& xplane, uint8_t registerCommand,
    242                          uint8_t unregisterCommand) throw() :
     236                         uint8_t unregisterCommand) noexcept :
    243237    data(0),
    244238    xplane(xplane),
     
    251245//------------------------------------------------------------------------------
    252246
    253 MultiBuffer::~MultiBuffer() throw()
     247MultiBuffer::~MultiBuffer() noexcept
    254248{
    255249    unregisterSafelyFromXPlane();
     
    259253//------------------------------------------------------------------------------
    260254
    261 size_t MultiBuffer::addInt(const std::string& name) throw()
     255size_t MultiBuffer::addInt(const std::string& name) noexcept
    262256{
    263257    unfinalize();
     
    268262//------------------------------------------------------------------------------
    269263
    270 size_t MultiBuffer::addFloat(const std::string& name) throw()
     264size_t MultiBuffer::addFloat(const std::string& name) noexcept
    271265{
    272266    unfinalize();
     
    277271//------------------------------------------------------------------------------
    278272
    279 size_t MultiBuffer::addDouble(const std::string& name) throw()
     273size_t MultiBuffer::addDouble(const std::string& name) noexcept
    280274{
    281275    unfinalize();
     
    287281
    288282size_t MultiBuffer::addFloatArray(const std::string& name, size_t length,
    289                                   size_t offset) throw()
     283                                  size_t offset) noexcept
    290284{
    291285    unfinalize();
     
    298292
    299293size_t MultiBuffer::addIntArray(const std::string& name, size_t length,
    300                                 size_t offset) throw()
     294                                size_t offset) noexcept
    301295{
    302296    unfinalize();
     
    309303
    310304size_t MultiBuffer::addByteArray(const std::string& name, size_t length,
    311                                  size_t offset) throw()
     305                                 size_t offset) noexcept
    312306{
    313307    unfinalize();
     
    334328//------------------------------------------------------------------------------
    335329
    336 void MultiBuffer::registerInXPlane() throw(Exception)
     330void MultiBuffer::registerInXPlane()
    337331{
    338332    if (finalize() && registeredID<0) {
     
    350344//------------------------------------------------------------------------------
    351345
    352 void MultiBuffer::unregisterFromXPlane() throw(Exception)
     346void MultiBuffer::unregisterFromXPlane()
    353347{
    354348    if (registeredID>=0) {
     
    363357//------------------------------------------------------------------------------
    364358
    365 bool MultiBuffer::unregisterSafelyFromXPlane() throw()
     359bool MultiBuffer::unregisterSafelyFromXPlane() noexcept
    366360{
    367361    try {
     
    376370//------------------------------------------------------------------------------
    377371
    378 void MultiBuffer::execute() throw(Exception)
     372void MultiBuffer::execute()
    379373{
    380374    if (data==0 && registeredID>=0) {
     
    395389
    396390void MultiBuffer::setInt(size_t id, int value)
    397     throw(InvalidIDException, TypeMismatchException)
    398391{
    399392    *reinterpret_cast<int32_t*>(getData(id, Protocol::TYPE_INT)) = value;
     
    403396
    404397int MultiBuffer::getInt(size_t id) const
    405     throw(InvalidIDException, TypeMismatchException)
    406398{
    407399    return *reinterpret_cast<const int32_t*>(getData(id, Protocol::TYPE_INT));
     
    411403
    412404const int32_t& MultiBuffer::getIntRef(size_t id) const
    413     throw(InvalidIDException, TypeMismatchException)
    414405{
    415406    return *reinterpret_cast<const int32_t*>(getData(id, Protocol::TYPE_INT));
     
    419410
    420411int32_t& MultiBuffer::getIntRef(size_t id)
    421     throw(InvalidIDException, TypeMismatchException)
    422412{
    423413    return *reinterpret_cast<int32_t*>(getData(id, Protocol::TYPE_INT));
     
    427417
    428418void MultiBuffer::setFloat(size_t id, float value)
    429     throw(InvalidIDException, TypeMismatchException)
    430419{
    431420    *reinterpret_cast<float*>(getData(id, Protocol::TYPE_FLOAT)) = value;
     
    435424
    436425float MultiBuffer::getFloat(size_t id) const
    437     throw(InvalidIDException, TypeMismatchException)
    438426{
    439427    return *reinterpret_cast<const float*>(getData(id, Protocol::TYPE_FLOAT));
     
    443431
    444432const float& MultiBuffer::getFloatRef(size_t id) const
    445     throw(InvalidIDException, TypeMismatchException)
    446433{
    447434    return *reinterpret_cast<const float*>(getData(id, Protocol::TYPE_FLOAT));
     
    451438
    452439float& MultiBuffer::getFloatRef(size_t id)
    453     throw(InvalidIDException, TypeMismatchException)
    454440{
    455441    return *reinterpret_cast<float*>(getData(id, Protocol::TYPE_FLOAT));
     
    459445
    460446void MultiBuffer::setDouble(size_t id, double value)
    461     throw(InvalidIDException, TypeMismatchException)
    462447{
    463448    *reinterpret_cast<double*>(getData(id, Protocol::TYPE_DOUBLE)) = value;
     
    467452
    468453double MultiBuffer::getDouble(size_t id) const
    469     throw(InvalidIDException, TypeMismatchException)
    470454{
    471455    return *reinterpret_cast<const double*>(getData(id, Protocol::TYPE_DOUBLE));
     
    475459
    476460const double& MultiBuffer::getDoubleRef(size_t id) const
    477     throw(InvalidIDException, TypeMismatchException)
    478461{
    479462    return *reinterpret_cast<const double*>(getData(id, Protocol::TYPE_DOUBLE));
     
    483466
    484467double& MultiBuffer::getDoubleRef(size_t id)
    485     throw(InvalidIDException, TypeMismatchException)
    486468{
    487469    return *reinterpret_cast<double*>(getData(id, Protocol::TYPE_DOUBLE));
     
    492474size_t MultiBuffer::setFloatArray(size_t id, const float* value,
    493475                                  size_t length, size_t offset)
    494     throw(InvalidIDException, TypeMismatchException)
    495476{
    496477    return setArray<float, Protocol::TYPE_FLOAT_ARRAY>(id, value, length, offset);
     
    501482size_t MultiBuffer::getFloatArray(size_t id, float* value,
    502483                                  size_t length, size_t offset) const
    503     throw(InvalidIDException, TypeMismatchException)
    504484{
    505485    return getArray<float, Protocol::TYPE_FLOAT_ARRAY>(id, value, length, offset);
     
    509489
    510490const float* MultiBuffer::getFloatArray(size_t id, size_t offset) const
    511     throw(InvalidIDException, TypeMismatchException)
    512491{
    513492    return getArray<float, Protocol::TYPE_FLOAT_ARRAY>(id, offset);
     
    518497size_t MultiBuffer::setIntArray(size_t id, const int32_t* value,
    519498                                size_t length, size_t offset)
    520     throw(InvalidIDException, TypeMismatchException)
     499
    521500{
    522501    return setArray<int32_t, Protocol::TYPE_INT_ARRAY>(id, value, length, offset);
     
    527506size_t MultiBuffer::getIntArray(size_t id, int32_t* value,
    528507                                size_t length, size_t offset) const
    529     throw(InvalidIDException, TypeMismatchException)
    530508{
    531509    return getArray<int32_t, Protocol::TYPE_INT_ARRAY>(id, value, length, offset);
     
    535513
    536514const int32_t* MultiBuffer::getIntArray(size_t id, size_t offset) const
    537     throw(InvalidIDException, TypeMismatchException)
    538515{
    539516    return getArray<int32_t, Protocol::TYPE_INT_ARRAY>(id, offset);
     
    544521size_t MultiBuffer::setByteArray(size_t id, const uint8_t* value,
    545522                                size_t length, size_t offset)
    546     throw(InvalidIDException, TypeMismatchException)
    547523{
    548524    return setArray<uint8_t, Protocol::TYPE_BYTE_ARRAY>(id, value, length, offset);
     
    553529size_t MultiBuffer::getByteArray(size_t id, uint8_t* value,
    554530                                size_t length, size_t offset) const
    555     throw(InvalidIDException, TypeMismatchException)
    556531{
    557532    return getArray<uint8_t, Protocol::TYPE_BYTE_ARRAY>(id, value, length, offset);
     
    561536
    562537const uint8_t* MultiBuffer::getByteArray(size_t id, size_t offset) const
    563     throw(InvalidIDException, TypeMismatchException)
    564538{
    565539    return getArray<uint8_t, Protocol::TYPE_BYTE_ARRAY>(id, offset);
     
    570544size_t MultiBuffer::setString(size_t id, const string& value,
    571545                              size_t offset)
    572     throw(InvalidIDException, TypeMismatchException)
    573546{
    574547    return setByteArray(id, reinterpret_cast<const uint8_t*>(value.c_str()),
     
    579552
    580553string MultiBuffer::getString(size_t id, size_t offset) const
    581     throw(InvalidIDException, TypeMismatchException)
    582554{
    583555    const DataRef& dataRef = getDataRef(id, Protocol::TYPE_BYTE_ARRAY);
     
    598570
    599571const char* MultiBuffer::getStringPtr(size_t id, size_t offset) const
    600         throw(InvalidIDException, TypeMismatchException)
    601572{
    602573    return reinterpret_cast<const char*>(getByteArray(id, offset));
     
    605576//------------------------------------------------------------------------------
    606577
    607 void MultiBuffer::writeSpec(uint8_t command) const throw(Exception)
     578void MultiBuffer::writeSpec(uint8_t command) const
    608579{
    609580    xplane.stream->writeU8(command);
     
    628599//------------------------------------------------------------------------------
    629600
    630 void MultiBuffer::reregisterInXPlane() throw(Exception)
     601void MultiBuffer::reregisterInXPlane()
    631602{
    632603    if (registeredID>=0) {
Note: See TracChangeset for help on using the changeset viewer.