本文整理汇总了C++中dds::WaitSet_var::detach_condition方法的典型用法代码示例。如果您正苦于以下问题:C++ WaitSet_var::detach_condition方法的具体用法?C++ WaitSet_var::detach_condition怎么用?C++ WaitSet_var::detach_condition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dds::WaitSet_var
的用法示例。
在下文中一共展示了WaitSet_var::detach_condition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleWaitCondition
/**
* Handles zero copy message sets. Consider your requirements and edit timeout nad matched status bits as needed.
* QoS should drive all of you design decisions.
*/
void CAppNodeImpl::HandleWaitCondition()
{
// Block until Subscriber is available
DDS::StatusCondition_var condition = _writer->get_statuscondition();
condition->set_enabled_statuses( DDS::PUBLICATION_MATCHED_STATUS );
DDS::WaitSet_var waitSet = new DDS::WaitSet;
waitSet->attach_condition( condition );
DDS::ConditionSeq conditions;
DDS::SubscriptionMatchedStatus matches = { 0, 0, 0, 0, 0 };
DDS::Duration_t timeout = { 30, 0 };
if ( waitSet->wait(conditions, timeout ) != DDS::RETCODE_OK )
{
LOG( ERROR ) << "wait condition failed.";
}
if ( _reader->get_subscription_matched_status( matches ) != DDS::RETCODE_OK )
{
LOG( ERROR ) << "Publication matched status failed.";
}
waitSet->detach_condition( condition );
}
示例2: if
int
OpenDDS::Model::WriterSync::wait_unmatch(const DDS::DataWriter_var& writer,
unsigned int num_readers)
{
DDS::ReturnCode_t stat;
DDS::StatusCondition_var condition = writer->get_statuscondition();
condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
DDS::ConditionSeq conditions;
DDS::PublicationMatchedStatus ms = { 0, 0, 0, 0, 0 };
DDS::Duration_t timeout = { 1, 0 };
do {
if (DCPS_debug_level > 4) {
ACE_DEBUG((LM_NOTICE, ACE_TEXT("WriterSync: pub checking unmatched\n")));
}
stat = writer->get_publication_matched_status(ms);
if (stat != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((
LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: wait_unmatch() -")
ACE_TEXT(" get_publication_matched_status failed!\n")),
-1);
} else if (ms.current_count == 0 && (unsigned int)ms.total_count >= num_readers) {
if (DCPS_debug_level > 4) {
ACE_DEBUG((LM_NOTICE, ACE_TEXT("WriterSync: pub match count %d total count %d\n"),
ms.current_count, ms.total_count));
}
break; // unmatched
}
if (DCPS_debug_level > 4) {
ACE_DEBUG((LM_NOTICE, ACE_TEXT("WriterSync: pub match count %d total count %d\n"),
ms.current_count, ms.total_count));
}
// wait for a change
stat = ws->wait(conditions, timeout);
if ((stat != DDS::RETCODE_OK) && (stat != DDS::RETCODE_TIMEOUT)) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: %N:%l: wait_unmatch() -")
ACE_TEXT(" wait failed!\n")),
-1);
}
} while (true);
ws->detach_condition(condition);
if (DCPS_debug_level > 4) {
ACE_DEBUG((LM_NOTICE, ACE_TEXT("WriterSync: pub unmatched\n")));
}
return 0;
}
示例3:
bool
wait_subscription_matched_status(const Options& /*opts*/, const DDS::DataReader_ptr r)
{
// To check the match status ?
DDS::SubscriptionMatchedStatus matches = {0, 0, 0, 0, 0};
TEST_ASSERT((r->get_subscription_matched_status(matches) == ::DDS::RETCODE_OK));
// Block until Subscriber is available
DDS::StatusCondition_var condition = r->get_statuscondition();
condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS
| DDS::SUBSCRIPTION_MATCHED_STATUS
// | DDS::REQUESTED_INCOMPATIBLE_QOS_STATUS
// | DDS::OFFERED_INCOMPATIBLE_QOS_STATUS
);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
// int duration = opts.test_duration;
DDS::Duration_t timeout = {
DDS::DURATION_INFINITE_SEC,
DDS::DURATION_INFINITE_NSEC
// (duration < 0) ? DDS::DURATION_INFINITE_SEC : duration,
// (duration < 0) ? DDS::DURATION_INFINITE_NSEC : 0
};
DDS::ConditionSeq conditions;
int status = ws->wait(conditions, timeout);
ws->detach_condition(condition);
if (status != DDS::RETCODE_OK)
{
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P|%t)")
ACE_TEXT(" ERROR: wait failed: %p\n")), false);
}
return true;
}
示例4: if
int
Writer::svc()
{
DDS::InstanceHandleSeq handles;
try {
// Block until Subscriber is available
DDS::StatusCondition_var condition = writer_->get_statuscondition();
condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::PublicationMatchedStatus matches = {0, 0, 0, 0, 0};
do {
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: wait failed!\n")));
ACE_OS::exit(-1);
}
if (writer_->get_publication_matched_status(matches) != ::DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: get_publication_matched_status failed!\n")));
ACE_OS::exit(-1);
}
} while (matches.current_count < 2);
ws->detach_condition(condition);
// Write samples
Messenger::MessageDataWriter_var message_dw
= Messenger::MessageDataWriter::_narrow(writer_.in());
if (CORBA::is_nil(message_dw.in())) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: _narrow failed!\n")));
ACE_OS::exit(-1);
}
Messenger::Message message;
message.from = CORBA::string_dup(ownership_dw_id_.c_str());
message.subject = CORBA::string_dup("Review");
message.text = CORBA::string_dup("Worst. Movie. Ever.");
message.count = 1;
message.strength = ownership_strength;
for (int i = 0; i < num_messages; i++) {
message.subject_id = message.count % 2; // 0 or 1
ACE_DEBUG ((LM_DEBUG, "(%P|%t) %s writes instance %d count %d str %d\n",
ownership_dw_id_.c_str(), message.subject_id, message.count, message.strength));
DDS::ReturnCode_t error = message_dw->write(message, ::DDS::HANDLE_NIL);
if (error != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: write returned %d!\n"), error));
if (error == DDS::RETCODE_TIMEOUT) {
timeout_writes_++;
}
}
if (message.count == 5) {
::DDS::DataWriterQos qos;
error = this->writer_->get_qos (qos);
if (error != ::DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: get_qos returned %d!\n"), error));
}
CORBA::Long old = qos.ownership_strength.value;
if (reset_ownership_strength != -1 && old != reset_ownership_strength) {
qos.ownership_strength.value = reset_ownership_strength;
// Add a delay so the builtin topic data update arrives after samples
// with previous strength is received by datareader. This helps simplify
// result verification on subscriber side.
ACE_OS::sleep (1);
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) %s : reset ownership strength from %d to %d\n"),
ownership_dw_id_.c_str(), old, reset_ownership_strength));
error = this->writer_->set_qos (qos);
if (error != ::DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: set_qos returned %d!\n"), error));
}
else {
message.strength = reset_ownership_strength;
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ownership strength in message is now %d\n"),
message.strength));
//.........这里部分代码省略.........
示例5: delay_between_pubs
//.........这里部分代码省略.........
writer_qos.history.depth = samples_per_thread_;
if (deadline_.sec > 0 || deadline_.nanosec > 0)
{
writer_qos.deadline.period.sec = deadline_.sec;
writer_qos.deadline.period.nanosec = deadline_.nanosec;
}
DDS::DataWriter_var writer =
publisher->create_datawriter(topic.in(),
writer_qos,
DDS::DataWriterListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(writer.in()))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" create_datawriter failed!\n")), 1);
FooDataWriter_var writer_i = FooDataWriter::_narrow(writer);
if (CORBA::is_nil(writer_i))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" _narrow failed!\n")), 1);
// Block until Subscriber is available
DDS::StatusCondition_var cond = writer->get_statuscondition();
cond->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(cond);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::PublicationMatchedStatus matches = {0, 0, 0, 0, 0};
do
{
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK)
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" wait failed!\n")), 1);
if (writer->get_publication_matched_status(matches) != ::DDS::RETCODE_OK)
{
ACE_ERROR ((LM_ERROR,
"(%P|%t) ERROR: failed to get publication matched status\n"));
ACE_OS::exit (1);
}
}
while (matches.current_count < 1);
ws->detach_condition(cond);
// The following is intentionally inefficient to stress various
// pathways related to publication; we should be especially dull
// and write only one sample at a time per writer.
ProgressIndicator progress("(%P|%t) PARTICIPANT %d%% (%d samples sent)\n",
samples_per_thread_);
for (std::size_t i = 0; i < samples_per_thread_; ++i)
{
Foo foo;
foo.key = 3;
DDS::InstanceHandle_t handle = writer_i->register_instance(foo);
if (writer_i->write(foo, handle) != DDS::RETCODE_OK)
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" write failed!\n")), 1);
++progress;
ACE_OS::sleep(delay_between_pubs);
}
DDS::Duration_t interval = { 30, 0};
if( DDS::RETCODE_OK != writer->wait_for_acknowledgments( interval)) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P:%t) ERROR: svc() - ")
ACE_TEXT("timed out waiting for acks!\n")
), 1);
}
publisher->delete_datawriter(writer);
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant.in());
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception("caught in svc()");
return 1;
}
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) <- PARTICIPANT FINISHED\n")));
return 0;
}
示例6: ACE_TMAIN
//.........这里部分代码省略.........
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_publisher failed!\n")),
-1);
}
// Create DataWriter
DDS::DataWriter_var writer =
publisher->create_datawriter(topic,
DATAWRITER_QOS_DEFAULT,
0,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!writer) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_datawriter failed!\n")),
-1);
}
Messenger::MessageDataWriter_var message_writer =
Messenger::MessageDataWriter::_narrow(writer);
if (!message_writer) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" _narrow failed!\n")),
-1);
}
// Block until Subscriber is available
DDS::StatusCondition_var condition = writer->get_statuscondition();
condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
while (true) {
DDS::PublicationMatchedStatus matches;
if (writer->get_publication_matched_status(matches) != ::DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" get_publication_matched_status failed!\n")),
-1);
}
if (matches.current_count >= 1) {
break;
}
DDS::ConditionSeq conditions;
DDS::Duration_t timeout = { 60, 0 };
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" wait failed!\n")),
-1);
}
}
ws->detach_condition(condition);
// Write samples
Messenger::Message message;
message.subject_id = 99;
message.from = "Comic Book Guy";
message.subject = "Review";
message.text = "Worst. Movie. Ever.";
message.count = 0;
for (int i = 0; i < 10; ++i) {
DDS::ReturnCode_t error = message_writer->write(message, DDS::HANDLE_NIL);
++message.count;
++message.subject_id;
if (error != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" write returned %d!\n"), error));
}
}
}
ACE_DEBUG((LM_DEBUG, "(%P|%t) Stop publisher\n"));
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant);
TheServiceParticipant->shutdown();
} catch (const CORBA::Exception& e) {
e._tao_print_exception("Exception caught in main():");
return -1;
}
ACE_DEBUG((LM_DEBUG, "(%P|%t) Publisher exiting\n"));
return 0;
}
示例7: MessageTypeSupportImpl
//.........这里部分代码省略.........
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_publisher failed!\n")),
-1);
}
// Create DataWriter
DDS::DataWriter_var writer =
publisher->create_datawriter(topic.in(),
DATAWRITER_QOS_DEFAULT,
DDS::DataWriterListener::_nil(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(writer.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_datawriter failed!\n")),
-1);
}
Messenger::MessageDataWriter_var message_writer =
Messenger::MessageDataWriter::_narrow(writer.in());
if (CORBA::is_nil(message_writer.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" _narrow failed!\n")),
-1);
}
// Block until Subscriber is available
DDS::StatusCondition_var condition = writer->get_statuscondition();
condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
DDS::ConditionSeq conditions;
DDS::PublicationMatchedStatus matches = { 0, 0, 0, 0, 0 };
DDS::Duration_t timeout = { 30, 0 };
do {
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" wait failed!\n")),
-1);
}
if (writer->get_publication_matched_status(matches) != ::DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" get_publication_matched_status failed!\n")),
-1);
}
} while (matches.current_count < 1);
ws->detach_condition(condition);
// Write samples
Messenger::Message message;
message.subject_id = 99;
message.from = CORBA::string_dup("Comic Book Guy");
message.subject = CORBA::string_dup("Review");
message.text = CORBA::string_dup("Worst. Movie. Ever.");
message.count = 0;
for (int i = 0; i < 10; i++) {
DDS::ReturnCode_t error = message_writer->write(message, DDS::HANDLE_NIL);
if (error != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" write returned %d!\n"), error));
}
}
// Wait for samples to be acknowledged
if (message_writer->wait_for_acknowledgments(timeout) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" wait_for_acknowledgments failed!\n")),
-1);
}
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant.in());
TheServiceParticipant->shutdown();
} catch (const CORBA::Exception& e) {
e._tao_print_exception("Exception caught in main():");
return -1;
}
return 0;
}
示例8: guard
//.........这里部分代码省略.........
// Create DataWriter
DDS::DataWriterQos writer_qos;
publisher->get_default_datawriter_qos(writer_qos);
#ifndef OPENDDS_NO_OWNERSHIP_PROFILE
writer_qos.history.depth = samples_per_thread_;
#endif
writer =
publisher->create_datawriter(topic.in(),
writer_qos,
DDS::DataWriterListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(writer.in()))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" create_datawriter failed!\n")), 1);
writer_i = FooDataWriter::_narrow(writer);
if (CORBA::is_nil(writer_i))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" _narrow failed!\n")), 1);
// Block until Subscriber is available
cond = writer->get_statuscondition();
cond->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
ws->attach_condition(cond);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::PublicationMatchedStatus matches = {0, 0, 0, 0, 0};
do
{
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK)
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" wait failed!\n")), 1);
if (writer->get_publication_matched_status(matches) != ::DDS::RETCODE_OK)
{
ACE_ERROR ((LM_ERROR,
"(%P|%t) ERROR: failed to get publication matched status\n"));
ACE_OS::exit (1);
}
}
while (matches.current_count < 1);
ws->detach_condition(cond);
// The following is intentionally inefficient to stress various
// pathways related to publication; we should be especially dull
// and write only one sample at a time per writer.
ProgressIndicator progress("(%P|%t) PARTICIPANT %d%% (%d samples sent)\n",
samples_per_thread_);
for (std::size_t i = 0; i < samples_per_thread_; ++i)
{
Foo foo;
foo.key = 3;
DDS::InstanceHandle_t handle = writer_i->register_instance(foo);
if (writer_i->write(foo, handle) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" write failed!\n")), 1);
}
++progress;
}
DDS::Duration_t interval = { 30, 0};
if( DDS::RETCODE_OK != writer->wait_for_acknowledgments( interval)) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("(%P:%t) ERROR: svc() - ")
ACE_TEXT("timed out waiting for acks!\n")
), 1);
}
}
// Clean-up!
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) <- PUBLISHER PARTICIPANT DEL CONT ENTITIES\n")));
participant->delete_contained_entities();
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) <- PUBLISHER DELETE PARTICIPANT\n")));
dpf->delete_participant(participant.in());
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) <- PUBLISHER PARTICIPANT VARS GOING OUT OF SCOPE\n")));
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception("caught in svc()");
return 1;
}
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) <- PARTICIPANT FINISHED\n")));
return 0;
}
示例9: listener
//.........这里部分代码省略.........
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" register_type failed!\n")), -1);
}
// Create Topic (Movie Discussion List)
CORBA::String_var type_name = ts->get_type_name();
DDS::Topic_var topic =
participant->create_topic("Movie Discussion List",
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);
}
// Create Subscriber
DDS::Subscriber_var subscriber =
participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
0,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!subscriber) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_subscriber failed!\n")), -1);
}
// Create DataReader
DDS::DataReaderListener_var listener(new DataReaderListenerImpl);
DDS::DataReader_var reader =
subscriber->create_datareader(topic,
DATAREADER_QOS_DEFAULT,
listener,
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (!reader) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" create_datareader failed!\n")), -1);
}
Messenger::MessageDataReader_var reader_i =
Messenger::MessageDataReader::_narrow(reader);
if (!reader_i) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" _narrow failed!\n")),
-1);
}
// Block until Publisher completes
DDS::StatusCondition_var condition = reader->get_statuscondition();
condition->set_enabled_statuses(DDS::SUBSCRIPTION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
while (true) {
DDS::SubscriptionMatchedStatus matches;
if (reader->get_subscription_matched_status(matches) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" get_subscription_matched_status failed!\n")), -1);
}
if (matches.current_count == 0 && matches.total_count > 0) {
break;
}
DDS::ConditionSeq conditions;
DDS::Duration_t timeout = { 60, 0 };
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: main() -")
ACE_TEXT(" wait failed!\n")), -1);
}
}
ws->detach_condition(condition);
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant);
TheServiceParticipant->shutdown();
} catch (const CORBA::Exception& e) {
e._tao_print_exception("Exception caught in main():");
return -1;
}
return 0;
}
示例10: ACE_TMAIN
int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
DDS::DomainParticipantFactory_var dpf = DDS::DomainParticipantFactory::_nil();
DDS::DomainParticipant_var participant = DDS::DomainParticipant::_nil();
try
{
QuantLibAddinCpp::initializeAddin();
boost::gregorian::date date ( boost::gregorian::from_undelimited_string( "20111019" ) );
long evaluationDate = QuantLib::Date( date.day(), QuantLib::Month(date.month().as_number()), date.year() ).serialNumber();
QuantLibAddinCpp::qlSettingsSetEvaluationDate(evaluationDate, OH_NULL);
std::string ticker;
// Initialize, and create a DomainParticipant
dpf = TheParticipantFactoryWithArgs(argc, argv);
qldds_utils::BasicDomainParticipant participant( dpf, EQUITY_OPTIONS_DOMAIN_ID );
participant.createPublisher();
participant.createSubscriber();
DDS::DomainParticipant_var dp = participant.getDomainParticipant();
ACE_Get_Opt cmd_opts( argc, argv, ":s:" );
int option;
while ( (option = cmd_opts()) != EOF )
{
switch( option )
{
case 's' :
ticker = cmd_opts.opt_arg();
break;
}
}
// Topics
// setting up qlBlackConstantVols Topic
DDS::Topic_var ql_black_constant_vols_topic = participant.createTopicAndRegisterType
< qlBlackConstantVolsTypeSupport_var, qlBlackConstantVolsTypeSupportImpl >
( QL_BLACK_CONSTANT_VOLS_TOPIC_NAME );
// setting up qlGeneralizedBlackScholesProcesses Topic
DDS::Topic_var ql_generalized_black_scholes_processes_topic = participant.createTopicAndRegisterType
< qlGeneralizedBlackScholesProcessesTypeSupport_var, qlGeneralizedBlackScholesProcessesTypeSupportImpl >
( QL_GENERALIZED_BLACK_SCHOLES_PROCESSES_TOPIC_NAME );
// setting up qlStrikedTypePayoff Topic
DDS::Topic_var ql_striked_type_payoffs_topic = participant.createTopicAndRegisterType
< qlStrikedTypePayoffsTypeSupport_var, qlStrikedTypePayoffsTypeSupportImpl >
( QL_STRIKED_TYPE_PAYOFFS_TOPIC_NAME );
// setting up qlEuropeanExercises Topic
DDS::Topic_var ql_european_exercises_topic = participant.createTopicAndRegisterType
< qlEuropeanExercisesTypeSupport_var, qlEuropeanExercisesTypeSupportImpl >
( QL_EUROPEAN_EXERCISES_TOPIC_NAME );
StraddleSetupTypeSupport_var ts_res = new StraddleSetupTypeSupportImpl;
if ( ts_res->register_type(dp, "") != DDS::RETCODE_OK )
{
std::cout << "Registration of the Topic FAILED!!!!" << std::endl;
}
CORBA::String_var type_name = ts_res->get_type_name();
std::cout << "Type Name : " << type_name << std::endl;
std::stringstream multi_topic_select;
multi_topic_select << "SELECT ticker, putVols, callVols, putPayoffs, callPayoffs, process, exercises FROM "<<
QL_BLACK_CONSTANT_VOLS_TOPIC_NAME << " NATURAL JOIN " <<
QL_GENERALIZED_BLACK_SCHOLES_PROCESSES_TOPIC_NAME << " NATURAL JOIN " <<
QL_STRIKED_TYPE_PAYOFFS_TOPIC_NAME << " NATURAL JOIN " <<
QL_EUROPEAN_EXERCISES_TOPIC_NAME << " WHERE ticker = '" << ticker << "'";
std::cout << multi_topic_select.str() << std::endl;
DDS::MultiTopic_var mt = dp->create_multitopic("MyMultiTopic", type_name, multi_topic_select.str().c_str(), DDS::StringSeq());
if ( CORBA::is_nil( mt ) )
std::cout << "MultiTopic Subscribtion failed.!!!!" << mt << std::endl;
DDS::Subscriber_var sub = participant.getSubscriber();
std::cout << "Creating Data Reader"<< std::endl;
DDS::DataReader_var dr = sub->create_datareader(mt, DATAREADER_QOS_DEFAULT, 0, ::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
std::cout << "Done..."<< std::endl;
DDS::WaitSet_var ws = new DDS::WaitSet;
DDS::ReadCondition_var rc = dr->create_readcondition( DDS::ANY_SAMPLE_STATE, DDS::ANY_VIEW_STATE, DDS::ANY_INSTANCE_STATE);
ws->attach_condition(rc);
DDS::Duration_t infinite = { DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC};
DDS::ConditionSeq active;
int ret = ws->wait(active, infinite);
if (ret != DDS::RETCODE_OK) return false;
ws->detach_condition(rc);
//.........这里部分代码省略.........
示例11: test
//.........这里部分代码省略.........
ACE_TEXT(" ERROR: create_datareader failed!\n")), 7);
FooDataReader_var reader_i = FooDataReader::_narrow(reader);
if (CORBA::is_nil(reader_i))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: _narrow failed!\n")), 1);
// Create DataWriter
DDS::DataWriter_var writer =
publisher->create_datawriter(topic.in(),
DATAWRITER_QOS_DEFAULT,
DDS::DataWriterListener::_nil(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(writer.in()))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: create_datawriter failed!\n")), 1);
FooDataWriter_var writer_i = FooDataWriter::_narrow(writer);
if (CORBA::is_nil(writer_i))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: _narrow failed!\n")), 1);
// Block until Subscriber is associated
DDS::StatusCondition_var cond = writer->get_statuscondition();
cond->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(cond);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::PublicationMatchedStatus matches = { 0, 0, 0, 0, 0 };
do
{
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK)
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: wait failed!\n")), 1);
if (writer->get_publication_matched_status(matches) != ::DDS::RETCODE_OK)
{
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: failed to get publication matched status!\n")),
2);
}
}
while (matches.current_count < 1);
ws->detach_condition(cond);
//
// FooDataWriter::dispose should cause an instance to be
// deleted after the last sample in the instance has been
// taken from the ReceivedDataElementList:
//
DDS_TEST test(reader_i);
if (!test) return 1;
Foo foo;
DDS::InstanceHandle_t handle;
handle = writer_i->register_instance(foo);
writer_i->write(foo, handle);
writer_i->dispose(foo, handle);
ACE_OS::sleep(5); // wait for samples to arrive
if (!test.take_all_samples())
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: unable to take samples!\n")), 2);
/// Verify instance has been deleted
if (test.has_instance(handle))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" ERROR: instance not removed!\n")), 3);
// Clean-up!
participant->delete_contained_entities();
TheParticipantFactory->delete_participant(participant);
TheTransportFactory->release();
TheServiceParticipant->shutdown();
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception("caught in main()");
return -1;
}
return 0;
}
示例12: MessageTypeSupportImpl
//.........这里部分代码省略.........
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: register_type() failed!\n")), -1);
}
// Create Topic (Movie Discussion List)
CORBA::String_var type_name = ts->get_type_name();
DDS::Topic_var topic =
participant->create_topic("Movie Discussion List",
type_name.in(),
TOPIC_QOS_DEFAULT,
DDS::TopicListener::_nil(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(topic.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: create_topic() failed!\n")), -1);
}
// Create Subscriber
DDS::Subscriber_var sub =
participant->create_subscriber(SUBSCRIBER_QOS_DEFAULT,
DDS::SubscriberListener::_nil(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(sub.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: create_subscriber() failed!\n")), -1);
}
// Create DataReader
DataReaderListenerImpl* const listener_servant = new DataReaderListenerImpl;
DDS::DataReaderListener_var listener(listener_servant);
DDS::DataReaderQos dr_qos;
sub->get_default_datareader_qos(dr_qos);
if (DataReaderListenerImpl::is_reliable()) {
std::cout << "Reliable DataReader" << std::endl;
dr_qos.reliability.kind = DDS::RELIABLE_RELIABILITY_QOS;
}
DDS::DataReader_var reader =
sub->create_datareader(topic.in(),
dr_qos,
listener.in(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(reader.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: create_datareader() failed!\n")), -1);
}
// Block until Publisher completes
DDS::StatusCondition_var condition = reader->get_statuscondition();
condition->set_enabled_statuses(DDS::SUBSCRIPTION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::SubscriptionMatchedStatus matches = { 0, 0, 0, 0, 0 };
while (true) {
if (reader->get_subscription_matched_status(matches) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: get_subscription_matched_status() failed!\n")), -1);
}
if (matches.current_count == 0 && matches.total_count > 0) {
break;
}
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: wait() failed!\n")), -1);
}
}
status = listener_servant->is_valid() ? 0 : -1;
ws->detach_condition(condition);
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant.in());
TheServiceParticipant->shutdown();
} catch (const CORBA::Exception& e) {
e._tao_print_exception("Exception caught in main():");
status = -1;
}
return status;
}
示例13: DataReaderListenerImpl
//.........这里部分代码省略.........
// Register Type (FooType)
FooTypeSupport_var ts = new FooTypeSupportImpl;
if (ts->register_type(participant.in(), "") != DDS::RETCODE_OK)
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" register_type failed!\n")), 5);
// Create Topic (FooTopic)
DDS::Topic_var topic =
participant->create_topic("FooTopic",
ts->get_type_name(),
TOPIC_QOS_DEFAULT,
DDS::TopicListener::_nil(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(topic.in()))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" create_topic failed!\n")), 6);
// Create DataReader
ProgressIndicator progress =
ProgressIndicator("(%P|%t) SUBSCRIBER %d%% (%d samples received)\n",
expected_samples);
DDS::DataReaderListener_var listener =
new DataReaderListenerImpl(received_samples, progress);
DDS::DataReaderQos reader_qos;
subscriber->get_default_datareader_qos(reader_qos);
reader_qos.history.kind = DDS::KEEP_ALL_HISTORY_QOS;
DDS::DataReader_var reader =
subscriber->create_datareader(topic.in(),
reader_qos,
listener.in(),
::OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(reader.in()))
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" create_datareader failed!\n")), 7);
// Block until Publisher completes
DDS::StatusCondition_var cond = reader->get_statuscondition();
cond->set_enabled_statuses(DDS::SUBSCRIPTION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(cond);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::SubscriptionMatchedStatus matches = {0, 0, 0, 0, 0};
do
{
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK)
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l: main()")
ACE_TEXT(" wait failed!\n")), 8);
if (reader->get_subscription_matched_status(matches) != ::DDS::RETCODE_OK)
{
ACE_ERROR ((LM_ERROR,
"ERROR: failed to get subscription matched status\n"));
return 1;
}
}
while (matches.current_count > 0 || matches.total_count < n_publishers);
ws->detach_condition(cond);
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant.in());
TheTransportFactory->release();
TheServiceParticipant->shutdown();
}
catch (const CORBA::Exception& e)
{
e._tao_print_exception("caught in main()");
return 9;
}
ACE_DEBUG((LM_INFO, ACE_TEXT("(%P|%t) <- SUBSCRIBER FINISHED\n")));
if (received_samples != expected_samples) {
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) ERROR: subscriber - ")
ACE_TEXT("received %d of expected %d samples.\n"),
received_samples,
expected_samples
));
return 10;
}
return 0;
}
示例14: while
void
DataReaderListenerImpl::on_data_available(DDS::DataReader_ptr reader)
{
TestMsgDataReader_var reader_i =
TestMsgDataReader::_narrow(reader);
if (!reader_i) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: on_data_available() -")
ACE_TEXT(" _narrow failed!\n")));
ACE_OS::exit(-1);
}
TestMsg message;
DDS::SampleInfo info;
DDS::ReturnCode_t error = reader_i->take_next_sample(message, info);
if (error == DDS::RETCODE_OK) {
if (info.valid_data) {
ACE_DEBUG((LM_DEBUG, "(%P|%t) DataReader %C has received message: %d from: %C\n", id_.c_str(), message.value, std::string(message.from).c_str()));
if (!origin_) {
TestMsgDataWriter_var message_writer =
TestMsgDataWriter::_narrow(writer_);
if (!message_writer) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: on_data_available() -")
ACE_TEXT(" _narrow failed!\n")));
ACE_OS::exit(-1);
}
// Block until Subscriber is available
DDS::StatusCondition_var condition = writer_->get_statuscondition();
condition->set_enabled_statuses(DDS::PUBLICATION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition);
while (true) {
DDS::PublicationMatchedStatus matches;
if (writer_->get_publication_matched_status(matches) != ::DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: on_data_available() -")
ACE_TEXT(" get_publication_matched_status failed!\n")));
ACE_OS::exit(-1);
}
ACE_DEBUG((LM_DEBUG, "(%P|%t) DataWriter %C has %d of %d readers\n", writer_id_.c_str(), matches.current_count, total_readers_));
if (matches.current_count >= total_readers_) {
break;
}
DDS::ConditionSeq conditions;
DDS::Duration_t timeout = { 60, 0 };
if (ws->wait(conditions, timeout) != DDS::RETCODE_OK) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: on_data_available() -")
ACE_TEXT(" wait failed!\n")));
ACE_OS::exit(-1);
}
}
ws->detach_condition(condition);
std::string from_list = std::string(message.from) + "->" + writer_id_;
message.from = from_list.c_str();
DDS::ReturnCode_t error;
do {
error = message_writer->write(message, DDS::HANDLE_NIL);
if ((error != DDS::RETCODE_OK) && (error != DDS::RETCODE_TIMEOUT)) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: on_data_available() -")
ACE_TEXT(" write returned %d!\n"), error));
}
} while (error == DDS::RETCODE_TIMEOUT);
}
if (++received_samples_ == expected_samples_) {
ACE_DEBUG((LM_DEBUG, "(%P|%t) DataReader %C has received expected number of samples\n", id_.c_str()));
if (!origin_) {
ACE_DEBUG((LM_DEBUG, "(%P|%t) DataWriter %C is waiting for acknowledgments\n", writer_id_.c_str()));
DDS::Duration_t timeout = { 30, 0 };
writer_->wait_for_acknowledgments(timeout);
}
done_callback_();
}
}
} else {
ACE_ERROR((LM_ERROR,
ACE_TEXT("ERROR: %N:%l: on_data_available() -")
ACE_TEXT(" take_next_sample failed!\n")));
}
}
示例15: MessageTypeSupportImpl
//.........这里部分代码省略.........
::DDS::DataReaderQos dr_qos;
sub->get_default_datareader_qos (dr_qos);
dr_qos.ownership.kind = ::DDS::EXCLUSIVE_OWNERSHIP_QOS;
dr_qos.deadline.period.sec = deadline.sec;
dr_qos.deadline.period.nanosec = deadline.nanosec;
dr_qos.liveliness.lease_duration.sec = liveliness.sec;
dr_qos.liveliness.lease_duration.nanosec = liveliness.nanosec;
DDS::DataReader_var reader1 =
sub->create_datareader(topic.in(),
dr_qos,
listener1.in(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(reader1.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: create_datareader() failed!\n")), -1);
}
DDS::DataReader_var reader2 =
sub->create_datareader(topic.in(),
dr_qos,
listener2.in(),
OpenDDS::DCPS::DEFAULT_STATUS_MASK);
if (CORBA::is_nil(reader2.in())) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: create_datareader() failed!\n")), -1);
}
// Block until Publisher completes
DDS::StatusCondition_var condition1 = reader1->get_statuscondition();
DDS::StatusCondition_var condition2 = reader2->get_statuscondition();
condition1->set_enabled_statuses(DDS::SUBSCRIPTION_MATCHED_STATUS);
condition2->set_enabled_statuses(DDS::SUBSCRIPTION_MATCHED_STATUS);
DDS::WaitSet_var ws = new DDS::WaitSet;
ws->attach_condition(condition1);
ws->attach_condition(condition2);
DDS::Duration_t timeout =
{ DDS::DURATION_INFINITE_SEC, DDS::DURATION_INFINITE_NSEC };
DDS::ConditionSeq conditions;
DDS::SubscriptionMatchedStatus matches1 = { 0, 0, 0, 0, 0 };
DDS::SubscriptionMatchedStatus matches2 = { 0, 0, 0, 0, 0 };
while (true) {
if (reader1->get_subscription_matched_status(matches1) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: get_subscription_matched_status() failed!\n")), -1);
}
if (reader2->get_subscription_matched_status(matches2) != DDS::RETCODE_OK) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: get_subscription_matched_status() failed!\n")), -1);
}
if ((matches1.current_count == 0 && matches1.total_count > 0) ||
(matches2.current_count == 0 && matches2.total_count > 0)) {
break;
}
DDS::ReturnCode_t wait_status = ws->wait(conditions, timeout);
if (wait_status != DDS::RETCODE_OK) {
std::cerr << "ERROR: Subscriber failed during waiting on wait set with return code "
<< wait_status << std::endl;
}
}
ws->detach_condition(condition1);
ws->detach_condition(condition2);
result1 = listener_svt1->verify_result();
result2 = listener_svt2->verify_result();
} // Scope of entities
// Clean-up!
participant->delete_contained_entities();
dpf->delete_participant(participant.in());
TheServiceParticipant->shutdown();
if (result1 == false || result2 == false) {
ACE_ERROR_RETURN((LM_ERROR,
ACE_TEXT("%N:%l main()")
ACE_TEXT(" ERROR: failed to verify message!\n")), -2);
}
} catch (const CORBA::Exception& e) {
e._tao_print_exception("Exception caught in main():");
return -1;
}
return 0;
}