/******************************************************************** * The Data Acquisition Backbone Core (DABC) ******************************************************************** * Copyright (C) 2009- * GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * Planckstr. 1 * 64291 Darmstadt * Germany * Contact: http://dabc.gsi.de ******************************************************************** * This software can be used under the GPL license agreements as stated * in LICENSE.txt file which is part of the distribution. ********************************************************************/ #include "dabc/ModuleAsync.h" #include "dabc/logging.h" #include "dabc/ModuleItem.h" #include "dabc/PoolHandle.h" #include "dabc/Port.h" dabc::ModuleAsync::~ModuleAsync() { } void dabc::ModuleAsync::ProcessUserEvent(ModuleItem* item, uint16_t evid) { switch (evid) { case evntInput: ProcessInputEvent((Port*) item); break; case evntOutput: ProcessOutputEvent((Port*) item); break; case evntPool: ProcessPoolEvent((PoolHandle*) item); break; case evntTimeout: ProcessTimerEvent((Timer*)item); break; case evntPortConnect: ProcessConnectEvent((Port*) item); break; case evntPortDisconnect: ProcessDisconnectEvent((Port*) item); break; } } void dabc::ModuleAsync::ProcessPoolEvent(PoolHandle* pool) { // this is default implementation Buffer* buf = pool->TakeRequestedBuffer(); dabc::Buffer::Release(buf); } void dabc::ModuleAsync::OnThreadAssigned() { dabc::Module::OnThreadAssigned(); // produce initial output events, // that user can fill output queue via processing of output event for (unsigned n=0;nOutputQueueCapacity() - port->OutputPending(); while (len--) GetUserEvent(port, evntOutput); } }