File: isyscomponent.h

package info (click to toggle)
corectrl 1.4.3%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,420 kB
  • sloc: cpp: 40,502; ansic: 174; javascript: 151; makefile: 18; sh: 3
file content (55 lines) | stat: -rw-r--r-- 1,396 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright 2019 Juan Palacios <jpalaciosdev@gmail.com>

#pragma once

#include "exportable.h"
#include "importable.h"
#include "item.h"
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

class ICommandQueue;

class ISysComponent
: public Item
, public Importable
, public Exportable
{
 public:
  class Importer : public Importable::Importer
  {
   public:
    virtual bool provideActive() const = 0;
  };

  class Exporter : public Exportable::Exporter
  {
   public:
    virtual void takeActive(bool active) = 0;
  };

  virtual bool active() const = 0;
  virtual void activate(bool active) = 0;

  /// @return unique key generated for this system component
  virtual std::string const &key() const = 0;

  /// @return component information as a pair of the component name and
  /// a vector of pairs of key and info values.
  virtual std::pair<std::string, std::vector<std::pair<std::string, std::string>>>
  componentInfo() const = 0;

  virtual void init() = 0;
  virtual void preInit(ICommandQueue &ctlCmds) = 0;
  virtual void postInit(ICommandQueue &ctlCmds) = 0;
  virtual void sync(ICommandQueue &ctlCmds) = 0;
  virtual void updateSensors(
      std::unordered_map<std::string, std::unordered_set<std::string>> const
          &ignored) = 0;

  virtual ~ISysComponent() = default;
};