Discussion:
[omniORB] Problem with method definitions
Perham, David A. (Mission Systems)
2007-03-27 04:57:42 UTC
Permalink
Howdy:
I am using Visual C++ .NET Version 7.1 and building IDL using omniOrb
Version 4.1.0.
In the IDL I decalre an interface with several methods that have as
parameters various combinations of base and complex types. Here is an
example:



boolean RequestCreateEntity( in EntityCreateDataType EntityData,
out long EntityId ) ;
The complex types passed as parameter:
typedef struct EntityCreateData
{
string<100> EntityName ;
string<8> EntityTag ;
short EntityClass ;
ENTITY_CLASSIFICATION_ENUM EntityClassification ;
ENTITY_TYPE_ENUM EntityType ;
boolean EntityActivationStatus ;
ENTITY_CONTROL_FLAG_ENUM EntityControlFlag ;
short EntityXPosition ;
short EntityYPosition ;
short EntityAltitude ;
float EntityCourse ;
short EntitySpeed ;
} EntityCreateDataType ;
In the Implementation class I define this method:
bool RequestCreateEntity(EntityCreateData EntityData,
long EntityId )
{ ... }
When I attempt to build the implementation class I get the following
error on any method which has a structure type (or pointer to such) as a
parameter:
Form1.cpp(270) : error C2259: 'ObjectServerImpl' : cannot instantiate
abstract class
due to following members:
'CORBA::Boolean _impl_EntityInterface::RequestCreateEntity(const
EntityCreateDataType &,CORBA::Long &)' : pure virtual function was not
defined
Looking at the omniOrb generated .h and .cpp files, I can find the
_impl_EntityInterface class with the following definition:
virtual CORBA::Boolean RequestCreateEntity(const EntityCreateDataType&
EntityData, CORBA::Long& EntityId) = 0;
Why does this signature not match the one (I thought) I was creating in
the idl? What am I missing here? Any help would be appreciated.
I have tried changing the parameters and return value of the methods to
CORBA::Long and CORBA::Boolean as well.
Thanks,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20070326/206f5c30/attachment.htm
Luke Deller
2007-03-27 05:41:45 UTC
Permalink
Hi David,

...
Post by Perham, David A. (Mission Systems)
bool RequestCreateEntity(EntityCreateData EntityData,
long EntityId )
...

As you have noticed from the error messages and the generated skeleton
files, the first parameter of your C++ function needs to be of type
"const EntityCreateData &". This is more efficient than
"EntityCreateData" because it doesn't require the whole struct to be
copied when the function is called.

There's a helpful table in the C++ Language Mapping Specification
(version 1.1) which shows the C++ type that you need in your function
signature for different IDL types. It's called "Table 1-3" and is
spread over pages 1-106 and 1-107, in section 1.22.1 "Operation
Parameters and Signatures". You can get this document from here:
http://www.omg.org/technology/documents/formal/c++.htm

Regards,
Luke.
**********************************************************************************************
Important Note
This email (including any attachments) contains information which is confidential and may be subject to legal privilege. If you are not the intended recipient you must not use, distribute or copy this email. If you have received this email in error please notify the
sender immediately and delete this email. Any views expressed in this email are not necessarily the views of XPlan Technology.

It is the duty of the recipient to virus scan and otherwise test the information provided before loading onto any computer system.
Xplan Technology does not warrant that the information is free of a virus or any other defect or error.
**********************************************************************************************
Loading...