Program Listing for File Entity.hpp
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/dds/core/Entity.hpp
)
// Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef _FASTDDS_ENTITY_HPP_
#define _FASTDDS_ENTITY_HPP_
#include <fastdds/dds/core/condition/StatusCondition.hpp>
#include <fastdds/dds/core/status/StatusMask.hpp>
#include <fastdds/dds/topic/TypeSupport.hpp>
#include <fastrtps/types/TypesBase.h>
namespace eprosima {
namespace fastdds {
namespace dds {
class Entity
{
public:
RTPS_DllAPI Entity(
const StatusMask& mask = StatusMask::all())
: status_mask_(mask)
, status_condition_(this)
, enable_(false)
{
}
virtual fastrtps::types::ReturnCode_t enable()
{
enable_ = true;
return fastrtps::types::ReturnCode_t::RETCODE_OK;
}
void close()
{
enable_ = false;
}
RTPS_DllAPI const StatusMask& get_status_mask() const
{
return status_mask_;
}
RTPS_DllAPI const StatusMask& get_status_changes() const;
const InstanceHandle_t& get_instance_handle() const
{
return instance_handle_;
}
RTPS_DllAPI bool is_enabled() const
{
return enable_;
}
RTPS_DllAPI bool operator ==(
const Entity& other) const
{
return (this->instance_handle_ == other.instance_handle_);
}
RTPS_DllAPI StatusCondition& get_statuscondition()
{
return status_condition_;
}
protected:
RTPS_DllAPI void set_instance_handle(
const InstanceHandle_t& handle)
{
instance_handle_ = handle;
}
StatusMask status_mask_;
StatusCondition status_condition_;
InstanceHandle_t instance_handle_;
bool enable_;
};
class DomainEntity : public Entity
{
public:
DomainEntity(
const StatusMask& mask = StatusMask::all())
: Entity(mask)
{
}
};
} // namespace dds
} // namespace fastdds
} // namespace eprosima
#endif // _FASTDDS_ENTITY_HPP_