Program Listing for File EndpointAttributes.h

Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/rtps/attributes/EndpointAttributes.h)

// Copyright 2016 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_ENDPOINTATTRIBUTES_H_
#define _FASTDDS_ENDPOINTATTRIBUTES_H_

#include <fastdds/rtps/attributes/ExternalLocators.hpp>
#include <fastdds/rtps/attributes/PropertyPolicy.h>
#include <fastrtps/qos/QosPolicies.h>

#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/common/Locator.h>
#include <fastdds/rtps/common/Types.h>

#if HAVE_SECURITY
#include <fastdds/rtps/security/accesscontrol/EndpointSecurityAttributes.h>
#endif  // HAVE_SECURITY

namespace eprosima {
namespace fastrtps {
namespace rtps {

class EndpointAttributes
{
public:

    EndpointKind_t endpointKind = EndpointKind_t::WRITER;

    TopicKind_t topicKind = TopicKind_t::NO_KEY;

    ReliabilityKind_t reliabilityKind = ReliabilityKind_t::BEST_EFFORT;

    DurabilityKind_t durabilityKind = DurabilityKind_t::VOLATILE;

    GUID_t persistence_guid;

    fastdds::rtps::ExternalLocators external_unicast_locators;

    bool ignore_non_matching_locators = false;

    LocatorList_t unicastLocatorList;

    LocatorList_t multicastLocatorList;

    LocatorList_t remoteLocatorList;

    PropertyPolicy properties;

    OwnershipQosPolicyKind ownershipKind = SHARED_OWNERSHIP_QOS;

    EndpointAttributes()
    {
        datasharing_.off();
    }

    virtual ~EndpointAttributes() = default;

    inline int16_t getUserDefinedID() const
    {
        return m_userDefinedID;
    }

    inline int16_t getEntityID() const
    {
        return m_entityID;
    }

    inline void setUserDefinedID(
            int16_t id)
    {
        m_userDefinedID = id;
    }

    inline void setEntityID(
            int16_t id)
    {
        m_entityID = id;
    }

    inline void set_data_sharing_configuration(
            DataSharingQosPolicy cfg)
    {
        datasharing_ = cfg;
    }

    inline const DataSharingQosPolicy& data_sharing_configuration() const
    {
        return datasharing_;
    }

#if HAVE_SECURITY
    const security::EndpointSecurityAttributes& security_attributes() const
    {
        return security_attributes_;
    }

    security::EndpointSecurityAttributes& security_attributes()
    {
        return security_attributes_;
    }

#endif // HAVE_SECURITY

private:

    int16_t m_userDefinedID = -1;

    int16_t m_entityID = -1;

#if HAVE_SECURITY
    security::EndpointSecurityAttributes security_attributes_;
#endif // HAVE_SECURITY

    DataSharingQosPolicy datasharing_;
};

} /* namespace rtps */
} /* namespace fastrtps */
} /* namespace eprosima */

#endif /* _FASTDDS_ENDPOINTATTRIBUTES_H_ */