Changeset 11982 for trunk/FACT++/src
- Timestamp:
- 09/06/11 12:49:44 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/RemoteControl.h
r11051 r11982 121 121 { 122 122 } 123 124 //void SetReceiver(void *) { } 123 125 124 126 bool PrintGeneralHelp() -
trunk/FACT++/src/argv.cc
r11229 r11982 4 4 5 5 using namespace std; 6 7 template<class T,class S> 8 std::ostream &operator<<(std::ostream &out, const pair<T,S> &f) 9 { 10 out << f.first << "|" << f.second; 11 return out; 12 } 13 template<class T, class S> 14 std::istream &operator>>(std::istream &in, pair<T,S> &f) 15 { 16 char c; 17 in >> f.first; 18 in >> c; 19 if (c!=':') 20 return in; 21 in >> f.second; 22 return in; 23 } 24 25 typedef pair<int,int> mytype; 26 27 28 //Source is OutputStreamable, meaning that an operator<< is defined 29 // that takes a std::ostream or std::wostream object on the left hand side 30 // and an instance of the argument type on the right. 31 32 // Target is InputStreamable, meaning that an operator>> is defined that 33 // takes a std::istream or std::wistream object on the left hand side and 34 // an instance of the result type on the right. 35 36 //Target is CopyConstructible [20.1.3]. 37 //Target is DefaultConstructible, meaning that it is possible to default-initialize an object of that type [8.5, 20.1.4]. 6 38 7 39 // -------------------------------------------------------------------------- … … 67 99 po::options_description config("Configuration"); 68 100 config.add_options() 101 ("xxx", vars<int>(), "Print available commandline options.") 102 ("test.*", var<int>(), "Print available commandline options.") 103 ("map.*", var<int>(), "Print available commandline options.") 69 104 ("compression", var<int>(), "set compression level") 70 105 ("optimization", var<int>(10, &opt), "optimization level") … … 82 117 ("switch", po_switch(), "include path") 83 118 ("bool", var<bool>()->implicit_value(true), "include path") 119 ("mytype", var<mytype>(), "include path") 84 120 ; 85 121 … … 170 206 cout << "Program " << argv[0] << " started successfully." << endl; 171 207 208 cout << conf.Has("test.A") << " " << conf.Get<int>("test.A") << endl; 209 cout << conf.Has("test.%") << " " << conf.Get<int>("test.%") << endl; 210 cout << conf.Has("test.9") << " " << conf.Get<int>("test.9") << endl; 211 cout << conf.Has("test.data") << " " << conf.Get<int>("test.data") << endl; 212 cout << conf.Has("test.pedestal") << " " << conf.Get<int>("test.pedestal") << endl; 213 cout << conf.Has("map.1") << " " << conf.Get<int>("map.1") << endl; 214 cout << conf.Has("map.2") << " " << conf.Get<int>("map.2") << endl; 215 216 return 0; 217 172 218 cout << conf.Has("switch") << " " << conf.Get<bool>("switch") << endl; 173 cout << conf.Has("bool") << " " << conf.Get<bool>("bool") << endl; 219 cout << conf.Has("bool") << " " << conf.Get<bool>("bool") << endl; 220 cout << conf.Has("mytype") << " " << conf.Get<mytype>("mytype") << endl; 221 222 cout << "---" << endl; 223 cout << conf.Has("test:A") << " " << conf.Get<int>("test:A") << endl; 224 cout << conf.Has("test:%") << " " << conf.Get<int>("test:%") << endl; 225 cout << conf.Has("test:9") << " " << conf.Get<int>("test:9") << endl; 226 227 /* 228 map<string, int> m = conf.GetMap<int>("test:"); 229 230 cout << m["test:A"] << endl; 231 cout << m["test:%"] << endl; 232 cout << m["test:9"] << endl; 233 */ 234 174 235 175 236 return 0; -
trunk/FACT++/src/biasctrl.cc
r11980 r11982 955 955 } 956 956 957 bool SetGapdReferenceCh(uint16_t ch) 958 { 959 if (!CheckChDac("SetGapdReferenceCh", fVoltGapd[ch], ch)) 960 return false; 961 962 fVoltRef[ch] = fVoltGapd[ch]; 963 964 if (!fIsRamping) 965 fIsRamping = RampOneStep(); 966 967 return true; 968 } 969 970 957 971 void SetZero() 958 972 { … … 1459 1473 } 1460 1474 1475 int SetGapdReferenceCh(const EventImp &evt) 1476 { 1477 if (!CheckEventSize(evt.GetSize(), "SetGapdReferenceCh", 2)) 1478 return false; 1479 1480 fBias.SetGapdReferenceCh(evt.GetUShort()); 1481 1482 return T::GetCurrentState(); 1483 } 1484 1485 1461 1486 // -------------------------------------------------------------------- 1462 1487 … … 1714 1739 ("Set a single channel a new DAC reference value. Starts ramping if necessary."); 1715 1740 1716 T::AddEvent("SET_G APD_REFERENCE_VOLTAGE", kConnected, kAtReference, kOverCurrent)1741 T::AddEvent("SET_GLOBAL_GAPD_REFERENCE_VOLTAGE", kConnected, kAtReference, kOverCurrent) 1717 1742 (Wrapper(bind(&ConnectionBias::SetGapdVoltage, &fBias, 0.))) 1718 1743 ("Set all channels to their G-APD reference voltage. Starts ramping if necessary."); 1744 1745 T::AddEvent("SET_CHANNEL_GAPD_REFERENCE_VOLTAGE", "S:1", kConnected, kAtReference, kOverCurrent) 1746 (bind(&StateMachineBias::SetGapdReferenceCh, this, placeholders::_1)) 1747 ("Set a single channel channels to its G-APD reference voltage. Starts ramping if necessary."); 1719 1748 1720 1749 T::AddEvent("SET_GAPD_REFERENCE_OFFSET", "F:1", kConnected, kAtReference, kOverCurrent) -
trunk/FACT++/src/logtime.cc
r11229 r11982 6 6 #include <iostream> 7 7 8 #include "DimDescriptionService.h" 9 8 10 int main(int, const char **) 9 11 { 10 // We could use putenv to make the Configure class change the value...12 // We could use putenv to make the Configure class change the value... 11 13 setenv("DIM_DNS_NODE", "localhost", 0); 12 14 … … 14 16 DimServer::start("TIME"); 15 17 18 usleep(2000000); 19 20 DimServer::stop(); 21 22 return 0; 23 16 24 // Some info on the console 17 25 std::cout << "Offering TIME/MESSAGE...\n" << std::endl; 26 27 short s; 28 int i; 29 long long ll; 30 float f; 31 DimDescribedService servt("TIME/TEST", "O:1;I:1;C", 32 "This is my test command|Char[c]:This is a char| Int This is an int|String[s]:This is a string"); 33 34 DimDescribedService servs("TIME/SHORT", s, "[a]"); 35 DimDescribedService servx("TIME/LONGLONG", ll, "|: This is my long long"); 36 DimDescribedService servi("TIME/INT", i, "|MyInt [ mi ] "); 37 DimDescribedService servf("TIME/FLOAT", f, "| MyFloat : This is my float"); 38 DimDescribedService servc("TIME/TIME", const_cast<char*>(""), "|MyTime[T]:This is my time"); 39 40 DimCommand cmd("TIME/CMD", "I:2;F:2"); 41 42 DimDescriptionService des("TIME/CMD", "|range[addr]:From DAC to DAC|values[DAC]:DAC values to be set"); 43 44 { 45 Time t0; 18 46 19 47 // Setup a DimService called TIME/MESSAGE … … 23 51 // Send current time 24 52 msg.Message(Time().GetAsStr()); 53 // servx.Update(); 54 /* 55 servs.updateService(); 56 servi.updateService(); 57 servf.updateService(); 58 servc.updateService(); 59 */ 60 // wait approximately one second 61 usleep(100000); 25 62 26 // wait approximately one second 27 usleep(1000000);63 // if (t0.UnixTime()-Time().UnixTime()<-5) 64 // break; 28 65 } 66 } 67 68 DimDescribedService servxx("TIME/XXX", const_cast<char*>(""), "|MyTime[T]:This is my time"); 69 usleep(10000000); 29 70 30 71 return 0; -
trunk/FACT++/src/mcp.cc
r11619 r11982 55 55 kStateConfiguring2, 56 56 kStateConfiguring3, 57 kStateConfiguring4, 57 58 kStateConfigured, 58 59 }; … … 271 272 } 272 273 274 Time fConfigTimer; 275 273 276 int Execute() 274 277 { … … 317 320 return GetCurrentState(); 318 321 322 fConfigTimer = Time(); 323 324 return kStateConfiguring4; 325 } 326 327 if (GetCurrentState()==kStateConfiguring4) 328 { 329 // We need some delay to ensure that after sending the 330 // "Enable Trigger Line" command to all FADs the really 331 // have all already enabled the trigger line 332 if (Time()-fConfigTimer<boost::posix_time::milliseconds(100)) 333 return kStateConfiguring4; 334 319 335 Message("Starting Trigger (FTM)"); 320 336 Dim::SendCommand("FTM_CONTROL/START_RUN"); … … 391 407 392 408 AddStateName(kStateConfiguring3, "Configuring3", 409 "."); 410 411 AddStateName(kStateConfiguring4, "Configuring4", 393 412 "."); 394 413
Note:
See TracChangeset
for help on using the changeset viewer.