本文整理汇总了C++中DomainParticipant_var::delete_contained_entities方法的典型用法代码示例。如果您正苦于以下问题:C++ DomainParticipant_var::delete_contained_entities方法的具体用法?C++ DomainParticipant_var::delete_contained_entities怎么用?C++ DomainParticipant_var::delete_contained_entities使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DomainParticipant_var
的用法示例。
在下文中一共展示了DomainParticipant_var::delete_contained_entities方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run_test
int run_test(int argc, ACE_TCHAR *argv[])
{
DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
DomainParticipant_var dp =
dpf->create_participant(23, PARTICIPANT_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
MessageTypeSupport_var ts = new MessageTypeSupportImpl;
ts->register_type(dp, "");
Publisher_var pub = dp->create_publisher(PUBLISHER_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
TransportImpl_rch pub_tport =
TheTransportFactory->create_transport_impl(1, AUTO_CONFIG);
PublisherImpl* pub_impl = dynamic_cast<PublisherImpl*>(pub.in());
pub_impl->attach_transport(pub_tport.in());
Subscriber_var sub = dp->create_subscriber(SUBSCRIBER_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
TransportImpl_rch sub_tport =
TheTransportFactory->create_transport_impl(2, AUTO_CONFIG);
SubscriberImpl* sub_impl = dynamic_cast<SubscriberImpl*>(sub.in());
sub_impl->attach_transport(sub_tport.in());
bool passed = run_sorting_test(dp, ts, pub, sub);
passed &= run_filtering_test(dp, ts, pub, sub);
dp->delete_contained_entities();
dpf->delete_participant(dp);
return passed ? 0 : 1;
}
示例2: run_test
int run_test(int argc, ACE_TCHAR* argv[])
{
DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
DomainParticipant_var dp =
dpf->create_participant(23, PARTICIPANT_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
Publisher_var pub = dp->create_publisher(PUBLISHER_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
DomainParticipant_var dp2 =
dpf->create_participant(23, PARTICIPANT_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
Subscriber_var sub = dp2->create_subscriber(SUBSCRIBER_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
TransportRegistry& treg = *TheTransportRegistry;
if (!treg.get_config("t1").is_nil()) {
treg.bind_config("t1", pub);
treg.bind_config("t2", sub);
}
const bool passed = run_multitopic_test(pub, sub);
dp->delete_contained_entities();
dpf->delete_participant(dp);
dp2->delete_contained_entities();
dpf->delete_participant(dp2);
return passed ? 0 : 1;
}
示例3: cleanup
void cleanup(const DomainParticipantFactory_var& dpf,
const DomainParticipant_var& dp)
{
if (!dpf || !dp) return;
ReturnCode_t ret = dp->delete_contained_entities();
if (ret != RETCODE_OK) {
ACE_DEBUG((LM_ERROR, "ERROR: %P delete_contained_entities() returned %d\n",
ret));
}
ret = dpf->delete_participant(dp);
if (ret != RETCODE_OK) {
ACE_DEBUG((LM_ERROR, "ERROR: %P delete_participant() returned %d\n", ret));
}
}
示例4: run_test
int run_test(int argc, ACE_TCHAR *argv[])
{
using namespace DDS;
using namespace OpenDDS::DCPS;
WaitSet_var ws = new WaitSet;
DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
DomainParticipant_var dp = dpf->create_participant(23,
PARTICIPANT_QOS_DEFAULT, 0, ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
Messenger::MessageTypeSupport_var ts = new Messenger::MessageTypeSupportImpl;
ts->register_type(dp, ts->get_type_name());
Topic_var topic = dp->create_topic("MyTopic", ts->get_type_name(),
TOPIC_QOS_DEFAULT, 0, ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
Publisher_var pub = dp->create_publisher(PUBLISHER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
TransportImpl_rch pub_tport =
TheTransportFactory->create_transport_impl(1, AUTO_CONFIG);
PublisherImpl* pub_impl = dynamic_cast<PublisherImpl*> (pub.in());
pub_impl->attach_transport(pub_tport.in());
DataWriter_var dw = pub->create_datawriter(topic, DATAWRITER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
StatusCondition_var cond = dw->get_statuscondition();
cond->set_enabled_statuses(OFFERED_INCOMPATIBLE_QOS_STATUS);
ws->attach_condition(cond);
Subscriber_var sub = dp->create_subscriber(SUBSCRIBER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
TransportImpl_rch sub_tport =
TheTransportFactory->create_transport_impl(2, AUTO_CONFIG);
SubscriberImpl* sub_impl = dynamic_cast<SubscriberImpl*> (sub.in());
sub_impl->attach_transport(sub_tport.in());
DataReaderQos dr_qos;
sub->get_default_datareader_qos(dr_qos);
dr_qos.durability.kind = PERSISTENT_DURABILITY_QOS;
Waiter w(ws);
w.activate();
DataReader_var dr = sub->create_datareader(topic, dr_qos, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
w.wait();
bool passed = (w.result() == RETCODE_OK);
ws->detach_condition(cond);
dp->delete_contained_entities();
dpf->delete_participant(dp);
return passed ? 0 : 1;
}
示例5: run_test
int run_test(int argc, ACE_TCHAR *argv[])
{
DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
DomainParticipant_var dp =
dpf->create_participant(23, PARTICIPANT_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
MessageTypeSupport_var ts = new MessageTypeSupportImpl;
ts->register_type(dp, "");
Publisher_var pub = dp->create_publisher(PUBLISHER_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
Subscriber_var sub = dp->create_subscriber(SUBSCRIBER_QOS_DEFAULT, 0,
DEFAULT_STATUS_MASK);
bool passed = run_sorting_test(dp, ts, pub, sub);
passed &= run_filtering_test(dp, ts, pub, sub);
passed &= run_change_parameter_test(dp, ts, pub, sub);
dp->delete_contained_entities();
dpf->delete_participant(dp);
return passed ? 0 : 1;
}
示例6: checkHandle
//.........这里部分代码省略.........
tHandle = CreateThread(NULL, 0, delayedEscape, NULL, 0, &tid);
while (!closed) {
/* Wait until at least one of the Conditions in the waitset triggers. */
status = userLoadWS->wait(guardList, DURATION_INFINITE);
checkStatus(status, "DDS::WaitSet::wait");
/* Walk over all guards to display information */
for (CORBA::ULong i = 0; i < guardList.length(); i++) {
if ( guardList[i].in() == newUser.in() ) {
/* The newUser ReadCondition contains data */
status = nameServer->read_w_condition(
nsList,
infoSeq,
LENGTH_UNLIMITED,
newUser.in() );
checkStatus(status, "Chat::NameServiceDataReader::read_w_condition");
for (CORBA::ULong j = 0; j < nsList.length(); j++) {
cout << "New user: " << nsList[j].name << endl;
}
status = nameServer->return_loan(nsList, infoSeq);
checkStatus(status, "Chat::NameServiceDataReader::return_loan");
} else if ( guardList[i].in() == leftUser.in() ) {
/* Some liveliness has changed (either a DataWriter joined or a DataWriter left) */
status = loadAdmin->get_liveliness_changed_status(livChangStatus);
checkStatus(status, "DDS::DataReader::get_liveliness_changed_status");
if (livChangStatus.alive_count < prevCount) {
/* A user has left the ChatRoom, since a DataWriter lost its liveliness */
/* Take the effected users so tey will not appear in the list later on. */
status = nameServer->take(
nsList,
infoSeq,
LENGTH_UNLIMITED,
ANY_SAMPLE_STATE,
ANY_VIEW_STATE,
NOT_ALIVE_NO_WRITERS_INSTANCE_STATE);
checkStatus(status, "Chat::NameServiceDataReader::take");
for (CORBA::ULong j = 0; j < nsList.length(); j++) {
/* re-apply query arguments */
ostringstream numberString;
numberString << nsList[j].userID;
args[0UL] = numberString.str().c_str();
status = singleUser->set_query_parameters(args);
checkStatus(status, "DDS::QueryCondition::set_query_parameters");
/* Read this users history */
status = loadAdmin->take_w_condition(
msgList,
infoSeq2,
LENGTH_UNLIMITED,
singleUser.in() );
checkStatus(status, "Chat::ChatMessageDataReader::take_w_condition");
/* Display the user and his history */
cout << "Departed user " << nsList[j].name << " has sent " <<
msgList.length() << " messages." << endl;
status = loadAdmin->return_loan(msgList, infoSeq2);
checkStatus(status, "Chat::ChatMessageDataReader::return_loan");
}
status = nameServer->return_loan(nsList, infoSeq);
checkStatus(status, "Chat::NameServiceDataReader::return_loan");
}
prevCount = livChangStatus.alive_count;
} else if ( guardList[i].in() == escape.in() ) {
cout << "UserLoad has terminated." << endl;
closed = true;
}
else
{
assert(0);
};
} /* for */
} /* while (!closed) */
/* Remove all Conditions from the WaitSet. */
status = userLoadWS->detach_condition( escape.in() );
checkStatus(status, "DDS::WaitSet::detach_condition (escape)");
status = userLoadWS->detach_condition( leftUser.in() );
checkStatus(status, "DDS::WaitSet::detach_condition (leftUser)");
status = userLoadWS->detach_condition( newUser.in() );
checkStatus(status, "DDS::WaitSet::detach_condition (newUser)");
/* Remove the type-names. */
CORBA::string_free(chatMessageTypeName);
CORBA::string_free(nameServiceTypeName);
/* Free all resources */
status = participant->delete_contained_entities();
checkStatus(status, "DDS::DomainParticipant::delete_contained_entities");
status = TheParticipantFactory->delete_participant( participant.in() );
checkStatus(status, "DDS::DomainParticipantFactory::delete_participant");
CloseHandle(tHandle);
return 0;
}
示例7: run_test
//.........这里部分代码省略.........
DomainParticipantFactory_var dpf = TheParticipantFactoryWithArgs(argc, argv);
DomainParticipant_var dp = dpf->create_participant(23,
PARTICIPANT_QOS_DEFAULT, 0, ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
MessageTypeSupport_var ts = new MessageTypeSupportImpl;
// leave type name not speficied would register it with _interface_repository_id
ts->register_type(dp, "");
CORBA::String_var type_name = ts->get_type_name();
Topic_var topic = dp->create_topic("MyTopic", type_name,
TOPIC_QOS_DEFAULT, 0, ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
Publisher_var pub = dp->create_publisher(PUBLISHER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
DataWriter_var dw = pub->create_datawriter(topic, DATAWRITER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
Subscriber_var sub = dp->create_subscriber(SUBSCRIBER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
DataReader_var dr = sub->create_datareader(topic, DATAREADER_QOS_DEFAULT, 0,
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
StatusCondition_var dw_sc = dw->get_statuscondition();
dw_sc->set_enabled_statuses(PUBLICATION_MATCHED_STATUS);
ws->attach_condition(dw_sc);
Duration_t infinite = {DURATION_INFINITE_SEC, DURATION_INFINITE_NSEC};
ConditionSeq active;
ws->wait(active, infinite);
ws->detach_condition(dw_sc);
ReturnCode_t ret = RETCODE_OK;
MessageDataWriter_var mdw = MessageDataWriter::_narrow(dw);
Message msg = {0};
for (int i(0); i < 12; ++i) {
++msg.subject_id;
ret = mdw->write(msg, HANDLE_NIL);
if (ret != RETCODE_OK) return ret;
}
ReadCondition_var dr_rc = dr->create_readcondition(NOT_READ_SAMPLE_STATE,
NEW_VIEW_STATE, ALIVE_INSTANCE_STATE);
ReadCondition_var dr_rc2 = dr->create_readcondition(ANY_SAMPLE_STATE,
ANY_VIEW_STATE, NOT_ALIVE_DISPOSED_INSTANCE_STATE);
ws->attach_condition(dr_rc);
ws->attach_condition(dr_rc2);
MessageDataReader_var mdr = MessageDataReader::_narrow(dr);
bool passed = true, done = false;
while (!done) {
ret = ws->wait(active, infinite);
if (ret != RETCODE_OK) {
passed = false;
break;
}
cout << "wait returned" << endl;
for (CORBA::ULong i(0); i < active.length(); ++i) {
if (active[i] == dr_rc) {
// To test both take_w_condition and
// take_next_instance_w_condition, we'll limit the "take" to 3
// samples and then use take_next_instance_w_condition.
MessageSeq data;
SampleInfoSeq info;
ret = mdr->take_w_condition(data, info, 3, dr_rc);
if (ret != RETCODE_OK && ret != RETCODE_NO_DATA) {
cout << "ERROR: take_w_condition returned " << ret << endl;
passed = false;
done = true;
}
if (ret == RETCODE_OK) {
received_data(data, mdw, msg);
}
cout << "testing take_next_instance_w_condition" << endl;
InstanceHandle_t handle = HANDLE_NIL;
while (true) {
ret = mdr->take_next_instance_w_condition(data, info, 1,
handle, dr_rc);
if (ret == RETCODE_NO_DATA) break;
if (ret != RETCODE_OK) {
cout << "ERROR: take_next_instance_w_condition returned "
<< ret << endl;
passed = false;
done = true;
}
received_data(data, mdw, msg);
handle = info[info.length() - 1].instance_handle;
}
} else if (active[i] == dr_rc2) {
cout << "an instance has been disposed, exiting" << endl;
done = true;
}
}
}
ws->detach_condition(dr_rc);
dr->delete_readcondition(dr_rc);
ws->detach_condition(dr_rc2);
// Instead of: dr->delete_readcondition(dr_rc2);
dr->delete_contained_entities();
dp->delete_contained_entities();
dpf->delete_participant(dp);
return passed ? 0 : 1;
}