Changeset 17236 for trunk


Ignore:
Timestamp:
10/17/13 15:20:41 (11 years ago)
Author:
tbretz
Message:
Using the new Queue implementation, all queued functions need to return true so that the event is afterwards removed from the queue.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilder.cc

    r16854 r17236  
    1111#include <boost/algorithm/string/join.hpp>
    1212
    13 #include "queue.h"
     13#include "../externals/Queue.h"
    1414
    1515#include "MessageImp.h"
     
    802802// ==========================================================================
    803803
    804 void proc1(const shared_ptr<EVT_CTRL2> &);
     804bool proc1(const shared_ptr<EVT_CTRL2> &);
    805805
    806806Queue<shared_ptr<EVT_CTRL2>> processingQueue1(bind(&proc1, placeholders::_1));
    807807
    808 void proc1(const shared_ptr<EVT_CTRL2> &evt)
     808bool proc1(const shared_ptr<EVT_CTRL2> &evt)
    809809{
    810810    applyCalib(*evt, processingQueue1.size());
     811    return true;
    811812}
    812813
     
    814815// a command queue, to which command+data is posted,
    815816// (e.g. runOpen+runInfo, runClose+runInfo, evtWrite+evtInfo)
    816 void writeEvt(const shared_ptr<EVT_CTRL2> &evt)
     817bool writeEvt(const shared_ptr<EVT_CTRL2> &evt)
    817818{
    818819    //const shared_ptr<RUN_CTRL2> &run = evt->runCtrl;
     
    832833                factPrintf(MessageImp::kError, "Could not open new file for run %d (evt=%d, runOpen failed)", evt->runNum, evt->evNum);
    833834                run.fileStat = kFileClosed;
    834                 return;
     835                return true;
    835836            }
    836837
     
    846847    // File already closed
    847848    if (run.fileStat==kFileClosed)
    848         return;
     849        return true;
    849850
    850851    bool rc1 = true;
     
    859860    // ... this is the case if CloseRunFile was called before any file was opened.
    860861    if (run.fileStat!=kFileOpen)
    861         return;
     862        return true;
    862863
    863864    // File is not yet to be closed.
    864865    if (rc1 && evt->closeRequest==kRequestNone)
    865         return;
     866        return true;
    866867
    867868    runClose(run);
     
    886887    const string str = boost::algorithm::join(reason, ", ");
    887888    factPrintf(MessageImp::kInfo, "File closed because %s",  str.c_str());
     889
     890    return true;
    888891}
    889892
    890893Queue<shared_ptr<EVT_CTRL2>> secondaryQueue(bind(&writeEvt, placeholders::_1));
    891894
    892 void procEvt(const shared_ptr<EVT_CTRL2> &evt)
     895bool procEvt(const shared_ptr<EVT_CTRL2> &evt)
    893896{
    894897    if (evt->valid())
     
    914917        {
    915918            secondaryQueue.emplace(new EVT_CTRL2(kRequestEventCheckFailed, evt->runCtrl));
    916             return;
     919            return true;
    917920        }
    918921    }
     
    920923    // If file is open post the event for being written
    921924    secondaryQueue.post(evt);
     925
     926    return true;
    922927}
    923928
Note: See TracChangeset for help on using the changeset viewer.