GCC Code Coverage Report


Directory: ./
File: ecapp/Domain.h
Date: 2026-09-23 16:22:15
Exec Total Coverage
Lines: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * This file is part of the ecapp library (EtherCAT application devices).
4 *
5 * Copyright (C) 2026 Florian Pose <fp@igh.de>
6 *
7 * The ecapp library is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation, version 3 of the
10 * License.
11 *
12 * The ecapp library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with the ecapp library. If not, see
19 * <https://www.gnu.org/licenses/>.
20 *
21 ****************************************************************************/
22
23 #ifndef ECAPP_DOMAIN_H
24 #define ECAPP_DOMAIN_H
25
26 /****************************************************************************/
27
28 #include "ecapp_export.h"
29
30 #include <ecrt.h> // EtherCAT realtime interface
31 #include <memory>
32 #include <pdserv.h>
33 #include <stdint.h>
34 #include <string>
35
36 /****************************************************************************/
37
38 namespace EcApp {
39
40 class Master;
41 class SubDevice;
42
43 18 class ECAPP_EXPORT Domain
44 {
45 public:
46 Domain(pdserv *, pdtask *, const std::string &prefix, Master *);
47 ~Domain();
48
49 void updateDataPointer();
50 void process(bool);
51 void queue();
52
53 ec_domain_t *getDomain();
54 uint8_t *getData() const;
55 bool isValid() const;
56
57 /** Registration for the SubDevice(s) plugged into this domain --
58 * called from SubDevice's own constructor/destructor (see
59 * ecapp/SubDevice.h), not meant to be called directly. */
60 void addInputDevice(SubDevice *);
61 void removeInputDevice(SubDevice *);
62 void addOutputDevice(SubDevice *);
63 void removeOutputDevice(SubDevice *);
64
65 /** Calls updateInputs()/updateOutputs() on every SubDevice
66 * currently registered with this domain (in registration order),
67 * so the application needs to call these instead of walking its
68 * own list of devices. domainIn and domainOut may be the same
69 * Domain -- each keeps its own registration, so calling both
70 * updateInputs() and updateOutputs() on it runs every device's
71 * corresponding method exactly once. */
72 void updateInputs();
73 void updateOutputs();
74
75 private:
76 struct Impl;
77 std::unique_ptr<Impl> impl;
78 };
79
80 } // namespace EcApp
81
82 #endif // ECAPP_DOMAIN_H
83
84 /****************************************************************************/
85