Changeset 57:f52efb9ba3d8 in xplra for src/client/c/hu/varadiistvan
- Timestamp:
- 03/07/13 18:13:05 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/client/c/hu/varadiistvan/xplra
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/client/c/hu/varadiistvan/xplra/MultiBuffer.cc
r40 r57 251 251 //------------------------------------------------------------------------------ 252 252 253 MultiBuffer::~MultiBuffer() throw( Exception)254 { 255 unregister FromXPlane();253 MultiBuffer::~MultiBuffer() throw() 254 { 255 unregisterSafelyFromXPlane(); 256 256 delete[] data; 257 257 } … … 358 358 xplane.checkResult(); 359 359 registeredID = -1; 360 } 361 } 362 363 //------------------------------------------------------------------------------ 364 365 bool MultiBuffer::unregisterSafelyFromXPlane() throw() 366 { 367 try { 368 unregisterFromXPlane(); 369 return true; 370 } catch(...) { 371 registeredID = -1; 372 return false; 360 373 } 361 374 } … … 615 628 //------------------------------------------------------------------------------ 616 629 630 void MultiBuffer::reregisterInXPlane() throw(Exception) 631 { 632 if (registeredID>=0) { 633 int origRegisteredID = registeredID; 634 try { 635 registeredID = -1; 636 registerInXPlane(); 637 } catch(...) { 638 registeredID = origRegisteredID; 639 throw; 640 } 641 } 642 } 643 644 //------------------------------------------------------------------------------ 645 617 646 // Local Variables: 618 647 // mode: C++ -
src/client/c/hu/varadiistvan/xplra/MultiBuffer.h
r33 r57 159 159 * made to unregister it. 160 160 */ 161 virtual ~MultiBuffer() throw( Exception);161 virtual ~MultiBuffer() throw(); 162 162 163 163 public: … … 236 236 */ 237 237 void unregisterFromXPlane() throw(Exception); 238 239 /** 240 * Unregister this buffer from X-Plane safely, i.e. without 241 * throwing any exceptions. If unregistration fails, the 242 * registered ID will be cleared anyway. 243 * 244 * @return whether unregistration succeeded. 245 */ 246 bool unregisterSafelyFromXPlane() throw(); 238 247 239 248 /** … … 480 489 */ 481 490 void writeSpec(uint8_t command) const throw(Exception); 491 492 /** 493 * Re-register the buffer in X-Plane, if it has been registered 494 * earlier. 495 * 496 * it has not been registered, nothing is done. Otherwise the 497 * buffer gets registered, and the old ID is forgotten. This 498 * function is meant to be used by the XPlane object when it 499 * creates a new connection. If the registration fails, the 500 * original ID is restored, so that this function could be called 501 * again 502 */ 503 void reregisterInXPlane() throw(Exception); 482 504 483 505 private: -
src/client/c/hu/varadiistvan/xplra/XPlane.cc
r54 r57 169 169 socket = clientSocket.release(); 170 170 stream = new DataStream(*socket); 171 172 for(multiBuffers_t::iterator i = multiBuffers.begin(); 173 i!=multiBuffers.end(); ++i) 174 { 175 MultiBuffer* buffer = *i; 176 buffer->reregisterInXPlane(); 177 } 171 178 } 172 179
Note:
See TracChangeset
for help on using the changeset viewer.