Coverage Report

Created: 2025-06-13 06:46

/src/Fast-DDS/include/fastdds/dds/topic/TopicDescription.hpp
Line
Count
Source (jump to first uncovered line)
1
// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
/**
16
 * @file TopicDescription.hpp
17
 */
18
19
#ifndef FASTDDS_DDS_TOPIC__TOPICDESCRIPTION_HPP
20
#define FASTDDS_DDS_TOPIC__TOPICDESCRIPTION_HPP
21
22
#include <string>
23
24
namespace eprosima {
25
namespace fastdds {
26
namespace dds {
27
28
class DomainParticipant;
29
class TopicDescriptionImpl;
30
31
/**
32
 * Class TopicDescription, represents the fact that both publications
33
 * and subscriptions are tied to a single data-type
34
 *
35
 * @ingroup FASTDDS_MODULE
36
 */
37
class TopicDescription
38
{
39
public:
40
41
    /**
42
     * Get the DomainParticipant to which the TopicDescription belongs.
43
     *
44
     * @return The DomainParticipant to which the TopicDescription belongs.
45
     */
46
    virtual DomainParticipant* get_participant() const = 0;
47
48
    /**
49
     * Get the name used to create this TopicDescription.
50
     *
51
     * @return the name used to create this TopicDescription.
52
     */
53
    const std::string& get_name() const
54
0
    {
55
0
        return name_;
56
0
    }
57
58
    /**
59
     * Get the associated type name.
60
     *
61
     * @return the type name.
62
     */
63
    const std::string& get_type_name() const
64
0
    {
65
0
        return type_name_;
66
0
    }
67
68
    virtual TopicDescriptionImpl* get_impl() const = 0;
69
70
protected:
71
72
    TopicDescription(
73
            const std::string& name,
74
            const std::string& type_name)
75
0
        : name_(name)
76
0
        , type_name_(type_name)
77
0
    {
78
0
    }
79
80
    virtual ~TopicDescription()
81
0
    {
82
0
    }
83
84
protected:
85
86
    //! Name that allows the TopicDescription to be retrieved locally
87
    std::string name_;
88
89
    //! Name that defines a unique resulting type for the publication or the subscription
90
    std::string type_name_;
91
};
92
93
} // namespace dds
94
} // namespace fastdds
95
} // namespace eprosima
96
97
#endif // FASTDDS_DDS_TOPIC__TOPICDESCRIPTION_HPP