[omniORB] namespace handling when a compiler doesn't support it
Dietmar May
dcmay@object-workshops.com
Mon, 4 Jan 1999 20:32:24 -0500
David,
> I am porting OmniORB2 to a compiler that doesn't support namespaces (Diab,
for
> those interested). The macros for dealing with namespaces when the compiler
> doesn't put code for a particular namespace in a class.
Orbix (pre-namespace circa ver. 2.2) handled this using concatenation of the
module name with the interface name, separated by '_'. This generates:
class foo_yourclass : ...
{
...
};
This is similar to the COM mapping in the CORBA interoperability spec, chapter
13. However, I don't think that omniORB can support this without changes (don't
know how much would be required, but pretty sure you'd have to change omniORB
sources in omni2idl).
Look in src/tool/omniidl2/omniORB2_be/o2be_interface.cc (and o2be_constant.cc,
etc). This is where the .hh and .cc generators are located.
For instance:
void o2be_interface::produce_hdr(std::fstream &s)
{
...
IND(s); s << "class " << uqname() << "_Helper {\n";
...
}
See also o2be_name in src/tool/omniidl2/omniORB2_be/o2be.h.
The method fqname() seems to return the fully qualified name (ie. scope name +
unqualified name).
If you can change uqname() to test a flag (that indicates whether to use
concatenation), and return either the original value of uqname() or return
fqname(), it may be pretty simple.
Hope this is helpful.
Regards,
Dietmar May
Software Architect
Object Workshops, Inc.
dcmay@object-workshops.com