コード例 #1
0
ファイル: Writer.cpp プロジェクト: Fantasticer/OpenDDS
int
Writer_Base::svc()
{
  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) %C svc() begins. %C\n"), name_, get_id()));

  try {
    DDS::InstanceHandleSeq handles;
    while (true) {
      writer_->get_matched_subscriptions(handles);
      if (handles.length() > 0)
        break;
      else
        ACE_OS::sleep(ACE_Time_Value(0, 200000));
    }

    pre_loop();

    for (int i = 0; i < num_messages; ++i) {
      if (!liveliness_lost_test || i == 0 || i == num_messages - 1) {
        in_loop(i);
        if (i == 0) {
          // Since an arbitrary amount of time was spent in the get_matched_subscriptions
          // loop above, any number of liveliness lost callbacks may have already occurred.
          // These are not the callbacks that the test is counting (liveliness_lost_test).
          DDS::DataWriterListener_var dwl = writer_->get_listener();
          DataWriterListenerImpl* listener = dynamic_cast<DataWriterListenerImpl*>(dwl.in());
          listener->reset_liveliness_lost_callbacks();
        }
      }

      ACE_OS::sleep(assert_liveliness_period);
    }

    while (true) {
      writer_->get_matched_subscriptions(handles);
      if (handles.length() == 0)
        break;
      else
        ACE_OS::sleep(1);
    }

  } catch (const CORBA::Exception& e) {
    cerr << "Exception caught in svc:" << endl << e << endl;
  }

  ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writer_Base::svc finished %C.\n"), name_));

  return 0;
}
コード例 #2
0
ファイル: RecorderImpl.cpp プロジェクト: tempbottle/OpenDDS
bool
RecorderImpl::lookup_instance_handles(const WriterIdSeq&       ids,
                                      DDS::InstanceHandleSeq & hdls)
{
  if (DCPS_debug_level > 9) {
    CORBA::ULong const size = ids.length();
    OPENDDS_STRING separator = "";
    OPENDDS_STRING buffer;

    for (unsigned long i = 0; i < size; ++i) {
      buffer += separator + OPENDDS_STRING(GuidConverter(ids[i]));
      separator = ", ";
    }

    ACE_DEBUG((LM_DEBUG,
               ACE_TEXT("(%P|%t) RecorderImpl::lookup_instance_handles: ")
               ACE_TEXT("searching for handles for writer Ids: %C.\n"),
               buffer.c_str()));
  }

  CORBA::ULong const num_wrts = ids.length();
  hdls.length(num_wrts);

  for (CORBA::ULong i = 0; i < num_wrts; ++i) {
    hdls[i] = this->participant_servant_->get_handle(ids[i]);
  }

  return true;
}
コード例 #3
0
ファイル: DataReader.cpp プロジェクト: osrf/opensplice
u_result
DDS::OpenSplice::DataReader::Implementation::copy_instance_handles (
    u_instanceHandle *list,
    os_uint32 length,
    c_voidp arg)
{
    DDS::InstanceHandleSeq *seq = (DDS::InstanceHandleSeq *)arg;
    DDS::InstanceHandle_t  *arr;
    os_uint32 i;

    /* Make space. */
    seq->length(length);

    /* Copy info. */
    arr = seq->get_buffer(FALSE);
    for (i = 0; i < length; i++) {
        arr[i] = (DDS::InstanceHandle_t)(list[i]);
    }

    return U_RESULT_OK;
}