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/ftmctrl.cc

    r11480 r11481  
    1919
    2020using namespace std;
     21using namespace std::placeholders;
    2122
    2223// ------------------------------------------------------------------------
     
    11351136    }
    11361137
    1137     boost::function<int(const EventImp &)> Wrapper(boost::function<void()> func)
    1138     {
    1139         return boost::bind(&StateMachineFTM::Wrap, this, func);
     1138    function<int(const EventImp &)> Wrapper(function<void()> func)
     1139    {
     1140        return bind(&StateMachineFTM::Wrap, this, func);
    11401141    }
    11411142
     
    17061707        // deletion and creation of threads and more.
    17071708
     1709
    17081710        // State names
    17091711        T::AddStateName(FTM::kDisconnected, "Disconnected",
     
    17311733        // FTM Commands
    17321734        T::AddEvent("TOGGLE_LED", FTM::kIdle)
    1733             (Wrapper(boost::bind(&ConnectionFTM::CmdToggleLed, &fFTM)))
     1735            (Wrapper(bind(&ConnectionFTM::CmdToggleLed, &fFTM)))
    17341736            ("toggle led");
    17351737
    17361738        T::AddEvent("PING", FTM::kIdle)
    1737             (Wrapper(boost::bind(&ConnectionFTM::CmdPing, &fFTM)))
     1739            (Wrapper(bind(&ConnectionFTM::CmdPing, &fFTM)))
    17381740            ("send ping");
    17391741
    17401742        T::AddEvent("REQUEST_DYNAMIC_DATA", FTM::kIdle)
    1741             (Wrapper(boost::bind(&ConnectionFTM::CmdReqDynDat, &fFTM)))
     1743            (Wrapper(bind(&ConnectionFTM::CmdReqDynDat, &fFTM)))
    17421744            ("request transmission of dynamic data block");
    17431745
    17441746        T::AddEvent("REQUEST_STATIC_DATA", FTM::kIdle)
    1745             (Wrapper(boost::bind(&ConnectionFTM::CmdReqStatDat, &fFTM)))
     1747            (Wrapper(bind(&ConnectionFTM::CmdReqStatDat, &fFTM)))
    17461748            ("request transmission of static data from FTM to memory");
    17471749
    17481750        T::AddEvent("GET_REGISTER", "I", FTM::kIdle)
    1749             (boost::bind(&StateMachineFTM::GetRegister, this, _1))
     1751            (bind(&StateMachineFTM::GetRegister, this, placeholders::_1))
    17501752            ("read register from address addr"
    17511753            "|addr[short]:Address of register");
    17521754
    17531755        T::AddEvent("SET_REGISTER", "I:2", FTM::kIdle)
    1754             (boost::bind(&StateMachineFTM::SetRegister, this, _1))
     1756            (bind(&StateMachineFTM::SetRegister, this, placeholders::_1))
    17551757            ("set register to value"
    17561758            "|addr[short]:Address of register"
     
    17581760
    17591761        T::AddEvent("START_RUN", FTM::kIdle, FTM::kConfigured)
    1760             (Wrapper(boost::bind(&ConnectionFTM::CmdStartRun, &fFTM)))
     1762            (Wrapper(bind(&ConnectionFTM::CmdStartRun, &fFTM)))
    17611763            ("start a run (start distributing triggers)");
    17621764
    17631765        T::AddEvent("STOP_RUN", FTM::kTakingData)
    1764             (Wrapper(boost::bind(&ConnectionFTM::CmdStopRun, &fFTM)))
     1766            (Wrapper(bind(&ConnectionFTM::CmdStopRun, &fFTM)))
    17651767            ("stop a run (stop distributing triggers)");
    17661768
    17671769        T::AddEvent("TAKE_N_EVENTS", "I", FTM::kIdle)
    1768             (boost::bind(&StateMachineFTM::TakeNevents, this, _1))
     1770            (bind(&StateMachineFTM::TakeNevents, this, placeholders::_1))
    17691771            ("take n events (distribute n triggers)|number[int]:Number of events to be taken");
    17701772
    17711773        T::AddEvent("DISABLE_REPORTS", "B", FTM::kIdle)
    1772             (boost::bind(&StateMachineFTM::DisableReports, this, _1))
     1774            (bind(&StateMachineFTM::DisableReports, this, placeholders::_1))
    17731775            ("disable sending rate reports"
    17741776             "|status[bool]:disable or enable that the FTM sends rate reports (yes/no)");
    17751777
    17761778        T::AddEvent("SET_THRESHOLD", "I:2", FTM::kIdle)
    1777             (boost::bind(&StateMachineFTM::SetThreshold, this, _1))
     1779            (bind(&StateMachineFTM::SetThreshold, this, placeholders::_1))
    17781780            ("Set the comparator threshold"
    17791781             "|Patch[idx]:Index of the patch (0-159), -1 for all"
     
    17811783
    17821784        T::AddEvent("SET_PRESCALING", "I:1", FTM::kIdle)
    1783             (boost::bind(&StateMachineFTM::SetPrescaling, this, _1))
     1785            (bind(&StateMachineFTM::SetPrescaling, this, placeholders::_1))
    17841786            (""
    17851787             "|[]:");
    17861788
    17871789        T::AddEvent("ENABLE_FTU", "I:1;B:1", FTM::kIdle)
    1788             (boost::bind(&StateMachineFTM::EnableFTU, this, _1))
     1790            (bind(&StateMachineFTM::EnableFTU, this, placeholders::_1))
    17891791            ("Enable or disable FTU"
    17901792             "|Board[idx]:Index of the board (0-39), -1 for all"
     
    17921794
    17931795        T::AddEvent("DISABLE_PIXEL", "S:1", FTM::kIdle)
    1794             (boost::bind(&StateMachineFTM::EnablePixel, this, _1, false))
     1796            (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, false))
    17951797            ("(-1 or all)");
    17961798
    17971799        T::AddEvent("ENABLE_PIXEL", "S:1", FTM::kIdle)
    1798             (boost::bind(&StateMachineFTM::EnablePixel, this, _1, true))
     1800            (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, true))
    17991801            ("(-1 or all)");
    18001802
    18011803        T::AddEvent("DISABLE_ALL_PIXELS_EXCEPT", "S:1", FTM::kIdle)
    1802             (boost::bind(&StateMachineFTM::DisableAllPixelsExcept, this, _1))
     1804            (bind(&StateMachineFTM::DisableAllPixelsExcept, this, placeholders::_1))
    18031805            ("");
    18041806
    18051807        T::AddEvent("DISABLE_ALL_PATCHES_EXCEPT", "S:1", FTM::kIdle)
    1806             (boost::bind(&StateMachineFTM::DisableAllPatchesExcept, this, _1))
     1808            (bind(&StateMachineFTM::DisableAllPatchesExcept, this, placeholders::_1))
    18071809            ("");
    18081810
    18091811        T::AddEvent("TOGGLE_PIXEL", "S:1", FTM::kIdle)
    1810             (boost::bind(&StateMachineFTM::TogglePixel, this, _1))
     1812            (bind(&StateMachineFTM::TogglePixel, this, placeholders::_1))
    18111813            ("");
    18121814
    18131815        T::AddEvent("TOGGLE_FTU", "I:1", FTM::kIdle)
    1814             (boost::bind(&StateMachineFTM::ToggleFTU, this, _1))
     1816            (bind(&StateMachineFTM::ToggleFTU, this, placeholders::_1))
    18151817            ("Toggle status of FTU (this is mainly meant to be used in the GUI)"
    18161818             "|Board[idx]:Index of the board (0-39)");
    18171819
    18181820        T::AddEvent("SET_TRIGGER_INTERVAL", "I:1", FTM::kIdle)
    1819             (boost::bind(&StateMachineFTM::SetTriggerInterval, this, _1))
     1821            (bind(&StateMachineFTM::SetTriggerInterval, this, placeholders::_1))
    18201822            ("Sets the trigger interval which is the distance between two consecutive artificial triggers."
    18211823             "|interval[int]:The applied trigger interval is: interval*4ns+8ns");
    18221824
    18231825        T::AddEvent("SET_TRIGGER_DELAY", "I:1", FTM::kIdle)
    1824             (boost::bind(&StateMachineFTM::SetTriggerDelay, this, _1))
     1826            (bind(&StateMachineFTM::SetTriggerDelay, this, placeholders::_1))
    18251827            (""
    18261828             "|delay[int]:The applied trigger delay is: delay*4ns+8ns");
    18271829
    18281830        T::AddEvent("SET_TIME_MARKER_DELAY", "I:1", FTM::kIdle)
    1829             (boost::bind(&StateMachineFTM::SetTimeMarkerDelay, this, _1))
     1831            (bind(&StateMachineFTM::SetTimeMarkerDelay, this, placeholders::_1))
    18301832            (""
    18311833            "|delay[int]:The applied time marker delay is: delay*4ns+8ns");
    18321834
    18331835        T::AddEvent("SET_DEAD_TIME", "I:1", FTM::kIdle)
    1834             (boost::bind(&StateMachineFTM::SetDeadTime, this, _1))
     1836            (bind(&StateMachineFTM::SetDeadTime, this, placeholders::_1))
    18351837            (""
    18361838            "|dead_time[int]:The applied dead time is: dead_time*4ns+8ns");
    18371839
    18381840        T::AddEvent("ENABLE_TRIGGER", "B:1", FTM::kIdle)
    1839             (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kTrigger))
     1841            (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kTrigger))
    18401842            ("Switch on the physics trigger"
    18411843             "|Enable[bool]:Enable physics trigger (yes/no)");
     
    18431845        // FIXME: Switch on/off depending on sequence
    18441846        T::AddEvent("ENABLE_EXT1", "B:1", FTM::kIdle)
    1845             (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kExt1))
     1847            (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kExt1))
    18461848            ("Switch on the triggers through the first external line"
    18471849             "|Enable[bool]:Enable ext1 trigger (yes/no)");
     
    18491851        // FIXME: Switch on/off depending on sequence
    18501852        T::AddEvent("ENABLE_EXT2", "B:1", FTM::kIdle)
    1851             (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kExt2))
     1853            (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kExt2))
    18521854            ("Switch on the triggers through the second external line"
    18531855             "|Enable[bool]:Enable ext2 trigger (yes/no)");
    18541856
    18551857        T::AddEvent("ENABLE_VETO", "B:1", FTM::kIdle)
    1856             (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kVeto))
     1858            (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kVeto))
    18571859            ("Enable veto line"
    18581860             "|Enable[bool]:Enable veto (yes/no)");
    18591861
    18601862        T::AddEvent("ENABLE_CLOCK_CONDITIONER", "B:1", FTM::kIdle)
    1861             (boost::bind(&StateMachineFTM::Enable, this, _1, FTM::StaticData::kClockConditioner))
     1863            (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kClockConditioner))
    18621864            ("Enable clock conidtioner output in favor of time marker output"
    18631865             "|Enable[bool]:Enable clock conditioner (yes/no)");
    18641866
    18651867        T::AddEvent("SET_TRIGGER_SEQUENCE", "S:3", FTM::kIdle)
    1866             (boost::bind(&StateMachineFTM::SetTriggerSeq, this, _1))
     1868            (bind(&StateMachineFTM::SetTriggerSeq, this, placeholders::_1))
    18671869            ("Setup the sequence of artificial triggers produced by the FTM"
    18681870             "|Ped[short]:number of pedestal triggers in a row"
     
    18711873
    18721874        T::AddEvent("SET_TRIGGER_MULTIPLICITY", "S:1", FTM::kIdle)
    1873             (boost::bind(&StateMachineFTM::SetTriggerMultiplicity, this, _1))
     1875            (bind(&StateMachineFTM::SetTriggerMultiplicity, this, placeholders::_1))
    18741876            ("Setup the Multiplicity condition for physcis triggers"
    18751877             "|N[int]:Number of requirered coincident triggers from sum-patches (1-40)");
    18761878
    18771879        T::AddEvent("SET_TRIGGER_WINDOW", "S:1", FTM::kIdle)
    1878             (boost::bind(&StateMachineFTM::SetTriggerWindow, this, _1))
     1880            (bind(&StateMachineFTM::SetTriggerWindow, this, placeholders::_1))
    18791881            ("");
    18801882
    18811883        T::AddEvent("SET_CALIBRATION_MULTIPLICITY", "S:1", FTM::kIdle)
    1882             (boost::bind(&StateMachineFTM::SetCalibMultiplicity, this, _1))
     1884            (bind(&StateMachineFTM::SetCalibMultiplicity, this, placeholders::_1))
    18831885            ("Setup the Multiplicity condition for artificial (calibration) triggers"
    18841886             "|N[int]:Number of requirered coincident triggers from sum-patches (1-40)");
    18851887
    18861888        T::AddEvent("SET_CALIBRATION_WINDOW", "S:1", FTM::kIdle)
    1887             (boost::bind(&StateMachineFTM::SetCalibWindow, this, _1))
     1889            (bind(&StateMachineFTM::SetCalibWindow, this, placeholders::_1))
    18881890            ("");
    18891891
    18901892        T::AddEvent("SET_CLOCK_FREQUENCY", "S:1", FTM::kIdle)
    1891             (boost::bind(&StateMachineFTM::SetClockFrequency, this, _1))
     1893            (bind(&StateMachineFTM::SetClockFrequency, this, placeholders::_1))
    18921894            ("");
    18931895
    18941896        T::AddEvent("SET_CLOCK_REGISTER", "X:8", FTM::kIdle)
    1895             (boost::bind(&StateMachineFTM::SetClockRegister, this, _1))
     1897            (bind(&StateMachineFTM::SetClockRegister, this, placeholders::_1))
    18961898            ("");
    18971899
     
    18991901        // we can allow it in idle _and_ taking data
    19001902        T::AddEvent("CONFIGURE", "C", FTM::kIdle, FTM::kTakingData)
    1901             (boost::bind(&StateMachineFTM::ConfigureFTM, this, _1))
     1903            (bind(&StateMachineFTM::ConfigureFTM, this, placeholders::_1))
    19021904            ("");
    19031905
    19041906        T::AddEvent("RESET_CONFIGURE", FTM::kConfiguring1, FTM::kConfiguring2, FTM::kConfigured, FTM::kConfigError1, FTM::kConfigError2)
    1905             (boost::bind(&StateMachineFTM::ResetConfig, this))
     1907            (bind(&StateMachineFTM::ResetConfig, this))
    19061908            ("");
    19071909
     
    19091911
    19101912        T::AddEvent("RESET_CRATE", "S:1", FTM::kIdle)
    1911             (boost::bind(&StateMachineFTM::ResetCrate, this, _1))
     1913            (bind(&StateMachineFTM::ResetCrate, this, placeholders::_1))
    19121914            ("Reset one of the crates 0-3"
    19131915             "|crate[short]:Crate number to be reseted (0-3)");
    19141916
    19151917        T::AddEvent("RESET_CAMERA", FTM::kIdle)
    1916             (Wrapper(boost::bind(&ConnectionFTM::CmdResetCamera, &fFTM)))
     1918            (Wrapper(bind(&ConnectionFTM::CmdResetCamera, &fFTM)))
    19171919            ("Reset all crates. The commands are sent in the order 0,1,2,3");
    19181920
     
    19201922        // Load/save static data block
    19211923        T::AddEvent("SAVE", "C", FTM::kIdle)
    1922             (boost::bind(&StateMachineFTM::SaveStaticData, this, _1))
     1924            (bind(&StateMachineFTM::SaveStaticData, this, placeholders::_1))
    19231925            ("Saves the static data (FTM configuration) from memory to a file"
    19241926             "|filename[string]:Filename (can include a path), .bin is automatically added");
    19251927
    19261928        T::AddEvent("LOAD", "C", FTM::kIdle)
    1927             (boost::bind(&StateMachineFTM::LoadStaticData, this, _1))
     1929            (bind(&StateMachineFTM::LoadStaticData, this, placeholders::_1))
    19281930            ("Loads the static data (FTM configuration) from a file into memory and sends it to the FTM"
    19291931             "|filename[string]:Filename (can include a path), .bin is automatically added");
     
    19331935        // Verbosity commands
    19341936        T::AddEvent("SET_VERBOSE", "B")
    1935             (boost::bind(&StateMachineFTM::SetVerbosity, this, _1))
     1937            (bind(&StateMachineFTM::SetVerbosity, this, placeholders::_1))
    19361938            ("set verbosity state"
    19371939             "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data");
    19381940
    19391941        T::AddEvent("SET_HEX_OUTPUT", "B")
    1940             (boost::bind(&StateMachineFTM::SetHexOutput, this, _1))
     1942            (bind(&StateMachineFTM::SetHexOutput, this, placeholders::_1))
    19411943            ("enable or disable hex output for received data"
    19421944             "|hexout[bool]:disable or enable hex output for received data (yes/no)");
    19431945
    19441946        T::AddEvent("SET_DYNAMIC_OUTPUT", "B")
    1945             (boost::bind(&StateMachineFTM::SetDynamicOut, this, _1))
     1947            (bind(&StateMachineFTM::SetDynamicOut, this, placeholders::_1))
    19461948            ("enable or disable output for received dynamic data (data is still broadcasted via Dim)"
    19471949             "|dynout[bool]:disable or enable output for dynamic data (yes/no)");
     
    19501952        // Conenction commands
    19511953        T::AddEvent("DISCONNECT", FTM::kConnected, FTM::kIdle)
    1952             (boost::bind(&StateMachineFTM::Disconnect, this))
     1954            (bind(&StateMachineFTM::Disconnect, this))
    19531955            ("disconnect from ethernet");
    19541956
    19551957        T::AddEvent("RECONNECT", "O", FTM::kDisconnected, FTM::kConnected, FTM::kIdle, FTM::kConfigured)
    1956             (boost::bind(&StateMachineFTM::Reconnect, this, _1))
     1958            (bind(&StateMachineFTM::Reconnect, this, placeholders::_1))
    19571959            ("(Re)connect ethernet connection to FTM, a new address can be given"
    19581960             "|[host][string]:new ethernet address in the form <host:port>");
     
    22382240    shell.SetReceiver(io_service);
    22392241
    2240     boost::thread t(boost::bind(RunThread, &io_service));
    2241     // boost::thread t(boost::bind(&StateMachineFTM<S>::Run, &io_service));
     2242    boost::thread t(bind(RunThread, &io_service));
     2243    // boost::thread t(bind(&StateMachineFTM<S>::Run, &io_service));
    22422244
    22432245    if (conf.Has("cmd"))
Note: See TracChangeset for help on using the changeset viewer.