geopm 3.1.1.dev456+g3ba31824
GEOPM - Global Extensible Open Power Manager
Loading...
Searching...
No Matches
BatchClient.hpp
Go to the documentation of this file.
1/*
2 * Copyright (c) 2015 - 2024 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef BATCHCLIENT_HPP_INCLUDE
7#define BATCHCLIENT_HPP_INCLUDE
8
9#include <memory>
10#include <vector>
11#include <signal.h>
12
13struct geopm_request_s;
14
15namespace geopm
16{
17 class SharedMemory;
18 class BatchStatus;
19
24 {
25 public:
26 BatchClient() = default;
27 virtual ~BatchClient() = default;
28
49 static std::unique_ptr<BatchClient> make_unique(const std::string &server_key,
50 double timeout,
51 int num_signal,
52 int num_control);
53
63 virtual std::vector<double> read_batch(void) = 0;
64
73 virtual void write_batch(std::vector<double> settings) = 0;
74
76 virtual void stop_batch(void) = 0;
77 };
78
80 {
81 public:
82 BatchClientImp(const std::string &server_key, double timeout,
83 int num_signal, int num_control);
84 BatchClientImp(int num_signal, int num_control,
85 std::shared_ptr<BatchStatus> batch_status,
86 std::shared_ptr<SharedMemory> signal_shmem,
87 std::shared_ptr<SharedMemory> control_shmem);
88 virtual ~BatchClientImp() = default;
89 std::vector<double> read_batch(void) override;
90 void write_batch(std::vector<double> settings) override;
91 void stop_batch(void) override;
92 private:
93 int m_num_signal;
94 int m_num_control;
95 std::shared_ptr<BatchStatus> m_batch_status;
96 std::shared_ptr<SharedMemory> m_signal_shmem;
97 std::shared_ptr<SharedMemory> m_control_shmem;
98 };
99}
100
101#endif
Interface that will attach to a batch server. The batch server that it connects to is typically creat...
Definition BatchClient.hpp:24
virtual void write_batch(std::vector< double > settings)=0
Ask batch server to write all of the control values.
virtual ~BatchClient()=default
virtual std::vector< double > read_batch(void)=0
Ask batch server to read all signal values and return result.
virtual void stop_batch(void)=0
Send message to batch server asking it to quit.
static std::unique_ptr< BatchClient > make_unique(const std::string &server_key, double timeout, int num_signal, int num_control)
Factory method to create a pointer to a BatchClient object.
Definition BatchClient.cpp:21
BatchClient()=default
Definition BatchClient.hpp:80
virtual ~BatchClientImp()=default
void stop_batch(void) override
Send message to batch server asking it to quit.
Definition BatchClient.cpp:99
std::vector< double > read_batch(void) override
Ask batch server to read all signal values and return result.
Definition BatchClient.cpp:60
void write_batch(std::vector< double > settings) override
Ask batch server to write all of the control values.
Definition BatchClient.cpp:78
Definition Agg.cpp:20
Definition geopm_pio.h:387