SmartSpectra C++ SDK
Measure human vitals from video with SmartSpectra C++ SDK.
Loading...
Searching...
No Matches
operation_context.hpp
1
2// operation_context.h
3// Created by Greg on 2/20/2024.
4// Copyright (C) 2024 Presage Security, Inc.
5//
6// This program is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 3 of the License, or (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public License
17// along with this program; if not, write to the Free Software Foundation,
18// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21#pragma once
22// === standard library includes (if any) ===
23// === third-party includes (if any) ===
24#include <mediapipe/framework/calculator_graph.h>
25// === local includes (if any) ===
26#include "settings.hpp"
27#include "output_stream_poller_wrapper.hpp"
28
30namespace poller = output_stream_poller_wrapper;
31
32template<settings::OperationMode TOperationMode>
36class OperationContext {
37public:
38 explicit OperationContext(const settings::OperationSettings<settings::OperationMode::Continuous>& settings) {};
39 void Reset(){};
41 absl::Status InitializePollers(mediapipe::CalculatorGraph& graph);
43 absl::Status QueryPollers(bool& operation_state_changed, bool verbose);
44};
45
46template<>
47class OperationContext<settings::OperationMode::Spot> {
48public:
52 void Reset();
54 absl::Status InitializePollers(mediapipe::CalculatorGraph& graph);
56 absl::Status QueryPollers(bool& operation_state_changed, bool verbose);
57private:
58 double time_left_s;
59 const double spot_duration_s;
60 poller::OutputStreamPollerWrapper time_left_poller;
61};
62
63} // namespace presage::smartspectra::container
OperationContext(const settings::OperationSettings< settings::OperationMode::Spot > &operation_settings)
Definition operation_context.cpp:32
absl::Status InitializePollers(mediapipe::CalculatorGraph &graph)
Definition operation_context.cpp:19
absl::Status QueryPollers(bool &operation_state_changed, bool verbose)
Definition operation_context.cpp:24
Definition background_container.cpp:10