Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
Entity.hpp
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
20#ifndef FASTDDS_DDS_CORE__ENTITY_HPP
21#define FASTDDS_DDS_CORE__ENTITY_HPP
22
23#include <fastdds/dds/common/InstanceHandle.hpp>
24#include <fastdds/dds/core/condition/StatusCondition.hpp>
25#include <fastdds/dds/core/ReturnCode.hpp>
26#include <fastdds/dds/core/status/StatusMask.hpp>
27
28namespace eprosima {
29namespace fastdds {
30namespace dds {
31
37class Entity
38{
39public:
40
46 FASTDDS_EXPORTED_API Entity(
47 const StatusMask& mask = StatusMask::all())
48 : status_mask_(mask)
49 , status_condition_(this)
50 , enable_(false)
51 {
52 }
53
60 {
61 enable_ = true;
62 return RETCODE_OK;
63 }
64
68 void close()
69 {
70 enable_ = false;
71 }
72
78 FASTDDS_EXPORTED_API const StatusMask& get_status_mask() const
79 {
80 return status_mask_;
81 }
82
97 FASTDDS_EXPORTED_API const StatusMask& get_status_changes() const;
98
105 {
106 return instance_handle_;
107 }
108
114 FASTDDS_EXPORTED_API bool is_enabled() const
115 {
116 return enable_;
117 }
118
119 FASTDDS_EXPORTED_API bool operator ==(
120 const Entity& other) const
121 {
122 return (this->instance_handle_ == other.instance_handle_);
123 }
124
130 FASTDDS_EXPORTED_API StatusCondition& get_statuscondition()
131 {
132 return status_condition_;
133 }
134
135protected:
136
142 FASTDDS_EXPORTED_API void set_instance_handle(
143 const InstanceHandle_t& handle)
144 {
145 instance_handle_ = handle;
146 }
147
150
153
156
159};
160
165class DomainEntity : public Entity
166{
167public:
168
175 const StatusMask& mask = StatusMask::all())
176 : Entity(mask)
177 {
178 }
179
180};
181
182} // namespace dds
183} // namespace fastdds
184} // namespace eprosima
185
186#endif // FASTDDS_DDS_CORE__ENTITY_HPP
The DomainEntity class is a subclass of Entity created in order to differentiate between DomainPartic...
Definition Entity.hpp:166
DomainEntity(const StatusMask &mask=StatusMask::all())
Constructor.
Definition Entity.hpp:174
The Entity class is the abstract base class for all the objects that support QoS policies,...
Definition Entity.hpp:38
FASTDDS_EXPORTED_API bool is_enabled() const
Checks if the Entity is enabled.
Definition Entity.hpp:114
FASTDDS_EXPORTED_API const StatusMask & get_status_changes() const
Retrieves the set of triggered statuses in the Entity.
InstanceHandle_t instance_handle_
InstanceHandle associated to the Entity.
Definition Entity.hpp:155
StatusMask status_mask_
StatusMask with relevant statuses set to 1.
Definition Entity.hpp:149
StatusCondition status_condition_
Condition associated to the Entity.
Definition Entity.hpp:152
FASTDDS_EXPORTED_API StatusCondition & get_statuscondition()
Allows access to the StatusCondition associated with the Entity.
Definition Entity.hpp:130
virtual ReturnCode_t enable()
This operation enables the Entity.
Definition Entity.hpp:59
FASTDDS_EXPORTED_API bool operator==(const Entity &other) const
Definition Entity.hpp:119
void close()
This operation disables the Entity before closing it.
Definition Entity.hpp:68
const InstanceHandle_t & get_instance_handle() const
Retrieves the instance handler that represents the Entity.
Definition Entity.hpp:104
bool enable_
Boolean that states if the Entity is enabled or disabled.
Definition Entity.hpp:158
FASTDDS_EXPORTED_API void set_instance_handle(const InstanceHandle_t &handle)
Setter for the Instance Handle.
Definition Entity.hpp:142
FASTDDS_EXPORTED_API const StatusMask & get_status_mask() const
Retrieves the set of relevant statuses for the Entity.
Definition Entity.hpp:78
FASTDDS_EXPORTED_API Entity(const StatusMask &mask=StatusMask::all())
Constructor.
Definition Entity.hpp:46
The StatusCondition class is a specific Condition that is associated with each Entity.
Definition StatusCondition.hpp:45
StatusMask is a bitmap or bitset field.
Definition StatusMask.hpp:48
static StatusMask all()
Get all StatusMasks.
Definition StatusMask.hpp:104
Definition DomainParticipant.hpp:45
const ReturnCode_t RETCODE_OK
Definition DDSReturnCode.hpp:61
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eProsima namespace.
Struct InstanceHandle_t, used to contain the key for WITH_KEY topics.
Definition InstanceHandle.hpp:154