MCPcopy Create free account
hub / github.com/TUC-ProAut/libRSF / getElementsBetween

Method getElementsBetween

include/DataSet.h:551–606  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549 }
550
551 std::vector<ObjectType> getElementsBetween(const KeyType &ID, const double TimeBegin, const double TimeEnd) const
552 {
553 std::vector<ObjectType> Objects;
554
555 /** catch special case, where timestamps are identical */
556 if (TimeBegin == TimeEnd)
557 {
558 return this->getElements(ID, TimeBegin);
559 }
560
561 if(this->checkID(ID))
562 {
563 /** identify true boarders */
564 double TimeFirst, TimeLast;
565 if (this->getTimeBelowOrEqual(ID, TimeEnd, TimeLast) == false)
566 {
567 PRINT_WARNING("Did not find upper bound of ", ID, " at ", TimeBegin);
568 return Objects;
569 }
570 if (this->getTimeAboveOrEqual(ID, TimeBegin, TimeFirst) == false)
571 {
572 PRINT_WARNING("Did not find lower bound of ", ID, " at ", TimeBegin);
573 return Objects;
574 }
575
576 if (TimeFirst > TimeLast)
577 {
578 PRINT_WARNING("There is no object between ", TimeBegin, "s and ", TimeEnd, "s of type ", ID);
579 return Objects;
580 }
581
582 /** iterate over timestamps */
583 double Time = TimeFirst;
584 do
585 {
586 std::vector<ObjectType> CurrentObjects = this->getElements(ID, Time);
587 Objects.insert(Objects.end(), CurrentObjects.begin(), CurrentObjects.end());
588
589 /** exit loop if last timestamp is reached */
590 if(Time == TimeLast)
591 break;
592 }
593 while(this->getTimeNext(ID, Time, Time));
594 }
595 else
596 {
597 PRINT_ERROR("There is no element with type: ", ID);
598 }
599
600 if(Objects.empty())
601 {
602 PRINT_WARNING("Returned empty vector!");
603 }
604
605 return Objects;
606 }
607
608 bool getUniqueIDs(const KeyType &ID, std::vector<UniqueID> &IDs) const

Callers

nothing calls this directly

Calls 8

getElementsMethod · 0.95
checkIDMethod · 0.95
getTimeBelowOrEqualMethod · 0.95
getTimeAboveOrEqualMethod · 0.95
getTimeNextMethod · 0.95
endMethod · 0.80
beginMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected