rti DDS publish. c++11例子 - 1

  • Participant Use Cases
    • Setting up a DomainParticipant
    • Looking up DomainParticipants
    • Finalizing the factory
  • Topic Use Cases
    • Setting up a Topic
    • Discovering Topics
      • Lookup local Topics by their topic name
      • The next two examples assume the following setup
      • Discover all Topics in a domain
      • Retrieve the TopicBuiltinTopicData for a Topic
  • Publisher Use Cases
    • Setting up a publisher
    • Looking up Publishers
  • DataWriter Use Cases
    • Setting up a DataWriter
    • Managing instances
    • Sending data
    • Looking up DataWriters
    • Getting Matched Subscriptions
  • Subscriber Use Cases
    • Setting up a subscriber
    • Looking up Subscribers

Participant Use Cases

Setting up a DomainParticipant

// When not explicitly provided to the constructor, the
// created DomainParticipants's QoS is default, has a NULL listener, and a
// status mask dds::core::status::StatusMask::all()
// Creating a DomainParticipants on domain 0
dds::domain::DomainParticipant participant1(0) ;
// Creating a DomainParticipants with a non-default QoS values
dds::domain::qos::DomainParticipantQos qos;// Set the initial peers. // The peers stored in initial_peers are merely potential peers--there is // no requirement that the peer DomainParticipants are actually up and// running or even will eventually exist. The Connext discovery process // will try to contact all potential peer participants in the list // periodically using unicast transports. const char * initial_peers_array[] = {"host1","10.10.30.192","1@localhost",        "2@host2","my://", /* all unicast addrs on transport plugins with alias "my" */"2@shmem://", /* shared memory */"FF00:ABCD::0","1@FF00:0:1234::0","225.1.2.3","3@225.1.0.55","FAA0::0#0/0/R"};
const dds::core::StringSeq initial_peers_list(initial_peers_array, initial_peers_array+11);
// Add the initial peers list to the DiscoveryQosPolicy while modifying
// the participant's qos inline
qos << rti::core::policy::Discovery().initial_peers(initial_peers_list);
// Creating a DomainParticipants on domain 1 with modified QoS
dds::domain::DomainParticipant participant2(1, qos);
// Creating a DomainParticipants on domain 2, with modified QoS, and a listener
ExampleParticipantListener *listener = new ExampleParticipantListener;
dds::domain::DomainParticipant participant3(2, qos, listener);
// Creating a DomainParticipants on domain 3, with modified QoS, a listener and
// a data_available() status mask
dds::domain::DomainParticipant participant4(3, qos, listener, dds::core::status::StatusMask::data_available());
// Creating an entity with a listener automatically retains the entity, so
// we must either explicitly close the DomainParticipant...
participant3.close();// ... or set the listener to null
participant4.listener(NULL, dds::core::status::StatusMask::none());

Looking up DomainParticipants

// Create and retain two DomainParticipants on domain 0 and one on domain 1create_and_retain_participant(0);create_and_retain_participant(0);create_and_retain_participant(1);// We don't have any references to the created DomainParticipants but we // can look them up using the domain id they were created on// If there is more than one participant on the same domain then this// operation will return only one of them. It is unspecified which one it// will returndds::domain::DomainParticipant participant1 = dds::domain::find(0);dds::domain::DomainParticipant participant2 = dds::domain::find(1);

Finalizing the factory

// The DomainParticipantFactory is a singleton that the C++ API uses
// implicitly to create participants. RTI Connext provides
// dds::domain::DomainParticipant::finalize_participant_factory()
// for users who want to release memory used by the participant factory.
dds::domain::DomainParticipant::finalize_participant_factory();

Topic Use Cases

Setting up a Topic

 // Create the participantdds::domain::DomainParticipant participant(0);// When not explicitly provided to the constructor, the // created topic's QoS is default, has a NULL listener, and a status mask// dds::core::status::StatusMask::all()// Creating a topic with user-defined type Foo and topic name MyTopic1dds::topic::Topic<Foo> topic1(participant, "MyTopic1");// Creating a topic with user-defined type Foo, topic name MyTopic1, // type name MyTypeNamedds::topic::Topic<Foo> topic2(participant, "MyTopic2", "MyTypeName2");// Creating a topic with user-defined type Foo, topic name MyTopic3, and// modified QoSdds::topic::qos::TopicQos qos;qos << dds::core::policy::Durability::TransientLocal();dds::topic::Topic<Foo> topic3(participant, "MyTopic3", qos);// Creating a topic with user-defined type Foo, topic name MyTopic4, type // name MyTypeName4 and modified QoSdds::topic::Topic<Foo> topic4(participant, "MyTopic4", "MyTypeName4", qos);// Creating a topic with user-defined type Foo, topic name MyTopic5, // modified QoS, and a non-NULL listenerExampleTopicListener *listener = new ExampleTopicListener; dds::topic::Topic<Foo> topic5(participant, "MyTopic5", qos, listener);// Creating a topic with user-defined type Foo, topic name MyTopic6, type // name MyTypeName6, modified QoS, and a non-NULL listenerdds::topic::Topic<Foo> topic6(participant, "MyTopic6", "MyTypeName6", qos, listener);// Creating a topic with user-defined type Foo, topic name MyTopic7, // modified QoS, a non-NULL listener, and a inconsistent_topic status maskdds::topic::Topic<Foo> topic7(participant, "MyTopic7", qos, listener, dds::core::status::StatusMask::inconsistent_topic());// Creating a topic with user-defined type Foo, topic name MyTopic8, type // name MyTypeName8, modified QoS, and a non-NULL listener, and // a inconsistent_topic status maskdds::topic::Topic<Foo> topic8(participant, "MyTopic8", "MyTypeName8", qos, listener, dds::core::status::StatusMask::inconsistent_topic());// Creating an Topic with a listener automatically retains the Topic, so // we must either explicitly close the Topic...topic4.close();topic5.close();topic6.close();topic7.close();// ... or set the listener to nulltopic8.listener(NULL, dds::core::status::StatusMask::none());

Discovering Topics

Lookup local Topics by their topic name

void howto_lookup_topics()
{dds::domain::DomainParticipant participant(0);// Create two Topics and retain themcreate_and_retain_topic(participant, "Topic1");create_and_retain_topic(participant, "Topic2");// We don't have any references to the created Topics but we can look // them up using topic name that they were created withdds::topic::Topic<Foo> topic1 = dds::topic::find<dds::topic::Topic<Foo> >(participant, "Topic1");dds::topic::Topic<Foo> topic2 = dds::topic::find<dds::topic::Topic<Foo> >(participant, "Topic2");// We retained the topics so we must close them nowtopic1.close();topic2.close();
}
void create_and_retain_topic(dds::domain::DomainParticipant &participant, const std::string& topic_name)
{dds::topic::Topic<Foo> topic(participant, topic_name);topic.retain();
}

The next two examples assume the following setup

   // Create two DomainParticipants on the same domaindds::domain::DomainParticipant participant1(1);dds::domain::DomainParticipant participant2(1);// Create some Topics for both of the Participantsdds::topic::Topic<Foo> topic1(participant1, "Topic1");dds::topic::Topic<Foo> topic2(participant1, "Topic2");dds::topic::Topic<Foo> topic3(participant2, "Topic3");

Discover all Topics in a domain

  // Get a list of the InstanceHandles of all of the topics in the // domain. topic_count will = 3dds::core::InstanceHandleSeq handles1;int topic_count = dds::topic::discover_any_topic(participant1, std::back_inserter(handles1));// discover_any_topic also takes a forward iterator and a max number of // topics to discover. topic_count will = 2. There is no guarantee// as to which two topics' handles will be retrieveddds::core::InstanceHandleSeq handles2(10, dds::core::InstanceHandle::nil());topic_count = dds::topic::discover_any_topic(participant2, handles2.begin(), 2);

Retrieve the TopicBuiltinTopicData for a Topic

   std::vector<dds::topic::TopicBuiltinTopicData> topic_data1;// Get the TopicBuiltinTopicData for all of the participant's local topics// topic_count will = 2 because participant1 has 2 associated Topicstopic_count = dds::topic::discover_topic_data(participant1, std::back_inserter(topic_data1));std::vector<dds::topic::TopicBuiltinTopicData> topic_data2(10);// discover_any_topic also takes a forward iterator and a max number of // topics to get the data for. Because we're using participant2, // topic_count will = 1topic_count = dds::topic::discover_topic_data(participant2, topic_data2.begin());// You can also retrieve data about a specific Topic or Topics with their // InstanceHandles. Because discover_topic_data will only retrieve data// about local topics, using an InstanceHandle that refers to a remote // Topic will cause an UnsupportedError to be thrown in either of the // following cases// Retrieve the TopicBuiltinTopicData for topic3dds::topic::TopicBuiltinTopicData topic_data = dds::topic::discover_topic_data(participant2, topic3->instance_handle());// Pass in a container with multiple handles and retrieve the // TopicBuiltinTopicData for each of the Topics associated with each of the // InstanceHandles std::vector<dds::topic::TopicBuiltinTopicData> topic_data3(10);dds::core::InstanceHandleSeq local_handles;local_handles.push_back(topic1->instance_handle());local_handles.push_back(topic2->instance_handle());// topic_count will equal 2topic_count = dds::topic::discover_topic_data(participant1, topic_data3.begin(), local_handles);

Publisher Use Cases

Setting up a publisher

 // Create the participantdds::domain::DomainParticipant participant(0);// When not explicitly provided to the constructor, the // created publisher's QoS is default, has a NULL listener, and a status mask// dds::core::status::StatusMask::all()// Creating a publisherdds::pub::Publisher publisher1(participant);// Creating a publisher with modified QoSdds::pub::qos::PublisherQos qos;qos << rti::core::policy::EntityName("PublisherName");dds::pub::Publisher publisher2(participant, qos);// Creating a publisher with modified QoS and a listenerExamplePublisherListener *listener = new ExamplePublisherListener;dds::pub::Publisher publisher3(participant, qos, listener);// Creating a publisher with modified QoS, a listener, and a sample_rejected() // status maskdds::pub::Publisher publisher4(participant, qos, listener, dds::core::status::StatusMask::offered_deadline_missed());// Creating an entity with a listener automatically retains the entity, so // we must either explicitly close the Publihser...publisher3.close();// ... or set the listener to nullpublisher4.listener(NULL, dds::core::status::StatusMask::none());

Looking up Publishers

void howto_lookup_publishers()
{dds::domain::DomainParticipant participant(0);// Create three Publishers and retain themcreate_and_retain_publisher(participant);create_and_retain_publisher(participant);create_and_retain_publisher(participant);// We don't have any references to the created Publishers but we can look // them up using the participant that they were created withstd::vector<dds::pub::Publisher> publishers1;// publisher_count will equal 3 and publishers1 will hold a reference to // each of the three publishers that were createdint publisher_count = rti::pub::find_publishers(participant, std::back_inserter(publishers1));// rti::pub::publishers also takes a forward iterator and a max number of// publishers to look upstd::vector<dds::pub::Publisher> publishers2(2, dds::pub::Publisher(dds::core::null));// publisher_count will equal 2 because we're only asking for 2publisher_count = rti::pub::find_publishers(participant, publishers2.begin(), 2);// We retained the publishers so we must close them nowfor (std::vector<dds::pub::Publisher>::iterator it = publishers1.begin();it != publishers1.end(); it++) {(*it).close();}
}
void create_and_retain_publisher(dds::domain::DomainParticipant &participant)
{dds::pub::Publisher publisher(participant);publisher.retain();
}

DataWriter Use Cases

Setting up a DataWriter

// Create the Participantdds::domain::DomainParticipant participant(0);// Create a Topicdds::topic::Topic<Foo> topic(participant, "MyTopicName");// When not explicitly provided to the constructor, the // created DataWriter's QoS is default, has a NULL listener, and a status mask// dds::core::status::StatusMask::all()// Creating a DataWriter, creating the subscriber inlinedds::pub::DataWriter<Foo> writer1(dds::pub::Publisher(participant), topic);// Create a Publisherdds::pub::Publisher publisher(participant);// Create a DataWriter with modified QoSdds::pub::qos::DataWriterQos writer_qos = dds::core::QosProvider::Default().datawriter_qos();writer_qos << dds::core::policy::Liveliness::ManualByParticipant();dds::pub::DataWriter<Foo> writer2(publisher, topic, writer_qos);// Create a DataWriter with the Qos of a topicwriter_qos = topic.qos(); // Copy the policies in TopicQos into a DataWriterQosdds::pub::DataWriter<Foo> writer3(publisher, topic, writer_qos);// Create a DataWriter with modified QoS and a listenerExampleDataWriterListener<Foo> listener;dds::pub::DataWriter<Foo> writer4(publisher, topic, writer_qos, &listener);// Create a DataWriter with modified QoS, a listener, and a liveliness_lost() // status maskdds::pub::DataWriter<Foo> writer5(publisher, topic, writer_qos, &listener, dds::core::status::StatusMask::liveliness_lost());// Create a DataWriter, then set a listener using bind_and_manage_listenerdds::pub::DataWriter<Foo> writer6(publisher, topic);auto listener_binder = rti::core::bind_and_manage_listener(writer6,new ExampleDataWriterListener<Foo>, dds::core::status::StatusMask::liveliness_lost());// Creating an entity with a listener automatically retains the entity, so // we must either explicitly close the DataWriter...writer4.close();// ... or set the listener to nullwriter5.listener(NULL, dds::core::status::StatusMask::none());// For writer6 we don't need to do anything, since the listener binder// takes care of setting the listener to null

Managing instances

The snippets in this section assume the following setup

dds::domain::DomainParticipant participant(0);
dds::topic::Topic<Foo> topic(participant, "MyTopic");
dds::pub::DataWriter<Foo> writer(dds::pub::Publisher(participant), topic);
Foo sample;
sample.x(100);

Getting an instance “key” value of user data type Foo

// Instead of a sample of type Foo, key_value() could also take a
// TopicInstance<Foo> object. key_value only populates the key field in the
// sample
Foo retrieved_sample_key;
writer.key_value(retrieved_sample_key, handle);

Registering an instance of type Foo

dds::core::InstanceHandle handle = writer.register_instance(sample);

Unregistering an instance of type Foo

writer.unregister_instance(handle);

Disposing of an instance of type Foo

writer.dispose_instance(handle);

Sending data

Set up a DataWriter
Register an instance
Write instances of type Foo (see also Working with IDL types)

 Foo data;dds::core::InstanceHandle handle = dds::core::InstanceHandle::nil();dds::core::Time timestamp(123);// Write a sample writer.write(data);// You can also write a sample with a timestamp that will be used as the // source timestamp for this samplewriter.write(data, timestamp);// You can also write a sample with an InstanceHandlewriter.write(data, handle);// The above call to write is equivalent to the followingwriter.write(dds::topic::TopicInstance<Foo>(handle, data));// Or a combination of handle and timestampwriter.write(data, handle, timestamp);// The above call to write is equivalent to the followingwriter.write(dds::topic::TopicInstance<Foo>(handle, data), timestamp);// Create a vector of three default-constructed samplesstd::vector<Foo> samples(3, Foo());// You can also write samples that are stored in a container by // passing in an iterator range to write()writer.write(samples.begin(), samples.end());// You can add a timestamp to the above call to writewriter.write(samples.begin(), samples.end(), timestamp);// Create a vector of three instance handlesstd::vector<dds::core::InstanceHandle> handles(3, dds::core::InstanceHandle::nil());// Write 3 samples along with their handleswriter.write(samples.begin(), samples.end(), handles.begin(), handles.end());// You can add a timestamp to the above call to writewriter.write(samples.begin(), samples.end(), handles.begin(), handles.end(), timestamp);// You can also use operator << to write sampleswriter << Foo(1, 2)<< std::make_pair(Foo(3, 4), timestamp) // add a timestamp<< std::make_pair(Foo(5, 6), handle); // add an instance handle
## DataWriter Listeners
Implementing a DataWriterListener class```cpp
// To create a DataWriterListener, inherit from the NoOpDataWriterListener class
// and then override any of the listener callback functions
template <typename T>
class ExampleDataWriterListener : public dds::pub::NoOpDataWriterListener<T>
{public:ExampleDataWriterListener() {}
public:void on_publication_matched(dds::pub::DataWriter<T>&,const dds::core::status::PublicationMatchedStatus &status){std::cout << "on_publication_matched callback" << std::endl;// Access information from the statusstd::cout << "total_count = " << status.total_count() << std::endl;std::cout << "total_count_change = " << status.total_count_change() << std::endl;std::cout << "current_count = " << status.current_count() << std::endl;std::cout << "current_count_change = " << status.current_count_change() << std::endl;dds::core::InstanceHandle handle = status.last_subscription_handle();// Extensionstd::cout << "current_count_peak = " << status->current_count_peak() << std::endl;}void on_offered_incompatible_qos(dds::pub::DataWriter<T>&,const dds::core::status::OfferedIncompatibleQosStatus &status){std::cout << "on_offered_incompatible_qos callback" << std::endl;// Access information from the statusstd::cout << "total_count = " << status.total_count() << std::endl;std::cout << "total_count_change = " << status.total_count_change() << std::endl;std::cout << "last_policy_id = " << status.last_policy_id() << std::endl;dds::core::policy::QosPolicyCountSeq qos_seq = status.policies();if (qos_seq.size() > 0) {std::cout << "policy_id of one first incompatible Qos policy = " << qos_seq[0].policy_id() << std::endl;}}void on_offered_deadline_missed(dds::pub::DataWriter<T>&,const dds::core::status::OfferedDeadlineMissedStatus &status){std::cout << "on_offered_deadline_missed callback" << std::endl;// Access information from the statusstd::cout << "total_count = " << status.total_count() << std::endl;std::cout << "total_count_change = " << status.total_count_change() << std::endl;dds::core::InstanceHandle handle = status.last_instance_handle();}void on_liveliness_lost(dds::pub::DataWriter<T>&,const dds::core::status::LivelinessLostStatus &status){std::cout << "on_liveliness_lost callback" << std::endl;// Access information from the statusstd::cout << "total_count = " << status.total_count() << std::endl;std::cout << "total_count_change = " << status.total_count_change() << std::endl;}
};

Setting a listener on a DataWriter

 dds::domain::DomainParticipant participant(0);dds::topic::Topic<Foo> topic(participant, "Topic1");ExampleDataWriterListener<Foo> *listener = new ExampleDataWriterListener<Foo>;// Create a DataWriter with a listener and default // dds::core::status::StatusMask::all()dds::pub::DataWriter<Foo> writer1(dds::pub::Publisher(participant), topic,dds::pub::qos::DataWriterQos(), listener);// Create a DataWriter with a null listenerdds::pub::DataWriter<Foo> writer2(dds::pub::Publisher(participant), topic);// Set the listener for the DataWriter after creationwriter2.listener(listener, dds::core::status::StatusMask::offered_incompatible_qos());// Setting a listener on an entity automatically retains the entity so // we must explicitly call close() in order for the DataWriter to be// destroyed writer1.close();// Instead of calling close, you can set the DataWriter's listener to null // and this will implicitly unretain the DataWriter so that it will be // destructed once all references to it go out of scopewriter2.listener(NULL, dds::core::status::StatusMask::none());delete listener;

The ListenerBinder class will take care of setting the listener and mask for an entity during creation and detaching the listener from the entity when the ListenerBinder is destructed. This is helpful because you will not have to explcitly close the entity or detach the listener yourself in order to teardown the entity

  dds::domain::DomainParticipant participant(0);dds::topic::Topic<Foo> topic(participant, "Topic1");// Create a DataWriter with a null listenerdds::pub::DataWriter<Foo> writer(dds::pub::Publisher(participant), topic);// Attach the listener to the DataWriter after creation using a // ListenerBinder. (Note: rti/core/ListenerBinder.hpp needs to be included)auto listener_binder = rti::core::bind_and_manage_listener(writer, new ExampleDataWriterListener<Foo>, dds::core::status::StatusMask::liveliness_lost());// To get the listener:ExampleDataWriterListener<Foo> *listener = listener_binder.listener(); // To get the entity:dds::pub::DataWriter<Foo> writer2 = listener_binder.entity();assert(writer == writer2);// When the reference count reaches zero, the listener_binder destructor // sets the writer's listener to NULL, and deletes the listener (to not// delete the listener we would have used bind_listener() instead of // bind_and_manage_listener()).//

Looking up DataWriters

Lookup DataWriters by topic name

  dds::domain::DomainParticipant participant(0);dds::pub::Publisher publisher(participant);dds::topic::Topic<Foo> topic1(participant, "Topic1");dds::topic::Topic<Foo> topic2(participant, "Topic2");// Create three DataWriters for topic1 and one for topic2 and retain themcreate_and_retain_writer(publisher, topic1);create_and_retain_writer(publisher, topic1);create_and_retain_writer(publisher, topic2);// We don't have any references to the created DataWriters but we can look // them up using the publisher and topic name that they were created withstd::vector<dds::pub::DataWriter<Foo> > writers;// writer_count will equal 1. If more than one DataWriter belongs to a // publisher with the same topic name then find may return any one of themint writer_count = dds::pub::find<dds::pub::DataWriter<Foo> >(publisher, "Topic1", std::back_inserter(writers));writer_count = dds::pub::find<dds::pub::DataWriter<Foo> >(publisher, "Topic2", std::back_inserter(writers));

Getting Matched Subscriptions

Lookup a DataWriter’s matched subscriptions

  dds::domain::DomainParticipant participant(0);dds::topic::Topic<Foo> topic(participant, "Topic1");dds::pub::DataWriter<Foo> writer(dds::pub::Publisher(participant), topic);// Create two readers that will match with the above writerdds::sub::DataReader<Foo> reader1(dds::sub::Subscriber(participant), topic);dds::sub::DataReader<Foo> reader2(dds::sub::Subscriber(participant), topic);// Get a list of the InstanceHandles corresponding to the DataWriter's // matched subscriptions.dds::core::InstanceHandleSeq subscription_handles1 = dds::pub::matched_subscriptions(writer);// matched_subscriptions also takes in an iterator range and will return// an InstanceHandle iterator to the end of the InstanceHandleSeqdds::core::InstanceHandleSeq subscription_handles2(2, dds::core::null);dds::core::InstanceHandleSeq::iterator last = dds::pub::matched_subscriptions(writer, subscription_handles2.begin(), subscription_handles2.end());// now last == subscription_handles2.end()

Use the InstanceHandles obtained from matched_subscriptions() to get the SubscriptionBuiltinTopicData for the subscriptions

     dds::topic::SubscriptionBuiltinTopicData subscription_data =dds::pub::matched_subscription_data(writer, subscription_handles1[0]);

Subscriber Use Cases

The following #includes are needed for the examples on this page

#include <dds/sub/ddssub.hpp>
#include <dds/domain/ddsdomain.hpp>
#include <dds/core/ddscore.hpp>

Setting up a subscriber

Set up participant
Create a Subscriber with each of the available constructors

// Create the participant
dds::domain::DomainParticipant participant(0);
// When not explicitly provided to the constructor, the
// created Subscriber's QoS is default, has a NULL listener, and a status mask
// dds::core::status::StatusMask::all()
// Creating a Subscriber
dds::sub::Subscriber subscriber1(participant);
// Creating a Subscriber with modified QoS
dds::sub::qos::SubscriberQos qos;
qos << dds::core::policy::Presentation::GroupAccessScope(true, false);
dds::sub::Subscriber subscriber2(participant, qos);
// Creating a Subscriber with modified QoS and a listener
ExampleSubscriberListener *listener = new ExampleSubscriberListener;
dds::sub::Subscriber subscriber3(participant, qos, listener);
// Creating a Subscriber with modified QoS, a listener, and a sample_rejected()
// status mask
dds::sub::Subscriber subscriber4(participant, qos, listener, dds::core::status::StatusMask::sample_rejected());
// Creating an entity with a listener automatically retains the entity, so
// we must either explicitly close the Subscriber...
subscriber3.close();// ... or set the listener to null
subscriber4.listener(NULL, dds::core::status::StatusMask::none());

Looking up Subscribers

Lookup Subscribers

void howto_lookup_subscribers()
{dds::domain::DomainParticipant participant(0);// Create three Subscribers and retain themcreate_and_retain_subscriber(participant);create_and_retain_subscriber(participant);create_and_retain_subscriber(participant);// We don't have any references to the created Subscribers but we can look // them up using the participant that they were created withstd::vector<dds::sub::Subscriber> subscribers1;// subscriber_count will equal 3 and subscribers1 will hold a reference to // each of the three subscribers that were createdint subscriber_count = rti::sub::find_subscribers(participant, std::back_inserter(subscribers1));// rti::sub::subscribers also takes a forward iterator and a max number of// subscribers to look upstd::vector<dds::sub::Subscriber> subscribers2(2, dds::sub::Subscriber(dds::core::null));// subscriber_count will equal 2 because we're only asking for 2subscriber_count = rti::sub::find_subscribers(participant, subscribers2.begin(), 2);// We retained the subscribers so we must close them nowfor (std::vector<dds::sub::Subscriber>::iterator it = subscribers1.begin();it != subscribers1.end(); it++) {(*it).close();}
}
void create_and_retain_subscriber(dds::domain::DomainParticipant &participant)
{dds::sub::Subscriber subscriber(participant);subscriber.retain();
}

RTI DDS. c++11例子 -1相关推荐

  1. 录制和播放RTI DDS(6.0)数据

    录制和播放程序: /home/chamo/rti_connext_dds-6.0.0/bin/rtirecordingservice -verbosity 3 /home/chamo/rti_conn ...

  2. 自动驾驶中间件之二:通信中间件,DDS与SOME/IP 谁主沉浮?

    本文是自动驾驶中间件科普系列第二篇,上一篇为自动驾驶中间件之一:AUTOSAR正在被"边缘化"? 随着传感器的数量越来越多,数据来源越来越多.规模也会越来越大,那这些多源异构数据如 ...

  3. SOA协议DDS和Some/IP对比

    SOME/IP 和 DDS 均已被纳入AUTOSAR AP的平台标准中. SOME/IP 和 DDS是在不同的应用场景和不同的需求下诞生的技术,所以它们之间注定有很大的区别. SOME/IP SOME ...

  4. 工业级数据分发服务DDS之安全篇

    目录 引出问题 分析问题 解决问题 官方标准 安全插件 域级安全 域内安全 基于RTPS协议的安全 RTI方案 安全插件的特性 支持的加解密算法 用于数据流保护的密码算法 用于密钥交换的密码算法 用于 ...

  5. 【DDS】DDS与OpenDDS

    DDS与openDDS DDS 什么是DDS? Data Distribution Service(DDS),根据字面理解就是数据分发服务.这套服务,在分布式应用环境下,可以高效率地分发参与者(应用) ...

  6. [C++11 std::thread] 使用C++11 编写 Linux 多线程程序

    From: http://www.ibm.com/developerworks/cn/linux/1412_zhupx_thread/index.html 本文讲述了如何使用 C++11 编写 Lin ...

  7. Linux多线程实践(10) --使用 C++11 编写 Linux 多线程程序

    在这个多核时代,如何充分利用每个 CPU 内核是一个绕不开的话题,从需要为成千上万的用户同时提供服务的服务端应用程序,到需要同时打开十几个页面,每个页面都有几十上百个链接的 web 浏览器应用程序,从 ...

  8. 【软件定义汽车】SOA协议DDS和Some/IP对比

    SOME/IP 和 DDS 均已被纳入AUTOSAR AP的平台标准中. SOME/IP 和 DDS是在不同的应用场景和不同的需求下诞生的技术,所以它们之间注定有很大的区别. SOME/IP SOME ...

  9. DDS元模型、应用模型

    DDS简介 DDS (Data Distribution Service ,数据分发服务 ) 是一种基于数据的通信中间件标准,目的是建立分布式系统的高质量的数据通信.目前广泛应用于航空航天.汽车自动驾 ...

  10. List(updated 2023.01.29)

    一.Wind River Wind River VxWorks Wind River VxWorks 5.5 Wind River VxWorks 5.5.1 Wind River VxWorks 5 ...

最新文章

  1. [C#,Java,PHP] - IMAP文件夹名称编码和解码方法
  2. android+包+反编译,简单的Android之apk包反编译方法
  3. 什么是服务器信息怎么看,怎么查看服务器信息
  4. 技术人如何自我提升?阿里技术带来丰富学习资源
  5. atitit.微信支付的教程文档 attilax总结
  6. Win32ASM学习[10]:传送指令
  7. JDBC01 利用JDBC连接数据库【不使用数据库连接池】
  8. 信息学奥赛一本通C++语言——1014:与圆相关的计算
  9. 怎样为企业挑选正确的EDR解决方案
  10. 使用checked关键字处理“溢出”错误
  11. IIS搭配Server-u构建企业空间服务(二)
  12. 最近我一个朋友在职场上陷入了迷茫
  13. 洛谷 [P1387] 最大正方形
  14. python的装饰器、迭代器、yield_Python学习日记(5)简单了解迭代器、生成器、装饰器、上下文管理器...
  15. php找100到1000之间的素数_php编程输出100以内的素数
  16. matlab符号运算求二阶微分方程,matlab二阶微分方程求解x 0.2x 0.4x=0.2u(t)
  17. xshell复制粘贴快捷键
  18. HTML5期末大作业——布卡漫画官网(4个页面)HTML+CSS+JavaScript
  19. linux系统安装达梦数据库
  20. 盘复分支语句和循环语句的那些知识

热门文章

  1. do还是doing imagine加to_do还是doing imagine加to_do、to do、doing用法全汇总,再也不用担心选错啦(收藏)......
  2. 如何将flv转换成mp3格式
  3. python提示syntaxerror什么意思_“SyntaxError:print”调用中缺少括号在Python中是什么意思?...
  4. HATETRIS:故意跟你作对的俄罗斯方块游戏
  5. JVM学习笔记(4)-运行时数据区详解之程序计数器与虚拟机栈
  6. Heidisql中如何解决MySqlServer go away问题
  7. python怎么读xls文件,python读取xls文件
  8. 微信小程序 环形进度条_微信小程序实现圆形进度条
  9. UE 5_可交互的门
  10. UltraVNC源码编译运行