Ejemplo n.º 1
0
void SubscriberDelegate::event_forwarder(
    dds::sub::SubscriberListener* listener,
    const dds::core::smart_ptr_traits<DDS::SubscriberListener>::ref_type& forwarder,
    const dds::core::status::StatusMask& event_mask)
{
#ifdef _WIN32
#pragma warning( push )
#pragma warning( disable : 4702 ) //disable warning caused by temporary exception, remove later
#endif
    throw dds::core::UnsupportedError(org::opensplice::core::exception_helper(
                                          OSPL_CONTEXT_LITERAL("dds::core::UnsupportedError : SubscriberListener is not currently supported")));
#ifdef _WIN32
#pragma warning ( pop ) //re-enable warning to prevent leaking to user code, remove later
#endif
    dds::core::smart_ptr_traits<DDS::SubscriberListener>::ref_type tmp_fwd;
    if(listener)
    {
        tmp_fwd = forwarder;
    }
    listener_ = listener;
    sub_event_forwarder_.swap(tmp_fwd);
    mask_ = event_mask;
    DDS::ReturnCode_t result = sub_->set_listener(sub_event_forwarder_.get(), event_mask.to_ulong());
    org::opensplice::core::check_and_throw(result, OSPL_CONTEXT_LITERAL("Calling ::set_listener"));
}
Ejemplo n.º 2
0
SubscriberDelegate::SubscriberDelegate(
    const dds::domain::DomainParticipant& dp,
    const dds::sub::qos::SubscriberQos& qos,
    const dds::core::status::StatusMask& event_mask) :
    dp_(dp),
    qos_(qos),
    listener_(0),
    mask_(event_mask),
    sub_(),
    sub_event_forwarder_()
{
    DDS::SubscriberQos sqos = org::opensplice::sub::qos::convertQos(qos);

    DDS::Subscriber_ptr s = dp->dp_->create_subscriber(sqos, 0,
                            event_mask.to_ulong());

    if(s == 0) throw dds::core::NullReferenceError(org::opensplice::core::exception_helper(
                    OSPL_CONTEXT_LITERAL(
                        "dds::core::NullReferenceError : Unable to create Subscriber. "
                        "Nil return from ::create_subscriber")));

    sub_.reset(s, ::org::opensplice::core::SubDeleter(dp_->dp_));

    DDS::DataReaderQos oldqos;
    DDS::ReturnCode_t result = sub_->get_default_datareader_qos(oldqos);
    org::opensplice::core::check_and_throw(result, OSPL_CONTEXT_LITERAL("Calling ::get_default_datareader_qos"));

    default_dr_qos_ = org::opensplice::sub::qos::convertQos(oldqos);

    entity_ = DDS::Entity::_narrow(s);
}
Ejemplo n.º 3
0
    Topic(const dds::domain::DomainParticipant& dp,
          const std::string& name,
          const std::string& type_name,
          const dds::topic::qos::TopicQos& qos,
          dds::topic::TopicListener<T>* listener,
          const dds::core::status::StatusMask& mask)
        : dds::topic::detail::TopicDescription<T>(dp, name, type_name),
          dp_(dp),
          qos_(qos),
          listener_(listener),
          mask_(mask)
    {
        char* tn = ts_.get_type_name();
        ts_.register_type(dp->dp_.get(), tn);

        DDS::TopicQos tqos = convertQos(qos);
        t_ = dp->dp_->create_topic(name.c_str(), tn, tqos, 0,
                                   mask.to_ulong());

        if (t_ == 0)
            throw dds::core::NullReferenceError(
                        org::opensplice::core::exception_helper(
                            OSPL_CONTEXT_LITERAL(
                                "dds::core::NullReferenceError : Unable to create Topic! "
                                "Nil return from ::create_topic")));

        topic_ = org::opensplice::core::DDS_TOPIC_REF(t_, org::opensplice::core::TopicDeleter(dp->dp_));
    }