requester and replier build error

2 posts / 0 new
Last post
Offline
Last seen: 1 year 9 months ago
Joined: 09/06/2018
Posts: 22
requester and replier build error

Hi,

We are using RTI DDS v5.3.1 and want to use the requester-replier pattern.  We are modifying the publisher example produced by rtiddsgen.  but, when we attempt to build, we get the following error:

Message_Data_publisher.cxx:242:5: error: ‘Requester’ was not declared in this scope
     Requester<std::string,std::string> myrquester( participant, "Message");

Our code snippet is as follows

#include <stdio.h>
#include <stdlib.h>

#include "My_Data.h"
#include "My_DataSupport.h"
#include "ndds/ndds_cpp.h"
#include "ndds/ndds_requestreply_cpp.h"

#include <iostream>
#include <string>

.

.

.

extern "C" int requester_main(int domainId, int sample_count)
{

    DDSDomainParticipant *participant = NULL;
    DDSPublisher *publisher = NULL;
    DDSTopic *topic = NULL;
    DDSDataWriter *writer = NULL;
    My_DataDataWriter * Message_Data_writer = NULL;
    My_Data *instance = NULL;
    DDS_ReturnCode_t retcode;
    DDS_InstanceHandle_t instance_handle = DDS_HANDLE_NIL;
    const char *type_name = NULL;
    int count = 0;  
    DDS_Duration_t send_period = {4,0};

    /* To customize participant QoS, use
    the configuration file USER_QOS_PROFILES.xml */
    participant = DDSTheParticipantFactory->create_participant(
        domainId, DDS_PARTICIPANT_QOS_DEFAULT,
        NULL /* listener */, DDS_STATUS_MASK_NONE);
    if (participant == NULL) {
        fprintf(stderr, "create_participant error\n");
        publisher_shutdown(participant);
        return -1;
    }

    /* create reqester */
    Requester<std::string,std::string> myrequester( participant, "Message");

We are using the makefile made by rtiddsgen.  The file ndds_requestreply_cpp.h does exist in our $NDDSHOME/include/ndds directory.  Are we doing someting obviously wrong?

 

tia,be

 

 

Offline
Last seen: 1 month 2 days ago
Joined: 04/02/2013
Posts: 151

The type Requester is in the connext namespace. Try:

connext::Requester<std::string,std::string> myrequester( participant, "Message");

Also, be aware that a new modern C++ API for request-reply is available, if you're interested: https://community.rti.com/static/documentation/connext-dds/6.0.0/doc/api/connext_dds/api_cpp2/group__RequestReplyModule.html

Best,

Alex