.. _program_listing_file_ecal_core_include_ecal_ecal_publisher.h: Program Listing for File ecal_publisher.h ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``ecal/core/include/ecal/ecal_publisher.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* ========================= eCAL LICENSE ================================= * * Copyright (C) 2016 - 2019 Continental Corporation * * 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. * * ========================= eCAL LICENSE ================================= */ #pragma once #include #include #include #include #include namespace eCAL { class CDataWriter; class ECAL_API CPublisher { public: CPublisher(); CPublisher(const std::string& topic_name_, const std::string& topic_type_ = "", const std::string& topic_desc_ = ""); virtual ~CPublisher(); CPublisher(const CPublisher&) = delete; CPublisher& operator=(const CPublisher&) = delete; CPublisher(CPublisher&& rhs) noexcept; CPublisher& operator=(CPublisher&& rhs) noexcept; bool Create(const std::string& topic_name_, const std::string& topic_type_ = "", const std::string& topic_desc_ = ""); bool Destroy(); bool SetDescription(const std::string& topic_desc_); bool SetAttribute(const std::string& attr_name_, const std::string& attr_value_); bool ClearAttribute(const std::string& attr_name_); bool ShareType(bool state_ = true); bool ShareDescription(bool state_ = true); bool SetQOS(const QOS::SWriterQOS& qos_); QOS::SWriterQOS GetQOS(); bool SetLayerMode(TLayer::eTransportLayer layer_, TLayer::eSendMode mode_); bool SetMaxBandwidthUDP(long bandwidth_); bool ShmSetBufferCount(long buffering_); bool ShmEnableZeroCopy(bool state_); bool SetID(long long id_); size_t Send(const void* const buf_, size_t len_, long long time_ = -1) const; size_t Send(const std::string& s_, long long time_ = -1) const; bool AddEventCallback(eCAL_Publisher_Event type_, PubEventCallbackT callback_); bool RemEventCallback(eCAL_Publisher_Event type_); bool IsCreated() const {return(m_created);} bool IsSubscribed() const; size_t GetSubscriberCount() const; std::string GetTopicName() const; std::string GetTypeName() const; std::string GetDescription() const; std::string Dump(const std::string& indent_ = "") const; protected: void InitializeQOS(); void InitializeTLayer(); // class members CDataWriter* m_datawriter; struct ECAL_API QOS::SWriterQOS m_qos; struct ECAL_API TLayer::STLayer m_tlayer; long long m_id; bool m_created; bool m_initialized; }; };