MCPcopy Create free account
hub / github.com/ImageEngine/cortex / handleReadDataParameters

Method handleReadDataParameters

src/IECoreImage/DisplayDriverServer.cpp:529–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527}
528
529void DisplayDriverServer::Session::handleReadDataParameters( const boost::system::error_code& error )
530{
531 if (error)
532 {
533 msg( Msg::Error, "DisplayDriverServer::Session::handleReadDataParameters", error.message().c_str() );
534 m_socket.close();
535 return;
536 }
537
538 // sanity check: check DisplayDriver object
539 if (! m_displayDriver )
540 {
541 msg( Msg::Error, "DisplayDriverServer::Session::handleReadDataParameters", "No display drivers!" );
542 m_socket.close();
543 return;
544 }
545
546 try
547 {
548 /// \todo Swap byte order if the sending host has a different order to us.
549 /// We used to send the data via MemoryIndexedIO which would take care of this
550 /// for us, but the overhead of this significantly affected interactive render
551 /// speeds.
552 const Imath::Box2i box = *reinterpret_cast<const Imath::Box2i *>( &m_buffer->readable()[0] );
553 const float *data = reinterpret_cast<const float *>( &m_buffer->readable()[0] + sizeof( box ) );
554 const size_t dataSize = ( m_buffer->readable().size() - sizeof( box ) ) / sizeof( float );
555
556 // call imageData passing the data
557 m_displayDriver->imageData( box, data, dataSize );
558
559 // prepare for getting more imageData packages or a imageClose.
560 boost::asio::async_read( m_socket,
561 boost::asio::buffer( m_header.buffer(), m_header.headerLength),
562 boost::bind(
563 &DisplayDriverServer::Session::handleReadHeader, SessionPtr(this),
564 boost::asio::placeholders::error
565 )
566 );
567 }
568 catch( std::exception &e )
569 {
570 msg( Msg::Error, "DisplayDriverServer::Session::handleReadDataParameters", e.what() );
571 m_socket.close();
572 return;
573 }
574}
575
576void DisplayDriverServer::Session::sendResult( DisplayDriverServerHeader::MessageType msg, size_t dataSize )
577{

Callers

nothing calls this directly

Calls 7

closeMethod · 0.80
readableMethod · 0.80
whatMethod · 0.80
bindFunction · 0.50
sizeMethod · 0.45
imageDataMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected