本文整理汇总了C++中dds::DomainParticipantFactory_var::get_default_participant_qos方法的典型用法代码示例。如果您正苦于以下问题:C++ DomainParticipantFactory_var::get_default_participant_qos方法的具体用法?C++ DomainParticipantFactory_var::get_default_participant_qos怎么用?C++ DomainParticipantFactory_var::get_default_participant_qos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::DomainParticipantFactory_var
的用法示例。
在下文中一共展示了DomainParticipantFactory_var::get_default_participant_qos方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DDS::DomainParticipant_var
TestBase::create_participant()
{
DDS::DomainId_t domain = DEFAULT_DOMAIN;
DDS::DomainParticipantQos qos;
DDS::DomainParticipantFactory_var dpf = TheParticipantFactory;
if (dpf->get_default_participant_qos(qos) != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: create_participant() -")
ACE_TEXT(" get_default_participant_qos failed!\n")));
ACE_OS::exit(-1);
}
DDS::DomainParticipantListener_ptr listener =
DDS::DomainParticipantListener::_nil();
DDS::StatusMask status = OpenDDS::DCPS::DEFAULT_STATUS_MASK;
if (init_participant(domain, qos, listener, status) != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: create_participant() -")
ACE_TEXT(" init_participant failed!\n")));
ACE_OS::exit(-1);
}
DDS::DomainParticipant_var participant =
dpf->create_participant(domain, qos, listener, status);
if (CORBA::is_nil(participant.in())) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: create_participant() -")
ACE_TEXT(" create_participant failed!\n")));
ACE_OS::exit(-1);
}
return participant;
}
示例2: ACE_TMAIN
int ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
int result = 0;
ACE_DEBUG ((LM_DEBUG, "(%P|%t) subscriber main\n"));
try
{
DDS::DomainParticipantFactory_var dpf;
DDS::DomainParticipant_var participant;
dpf = TheParticipantFactoryWithArgs(argc, argv);
if (parse_args (argc, argv) == -1) {
return -1;
}
DDS::DomainParticipantQos partQos;
dpf->get_default_participant_qos(partQos);
// set up user data in DP qos
CORBA::ULong part_user_data_len
= static_cast<CORBA::ULong>(ACE_OS::strlen (PART_USER_DATA));
partQos.user_data.value.length (part_user_data_len);
partQos.user_data.value.replace (part_user_data_len,
part_user_data_len,
reinterpret_cast<CORBA::Octet*>(PART_USER_DATA));
participant = dpf->create_participant(411,
partQos,
DDS::DomainParticipantListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (participant.in ())) {
cerr << "subscriber: create_participant failed." << endl;
return 1 ;
}
::Messenger::MessageTypeSupport_var mts = new ::Messenger::MessageTypeSupportImpl();
if (DDS::RETCODE_OK != mts->register_type(participant.in (), "Messenger")) {
cerr << "subscriber: Failed to register the MessageTypeTypeSupport." << endl;
exit(1);
}
CORBA::String_var type_name = mts->get_type_name ();
DDS::TopicQos topic_qos;
participant->get_default_topic_qos(topic_qos);
// set up topic data in topic qos
CORBA::ULong topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (TOPIC_DATA));
topic_qos.topic_data.value.length (topic_data_len);
topic_qos.topic_data.value.replace (topic_data_len, topic_data_len, reinterpret_cast<CORBA::Octet*>(TOPIC_DATA));
DDS::Topic_var topic = participant->create_topic("Movie Discussion List",
type_name.in (),
topic_qos,
DDS::TopicListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (topic.in ())) {
cerr << "subscriber: Failed to create_topic." << endl;
exit(1);
}
// Create the subscriber
DDS::SubscriberQos sub_qos;
participant->get_default_subscriber_qos (sub_qos);
// set up group data in subscriber qos
CORBA::ULong group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (GROUP_DATA));
sub_qos.group_data.value.length (group_data_len);
sub_qos.group_data.value.replace (group_data_len, group_data_len, reinterpret_cast<CORBA::Octet*>(GROUP_DATA));
DDS::Subscriber_var sub =
participant->create_subscriber(sub_qos,
DDS::SubscriberListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (sub.in ())) {
cerr << "subscriber: Failed to create_subscriber." << endl;
exit(1);
}
// activate the listener
DDS::DataReaderListener_var listener (new DataReaderListenerImpl);
DataReaderListenerImpl* listener_servant =
dynamic_cast<DataReaderListenerImpl*>(listener.in());
DDS::Subscriber_var builtin = participant->get_builtin_subscriber();
DDS::DataReader_var bitdr =
builtin->lookup_datareader(OpenDDS::DCPS::BUILT_IN_PUBLICATION_TOPIC);
listener_servant->set_builtin_datareader(bitdr.in());
if (CORBA::is_nil (listener.in ())) {
cerr << "subscriber: listener is nil." << endl;
exit(1);
}
// Create the Datareaders
DDS::DataReaderQos dr_qos;
sub->get_default_datareader_qos (dr_qos);
//.........这里部分代码省略.........
示例3: init
void KVStore::init() {
DDS::DomainId_t myDomain = NULL;
DDS::DomainParticipantFactory_var dpf;
DDS::DomainParticipant_var dp;
DDS::Subscriber_var subscriber;
DDS::Publisher_var publisher;
DDS::DomainParticipantQos dpQos;
DDS::TopicQos tQos;
DDS::SubscriberQos sQos;
DDS::DataReaderQos drQos;
DDS::PublisherQos pQos;
DDS::DataWriterQos dwQos;
DDS::Topic_var topic;
DDSKVStore::TransactionTypeSupport_var ts;
// Create Participants
dpf = DDS::DomainParticipantFactory::get_instance();
dpf->get_default_participant_qos(dpQos);
dp = dpf->create_participant(myDomain, dpQos, NULL, DDS::STATUS_MASK_NONE);
// Create Subscriber
dp->get_default_subscriber_qos(sQos);
sQos.partition.name.length(1);
sQos.partition.name[0] = partition.c_str();
subscriber = dp->create_subscriber(sQos, NULL, DDS::STATUS_MASK_NONE);
// Create Publisher
dp->get_default_publisher_qos(pQos);
pQos.partition.name.length(1);
pQos.partition.name[0] = partition.c_str();
publisher = dp->create_publisher(pQos, NULL, DDS::STATUS_MASK_NONE);
// Set DataReader QoS settings
subscriber->get_default_datareader_qos(drQos);
drQos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
drQos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
drQos.history.depth = 30;
// Set DataWriter QoS settings
publisher->get_default_datawriter_qos(dwQos);
dwQos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
dwQos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
dwQos.history.depth = 30;
// Set Topic Qos settings
dp->get_default_topic_qos(tQos);
tQos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
tQos.history.kind = DDS::KEEP_LAST_HISTORY_QOS;
tQos.history.depth = 30;
// Create Topic
ts = new DDSKVStore::TransactionTypeSupport();
ts->register_type(dp, "DDSKVStore::Transaction");
topic = dp->create_topic("Transaction", "DDSKVStore::Transaction", tQos,
NULL, DDS::STATUS_MASK_NONE);
// Create Datareader
dataReader = subscriber->create_datareader(topic, drQos, NULL,
DDS::STATUS_MASK_NONE);
transactionDataReader = DDSKVStore::TransactionDataReader::_narrow(
dataReader);
if (dataReader == NULL)
std::cout << "ERROR: DDS Connection failed" << std::endl;
// Create Datawriter
transactionDataWriter = DDSKVStore::TransactionDataWriter::_narrow(
publisher->create_datawriter(topic, dwQos, NULL,
DDS::STATUS_MASK_NONE));
if (transactionDataWriter == NULL)
std::cout << "ERROR: DDS Connection failed" << std::endl;
// Create Readcondition
readCondition = dataReader->create_readcondition(DDS::ANY_SAMPLE_STATE,
DDS::ANY_VIEW_STATE, DDS::ALIVE_INSTANCE_STATE);
}
示例4: shifter
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try {
// Initialize DomainParticipantFactory
DDS::DomainParticipantFactory_var dpf =
TheParticipantFactoryWithArgs(argc, argv);
enum {
READER,
WRITER
} mode = READER;
bool toggle = false;
{
// New scope.
ACE_Arg_Shifter shifter (argc, argv);
while (shifter.is_anything_left ()) {
const ACE_TCHAR* x = shifter.get_current();
if (ACE_OS::strcmp(x, ACE_TEXT("-reader")) == 0) {
mode = READER;
}
if (ACE_OS::strcmp(x, ACE_TEXT("-writer")) == 0) {
mode = WRITER;
}
if (ACE_OS::strcmp(x, ACE_TEXT("-toggle")) == 0) {
toggle = true;
}
shifter.consume_arg ();
}
}
// Create DomainParticipant
DDS::DomainParticipantQos dp_qos;
dpf->get_default_participant_qos(dp_qos);
dp_qos.user_data.value.length(6);
dp_qos.user_data.value[0] = 0;
dp_qos.user_data.value[1] = 0;
dp_qos.user_data.value[2] = 0;
dp_qos.user_data.value[3] = 0;
dp_qos.user_data.value[4] = 0;
dp_qos.user_data.value[5] = (mode == READER) ? 0 : 1;
DDS::DomainParticipant_var participant =
dpf->create_participant(DOMAIN_ID,
dp_qos,
0,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!participant) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_participant failed!\n")),
-1);
}
// Register TypeSupport
TestMsgTypeSupport_var ts =
new TestMsgTypeSupportImpl;
if (ts->register_type(participant, "") != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" register_type failed!\n")),
-1);
}
// Create Topic
CORBA::String_var type_name = ts->get_type_name();
DDS::Topic_var topic =
participant->create_topic("TheTopic",
type_name,
TOPIC_QOS_DEFAULT,
0,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!topic) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_topic failed!\n")),
-1);
}
int return_code = 1;
switch (mode) {
case READER:
return_code = do_reader(participant, topic, toggle);
break;
case WRITER:
return_code = do_writer(participant, topic, toggle);
break;
}
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant);
TheServiceParticipant->shutdown();
return return_code;
//.........这里部分代码省略.........
示例5: shifter
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
try {
// Initialize DomainParticipantFactory
DDS::DomainParticipantFactory_var dpf =
TheParticipantFactoryWithArgs(argc, argv);
std::string participant_id;
std::vector<std::string> readers;
std::vector<std::string> writers;
bool reliable = false;
int total_readers = 0, total_writers = 0;
{
// New scope.
ACE_Arg_Shifter shifter (argc, argv);
while (shifter.is_anything_left ()) {
const ACE_TCHAR* x;
x = shifter.get_the_parameter (ACE_TEXT("-participant"));
if (x != NULL) {
participant_id = ACE_TEXT_ALWAYS_CHAR(x);
}
x = shifter.get_the_parameter (ACE_TEXT("-reader"));
if (x != NULL) {
readers.push_back(ACE_TEXT_ALWAYS_CHAR(x));
}
x = shifter.get_the_parameter (ACE_TEXT("-writer"));
if (x != NULL) {
writers.push_back(ACE_TEXT_ALWAYS_CHAR(x));
}
x = shifter.get_the_parameter (ACE_TEXT("-reliable"));
if (x != NULL) {
reliable = ACE_OS::atoi(x);
}
x = shifter.get_the_parameter (ACE_TEXT("-total_readers"));
if (x != NULL) {
total_readers = ACE_OS::atoi(x);
}
x = shifter.get_the_parameter (ACE_TEXT("-total_writers"));
if (x != NULL) {
total_writers = ACE_OS::atoi(x);
}
shifter.consume_arg ();
}
}
participant_id.resize(12);
// Create DomainParticipant
DDS::DomainParticipantQos dp_qos;
dpf->get_default_participant_qos(dp_qos);
dp_qos.user_data.value.length(6);
dp_qos.user_data.value[0] = fromhex(participant_id, 0);
dp_qos.user_data.value[1] = fromhex(participant_id, 1);
dp_qos.user_data.value[2] = fromhex(participant_id, 2);
dp_qos.user_data.value[3] = fromhex(participant_id, 3);
dp_qos.user_data.value[4] = fromhex(participant_id, 4);
dp_qos.user_data.value[5] = fromhex(participant_id, 5);
DDS::DomainParticipant_var participant =
dpf->create_participant(DOMAIN_ID,
dp_qos,
0,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!participant) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_participant failed!\n")),
-1);
}
// Register TypeSupport
TestMsgTypeSupport_var ts =
new TestMsgTypeSupportImpl;
if (ts->register_type(participant, "") != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" register_type failed!\n")),
-1);
}
// Create Topic
CORBA::String_var type_name = ts->get_type_name();
DDS::Topic_var topic =
participant->create_topic("TheTopic",
type_name,
TOPIC_QOS_DEFAULT,
0,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!topic) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_topic failed!\n")),
-1);
}
//.........这里部分代码省略.........
示例6: ACE_TMAIN
int ACE_TMAIN(int argc, ACE_TCHAR *argv[]) {
try
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) publisher main\n"));
DDS::DomainParticipantFactory_var dpf =
TheParticipantFactoryWithArgs(argc, argv);
if (parse_args (argc, argv) == -1) {
return -1;
}
DDS::DomainParticipantQos partQos;
dpf->get_default_participant_qos(partQos);
// set up user data in DP qos
CORBA::ULong part_user_data_len
= static_cast<CORBA::ULong>(ACE_OS::strlen (PART_USER_DATA));
partQos.user_data.value.length (part_user_data_len);
partQos.user_data.value.replace (part_user_data_len,
part_user_data_len,
reinterpret_cast<CORBA::Octet*>(PART_USER_DATA));
DDS::DomainParticipant_var participant =
dpf->create_participant(411,
partQos,
DDS::DomainParticipantListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (participant.in ())) {
cerr << "publisher: create_participant failed." << endl;
return 1;
}
::Messenger::MessageTypeSupport_var ts = new ::Messenger::MessageTypeSupportImpl();
if (DDS::RETCODE_OK != ts->register_type(participant.in (), "Messenger")) {
cerr << "publisher: register_type failed." << endl;
exit(1);
}
CORBA::String_var type_name = ts->get_type_name ();
DDS::TopicQos topic_qos;
participant->get_default_topic_qos(topic_qos);
// set up topic data in topic qos
CORBA::ULong topic_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (TOPIC_DATA));
topic_qos.topic_data.value.length (topic_data_len);
topic_qos.topic_data.value.replace (topic_data_len, topic_data_len, reinterpret_cast<CORBA::Octet*>(TOPIC_DATA));
DDS::Topic_var topic =
participant->create_topic ("Movie Discussion List",
type_name.in (),
topic_qos,
DDS::TopicListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (topic.in ())) {
cerr << "publisher: create_topic failed." << endl;
exit(1);
}
DDS::PublisherQos pub_qos;
participant->get_default_publisher_qos (pub_qos);
// set up group data in group qos
CORBA::ULong group_data_len = static_cast<CORBA::ULong> (ACE_OS::strlen (GROUP_DATA));
pub_qos.group_data.value.length (group_data_len);
pub_qos.group_data.value.replace (group_data_len, group_data_len, reinterpret_cast<CORBA::Octet*>(GROUP_DATA));
DDS::Publisher_var pub =
participant->create_publisher(pub_qos,
DDS::PublisherListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (pub.in ())) {
cerr << "publisher: create_publisher failed." << endl;
exit(1);
}
// Create the datawriter
DDS::DataWriterQos dw_qos;
pub->get_default_datawriter_qos (dw_qos);
dw_qos.durability.kind = DDS::TRANSIENT_LOCAL_DURABILITY_QOS;
dw_qos.reliability.kind = ::DDS::RELIABLE_RELIABILITY_QOS;
dw_qos.resource_limits.max_samples_per_instance = 1000;
dw_qos.history.kind = ::DDS::KEEP_ALL_HISTORY_QOS;
// set up user data in DW qos
CORBA::ULong dw_user_data_len = static_cast<CORBA::ULong>(ACE_OS::strlen (DW_USER_DATA));
dw_qos.user_data.value.length (dw_user_data_len);
dw_qos.user_data.value.replace (dw_user_data_len,
dw_user_data_len,
reinterpret_cast<CORBA::Octet*>(DW_USER_DATA));
DDS::DataWriter_var dw =
pub->create_datawriter(topic.in (),
dw_qos,
DDS::DataWriterListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil (dw.in ())) {
cerr << "publisher: create_datawriter failed." << endl;
//.........这里部分代码省略.........