Function Overloading in IDL file

Function Overloading in IDL file

Problem:

Product Name: VisiBroker
Product Version: All
Product Component: idl2cpp
Platform/OS Version: All

You need to change an operation of a CORBA server. However, since the server has been used widely, you do not want to just change the operation, rather need to put an additional operation. Is it possible to have two method with same name but different signature in IDL?

Resolution:

  
This article explains why function overloading is impossible in IDL file.
 
Unfortunately, operation names are scoped by their enclosing interface and must be unique within that interface. This restriction was introduced because overloading makes it difficult to map IDL to a non Object-oriented language such as C. Moreover, idl2cpp assumes every method in an interface has individual name. For example, a snippet of file bank_s.cc of bank_agent example which generated by idl2cpp bank.idl:

...
static ::CORBA::MethodDescription _sk_Bank_Account_methods[] = {
{"balance", POA_Bank::Account::_balance}
};
...


The first element of the record is method's name so it is not able to have the same name in it.
 

Tags (2)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2013-02-15 20:43
Updated by:
 
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.