GCC Code Coverage Report


Directory: ./
File: pdcom5/src/msrproto/Variable.h
Date: 2024-12-29 04:08:32
Exec Total Coverage
Lines: 7 10 70.0%
Branches: 0 2 0.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 377 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 475 std::string getPath() const override { return DirNode::path(); }
54 5 std::string getName() const override { return DirNode::name(); }
55 std::string getAlias() const override { return alias_; }
56 45 std::chrono::duration<double> getSampleTime() const override
57 {
58 45 return sample_time_;
59 }
60 int getTaskId() const override { return task_id_; }
61 bool isWriteable() const override { return writeable_; }
62 3 PdCom::Variable toUApi() const
63 {
64 return impl::Variable::toUApi(
65 3 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