[aspectc-user] Generate client/server. Feasible ?

Patrick Duflot pduflot at caramail.com
Wed Mar 1 14:02:05 CET 2006


Hi,

My goal is to generate client and server classes from an interface declaration. The client and the server use XML and windows socket to communicate with each other. Is it feasible with aspectC++ ? How ?

Let's say I have an interface IFoo

interface IFoo
{
public:
virtual int Foo(int i, std::string s) = 0;
};

I want to generate something like this :

#include "MyProtocol.h"

class CFooClient : public CMyProtocol
{
public:
CFooClient() : CMyProtocol(true) {}
int Foo(int i, std::string s)
{
SendMethod(CXMLMethod("Foo", CXMLParam("i", i), CXMLParam("s", s)));
}
};

class CFooServer : public CMyProtocol
{
public:
CFooServer() : CMyProtocol(false) {}
protected:
int OnReceive(CXMLMethod method) {
switch (method.GetLabel()) {
case "Foo":
return Foo(method.GetParam("i"), method.GetParam("s"));
}
return -1;
}
};

Any help would be really welcome

Patrick

Sexy Like Us : Tu veux savoir si tu as la cote ? http://www.sexy.lycos.fr


More information about the aspectc-user mailing list