|
|
|
|||||
|
If I have a number of implementations of a given interface, modifying the interface requires changing a lot of boilerplate code, which is both tedious and error-prone.
We solved this problem in XPCOM/xpidl by generating helper macros for each interface, such that you would put in Code:
class mySample : public nsISample
{
public:
mySample();
// nsISample interface
NS_DECL_NSISAMPLE;
private:
int _sampleInt;
};
Mike |
|
|||||
|
I think the suggestion is for slice2cpp to generate a #define for each interface/class that would contain declarations for the methods defined in that interface. For example, the following slice:
Foo.ice: Code:
module Bar {
interface Foo {
void opA (int arg);
int opB (string s);
};
};
Code:
#define ICE_DECLARE__BAR_FOO \
virtual void opA (::Ice::Int, const ::Ice::Context&); \
virtual int opB (const ::std::string&, const ::Ice::Context&)
__________________
vladimir@pobox.com |
|
|||||
|
Quote:
I'm happy to whip up a slice2cpp patch in a bit, if I get some time for it. Mike |
|
||||||
|
Quote:
Cheers, Michi. |
|
||||||
|
OK, after consulting with Marc, I have to take back what I said, sorry
The complexity isn't worth the minor gain in convenience, we believe. It's easy enough to copy and paste the signature from the generated header file, or to generate an implementation stub with --impl and to copy and paste from that. Besides, if I see something like Code:
class FooI : public virtual Foo {
public:
OP_DECL_Foo
// Other declarations here...
};
In general, it's a fine line between convenience and complexity. One example that springs to mind is TAO. It's so full of "convenient" macros that, in the end, the code looks totally unreadable (at least to me, it does, because I'm not intimately familiar with TAO). One person's convenience feature is another person's obfuscation... Cheers, Michi. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about proxy's factory methods. | rc_hz | Help Center | 7 | 09-05-2006 07:58 AM |
| Add methods to a Java sample ???? | surfer | Help Center | 8 | 01-18-2006 07:23 PM |
| C# code generated for comparison methods | kwaclaw | Comments | 3 | 10-11-2005 01:54 PM |
| Local or server private methods | dashie | Help Center | 6 | 12-22-2004 02:31 AM |
| macro to resolve ambiguous-base Ice::Object methods | shaver | Comments | 2 | 01-24-2004 09:36 PM |