Ignore:
Timestamp:
07/20/11 08:03:38 (13 years ago)
Author:
tbretz
Message:
Replaced boost::thread by std::thread and boost::bind by std::bind from the C++0x standard
File:
1 edited

Legend:

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

    r11480 r11481  
     1#include <functional>
     2
    13#include "Dim.h"
    24#include "Event.h"
     
    15281530        // FAD Commands
    15291531        T::AddEvent("SEND_CMD", "I:1")
    1530             (boost::bind(&StateMachineFAD::SendCmd, this, _1))
     1532            (bind(&StateMachineFAD::SendCmd, this, placeholders::_1))
    15311533            ("Send a command to the FADs. Values between 0 and 0xffff are allowed."
    15321534             "|command[uint16]:Command to be transmittted.");
    15331535        T::AddEvent("SEND_DATA", "I:2")
    1534             (boost::bind(&StateMachineFAD::SendCmdData, this, _1))
     1536            (bind(&StateMachineFAD::SendCmdData, this, placeholders::_1))
    15351537            ("Send a command with data to the FADs. Values between 0 and 0xffff are allowed."
    15361538             "|command[uint16]:Command to be transmittted."
     
    15381540
    15391541        T::AddEvent("ENABLE_SRCLK", "B:1")
    1540             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdSrclk))
     1542            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSrclk))
    15411543            ("Set SRCLK");
    15421544        T::AddEvent("ENABLE_BUSY", "B:1")
    1543             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdBusy))
     1545            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdBusy))
    15441546            ("Set BUSY");
    15451547        T::AddEvent("ENABLE_SCLK", "B:1")
    1546             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdSclk))
     1548            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSclk))
    15471549            ("Set SCLK");
    15481550        T::AddEvent("ENABLE_DRS", "B:1")
    1549             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdDrsEnable))
     1551            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdDrsEnable))
    15501552            ("Switch Domino wave");
    15511553        T::AddEvent("ENABLE_DWRITE", "B:1")
    1552             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdDwrite))
     1554            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdDwrite))
    15531555            ("Set Dwrite (possibly high / always low)");
    15541556        T::AddEvent("ENABLE_CONTINOUS_TRIGGER", "B:1")
    1555             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdContTrigger))
     1557            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdContTrigger))
    15561558            ("Enable continous (internal) trigger.");
    15571559        T::AddEvent("ENABLE_TRIGGER_LINE", "B:1")
    1558             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdTriggerLine))
     1560            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdTriggerLine))
    15591561            ("Incoming triggers can be accepted/will not be accepted");
    15601562        T::AddEvent("ENABLE_COMMAND_SOCKET_MODE", "B:1")
    1561             (boost::bind(&StateMachineFAD::CmdEnable, this, _1, FAD::kCmdSocket))
     1563            (bind(&StateMachineFAD::CmdEnable, this, placeholders::_1, FAD::kCmdSocket))
    15621564            ("Set debug mode (yes: dump events through command socket, no=dump events through other sockets)");
    15631565
    15641566        T::AddEvent("SET_TRIGGER_RATE", "I:1")
    1565             (boost::bind(&StateMachineFAD::SetTriggerRate, this, _1))
     1567            (bind(&StateMachineFAD::SetTriggerRate, this, placeholders::_1))
    15661568            ("Enable continous trigger");
    15671569        T::AddEvent("SEND_SINGLE_TRIGGER")
    1568             (boost::bind(&StateMachineFAD::Trigger, this, 1))
     1570            (bind(&StateMachineFAD::Trigger, this, 1))
    15691571            ("Issue software triggers");
    15701572        T::AddEvent("SEND_N_TRIGGERS", "I")
    1571             (boost::bind(&StateMachineFAD::SendTriggers, this, _1))
     1573            (bind(&StateMachineFAD::SendTriggers, this, placeholders::_1))
    15721574            ("Issue software triggers");
    15731575        T::AddEvent("START_RUN", "")
    1574             (boost::bind(&StateMachineFAD::StartRun, this, _1, true))
     1576            (bind(&StateMachineFAD::StartRun, this, placeholders::_1, true))
    15751577            ("Set FAD DAQ mode. when started, no configurations must be send.");
    15761578        T::AddEvent("STOP_RUN")
    1577             (boost::bind(&StateMachineFAD::StartRun, this, _1, false))
     1579            (bind(&StateMachineFAD::StartRun, this, placeholders::_1, false))
    15781580            ("");
    15791581        T::AddEvent("PHASE_SHIFT", "S:1")
    1580             (boost::bind(&StateMachineFAD::PhaseShift, this, _1))
     1582            (bind(&StateMachineFAD::PhaseShift, this, placeholders::_1))
    15811583            ("Adjust ADC phase (in 'steps')");
    15821584
    15831585        T::AddEvent("RESET_EVENT_COUNTER")
    1584             (boost::bind(&StateMachineFAD::Cmd, this, FAD::kCmdResetEventCounter))
     1586            (bind(&StateMachineFAD::Cmd, this, FAD::kCmdResetEventCounter))
    15851587            ("");
    15861588
    15871589        T::AddEvent("SET_RUN_NUMBER", "X:1")
    1588             (boost::bind(&StateMachineFAD::SetRunNumber, this, _1))
     1590            (bind(&StateMachineFAD::SetRunNumber, this, placeholders::_1))
    15891591            ("");
    15901592
    15911593        T::AddEvent("SET_MAX_MEMORY", "S:1")
    1592             (boost::bind(&StateMachineFAD::SetMaxMemoryBuffer, this, _1))
     1594            (bind(&StateMachineFAD::SetMaxMemoryBuffer, this, placeholders::_1))
    15931595            ("Set maximum memory buffer size allowed to be consumed by the EventBuilder to buffer events."
    15941596             "|memory[short]:Buffer size in Mega-bytes.");
    15951597
    15961598        T::AddEvent("SET_REGISTER", "I:2")
    1597             (boost::bind(&StateMachineFAD::SetRegister, this, _1))
     1599            (bind(&StateMachineFAD::SetRegister, this, placeholders::_1))
    15981600            ("set register to value"
    15991601            "|addr[short]:Address of register"
     
    16021604        // FIXME:  Maybe add a mask which channels should be set?
    16031605        T::AddEvent("SET_REGION_OF_INTEREST", "I:2")
    1604             (boost::bind(&StateMachineFAD::SetRoi, this, _1))
     1606            (bind(&StateMachineFAD::SetRoi, this, placeholders::_1))
    16051607            ("Set region-of-interest to value"
    16061608            "|addr[short]:Address of register"
     
    16091611        // FIXME:  Maybe add a mask which channels should be set?
    16101612        T::AddEvent("SET_DAC_VALUE", "I:2")
    1611             (boost::bind(&StateMachineFAD::SetDac, this, _1))
     1613            (bind(&StateMachineFAD::SetDac, this, placeholders::_1))
    16121614            ("Set DAC numbers in range to value"
    16131615            "|addr[short]:Address of register (-1 for all)"
     
    16151617
    16161618        T::AddEvent("CONFIGURE", "C", FAD::kConnected, FAD::kConfigured)
    1617             (boost::bind(&StateMachineFAD::StartConfigure, this, _1))
     1619            (bind(&StateMachineFAD::StartConfigure, this, placeholders::_1))
    16181620            ("");
    16191621
    16201622        T::AddEvent("RESET_CONFIGURE", FAD::kConfiguring, FAD::kConfigured)
    1621             (boost::bind(&StateMachineFAD::ResetConfig, this))
     1623            (bind(&StateMachineFAD::ResetConfig, this))
    16221624            ("");
    16231625
    16241626        // Verbosity commands
    16251627        T::AddEvent("SET_VERBOSE", "B:1")
    1626             (boost::bind(&StateMachineFAD::SetVerbosity, this, _1))
     1628            (bind(&StateMachineFAD::SetVerbosity, this, placeholders::_1))
    16271629            ("Set verbosity state"
    16281630             "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data");
    16291631
    16301632        T::AddEvent("SET_HEX_OUTPUT", "B:1")
    1631             (boost::bind(&StateMachineFAD::SetHexOutput, this, _1))
     1633            (bind(&StateMachineFAD::SetHexOutput, this, placeholders::_1))
    16321634            ("Enable or disable hex output for received data"
    16331635             "|hexout[bool]:disable or enable hex output for received data (yes/no)");
    16341636
    16351637        T::AddEvent("SET_DATA_OUTPUT", "B:1")
    1636             (boost::bind(&StateMachineFAD::SetDataOutput, this, _1))
     1638            (bind(&StateMachineFAD::SetDataOutput, this, placeholders::_1))
    16371639            ("");
    16381640
    16391641        T::AddEvent("SET_DEBUG_TX", "B:1")
    1640             (boost::bind(&StateMachineFAD::SetDebugTx, this, _1))
     1642            (bind(&StateMachineFAD::SetDebugTx, this, placeholders::_1))
    16411643            ("Enable or disable the output of messages in case of successfull data transmission to the boards."
    16421644             "|debug[bool]:disable or enable debug output for transmitted data (yes/no)");
    16431645
    16441646        T::AddEvent("SET_DEBUG_EVENT_BUILDER_OUT", "B:1")
    1645             (boost::bind(&StateMachineFAD::SetDebugEb, this, _1))
     1647            (bind(&StateMachineFAD::SetDebugEb, this, placeholders::_1))
    16461648            ("");
    16471649
    16481650        T::AddEvent("PRINT_EVENT", "S:1")
    1649             (boost::bind(&StateMachineFAD::PrintEvent, this, _1))
     1651            (bind(&StateMachineFAD::PrintEvent, this, placeholders::_1))
    16501652            ("Print (last) event"
    16511653             "|board[short]:slot from which the event should be printed (-1 for all)");
    16521654
    16531655        T::AddEvent("DUMP_STREAM", "B:1")
    1654             (boost::bind(&StateMachineFAD::SetDumpStream, this, _1))
     1656            (bind(&StateMachineFAD::SetDumpStream, this, placeholders::_1))
    16551657            ("For debugging purpose: the binary data stream read from the sockets 0-7 can be dumped to files."
    16561658             "|switch[bool]:Enable (yes) or disable (no)");
    16571659
    16581660        T::AddEvent("DUMP_RECV", "B:1")
    1659             (boost::bind(&StateMachineFAD::SetDumpRecv, this, _1))
     1661            (bind(&StateMachineFAD::SetDumpRecv, this, placeholders::_1))
    16601662            ("For debugging purpose: the times when data has been receives are dumped to a file."
    16611663             "|switch[bool]:Enable (yes) or disable (no)");
    16621664
    16631665        T::AddEvent("BLOCK_TRANSMISSION", "S:1;B:1")
    1664             (boost::bind(&StateMachineFAD::SetBlockTransmission, this, _1))
     1666            (bind(&StateMachineFAD::SetBlockTransmission, this, placeholders::_1))
    16651667            ("Blocks the transmission of commands to the given slot. Use with care! For debugging pupose only!"
    16661668             "|slot[short]:Slot to which the command transmission should be blocked (0-39)"
     
    16681670
    16691671        T::AddEvent("BLOCK_TRANSMISSION_RANGE", "S:2;B:1")
    1670             (boost::bind(&StateMachineFAD::SetBlockTransmissionRange, this, _1))
     1672            (bind(&StateMachineFAD::SetBlockTransmissionRange, this, placeholders::_1))
    16711673            ("Blocks the transmission of commands to the given range of slots. Use with care! For debugging pupose only!"
    16721674             "|first[short]:First slot to which the command transmission should be blocked (0-39)"
     
    16751677
    16761678        T::AddEvent("IGNORE_EVENTS", "S:1;B:1")
    1677             (boost::bind(&StateMachineFAD::SetIgnoreSlot, this, _1))
     1679            (bind(&StateMachineFAD::SetIgnoreSlot, this, placeholders::_1))
    16781680            ("Instructs the event-builder to ignore events from the given slot but still read the data from the socket."
    16791681             "|slot[short]:Slot from which the data should be ignored when building events"
     
    16811683
    16821684        T::AddEvent("IGNORE_EVENTS_RANGE", "S:2;B:1")
    1683             (boost::bind(&StateMachineFAD::SetIgnoreSlots, this, _1))
     1685            (bind(&StateMachineFAD::SetIgnoreSlots, this, placeholders::_1))
    16841686            ("Instructs the event-builder to ignore events from the given slot but still read the data from the socket."
    16851687             "|first[short]:First slot from which the data should be ignored when building events"
     
    16881690
    16891691        T::AddEvent("CLOSE_OPEN_FILES", FAD::kConnecting, FAD::kConnected)
    1690             (boost::bind(&StateMachineFAD::CloseOpenFiles, this))
     1692            (bind(&StateMachineFAD::CloseOpenFiles, this))
    16911693            ("Close all run files opened by the EventBuilder.");
    16921694
    16931695        T::AddEvent("TEST", "S:1")
    1694            (boost::bind(&StateMachineFAD::Test, this, _1))
     1696           (bind(&StateMachineFAD::Test, this, placeholders::_1))
    16951697            ("");
    16961698
     
    16991701        // Conenction commands
    17001702        T::AddEvent("START", FAD::kOffline)
    1701             (boost::bind(&StateMachineFAD::StartConnection, this))
     1703            (bind(&StateMachineFAD::StartConnection, this))
    17021704            ("Start EventBuilder thread and connect all valid slots.");
    17031705
    17041706        T::AddEvent("STOP",  FAD::kDisconnected, FAD::kConnecting, FAD::kConnected)
    1705             (boost::bind(&StateMachineFAD::StopConnection, this))
     1707            (bind(&StateMachineFAD::StopConnection, this))
    17061708            ("Stop EventBuilder thread (still write buffered events) and disconnect all slots.");
    17071709
    17081710        T::AddEvent("ABORT", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected)
    1709             (boost::bind(&StateMachineFAD::AbortConnection, this))
     1711            (bind(&StateMachineFAD::AbortConnection, this))
    17101712            ("Immediately abort EventBuilder thread and disconnect all slots.");
    17111713
    17121714        T::AddEvent("SOFT_RESET", FAD::kConnected)
    1713             (boost::bind(&StateMachineFAD::Reset, this, true))
     1715            (bind(&StateMachineFAD::Reset, this, true))
    17141716            ("Wait for buffers to drain, close all files and reinitialize event builder thread.");
    17151717
    17161718        T::AddEvent("HARD_RESET", FAD::kConnected)
    1717             (boost::bind(&StateMachineFAD::Reset, this, false))
     1719            (bind(&StateMachineFAD::Reset, this, false))
    17181720            ("Free all buffers, close all files and reinitialize event builder thread.");
    17191721
    17201722        T::AddEvent("CONNECT", "S:1", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected)
    1721             (boost::bind(&StateMachineFAD::EnableSlot, this, _1, true))
     1723            (bind(&StateMachineFAD::EnableSlot, this, placeholders::_1, true))
    17221724            ("Connect a disconnected slot.");
    17231725
    17241726        T::AddEvent("DISCONNECT", "S:1", FAD::kConnecting, FAD::kConnected)
    1725             (boost::bind(&StateMachineFAD::EnableSlot, this, _1, false))
     1727            (bind(&StateMachineFAD::EnableSlot, this, placeholders::_1, false))
    17261728            ("Disconnect a connected slot.");
    17271729
    17281730        T::AddEvent("TOGGLE", "S:1", FAD::kDisconnected, FAD::kConnecting, FAD::kConnected)
    1729             (boost::bind(&StateMachineFAD::ToggleSlot, this, _1))
     1731            (bind(&StateMachineFAD::ToggleSlot, this, placeholders::_1))
    17301732            ("");
    17311733
    17321734        T::AddEvent("SET_FILE_FORMAT", "S:1")
    1733             (boost::bind(&StateMachineFAD::SetFileFormat, this, _1))
     1735            (bind(&StateMachineFAD::SetFileFormat, this, placeholders::_1))
    17341736            ("");
    17351737
    17361738
    17371739        T::AddEvent("ADD_ADDRESS", "C", FAD::kOffline)
    1738             (boost::bind(&StateMachineFAD::AddAddress, this, _1))
     1740            (bind(&StateMachineFAD::AddAddress, this, placeholders::_1))
    17391741            ("Add the address of a DRS4 board to the first free slot"
    17401742             "|IP[string]:address in the format <address:port>");
    17411743        T::AddEvent("REMOVE_SLOT", "S:1", FAD::kOffline)
    1742             (boost::bind(&StateMachineFAD::RemoveSlot, this, _1))
     1744            (bind(&StateMachineFAD::RemoveSlot, this, placeholders::_1))
    17431745            ("Remove the Iaddress in slot n. For a list see LIST"
    17441746             "|slot[short]:Remove the address in slot n from the list");
    17451747        T::AddEvent("LIST_SLOTS")
    1746             (boost::bind(&StateMachineFAD::ListSlots, this))
     1748            (bind(&StateMachineFAD::ListSlots, this))
    17471749            ("Print a list of all available board addressesa and whether they are enabled");
    17481750    }
     
    20232025    shell.SetReceiver(io_service);
    20242026
    2025     boost::thread t(boost::bind(RunThread, &io_service));
    2026     //boost::thread t(boost::bind(&StateMachineFAD<S>::Run, &io_service));
     2027    boost::thread t(bind(RunThread, &io_service));
     2028    //boost::thread t(bind(&StateMachineFAD<S>::Run, &io_service));
    20272029
    20282030    if (conf.Has("cmd"))
Note: See TracChangeset for help on using the changeset viewer.