Relative Paths

This commit is contained in:
2020-08-13 20:53:35 +02:00
parent e535bc1427
commit d5dedce294
384 changed files with 2477 additions and 2477 deletions

View File

@ -1,4 +1,4 @@
#include <framework/timemanager/CCSDSTime.h>
#include "CCSDSTime.h"
#include <stdio.h>
#include <inttypes.h>
#include <math.h>

View File

@ -3,8 +3,8 @@
// COULDDO: have calls in Clock.h which return time quality and use timespec accordingly
#include <framework/timemanager/Clock.h>
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "Clock.h"
#include "../returnvalues/HasReturnvaluesIF.h"
#include <stdint.h>
bool operator<(const timeval& lhs, const timeval& rhs);

View File

@ -1,9 +1,9 @@
#ifndef FRAMEWORK_TIMEMANAGER_CLOCK_H_
#define FRAMEWORK_TIMEMANAGER_CLOCK_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include <framework/ipc/MutexFactory.h>
#include <framework/globalfunctions/timevalOperations.h>
#include "../returnvalues/HasReturnvaluesIF.h"
#include "../ipc/MutexFactory.h"
#include "../globalfunctions/timevalOperations.h"
#include <cstdint>
#include <sys/time.h>

View File

@ -6,7 +6,7 @@
*/
#include <framework/timemanager/Countdown.h>
#include "Countdown.h"
Countdown::Countdown(uint32_t initialTimeout) : startTime(0), timeout(initialTimeout) {
}

View File

