Frame* Pipe::getFrame( const co::ObjectVersion& frameVersion, const Eye eye, const bool isOutput ) { LB_TS_THREAD( _pipeThread ); Frame* frame = _impl->frames[ frameVersion.identifier ]; if( !frame ) { ClientPtr client = getClient(); frame = new Frame(); LBCHECK( client->mapObject( frame, frameVersion )); _impl->frames[ frameVersion.identifier ] = frame; } else frame->sync( frameVersion.version ); const co::ObjectVersion& dataVersion = frame->getDataVersion( eye ); LBLOG( LOG_ASSEMBLY ) << "Use " << dataVersion << std::endl; FrameDataPtr frameData = getNode()->getFrameData( dataVersion ); LBASSERT( frameData ); if( isOutput ) { if( !frameData->isAttached() ) { ClientPtr client = getClient(); LBCHECK( client->mapObject( frameData.get(), dataVersion )); } else if( frameData->getVersion() < dataVersion.version ) frameData->sync( dataVersion.version ); _impl->outputFrameDatas[ dataVersion.identifier ] = frameData; } else _impl->inputFrameDatas[ dataVersion.identifier ] = frameData; frame->setFrameData( frameData ); return frame; }
co::QueueSlave* Pipe::getQueue( const UUID& queueID ) { LB_TS_THREAD( _pipeThread ); if( queueID == 0 ) return 0; co::QueueSlave* queue = _impl->queues[ queueID ]; if( !queue ) { queue = new co::QueueSlave; ClientPtr client = getClient(); LBCHECK( client->mapObject( queue, queueID )); _impl->queues[ queueID ] = queue; } return queue; }
co::Barrier* Node::getBarrier( const co::ObjectVersion barrier ) { lunchbox::ScopedMutex<> mutex( _barriers ); co::Barrier* netBarrier = _barriers.data[ barrier.identifier ]; if( netBarrier ) netBarrier->sync( barrier.version ); else { ClientPtr client = getClient(); netBarrier = new co::Barrier; LBCHECK( client->mapObject( netBarrier, barrier )); _barriers.data[ barrier.identifier ] = netBarrier; } return netBarrier; }
View* Pipe::getView( const co::ObjectVersion& viewVersion ) { LB_TS_THREAD( _pipeThread ); if( viewVersion.identifier == 0 ) return 0; View* view = _impl->views[ viewVersion.identifier ]; if( !view ) { NodeFactory* nodeFactory = Global::getNodeFactory(); view = nodeFactory->createView( 0 ); LBASSERT( view ); view->_pipe = this; ClientPtr client = getClient(); LBCHECK( client->mapObject( view, viewVersion )); _impl->views[ viewVersion.identifier ] = view; } view->sync( viewVersion.version ); return view; }