[Spread-users] Using events interface in C++

John Lane Schultz jschultz at spreadconcepts.com
Mon Mar 16 16:07:12 EDT 2009


I don't understand your question.  What do you mean by "Calls to
Spread functions are not caught when they occur in a class function"?

Are you saying that you want the events to fire a method on a
particular class instance rather than a regular C function?

In that case simply have a standalone event function that translates
the callback to the class method you want.  For example,

class my_class
{
  ...

public:
  int my_cplusplus_method(int code) { ... }
};

void my_c_fcn(int code, void * data)
{
  my_class * mc = (my_class*) data;

  mc->my_cpluplus_method(code);
}

Then schedule your callback like so:

void foo(my_class * mc, int code, sp_time delta_to)
{
  E_queue(my_c_fcn, code, mc, delta_to);
}

Cheers!
John

---
John Lane Schultz
Spread Concepts LLC
Phn: 443 838 2200 
Fax: 301 560 8875

Monday, March 16, 2009, 1:25:57 PM, you wrote:


> Hi,

> I'm having problems with the Spread events interface in C++. Calls
> to Spread functions are not caught when they occur in a class
> function. Is there any example on how to use the events interface in C++?
> Thanks in advance,

> Erik



>       

> _______________________________________________
> Spread-users mailing list
> Spread-users at lists.spread.org
> http://lists.spread.org/mailman/listinfo/spread-users





More information about the Spread-users mailing list