blob: a7e9287e74ed67f54411f287142368cbaa970eeb [file]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SHARED_MEM_CLIENT_SEGMENT_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SHARED_MEM_CLIENT_SEGMENT_H_
#include <string>
// copybara:strip_begin(g3-shared-libs)
#include "tlbmc/hal/shared_mem/metrics.h"
// copybara:strip_end
#include "tlbmc/hal/shared_mem/sensors.h"
namespace milotic_tlbmc {
/*
* This class represents the client-side accessor to the shared memory segment.
* Both existing implementations are thread safe. In case of
* StaticSharedMemorySegment the thread safety is guaranteed by the immutability
* of the segment meta-data after initialization In case of the
* CompatClientSegment, thread safety is guaranteed by an IPC mutex.
*
*
*/
class ClientSegment {
public:
virtual ~ClientSegment() = default;
/* Returns a pointer to the IpcSensor named `sensor_name` or null if not found
*/
[[nodiscard]] virtual IpcSensor* FindSensor(
const std::string& sensor_name) const = 0;
/* Returns a pointer to the TlbmcMetrics object in process memory.
* Should never be null under normal circumstances */
/* Note: Metrics is no longer in shared memory. We still keep the API in this
* shared memory layer to keep the change less disruptive.*/
// copybara:strip_begin(g3-shared-libs)
[[nodiscard]] virtual TlbmcMetrics* GetMetrics() = 0;
// copybara:strip_end
};
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SHARED_MEM_CLIENT_SEGMENT_H_