Esempio n. 1
0
void
Test::DataWriterListener::display_partitions (
  DDS::DataWriter_ptr writer) const
{
  // Display offered partition.
  DDS::Publisher_var publisher (writer->get_publisher ());
  DDS::PublisherQos pub_qos;
  publisher->get_qos (pub_qos);

  DDS::PartitionQosPolicy const & partition = pub_qos.partition;

  ACE_DEBUG ((LM_DEBUG,
              ACE_TEXT ("(%P|%t) Offered Partition\n")
              ACE_TEXT ("Partition\tName\n")
              ACE_TEXT ("=========\t====\n")));

  CORBA::ULong const len = partition.name.length ();

  if (len == 0)
    ACE_DEBUG ((LM_DEBUG,
                ACE_TEXT ("** Zero length partition name ")
                ACE_TEXT ("sequence (default) **\n")));

  for (CORBA::ULong i = 0; i != len; ++i)
    {
      char const * s = partition.name[i];

      ACE_DEBUG ((LM_DEBUG,
                  ACE_TEXT (" %u\t\t%s\n"),
                  i,
                  *s == 0 ? "\"\"" : s));
    }
}
Esempio n. 2
0
Writer::Writer (::DDS::DataWriter_ptr writer)
  : writer_ (::DDS::DataWriter::_duplicate (writer))
  , timeout_writes_ (0)
  , count_ (0)
  , dwl_servant_ (0)
{
  ::DDS::DataWriterListener_var dwl = writer->get_listener ();
  this->dwl_servant_ =
    dynamic_cast<DataWriterListenerImpl*> (dwl.in ());
}
Esempio n. 3
0
Writer::Writer(::DDS::DataWriter_ptr writer)
: writer_ (::DDS::DataWriter::_duplicate (writer)),
  finished_instances_ (0),
  timeout_writes_ (0),
  start_ (true),
  count_ (0),
  dwl_servant_ (0)
{
  ::DDS::DataWriterListener_var dwl = writer->get_listener();
  dwl_servant_ =
    dynamic_cast<DataWriterListenerImpl*>(dwl.in());
}
Esempio n. 4
0
Writer::Writer(
  ::DDS::DataWriter_ptr writer,
  const PublicationProfile& profile,
  bool verbose

) : writer_( ::DDS::DataWriter::_duplicate( writer)),
    publicationId_(writer->get_instance_handle()),
    profile_( profile),
    verbose_( verbose),
    done_( false),
    messages_( 0)
{
}
Esempio n. 5
0
bool
wait_publication_matched_status(const Options& opts, const DDS::DataWriter_ptr w)
{
  //  To check the match status ?
  DDS::PublicationMatchedStatus matches = {0, 0, 0, 0, 0};
  TEST_ASSERT((w->get_publication_matched_status(matches) == ::DDS::RETCODE_OK));

  // Block until Subscriber is available
  DDS::StatusCondition_var condition = w->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 = {
    (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 at %N:%l\n")), false);
    }

  return true;
}
Esempio n. 6
0
Assert_Participant_Liveliness::Assert_Participant_Liveliness(
  DDS::DataWriter_ptr writer, const char* name)
  : Writer_Base(writer, name)
  , participant_(DDS::Publisher_var(writer->get_publisher())->get_participant())
{
}