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

Using the multi-get and multi-set commands in unregistered multi-dataref getters and setters, respectively

File:
1 edited

Legend:

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

    r26 r33  
    339339        xplane.checkStream();
    340340
    341         xplane.stream->writeU8(registerCommand);
    342         xplane.stream->writeU32(dataRefs.size());
    343 
    344         for(vector<DataRef>::const_iterator i = dataRefs.begin();
    345             i!=dataRefs.end(); ++i)
    346         {
    347             const DataRef& dataRef = *i;
    348             xplane.stream->writeString(dataRef.name);
    349             xplane.stream->writeU8(dataRef.type);
    350             if (dataRef.isArray()) {
    351                 xplane.stream->writeS32(dataRef.length);
    352                 xplane.stream->writeS32(dataRef.offset);
    353             }
    354         }
    355 
    356         xplane.stream->flush();
    357 
    358         uint8_t result = xplane.stream->readU8();
     341        writeSpec(registerCommand);
     342
    359343        uint32_t id = xplane.stream->readU32();
    360344        xplane.checkStream();
    361         xplane.checkResult(result);
    362345
    363346        registeredID = static_cast<int>(id);
     
    609592//------------------------------------------------------------------------------
    610593
     594void MultiBuffer::writeSpec(uint8_t command) const throw(Exception)
     595{
     596    xplane.stream->writeU8(command);
     597    xplane.stream->writeU32(dataRefs.size());
     598
     599    for(vector<DataRef>::const_iterator i = dataRefs.begin();
     600        i!=dataRefs.end(); ++i)
     601    {
     602        const DataRef& dataRef = *i;
     603        xplane.stream->writeString(dataRef.name);
     604        xplane.stream->writeU8(dataRef.type);
     605        if (dataRef.isArray()) {
     606            xplane.stream->writeS32(dataRef.length);
     607            xplane.stream->writeS32(dataRef.offset);
     608        }
     609    }
     610
     611    xplane.stream->flush();
     612    xplane.checkResult();
     613}
     614
     615//------------------------------------------------------------------------------
     616
    611617// Local Variables:
    612618// mode: C++
Note: See TracChangeset for help on using the changeset viewer.