Woman, Life, Freedom


Adaptive AUTOSAR
ARA public interface header documentation
supervised_entity.h
1#ifndef SUPERVISED_ENTITY_H
2#define SUPERVISED_ENTITY_H
3
4#include <assert.h>
5#include <type_traits>
6#include "../core/instance_specifier.h"
7#include "./checkpoint_communicator.h"
8
9namespace ara
10{
11 namespace phm
12 {
16 {
17 private:
18 const core::InstanceSpecifier &mInstance;
19 CheckpointCommunicator *const mCommunicator;
20
21 public:
26 CheckpointCommunicator *communicator);
27
29 SupervisedEntity(const SupervisedEntity &se) = delete;
30 SupervisedEntity &operator=(const SupervisedEntity &se) = delete;
31
32 ~SupervisedEntity() noexcept = default;
33
37 template <typename EnumT>
38 void ReportCheckpoint(EnumT checkpointId)
39 {
40 constexpr const bool cIsSame{
41 std::is_same<std::underlying_type_t<EnumT>, uint32_t>::value};
42 assert(cIsSame);
43
44 auto _checkpoint{static_cast<uint32_t>(checkpointId)};
45 mCommunicator->TrySend(_checkpoint);
46 }
47 };
48 }
49}
50
51#endif
AUTOSAR shortname-path wrapper.
Definition: instance_specifier.h:14
An abstract class to communicate a checkpoint between an application and the PHM cluster.
Definition: checkpoint_communicator.h:15
virtual bool TrySend(uint32_t checkpoint)=0
Try to send a checkpoint occurrence.
A class that collects and reports supervision checkpoints.
Definition: supervised_entity.h:16
SupervisedEntity(const core::InstanceSpecifier &instance, CheckpointCommunicator *communicator)
Constructor.
Definition: supervised_entity.cpp:9
void ReportCheckpoint(EnumT checkpointId)
Report a checkpoint to the PHM functional cluster.
Definition: supervised_entity.h:38