|
Go to the documentation of this file.
50 FD_DHV( "AttributeDeviceEvent::AttributeDeviceEvent(" << this << ")");
51 pOutputPrototype= FallbackAttributep();
52 pInputPrototype= FallbackAttributep();
63 FD_DHV( "AttributeDeviceEvent(" << this << "): form other attr " << &rOtherAttr);
91 FD_DHV( "AttributeDeviceEvent(" << this << "):DoAssign(): "
92 << typeid(*this).name() << " from " << typeid(rSrcAttr).name());
109 FD_DHV( "AttributeDeviceEvent(" << this << ")::DoRead(tr)");
170 #ifdef FAUDES_DEBUG_IOPERF
174 mPerformanceEndIterator = 0;
175 mPerformanceBeginIterator = 0;
185 static std::set<vDevice*> *dlist = new std::set< vDevice* >();
201 #ifdef FAUDES_DEBUG_IOPERF
203 delete mpPerformanceWaitEnter;
204 delete mpPerformanceWaitExit;
214 FD_DHV( "vDevice::FromTokenReader()");
219 std::stringstream errstr;
220 errstr << "Expected Begin Section in \"" << rTr. FileName() << "\"";
221 throw Exception( "vDevice::FromFile", errstr.str(), 52);
225 FD_DHV( "vDevice::FromFile(" << rTr. FileName() << "): device type " << ftype);
228 std::stringstream errstr;
229 errstr << "Unknown type \"" << ftype << "\" at \"" << rTr. FileLine() << "\"";
230 throw Exception( "vDevice()::FromFile", errstr.str(), 52);
236 std::stringstream errstr;
237 errstr << "Could not cast to device object from type \"" << ftype << "\" at \"" << rTr. FileLine() << "\")";
238 throw Exception( "vDevice()::FromFile", errstr.str(), 52);
249 FD_DHV( "vDevice::FromFile(" << rFileName << ")");
261 FD_DH( "vDevice::StopAll()");
263 std::set<vDevice*>::const_iterator dit;
265 if( dynamic_cast<xDevice*>(*dit) ) continue;
266 FD_DH( "vDevice::StopAll(): Reset: " << (*dit)->Name());
271 if( dynamic_cast<xDevice*>(*dit) ) continue;
272 FD_DH( "vDevice::StopAll(): Stop " << (*dit)->Name());
276 FD_DH( "vDevice::StopAll(): done");
287 std::stringstream errstr;
288 errstr << "cannot start device when not configured";
289 throw Exception( "vDevice()::Start()", errstr.str(), 550);
341 FD_DHV( "vDevice(" << mName << ")::Name(\"" << rName << "\")");
361 switch(currentState) {
362 case Down: res= "down"; break;
363 case StartUp: res= "starting up"; break;
364 case Up: res= "up and running"; break;
365 case ShutDown: res= "shutting down"; break;
374 (void) pContext; (void) rTw;
377 std::string label=rLabel;
396 (void) pContext; (void) rTw;
409 (void) pContext; (void) rTw;
411 FD_DHV( "vDevice("<< mName<< ")::DoWriteConfiguration()");
413 std::string label=rLabel;
414 if(label == "") label = "EventConfiguration";
421 #ifdef FAUDES_DEBUG_CODE
423 std::stringstream errstr;
424 errstr << "Invalid attribute configuration";
425 throw Exception( "vDevice::DoWriteConfiguration", errstr.str(), 550);
451 attrp-> Write(rTw, "",pContext);
452 etoken.SetEnd( "Event");
466 (void) pContext; (void) rLabel; (void) rTr;
471 std::string label = rLabel;
494 std::string label=rLabel;
495 if(label== "") label= "EventConfiguration";
507 FD_DHV( "vDevice("<< mName<< ")::DoReadConfiguration()");
511 #ifdef FAUDES_DEBUG_CODE
513 std::stringstream errstr;
514 errstr << "Invalid attribute configuration" << rTr. FileLine();
515 throw Exception( "vDevice::DoReadConfiguration", errstr.str(), 550);
519 FD_DHV( "vDevice::DoReadConfiguration(" << this << "): attribute type " << typeid(*attrp).name());
523 while(!rTr. Eos(label)) {
532 attrp-> Read(rTr, "",pContext);
544 FD_DHV( "vDevice(" << this << ")::DoReadConfiguration(..): " << token. Str() << "\"");
555 if((iotype== "input") || (iotype== "output")) {
565 std::stringstream errstr;
566 errstr << "Invalid token of type " << token. Type() << " at " << rTr. FileLine();
567 throw Exception( "vDevice::DoReadConfiguration", errstr.str(), 50);
575 (void) pContext; (void) rLabel; (void) rTr;
608 FD_DHV( "vDevice(" << mName << ")::Configure(event)");
612 if( typeid(attr)!= typeid(*cap)) {
613 std::stringstream errstr;
614 errstr << "Cannot cast attribute to device event attribute";
615 throw Exception( "vDevice::Configure", errstr.str(), 550);
626 FD_DHV( "vDevice(" << mName << ")::Configure(alphabet)");
631 if( typeid(*oap)!= typeid(*cap)) {
632 std::stringstream errstr;
633 errstr << "Cannot cast attribute to device event attribute";
634 throw Exception( "vDevice::Configure", errstr.str(), 550);
637 for(EventSet::Iterator eit=rPhysicalEvents. Begin(); eit!=rPhysicalEvents. End(); eit++) {
661 std::stringstream errstr;
662 errstr << "Cannot cast attribute to device event attribute";
663 throw Exception( "vDevice()::Configure", errstr.str(), 550);
673 FD_DHV( "vDevice(" << mName << ")::UseCondition()");
703 faudes_systime_t res;
705 faudes_systime_t now;
706 faudes_gettimeofday(&now);
710 faudes_systime_t delta;
711 delta.tv_sec = durationMsec/1000;
712 delta.tv_nsec = ( durationMsec - (delta.tv_sec*1000) ) *1000000;
735 return ( long int)((1.0/ mTimeScale)*real_time/1000*1000);
743 faudes_systime_t now;
744 faudes_gettimeofday(&now);
746 faudes_systime_t diff;
749 return ( long int) ((1000.0/ mTimeScale) * (diff.tv_sec + diff.tv_nsec*1e-9));
764 faudes_systime_t now;
765 faudes_gettimeofday(&now);
767 faudes_systime_t diffTime;
770 return 1000*diffTime.tv_sec + diffTime.tv_nsec/1000000;
777 FD_DHV( "vDevice("<< mName<< ")::CurrentTimeMs(nowms) ");
779 faudes_systime_t now;
780 faudes_gettimeofday(&now);
782 faudes_systime_t delta;
783 delta.tv_sec = nowms/1000;
784 delta.tv_nsec = 1000000*(nowms%1000);
803 FD_DHV( "vDevice("<< mName<< ")::WaitInputs("<< duration << ")");
806 if(duration> 3600*24) { duration= 3600*24;};
818 if(!sr && duration>0) {
820 #ifdef FAUDES_DEBUG_IOPERF
822 faudes_systime_t now;
823 faudes_gettimeofday(&now);
824 mpPerformanceWaitEnter[mPerformanceEndIterator]=now;
830 FD_DHV( "vDevice("<< mName<< ")::WaitInputs("<< duration << "): waiting for condition");
836 #ifdef FAUDES_DEBUG_IOPERF
838 faudes_gettimeofday(&now);
839 mpPerformanceWaitExit[mPerformanceEndIterator]=now;
840 mPerformanceEndIterator++;
842 mPerformanceEndIterator=0;
843 if(mPerformanceEndIterator == mPerformanceBeginIterator)
844 mPerformanceBeginIterator++;
846 mPerformanceBeginIterator=0;
863 FD_DHV( "vDevice("<< mName<< ")::WaitInputsMs("<< duration << ")");
866 if(duration> 30*3600*24) { duration= 30*3600*24;};
877 if(!sr && duration>0) {
879 #ifdef FAUDES_DEBUG_IOPERF
881 faudes_systime_t now;
882 faudes_gettimeofday(&now);
883 mpPerformanceWaitEnter[mPerformanceEndIterator]=now;
887 faudes_systime_t condtime;
894 #ifdef FAUDES_DEBUG_IOPERF
896 faudes_gettimeofday(&now);
897 mpPerformanceWaitExit[mPerformanceEndIterator]=now;
898 mPerformanceEndIterator++;
900 mPerformanceEndIterator=0;
901 if(mPerformanceEndIterator == mPerformanceBeginIterator)
902 mPerformanceBeginIterator++;
904 mPerformanceBeginIterator=0;
944 FD_DHV( "vDevice("<< mName<< ")::ReadInput(): found: " << res);
965 FD_DHV( "vDevice("<< mName<< ")::PeekInput(): found: " << res);
988 #ifdef FAUDES_DEBUG_IOPERF
990 FD_DHV( "vDevice::Performance(" << Name() << "): " << mPerformanceBeginIterator << " " << mPerformanceEndIterator);
994 busyduration. Dim(50);
995 busyduration. Clear();
996 busyduration. Name( "performance " + Name() + " (busy duration in usecs)");
999 for( int i = mPerformanceBeginIterator; ;i++){
1003 if(ip==mPerformanceEndIterator) break;
1004 faudes_systime_t busy;
1006 busyduration. Sample(busy.tv_sec*1000000 + busy.tv_nsec/1000);
1013 return busyduration;
1017 FD_DHV( "vDevice::Performance(" << Name() << "): not enabled");
1019 busyduration. Name( "performance monitoring not enabled");
1020 return busyduration;
1027 #ifdef FAUDES_DEBUG_IOPERF
1030 busyduration. Write();
1032 std::cout << busyduration. Str() << std::endl;
1039 #ifdef FAUDES_DEBUG_IOPERF
1040 mPerformanceEndIterator = 0;
1041 mPerformanceBeginIterator = 0;
libFAUDES 2.28a
--- 2016.09.13
--- c++ api documentaion by doxygen
|