GCC Code Coverage Report


Directory: ./
File: src/msrproto/Variable.h
Date: 2024-02-26 09:07:35
Exec Total Coverage
Lines: 9 10 90.0%
Branches: 1 2 50.0%

Line Branch Exec Source
1 /*****************************************************************************
2 *
3 * Copyright (C) 2021 Richard Hacker (lerichi at gmx dot net),
4 * Florian Pose (fp at igh dot de),
5 * Bjarne von Horn (vh at igh dot de).
6 *
7 * This file is part of the PdCom library.
8 *
9 * The PdCom library is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * The PdCom library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17 * License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with the PdCom library. If not, see <http://www.gnu.org/licenses/>.
21 *
22 *****************************************************************************/
23
24 #ifndef PDCOM5_MSRPROTO_VARIABLE_H
25 #define PDCOM5_MSRPROTO_VARIABLE_H
26
27 #include "../Variable.h"
28 #include "DirNode.h"
29
30 #include <pdcom5/SizeTypeInfo.h>
31 #include <string>
32 #include <vector>
33
34 namespace PdCom { namespace impl { namespace MsrProto {
35
36 class ProtocolHandler;
37
38 57 class Variable : public PdCom::impl::Variable, public DirNode
39 {
40 public:
41 Variable(
42 PdCom::SizeInfo size_info,
43 const PdCom::TypeInfo *type_info,
44 std::weak_ptr<impl::Process> process,
45 unsigned int index,
46 unsigned taskId,
47 bool writeable,
48 double sampleTime,
49 const char *alias,
50 bool isDir,
51 bool is_parameter);
52
53 104 std::string getPath() const override { return DirNode::path(); }
54 1 std::string getName() const override { return DirNode::name(); }
55 std::string getAlias() const override { return alias_; }
56 13 std::chrono::duration<double> getSampleTime() const override
57 {
58 13 return sample_time_;
59 }
60 1 int getTaskId() const override { return task_id_; }
61
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
1 bool isWriteable() const override { return writeable_; }
62 1 PdCom::Variable toUApi() const
63 {
64 return impl::Variable::toUApi(
65 1 std::static_pointer_cast<const Variable>(shared_from_this()));
66 }
67
68 const bool is_parameter_;
69 const unsigned int index_;
70 const std::chrono::duration<double> sample_time_;
71 const int task_id_;
72 const bool writeable_;
73 const std::string alias_;
74 };
75 }}} // namespace PdCom::impl::MsrProto
76
77 #endif // PDCOM5_MSRPROTO_VARIABLE_H
78