I've always been a firm supporter of functors. They're just cleaner
(in my mind) than callback functions, especially when a way to easily
provide instance-specific data through the constructor.

On 5/1/06, Christopher Nelson <[EMAIL PROTECTED]> wrote:
An Alternative Method
---------------------

This would be very similar to the current method, except that you would
use a functor.

So the code above would be more like this:

class onParticleFountainEvent : public iAws2ScriptEvent
{
public:
        /** Callback for particle fountain events like Start/Stop, etc.
*/
        static void operator()(iAws2ScriptObject *info)
        {
                switch(info->GetIntArg(0))
                {
                        default:
                                pe2App()->ReportError("Unknown particle
fountain command received!");
                }
        }
};


void initializeScriptEvents(csRef<iAws2> aws)
{
        iAws2ScriptObject *so;

        so = aws->CreateScriptObject("particleFountain", new
onParticleFountainEvent());

}

============================================================


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to