Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
argument.h
1#ifndef ARGUMENT_H
2#define ARGUMENT_H
3
4#include <string>
5#include <type_traits>
6
7namespace ara
8{
9 namespace log
10 {
13 template <typename T>
15 {
16 private:
17 T mPayload;
18 std::string mIdentifier;
19 std::string mUnit;
20 const std::string cIdSeperator{": "};
21 const std::string cUnitSeperator{" "};
22
23 public:
29 T &&payload,
30 const char *identifier,
31 const char *unit) : mPayload(payload),
32 mIdentifier(identifier),
33 mUnit(unit)
34 {
35 }
36
37 ~Argument() noexcept = default;
38
41 std::string ToString() const
42 {
43 std::string _payloadString = std::to_string(mPayload);
44 std::string _result =
45 mIdentifier + cIdSeperator + _payloadString + cUnitSeperator + mUnit;
46
47 return _result;
48 }
49 };
50 }
51}
52
53#endif
A payload (quantity) with an unit wrapper.
Definition: argument.h:15
Argument(T &&payload, const char *identifier, const char *unit)
brief description Constructor
Definition: argument.h:28
std::string ToString() const
Convert the payload to a standard string.
Definition: argument.h:41