error: cannot allocate an object of abstract type ‘FRONTEND_RFInfo_In_i

239 Views Asked by At

Using:

Redhawk 1.9 / CentOS 6.4 (32 bit) / C++ implementation

Creating a new FRONTEND::TUNER device

Using default setting on code generation

The following error message happens when I add the following port required for FRONTEND Digital Tuner and regenerate the code.

<ports>
  <provides repid="IDL:FRONTEND/DigitalTuner:1.0" providesname="DigitalTuner"/>
  <provides repid="IDL:FRONTEND/RFInfo:1.0" providesname="RFInfo"/>
</ports>

Error message (Problems window):

cannot allocate an object of abstract type ‘FRONTEND_RFInfo_In_i’ TestFrontEndDevice_base.cpp /TestFrontEndDevice/cpp line 50 C/C++ Problem

Error message (console):

port_impl.h:56: note: because the following virtual functions are pure within ‘FRONTEND_RFInfo_In_i’:

/usr/local/redhawk/core/include/redhawk/FRONTEND/RFInfo.h:323: note: virtual void FRONTEND::_impl_RFInfo::rf_flow_id(const char*)

/usr/local/redhawk/core/include/redhawk/FRONTEND/RFInfo.h:325: note: virtual void FRONTEND::_impl_RFInfo::rfinfo_pkt(const FRONTEND::RFInfoPkt&)

make: * [TestFrontEndDevice-TestFrontEndDevice_base.o] Error 1

2

There are 2 best solutions below

0
On

There appears to be a bug in the code generation for the RFInfo class. If you compare the signatures of the generated code in the port_impl.h file to those of the "unimplemented" ones above, you'll notice that for the rf_flow_id function in port_impl.h there is no const keyword. The same can be said about the rfinfo_pkt method. It is missing the const keyword and an ampersand in the function declaration.

To fix this, simply add the const keywords and the ampersand in the appropriate places in both the declaration in the port_impl.h file and the definition in the port_impl.cpp file.

2
On

This is a known issue that has been fixed for the 1.9.1 release.

The problem is the result of the RFInfo port function signatures in the generated port_impl.* files being different from those in the parent/base class, which also happen to be pure virtual. To fix the issue in your code, you'll need to add "const" to rf_flow_id, and both "const" and "&" to rfinfo_pkt, as shown below:

In port_impl.h:

-        void rf_flow_id( char* data);
+        void rf_flow_id( const char* data);

-        void rfinfo_pkt( FRONTEND::RFInfoPkt data);
+        void rfinfo_pkt( const FRONTEND::RFInfoPkt& data);

In port_impl.cpp:

-void FRONTEND_RFInfo_In_i::rf_flow_id( char* data)
+void FRONTEND_RFInfo_In_i::rf_flow_id( const char* data)

-void FRONTEND_RFInfo_In_i::rfinfo_pkt( FRONTEND::RFInfoPkt data)
+void FRONTEND_RFInfo_In_i::rfinfo_pkt( const FRONTEND::RFInfoPkt& data)