Coverage Report

Created: 2025-10-12 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/opendnp3/cpp/lib/src/master/IMasterScheduler.h
Line
Count
Source
1
/*
2
 * Copyright 2013-2022 Step Function I/O, LLC
3
 *
4
 * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O
5
 * LLC (https://stepfunc.io) under one or more contributor license agreements.
6
 * See the NOTICE file distributed with this work for additional information
7
 * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license
8
 * this file to you under the Apache License, Version 2.0 (the "License"); you
9
 * may not use this file except in compliance with the License. You may obtain
10
 * a copy of the License at:
11
 *
12
 * http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing, software
15
 * distributed under the License is distributed on an "AS IS" BASIS,
16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
 * See the License for the specific language governing permissions and
18
 * limitations under the License.
19
 */
20
#ifndef OPENDNP3_IMASTERSCHEDULER_H
21
#define OPENDNP3_IMASTERSCHEDULER_H
22
23
#include "master/IMasterTask.h"
24
#include "master/IMasterTaskRunner.h"
25
26
namespace opendnp3
27
{
28
29
/**
30
 * Interface used by master sessions to schedule tasks
31
 */
32
class IMasterScheduler
33
{
34
35
public:
36
13
    virtual ~IMasterScheduler() {}
37
38
    virtual void Shutdown() = 0;
39
40
    /**
41
     * Add a single task to the scheduler. The tasks will be started asynchronously,
42
     * i.e. not by the call to this method
43
     */
44
    virtual void Add(const std::shared_ptr<IMasterTask>& task, IMasterTaskRunner& runner) = 0;
45
46
    /**
47
     * Remove all tasks associated with this context, including the running one
48
     */
49
    virtual void SetRunnerOffline(const IMasterTaskRunner& runner) = 0;
50
51
    /**
52
     *
53
     */
54
    virtual bool CompleteCurrentFor(const IMasterTaskRunner& runner) = 0;
55
56
    /**
57
     *  Called if task changes in such a way that it might be runnable sooner than scheduled
58
     */
59
    virtual void Evaluate() = 0;
60
61
    /**
62
     * Run a task as soon as possible
63
     */
64
    virtual void Demand(const std::shared_ptr<IMasterTask>& task) = 0;
65
66
    /**
67
     * Add multiple tasks in one call
68
     */
69
    void Add(std::initializer_list<std::shared_ptr<IMasterTask>> tasks, IMasterTaskRunner& runner)
70
0
    {
71
0
        for (auto& task : tasks)
72
0
            this->Add(task, runner);
73
0
    }
74
};
75
76
} // namespace opendnp3
77
78
#endif