Changeset 16732 for trunk/FACT++/src
- Timestamp:
- 06/05/13 21:24:37 (11 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/biasctrl.cc
r15250 r16732 7 7 #include "Shell.h" 8 8 #include "StateMachineDim.h" 9 #include "StateMachineAsio.h" 9 10 #include "ConnectionUSB.h" 10 11 #include "Configuration.h" … … 1549 1550 1550 1551 template <class T, class S> 1551 class StateMachineBias : public T, public ba::io_service, public ba::io_service::work1552 class StateMachineBias : public StateMachineAsio<T> 1552 1553 { 1553 1554 int Wrap(boost::function<void()> f) … … 1798 1799 // Now wait until all connection have been closed and 1799 1800 // all pending handlers have been processed 1800 poll();1801 ba::io_service::poll(); 1801 1802 1802 1803 if (evt.GetBool()) … … 1845 1846 int Execute() 1846 1847 { 1847 // Dispatch (execute) at most one handler from the queue. In contrary1848 // to run_one(), it doesn't wait until a handler is available1849 // which can be dispatched, so poll_one() might return with 01850 // handlers dispatched. The handlers are always dispatched/executed1851 // synchronously, i.e. within the call to poll_one()1852 poll_one();1853 1854 1848 return fExpertMode && fBias.GetStatus()>=State::kConnected ? 1855 1849 State::kExpertMode : fBias.GetStatus(); … … 1858 1852 public: 1859 1853 StateMachineBias(ostream &out=cout) : 1860 T(out, "BIAS_CONTROL"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 1861 fBias(*this, *this), fExpertMode(false) 1862 { 1863 // ba::io_service::work is a kind of keep_alive for the loop. 1864 // It prevents the io_service to go to stopped state, which 1865 // would prevent any consecutive calls to run() 1866 // or poll() to do nothing. reset() could also revoke to the 1867 // previous state but this might introduce some overhead of 1868 // deletion and creation of threads and more. 1869 1854 StateMachineAsio<T>(out, "BIAS_CONTROL"), fBias(*this, *this), fExpertMode(false) 1855 { 1870 1856 // State names 1871 1857 T::AddStateName(State::kDisconnected, "Disconnected", -
trunk/FACT++/src/drivectrl.cc
r15458 r16732 1 #include <boost/bind.hpp>2 1 #include <boost/regex.hpp> 3 2 … … 11 10 #include "Shell.h" 12 11 #include "StateMachineDim.h" 12 #include "StateMachineAsio.h" 13 13 #include "Connection.h" 14 14 #include "LocalControl.h" … … 778 778 779 779 template <class T, class S> 780 class StateMachineDrive : public T, public ba::io_service, public ba::io_service::work780 class StateMachineDrive : public StateMachineAsio<T> 781 781 { 782 782 private: … … 1179 1179 // Now wait until all connection have been closed and 1180 1180 // all pending handlers have been processed 1181 poll();1181 ba::io_service::poll(); 1182 1182 1183 1183 if (evt.GetBool()) … … 1210 1210 int Execute() 1211 1211 { 1212 // Dispatch (execute) at most one handler from the queue. In contrary1213 // to run_one(), it doesn't wait until a handler is available1214 // which can be dispatched, so poll_one() might return with 01215 // handlers dispatched. The handlers are always dispatched/executed1216 // synchronously, i.e. within the call to poll_one()1217 poll_one();1218 1219 1212 /* 1220 1213 if (T::GetCurrentState()==Drive::State::kLocked) … … 1271 1264 public: 1272 1265 StateMachineDrive(ostream &out=cout) : 1273 T(out, "DRIVE_CONTROL"), ba::io_service::work(static_cast<ba::io_service&>(*this)),1274 f Drive(*this, *this), fAutoResume(false), fSunRise(Time().GetNextSunRise())1266 StateMachineAsio<T>(out, "DRIVE_CONTROL"), fDrive(*this, *this), 1267 fAutoResume(false), fSunRise(Time().GetNextSunRise()) 1275 1268 { 1276 1269 // State names -
trunk/FACT++/src/fadctrl.cc
r16619 r16732 5 5 #include "Shell.h" 6 6 #include "StateMachineDim.h" 7 #include "StateMachineAsio.h" 7 8 #include "Connection.h" 8 9 #include "LocalControl.h" … … 544 545 545 546 template <class T> 546 class StateMachineFAD : public T, public EventBuilderWrapper, public ba::io_service, public ba::io_service::work547 class StateMachineFAD : public StateMachineAsio<T>, public EventBuilderWrapper 547 548 { 548 549 private: … … 1386 1387 int Execute() 1387 1388 { 1388 // Dispatch (execute) at most one handler from the queue. In contrary1389 // to run_one(), it doesn't wait until a handler is available1390 // which can be dispatched, so poll_one() might return with 01391 // handlers dispatched. The handlers are always dispatched/executed1392 // synchronously, i.e. within the call to poll_one()1393 poll_one();1394 1395 1389 // ===== Evaluate connection status ===== 1396 1390 … … 1648 1642 public: 1649 1643 StateMachineFAD(ostream &out=cout) : 1650 T(out, "FAD_CONTROL"), EventBuilderWrapper(*static_cast<MessageImp*>(this)), ba::io_service::work(static_cast<ba::io_service&>(*this)), 1644 StateMachineAsio<T>(out, "FAD_CONTROL"), 1645 EventBuilderWrapper(*static_cast<MessageImp*>(this)), 1651 1646 fStatus1(40), fStatus2(40), fStatusT(false), 1652 1647 fDimStartRun("FAD_CONTROL/START_RUN", "X:1;X:1", … … 1659 1654 "|thread[bool]:true or false whether the event builder threads are running") 1660 1655 { 1661 // ba::io_service::work is a kind of keep_alive for the loop.1662 // It prevents the io_service to go to stopped state, which1663 // would prevent any consecutive calls to run()1664 // or poll() to do nothing. reset() could also revoke to the1665 // previous state but this might introduce some overhead of1666 // deletion and creation of threads and more.1667 1656 ResetConfig(); 1668 1657 SetOutputFormat(FAD::kNone); … … 1949 1938 } 1950 1939 1951 tcp::resolver resolver( get_io_service());1940 tcp::resolver resolver(StateMachineAsio<T>::get_io_service()); 1952 1941 1953 1942 boost::system::error_code ec; -
trunk/FACT++/src/ftmctrl.cc
r16444 r16732 5 5 #include "Shell.h" 6 6 #include "StateMachineDim.h" 7 #include "StateMachineAsio.h" 7 8 #include "Connection.h" 8 9 #include "LocalControl.h" … … 1397 1398 1398 1399 template <class T, class S> 1399 class StateMachineFTM : public T, public ba::io_service, public ba::io_service::work1400 class StateMachineFTM : public StateMachineAsio<T> 1400 1401 { 1401 1402 int Wrap(function<void()> f) … … 1877 1878 // Now wait until all connection have been closed and 1878 1879 // all pending handlers have been processed 1879 poll();1880 ba::io_service::poll(); 1880 1881 1881 1882 if (evt.GetBool()) … … 1933 1934 int Execute() 1934 1935 { 1935 // Dispatch (execute) at most one handler from the queue. In contrary1936 // to run_one(), it doesn't wait until a handler is available1937 // which can be dispatched, so poll_one() might return with 01938 // handlers dispatched. The handlers are always dispatched/executed1939 // synchronously, i.e. within the call to poll_one()1940 poll_one();1941 1942 1936 // If FTM is neither in data taking nor idle, 1943 1937 // leave configuration state … … 2033 2027 public: 2034 2028 StateMachineFTM(ostream &out=cout) : 2035 T(out, "FTM_CONTROL"), ba::io_service::work(static_cast<ba::io_service&>(*this)), 2036 fFTM(*this, *this) 2037 { 2038 // ba::io_service::work is a kind of keep_alive for the loop. 2039 // It prevents the io_service to go to stopped state, which 2040 // would prevent any consecutive calls to run() 2041 // or poll() to do nothing. reset() could also revoke to the 2042 // previous state but this might introduce some overhead of 2043 // deletion and creation of threads and more. 2044 2045 2029 StateMachineAsio<T>(out, "FTM_CONTROL"), fFTM(*this, *this) 2030 { 2046 2031 // State names 2047 2032 T::AddStateName(FTM::State::kDisconnected, "Disconnected",
Note:
See TracChangeset
for help on using the changeset viewer.