Program Listing for File Domain.h

Return to documentation for file (/tmp/ws/src/fastrtps/include/fastrtps/Domain.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 DOMAIN_H_
#define DOMAIN_H_

#include <fastdds/dds/topic/TopicDataType.hpp>
#include <fastrtps/attributes/ParticipantAttributes.h>
#include <mutex>

#ifdef USE_DEPRECATION
#if defined(__GNUC__) || defined(__clang__)
#define DEPRECATED __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define DEPRECATED __declspec(deprecated)
#else
#define DEPRECATED
#endif // if defined(__GNUC__) || defined(__clang__)
#else
#define DEPRECATED
#endif // ifdef USE_DEPRECATION

namespace eprosima {
namespace fastrtps {

class ParticipantListener;
class Participant;
class ParticipantImpl;
class Publisher;
class PublisherAttributes;
class PublisherListener;
class Subscriber;
class SubscriberAttributes;
class SubscriberListener;

namespace types {
class DynamicPubSubType;
} // namespace types

class Domain
{
public:

    RTPS_DllAPI DEPRECATED static Participant* createParticipant(
            const std::string& participant_profile,
            ParticipantListener* listen = nullptr);

    RTPS_DllAPI DEPRECATED static Participant* createParticipant(
            const ParticipantAttributes& att,
            ParticipantListener* listen = nullptr);

    RTPS_DllAPI static void getDefaultParticipantAttributes(
            ParticipantAttributes& participant_attributes);

    RTPS_DllAPI static Publisher* createPublisher(
            Participant* part,
            const std::string& publisher_profile,
            PublisherListener* listen = nullptr);

    RTPS_DllAPI static Publisher* createPublisher(
            Participant* part,
            const PublisherAttributes& att,
            PublisherListener* listen = nullptr);

    RTPS_DllAPI static void getDefaultPublisherAttributes(
            PublisherAttributes& publisher_attributes);

    RTPS_DllAPI static Subscriber* createSubscriber(
            Participant* part,
            const std::string& subscriber_profile,
            SubscriberListener* listen = nullptr);

    RTPS_DllAPI static Subscriber* createSubscriber(
            Participant* part,
            const SubscriberAttributes& att,
            SubscriberListener* listen = nullptr);

    RTPS_DllAPI static void getDefaultSubscriberAttributes(
            SubscriberAttributes& subscriber_attributes);

    RTPS_DllAPI static bool removeParticipant(
            Participant* part);

    RTPS_DllAPI static bool removePublisher(
            Publisher* pub);

    RTPS_DllAPI static bool removeSubscriber(
            Subscriber* sub);

    RTPS_DllAPI static bool getRegisteredType(
            Participant* part,
            const char* typeName,
            fastdds::dds::TopicDataType** type);

    RTPS_DllAPI static bool registerType(
            Participant* part,
            fastdds::dds::TopicDataType* type);

    RTPS_DllAPI static bool registerDynamicType(
            Participant* part,
            types::DynamicPubSubType* type);

    RTPS_DllAPI static bool unregisterType(
            Participant* part,
            const char* typeName);

    RTPS_DllAPI static void stopAll();

    RTPS_DllAPI static bool loadXMLProfilesFile(
            const std::string& xml_profile_file);

    RTPS_DllAPI static bool loadXMLProfilesString(
            const char* data,
            size_t length);

private:

    typedef std::pair<Participant*, ParticipantImpl*> t_p_Participant;

    Domain();

    virtual ~Domain();

    static std::mutex m_mutex;

    static std::vector<t_p_Participant> m_participants;

    static bool default_xml_profiles_loaded;
};

} /* namespace  */
} /* namespace eprosima */

#endif /* DOMAIN_H_ */