Changeset 11481 for trunk/FACT++/src/ftmctrl.cc
- Timestamp:
- 07/20/11 08:03:38 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ftmctrl.cc
r11480 r11481 19 19 20 20 using namespace std; 21 using namespace std::placeholders; 21 22 22 23 // ------------------------------------------------------------------------ … … 1135 1136 } 1136 1137 1137 boost::function<int(const EventImp &)> Wrapper(boost::function<void()> func)1138 { 1139 return b oost::bind(&StateMachineFTM::Wrap, this, func);1138 function<int(const EventImp &)> Wrapper(function<void()> func) 1139 { 1140 return bind(&StateMachineFTM::Wrap, this, func); 1140 1141 } 1141 1142 … … 1706 1707 // deletion and creation of threads and more. 1707 1708 1709 1708 1710 // State names 1709 1711 T::AddStateName(FTM::kDisconnected, "Disconnected", … … 1731 1733 // FTM Commands 1732 1734 T::AddEvent("TOGGLE_LED", FTM::kIdle) 1733 (Wrapper(b oost::bind(&ConnectionFTM::CmdToggleLed, &fFTM)))1735 (Wrapper(bind(&ConnectionFTM::CmdToggleLed, &fFTM))) 1734 1736 ("toggle led"); 1735 1737 1736 1738 T::AddEvent("PING", FTM::kIdle) 1737 (Wrapper(b oost::bind(&ConnectionFTM::CmdPing, &fFTM)))1739 (Wrapper(bind(&ConnectionFTM::CmdPing, &fFTM))) 1738 1740 ("send ping"); 1739 1741 1740 1742 T::AddEvent("REQUEST_DYNAMIC_DATA", FTM::kIdle) 1741 (Wrapper(b oost::bind(&ConnectionFTM::CmdReqDynDat, &fFTM)))1743 (Wrapper(bind(&ConnectionFTM::CmdReqDynDat, &fFTM))) 1742 1744 ("request transmission of dynamic data block"); 1743 1745 1744 1746 T::AddEvent("REQUEST_STATIC_DATA", FTM::kIdle) 1745 (Wrapper(b oost::bind(&ConnectionFTM::CmdReqStatDat, &fFTM)))1747 (Wrapper(bind(&ConnectionFTM::CmdReqStatDat, &fFTM))) 1746 1748 ("request transmission of static data from FTM to memory"); 1747 1749 1748 1750 T::AddEvent("GET_REGISTER", "I", FTM::kIdle) 1749 (b oost::bind(&StateMachineFTM::GetRegister, this,_1))1751 (bind(&StateMachineFTM::GetRegister, this, placeholders::_1)) 1750 1752 ("read register from address addr" 1751 1753 "|addr[short]:Address of register"); 1752 1754 1753 1755 T::AddEvent("SET_REGISTER", "I:2", FTM::kIdle) 1754 (b oost::bind(&StateMachineFTM::SetRegister, this,_1))1756 (bind(&StateMachineFTM::SetRegister, this, placeholders::_1)) 1755 1757 ("set register to value" 1756 1758 "|addr[short]:Address of register" … … 1758 1760 1759 1761 T::AddEvent("START_RUN", FTM::kIdle, FTM::kConfigured) 1760 (Wrapper(b oost::bind(&ConnectionFTM::CmdStartRun, &fFTM)))1762 (Wrapper(bind(&ConnectionFTM::CmdStartRun, &fFTM))) 1761 1763 ("start a run (start distributing triggers)"); 1762 1764 1763 1765 T::AddEvent("STOP_RUN", FTM::kTakingData) 1764 (Wrapper(b oost::bind(&ConnectionFTM::CmdStopRun, &fFTM)))1766 (Wrapper(bind(&ConnectionFTM::CmdStopRun, &fFTM))) 1765 1767 ("stop a run (stop distributing triggers)"); 1766 1768 1767 1769 T::AddEvent("TAKE_N_EVENTS", "I", FTM::kIdle) 1768 (b oost::bind(&StateMachineFTM::TakeNevents, this,_1))1770 (bind(&StateMachineFTM::TakeNevents, this, placeholders::_1)) 1769 1771 ("take n events (distribute n triggers)|number[int]:Number of events to be taken"); 1770 1772 1771 1773 T::AddEvent("DISABLE_REPORTS", "B", FTM::kIdle) 1772 (b oost::bind(&StateMachineFTM::DisableReports, this,_1))1774 (bind(&StateMachineFTM::DisableReports, this, placeholders::_1)) 1773 1775 ("disable sending rate reports" 1774 1776 "|status[bool]:disable or enable that the FTM sends rate reports (yes/no)"); 1775 1777 1776 1778 T::AddEvent("SET_THRESHOLD", "I:2", FTM::kIdle) 1777 (b oost::bind(&StateMachineFTM::SetThreshold, this,_1))1779 (bind(&StateMachineFTM::SetThreshold, this, placeholders::_1)) 1778 1780 ("Set the comparator threshold" 1779 1781 "|Patch[idx]:Index of the patch (0-159), -1 for all" … … 1781 1783 1782 1784 T::AddEvent("SET_PRESCALING", "I:1", FTM::kIdle) 1783 (b oost::bind(&StateMachineFTM::SetPrescaling, this,_1))1785 (bind(&StateMachineFTM::SetPrescaling, this, placeholders::_1)) 1784 1786 ("" 1785 1787 "|[]:"); 1786 1788 1787 1789 T::AddEvent("ENABLE_FTU", "I:1;B:1", FTM::kIdle) 1788 (b oost::bind(&StateMachineFTM::EnableFTU, this,_1))1790 (bind(&StateMachineFTM::EnableFTU, this, placeholders::_1)) 1789 1791 ("Enable or disable FTU" 1790 1792 "|Board[idx]:Index of the board (0-39), -1 for all" … … 1792 1794 1793 1795 T::AddEvent("DISABLE_PIXEL", "S:1", FTM::kIdle) 1794 (b oost::bind(&StateMachineFTM::EnablePixel, this,_1, false))1796 (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, false)) 1795 1797 ("(-1 or all)"); 1796 1798 1797 1799 T::AddEvent("ENABLE_PIXEL", "S:1", FTM::kIdle) 1798 (b oost::bind(&StateMachineFTM::EnablePixel, this,_1, true))1800 (bind(&StateMachineFTM::EnablePixel, this, placeholders::_1, true)) 1799 1801 ("(-1 or all)"); 1800 1802 1801 1803 T::AddEvent("DISABLE_ALL_PIXELS_EXCEPT", "S:1", FTM::kIdle) 1802 (b oost::bind(&StateMachineFTM::DisableAllPixelsExcept, this,_1))1804 (bind(&StateMachineFTM::DisableAllPixelsExcept, this, placeholders::_1)) 1803 1805 (""); 1804 1806 1805 1807 T::AddEvent("DISABLE_ALL_PATCHES_EXCEPT", "S:1", FTM::kIdle) 1806 (b oost::bind(&StateMachineFTM::DisableAllPatchesExcept, this,_1))1808 (bind(&StateMachineFTM::DisableAllPatchesExcept, this, placeholders::_1)) 1807 1809 (""); 1808 1810 1809 1811 T::AddEvent("TOGGLE_PIXEL", "S:1", FTM::kIdle) 1810 (b oost::bind(&StateMachineFTM::TogglePixel, this,_1))1812 (bind(&StateMachineFTM::TogglePixel, this, placeholders::_1)) 1811 1813 (""); 1812 1814 1813 1815 T::AddEvent("TOGGLE_FTU", "I:1", FTM::kIdle) 1814 (b oost::bind(&StateMachineFTM::ToggleFTU, this,_1))1816 (bind(&StateMachineFTM::ToggleFTU, this, placeholders::_1)) 1815 1817 ("Toggle status of FTU (this is mainly meant to be used in the GUI)" 1816 1818 "|Board[idx]:Index of the board (0-39)"); 1817 1819 1818 1820 T::AddEvent("SET_TRIGGER_INTERVAL", "I:1", FTM::kIdle) 1819 (b oost::bind(&StateMachineFTM::SetTriggerInterval, this,_1))1821 (bind(&StateMachineFTM::SetTriggerInterval, this, placeholders::_1)) 1820 1822 ("Sets the trigger interval which is the distance between two consecutive artificial triggers." 1821 1823 "|interval[int]:The applied trigger interval is: interval*4ns+8ns"); 1822 1824 1823 1825 T::AddEvent("SET_TRIGGER_DELAY", "I:1", FTM::kIdle) 1824 (b oost::bind(&StateMachineFTM::SetTriggerDelay, this,_1))1826 (bind(&StateMachineFTM::SetTriggerDelay, this, placeholders::_1)) 1825 1827 ("" 1826 1828 "|delay[int]:The applied trigger delay is: delay*4ns+8ns"); 1827 1829 1828 1830 T::AddEvent("SET_TIME_MARKER_DELAY", "I:1", FTM::kIdle) 1829 (b oost::bind(&StateMachineFTM::SetTimeMarkerDelay, this,_1))1831 (bind(&StateMachineFTM::SetTimeMarkerDelay, this, placeholders::_1)) 1830 1832 ("" 1831 1833 "|delay[int]:The applied time marker delay is: delay*4ns+8ns"); 1832 1834 1833 1835 T::AddEvent("SET_DEAD_TIME", "I:1", FTM::kIdle) 1834 (b oost::bind(&StateMachineFTM::SetDeadTime, this,_1))1836 (bind(&StateMachineFTM::SetDeadTime, this, placeholders::_1)) 1835 1837 ("" 1836 1838 "|dead_time[int]:The applied dead time is: dead_time*4ns+8ns"); 1837 1839 1838 1840 T::AddEvent("ENABLE_TRIGGER", "B:1", FTM::kIdle) 1839 (b oost::bind(&StateMachineFTM::Enable, this,_1, FTM::StaticData::kTrigger))1841 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kTrigger)) 1840 1842 ("Switch on the physics trigger" 1841 1843 "|Enable[bool]:Enable physics trigger (yes/no)"); … … 1843 1845 // FIXME: Switch on/off depending on sequence 1844 1846 T::AddEvent("ENABLE_EXT1", "B:1", FTM::kIdle) 1845 (b oost::bind(&StateMachineFTM::Enable, this,_1, FTM::StaticData::kExt1))1847 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kExt1)) 1846 1848 ("Switch on the triggers through the first external line" 1847 1849 "|Enable[bool]:Enable ext1 trigger (yes/no)"); … … 1849 1851 // FIXME: Switch on/off depending on sequence 1850 1852 T::AddEvent("ENABLE_EXT2", "B:1", FTM::kIdle) 1851 (b oost::bind(&StateMachineFTM::Enable, this,_1, FTM::StaticData::kExt2))1853 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kExt2)) 1852 1854 ("Switch on the triggers through the second external line" 1853 1855 "|Enable[bool]:Enable ext2 trigger (yes/no)"); 1854 1856 1855 1857 T::AddEvent("ENABLE_VETO", "B:1", FTM::kIdle) 1856 (b oost::bind(&StateMachineFTM::Enable, this,_1, FTM::StaticData::kVeto))1858 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kVeto)) 1857 1859 ("Enable veto line" 1858 1860 "|Enable[bool]:Enable veto (yes/no)"); 1859 1861 1860 1862 T::AddEvent("ENABLE_CLOCK_CONDITIONER", "B:1", FTM::kIdle) 1861 (b oost::bind(&StateMachineFTM::Enable, this,_1, FTM::StaticData::kClockConditioner))1863 (bind(&StateMachineFTM::Enable, this, placeholders::_1, FTM::StaticData::kClockConditioner)) 1862 1864 ("Enable clock conidtioner output in favor of time marker output" 1863 1865 "|Enable[bool]:Enable clock conditioner (yes/no)"); 1864 1866 1865 1867 T::AddEvent("SET_TRIGGER_SEQUENCE", "S:3", FTM::kIdle) 1866 (b oost::bind(&StateMachineFTM::SetTriggerSeq, this,_1))1868 (bind(&StateMachineFTM::SetTriggerSeq, this, placeholders::_1)) 1867 1869 ("Setup the sequence of artificial triggers produced by the FTM" 1868 1870 "|Ped[short]:number of pedestal triggers in a row" … … 1871 1873 1872 1874 T::AddEvent("SET_TRIGGER_MULTIPLICITY", "S:1", FTM::kIdle) 1873 (b oost::bind(&StateMachineFTM::SetTriggerMultiplicity, this,_1))1875 (bind(&StateMachineFTM::SetTriggerMultiplicity, this, placeholders::_1)) 1874 1876 ("Setup the Multiplicity condition for physcis triggers" 1875 1877 "|N[int]:Number of requirered coincident triggers from sum-patches (1-40)"); 1876 1878 1877 1879 T::AddEvent("SET_TRIGGER_WINDOW", "S:1", FTM::kIdle) 1878 (b oost::bind(&StateMachineFTM::SetTriggerWindow, this,_1))1880 (bind(&StateMachineFTM::SetTriggerWindow, this, placeholders::_1)) 1879 1881 (""); 1880 1882 1881 1883 T::AddEvent("SET_CALIBRATION_MULTIPLICITY", "S:1", FTM::kIdle) 1882 (b oost::bind(&StateMachineFTM::SetCalibMultiplicity, this,_1))1884 (bind(&StateMachineFTM::SetCalibMultiplicity, this, placeholders::_1)) 1883 1885 ("Setup the Multiplicity condition for artificial (calibration) triggers" 1884 1886 "|N[int]:Number of requirered coincident triggers from sum-patches (1-40)"); 1885 1887 1886 1888 T::AddEvent("SET_CALIBRATION_WINDOW", "S:1", FTM::kIdle) 1887 (b oost::bind(&StateMachineFTM::SetCalibWindow, this,_1))1889 (bind(&StateMachineFTM::SetCalibWindow, this, placeholders::_1)) 1888 1890 (""); 1889 1891 1890 1892 T::AddEvent("SET_CLOCK_FREQUENCY", "S:1", FTM::kIdle) 1891 (b oost::bind(&StateMachineFTM::SetClockFrequency, this,_1))1893 (bind(&StateMachineFTM::SetClockFrequency, this, placeholders::_1)) 1892 1894 (""); 1893 1895 1894 1896 T::AddEvent("SET_CLOCK_REGISTER", "X:8", FTM::kIdle) 1895 (b oost::bind(&StateMachineFTM::SetClockRegister, this,_1))1897 (bind(&StateMachineFTM::SetClockRegister, this, placeholders::_1)) 1896 1898 (""); 1897 1899 … … 1899 1901 // we can allow it in idle _and_ taking data 1900 1902 T::AddEvent("CONFIGURE", "C", FTM::kIdle, FTM::kTakingData) 1901 (b oost::bind(&StateMachineFTM::ConfigureFTM, this,_1))1903 (bind(&StateMachineFTM::ConfigureFTM, this, placeholders::_1)) 1902 1904 (""); 1903 1905 1904 1906 T::AddEvent("RESET_CONFIGURE", FTM::kConfiguring1, FTM::kConfiguring2, FTM::kConfigured, FTM::kConfigError1, FTM::kConfigError2) 1905 (b oost::bind(&StateMachineFTM::ResetConfig, this))1907 (bind(&StateMachineFTM::ResetConfig, this)) 1906 1908 (""); 1907 1909 … … 1909 1911 1910 1912 T::AddEvent("RESET_CRATE", "S:1", FTM::kIdle) 1911 (b oost::bind(&StateMachineFTM::ResetCrate, this,_1))1913 (bind(&StateMachineFTM::ResetCrate, this, placeholders::_1)) 1912 1914 ("Reset one of the crates 0-3" 1913 1915 "|crate[short]:Crate number to be reseted (0-3)"); 1914 1916 1915 1917 T::AddEvent("RESET_CAMERA", FTM::kIdle) 1916 (Wrapper(b oost::bind(&ConnectionFTM::CmdResetCamera, &fFTM)))1918 (Wrapper(bind(&ConnectionFTM::CmdResetCamera, &fFTM))) 1917 1919 ("Reset all crates. The commands are sent in the order 0,1,2,3"); 1918 1920 … … 1920 1922 // Load/save static data block 1921 1923 T::AddEvent("SAVE", "C", FTM::kIdle) 1922 (b oost::bind(&StateMachineFTM::SaveStaticData, this,_1))1924 (bind(&StateMachineFTM::SaveStaticData, this, placeholders::_1)) 1923 1925 ("Saves the static data (FTM configuration) from memory to a file" 1924 1926 "|filename[string]:Filename (can include a path), .bin is automatically added"); 1925 1927 1926 1928 T::AddEvent("LOAD", "C", FTM::kIdle) 1927 (b oost::bind(&StateMachineFTM::LoadStaticData, this,_1))1929 (bind(&StateMachineFTM::LoadStaticData, this, placeholders::_1)) 1928 1930 ("Loads the static data (FTM configuration) from a file into memory and sends it to the FTM" 1929 1931 "|filename[string]:Filename (can include a path), .bin is automatically added"); … … 1933 1935 // Verbosity commands 1934 1936 T::AddEvent("SET_VERBOSE", "B") 1935 (b oost::bind(&StateMachineFTM::SetVerbosity, this,_1))1937 (bind(&StateMachineFTM::SetVerbosity, this, placeholders::_1)) 1936 1938 ("set verbosity state" 1937 1939 "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data"); 1938 1940 1939 1941 T::AddEvent("SET_HEX_OUTPUT", "B") 1940 (b oost::bind(&StateMachineFTM::SetHexOutput, this,_1))1942 (bind(&StateMachineFTM::SetHexOutput, this, placeholders::_1)) 1941 1943 ("enable or disable hex output for received data" 1942 1944 "|hexout[bool]:disable or enable hex output for received data (yes/no)"); 1943 1945 1944 1946 T::AddEvent("SET_DYNAMIC_OUTPUT", "B") 1945 (b oost::bind(&StateMachineFTM::SetDynamicOut, this,_1))1947 (bind(&StateMachineFTM::SetDynamicOut, this, placeholders::_1)) 1946 1948 ("enable or disable output for received dynamic data (data is still broadcasted via Dim)" 1947 1949 "|dynout[bool]:disable or enable output for dynamic data (yes/no)"); … … 1950 1952 // Conenction commands 1951 1953 T::AddEvent("DISCONNECT", FTM::kConnected, FTM::kIdle) 1952 (b oost::bind(&StateMachineFTM::Disconnect, this))1954 (bind(&StateMachineFTM::Disconnect, this)) 1953 1955 ("disconnect from ethernet"); 1954 1956 1955 1957 T::AddEvent("RECONNECT", "O", FTM::kDisconnected, FTM::kConnected, FTM::kIdle, FTM::kConfigured) 1956 (b oost::bind(&StateMachineFTM::Reconnect, this,_1))1958 (bind(&StateMachineFTM::Reconnect, this, placeholders::_1)) 1957 1959 ("(Re)connect ethernet connection to FTM, a new address can be given" 1958 1960 "|[host][string]:new ethernet address in the form <host:port>"); … … 2238 2240 shell.SetReceiver(io_service); 2239 2241 2240 boost::thread t(b oost::bind(RunThread, &io_service));2241 // boost::thread t(b oost::bind(&StateMachineFTM<S>::Run, &io_service));2242 boost::thread t(bind(RunThread, &io_service)); 2243 // boost::thread t(bind(&StateMachineFTM<S>::Run, &io_service)); 2242 2244 2243 2245 if (conf.Has("cmd"))
Note:
See TracChangeset
for help on using the changeset viewer.