@ -8,7 +8,7 @@
#ifndef COUNTDOWN_H_
#define COUNTDOWN_H_
#include <framework/timemanager/Clock.h>
#include "Clock.h"
class Countdown {
private:

View File

@ -1,57 +1,57 @@
#include <framework/timemanager/Stopwatch.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
#include <iomanip>
Stopwatch::Stopwatch(bool displayOnDestruction,
StopwatchDisplayMode displayMode): displayOnDestruction(
displayOnDestruction), displayMode(displayMode) {
// Measures start time on initialization.
Clock::getClock_timeval(&startTime);
}
void Stopwatch::start() {
Clock::getClock_timeval(&startTime);
}
dur_millis_t Stopwatch::stop() {
stopInternal();
return elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000;
}
dur_seconds_t Stopwatch::stopSeconds() {
stopInternal();
return timevalOperations::toDouble(elapsedTime);
}
void Stopwatch::display() {
if(displayMode == StopwatchDisplayMode::MILLIS) {
sif::info << "Stopwatch: Operation took " << (elapsedTime.tv_sec * 1000 +
elapsedTime.tv_usec / 1000) << " milliseconds" << std::endl;
}
else if(displayMode == StopwatchDisplayMode::SECONDS) {
sif::info <<"Stopwatch: Operation took " << std::setprecision(3)
<< std::fixed << timevalOperations::toDouble(elapsedTime)
<< " seconds" << std::endl;
}
}
Stopwatch::~Stopwatch() {
if(displayOnDestruction) {
stopInternal();
display();
}
}
void Stopwatch::setDisplayMode(StopwatchDisplayMode displayMode) {
this->displayMode = displayMode;
}
StopwatchDisplayMode Stopwatch::getDisplayMode() const {
return displayMode;
}
void Stopwatch::stopInternal() {
timeval endTime;
Clock::getClock_timeval(&endTime);
elapsedTime = endTime - startTime;
}
#include "Stopwatch.h"
#include "../serviceinterface/ServiceInterfaceStream.h"
#include <iomanip>
Stopwatch::Stopwatch(bool displayOnDestruction,
StopwatchDisplayMode displayMode): displayOnDestruction(
displayOnDestruction), displayMode(displayMode) {
// Measures start time on initialization.
Clock::getClock_timeval(&startTime);
}
void Stopwatch::start() {
Clock::getClock_timeval(&startTime);
}
dur_millis_t Stopwatch::stop() {
stopInternal();
return elapsedTime.tv_sec * 1000 + elapsedTime.tv_usec / 1000;
}
dur_seconds_t Stopwatch::stopSeconds() {
stopInternal();
return timevalOperations::toDouble(elapsedTime);
}
void Stopwatch::display() {
if(displayMode == StopwatchDisplayMode::MILLIS) {
sif::info << "Stopwatch: Operation took " << (elapsedTime.tv_sec * 1000 +
elapsedTime.tv_usec / 1000) << " milliseconds" << std::endl;
}
else if(displayMode == StopwatchDisplayMode::SECONDS) {
sif::info <<"Stopwatch: Operation took " << std::setprecision(3)
<< std::fixed << timevalOperations::toDouble(elapsedTime)
<< " seconds" << std::endl;
}
}
Stopwatch::~Stopwatch() {
if(displayOnDestruction) {
stopInternal();
display();
}
}
void Stopwatch::setDisplayMode(StopwatchDisplayMode displayMode) {
this->displayMode = displayMode;
}
StopwatchDisplayMode Stopwatch::getDisplayMode() const {
return displayMode;
}
void Stopwatch::stopInternal() {
timeval endTime;
Clock::getClock_timeval(&endTime);
elapsedTime = endTime - startTime;
}

View File

@ -1,71 +1,71 @@
#ifndef FRAMEWORK_TIMEMANAGER_STOPWATCH_H_
#define FRAMEWORK_TIMEMANAGER_STOPWATCH_H_
#include <framework/timemanager/Clock.h>
enum class StopwatchDisplayMode {
MILLIS,
SECONDS
};
/**
* @brief Simple Stopwatch implementation to measure elapsed time
* @details
* This class can be used to measure elapsed times. It also displays elapsed
* times automatically on destruction if not explicitely deactivated in the
* constructor. The default time format is the elapsed time in miliseconds
* in seconds as a double.
* @author R. Mueller
*/
class Stopwatch {
public:
/**
* Default constructor. Call "Stopwatch stopwatch" without brackets if
* no parameters are required!
* @param displayOnDestruction If set to true, displays measured time on
* object destruction
* @param displayMode Display format is either MS rounded or MS as double
* format
* @param outputPrecision If using double format, specify precision here.
*/
Stopwatch(bool displayOnDestruction = true, StopwatchDisplayMode displayMode
= StopwatchDisplayMode::MILLIS);
virtual~ Stopwatch();
/**
* Caches the start time
*/
void start();
/**
* Calculates the elapsed time since start and returns it
* @return elapsed time in milliseconds (rounded)
*/
dur_millis_t stop();
/**
* Calculates the elapsed time since start and returns it
* @return elapsed time in seconds (double precision)
*/
dur_seconds_t stopSeconds();
/**
* Displays the elapsed times on the osstream, depending on internal display
* mode.
*/
void display();
StopwatchDisplayMode getDisplayMode() const;
void setDisplayMode(StopwatchDisplayMode displayMode);
bool displayOnDestruction = true;
private:
timeval startTime {0, 0};
timeval elapsedTime {0, 0};
StopwatchDisplayMode displayMode = StopwatchDisplayMode::MILLIS;
void stopInternal();
};
#endif /* FRAMEWORK_TIMEMANAGER_STOPWATCH_H_ */
#ifndef FRAMEWORK_TIMEMANAGER_STOPWATCH_H_
#define FRAMEWORK_TIMEMANAGER_STOPWATCH_H_
#include "Clock.h"
enum class StopwatchDisplayMode {
MILLIS,
SECONDS
};
/**
* @brief Simple Stopwatch implementation to measure elapsed time
* @details
* This class can be used to measure elapsed times. It also displays elapsed
* times automatically on destruction if not explicitely deactivated in the
* constructor. The default time format is the elapsed time in miliseconds
* in seconds as a double.
* @author R. Mueller
*/
class Stopwatch {
public:
/**
* Default constructor. Call "Stopwatch stopwatch" without brackets if
* no parameters are required!
* @param displayOnDestruction If set to true, displays measured time on
* object destruction
* @param displayMode Display format is either MS rounded or MS as double
* format
* @param outputPrecision If using double format, specify precision here.
*/
Stopwatch(bool displayOnDestruction = true, StopwatchDisplayMode displayMode
= StopwatchDisplayMode::MILLIS);
virtual~ Stopwatch();
/**
* Caches the start time
*/
void start();
/**
* Calculates the elapsed time since start and returns it
* @return elapsed time in milliseconds (rounded)
*/
dur_millis_t stop();
/**
* Calculates the elapsed time since start and returns it
* @return elapsed time in seconds (double precision)
*/
dur_seconds_t stopSeconds();
/**
* Displays the elapsed times on the osstream, depending on internal display
* mode.
*/
void display();
StopwatchDisplayMode getDisplayMode() const;
void setDisplayMode(StopwatchDisplayMode displayMode);
bool displayOnDestruction = true;
private:
timeval startTime {0, 0};
timeval elapsedTime {0, 0};
StopwatchDisplayMode displayMode = StopwatchDisplayMode::MILLIS;
void stopInternal();
};
#endif /* FRAMEWORK_TIMEMANAGER_STOPWATCH_H_ */

View File

@ -5,7 +5,7 @@
* @author baetz
*/
#include <framework/timemanager/TimeMessage.h>
#include "TimeMessage.h"
TimeMessage::TimeMessage() {
this->messageSize += sizeof(timeval) + sizeof(uint32_t);

View File

@ -8,8 +8,8 @@
#ifndef TIMEMESSAGE_H_
#define TIMEMESSAGE_H_
#include <framework/ipc/MessageQueueMessage.h>
#include <framework/timemanager/Clock.h>
#include "../ipc/MessageQueueMessage.h"
#include "Clock.h"
#include <cstring>
class TimeMessage : public MessageQueueMessage {

View File

@ -1,7 +1,7 @@
#ifndef FRAMEWORK_TIMEMANAGER_TIMESTAMPERIF_H_
#define FRAMEWORK_TIMEMANAGER_TIMESTAMPERIF_H_
#include <framework/returnvalues/HasReturnvaluesIF.h>
#include "../returnvalues/HasReturnvaluesIF.h"
/**
* A class implementing this IF provides facilities to add a time stamp to the