Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-08-12 Thread Der Lockruf des Kaos
Before i posted to the List, i already managed too bind the Non-Member 
Functions to the Handler (e.g. ecore_event_handler_add)

int Test( void *d, int t, void *e ) { return 0; }
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, Test, NULL );

I think it's the same in Factory.*.

My Problem is, if i have a class and a Memberfunctions Test like the one above, 
i can't right of it. ( xnowfall tells us a plausible Reason why it doesn't fit 
like i tried it )
This Version would look like

int 
ClassA::Test( void *d, int t, void *e ) { return 0; }
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, CannotBindIt, NULL );
CannotBindIt: ClassA::Test, ClassA-Test, bind...(...)
Nothing worked.

I guess this Example from avisynth is for Non-ClassMember Functions, or am i 
wrong?


Greets,
Christian


---
SF.Net email is Sponsored by the Better Software Conference  EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile  Plan-Driven Development * Managing Projects  Teams * Testing  QA
Security * Process Improvement  Measurement * http://www.sqe.com/bsce5sf
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-08-11 Thread Vincent Torri

For an example of implementation of callbacks with boost:

http://cvs.sourceforge.net/viewcvs.py/avisynth2/avisynth/src/filters/source/gstreamer/?only_with_tag=avisynth_3_0

look at factory.*

Vincent

On Mon, 1 Aug 2005, Carsten Haitzler wrote:

 On Sun, 31 Jul 2005 22:08:37 +0200 Der Lockruf des Kaos
 [EMAIL PROTECTED] babbled:

   ecore_* takes a pointer to a function whereas boost::bind returns an
   object (that can be used as a function by operator overloading). to use
   a member function you need both a pointer to an object instance and a
   pointer to the function, which boost::bind wraps up in an object, but
   which the efl can't use.
  
   it would be nice to use stuff like boost::bind, but that's a c++ thing
   and the efl is c
 
  Ok so i must use something else then i guess.
  Thanks for this good Explanation!
  I didn't realize this.

 yeah - basically you will need to write a c callback to c++ boost::bind style
 calling to make it work. one side of this must me a standard C function call 
 of
 the prototype ecore expects as handler callbacks. it is possible as you can
 create a generic callback handler that uses the data pointer as the pointer to
 the boots:bind: object and then proceeds to call down further from there using
 c++ as the object you gety is both an object AND a callback (from 
 boost::bind).

 btw - just theorising here - no practical examples for you.

 remember efl is c and done in a c way making it easy for c. c++ is often very
 similar and it is possible to bridge the 2 BUT when you jump into heavily OO 
 c++
 construct systems like boost::bind the separation between c and it gets larger
 and harder to bridge.

  So i guess i must code a Mini IPC Thing or think about restructuring my
  Framework in another Fashion. ;)
 
  BtW: Enlightenment rocks!
 
  Greets,
  Christian
 
 
 
  ---
  SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
  from IBM. Find simple to follow Roadmaps, straightforward articles,
  informative Webcasts and more! Get everything you need to get up to
  speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
  ___
  enlightenment-users mailing list
  enlightenment-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/enlightenment-users
 


 --
 - Codito, ergo sum - I code, therefore I am --
 The Rasterman (Carsten Haitzler)[EMAIL PROTECTED]
 裸好多  [EMAIL PROTECTED]
 Tokyo, Japan (東京 日本)


 ---
 SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
 from IBM. Find simple to follow Roadmaps, straightforward articles,
 informative Webcasts and more! Get everything you need to get up to
 speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
 ___
 enlightenment-users mailing list
 enlightenment-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-users



---
SF.Net email is Sponsored by the Better Software Conference  EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile  Plan-Driven Development * Managing Projects  Teams * Testing  QA
Security * Process Improvement  Measurement * http://www.sqe.com/bsce5sf
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-08-11 Thread Vincent Torri

Can't you wrap ecore objects with a boost::smart_ptr ? I use the smart_ptr
to wrap objects of the Gstreamer library without any problem. After that,
I think it is not difficult to use the C++ stuff of boost. For examples,
maybe you can have a look there:

http://cvs.sourceforge.net/viewcvs.py/avisynth2/avisynth/src/gstreamer/?only_with_tag=avisynth_3_0

Hope this helps

Vincent

On Sun, 31 Jul 2005, xnowfall wrote:

 ecore_* takes a pointer to a function whereas boost::bind returns an
 object (that can be used as a function by operator overloading). to use
 a member function you need both a pointer to an object instance and a
 pointer to the function, which boost::bind wraps up in an object, but
 which the efl can't use.

 it would be nice to use stuff like boost::bind, but that's a c++ thing
 and the efl is c



 ---
 SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
 from IBM. Find simple to follow Roadmaps, straightforward articles,
 informative Webcasts and more! Get everything you need to get up to
 speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
 ___
 enlightenment-users mailing list
 enlightenment-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-users



---
SF.Net email is Sponsored by the Better Software Conference  EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile  Plan-Driven Development * Managing Projects  Teams * Testing  QA
Security * Process Improvement  Measurement * http://www.sqe.com/bsce5sf
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


[e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-07-31 Thread Der Lockruf des Kaos
Hi all,

I have a Problem with C++ Member Functions and Pointers to this Member 
Functions so that they fit into a Function with take a normal Function.
I guess i'm a Newbie, otherwise i should have already solved it, i think. ;)

I want to use IPC Stuff from Ecore. But before you can make use of ecore_ipc 
you must initialize it, as far as i can see.
I atached 4 Files, where i build a little Scenario:
1. Example.cpp // The Main Program
2. Testclass.hpp
3. Testclass.cpp
4. Makefile // Perhaps you must adjust some of the Variables

I commented the important Points in the Code again.

So i must first call 
ecore_ipc_init() // Testclass Line 68
and
must supply 3 Functions to ecore for handling Events
1. A Function that is called, when a new IPC Server is added
2. A Function that is called, when a IPC Server is deleted
3. A Function that is called, when some Message is sent

Namely:
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_ADD, ipc_server_add, NULL );
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, ipc_server_del, NULL );
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DATA, ipc_server_data, NULL );

ipc_server_add, ipc_server_del and ipc_server_data are the functions that 
are available outside the Class Testclass

The Example Program as it is compiles and i can start it, the ecore_pic_init() 
succeds the 3 Functions get registered but this 3 submitted Functions are 
standing outside my Testclass,
but my Target is to have they inside my Testclass.

That's my Problem, i didn't get the Clue to give these MemberFunctions to these 
3 Functions:
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_ADD, ipc_server_add, NULL );
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, ipc_server_del, NULL );
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DATA, ipc_server_data, NULL );

I tried Things like that, but that didn't helped me:
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, boost::bind( 
boost::typeint(), Testclass::ipc_server_add ), NULL );
ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, boost::bind( 
boost::typeint(), Testclass::ipc_server_add, _1, _2, _3 ), NULL );

So i want to ask to the Mailinglist in Hope somebody knows how to do this Task 
in the right Way. ;)

Thanks for your help and Greets to all,
Christian#include Testclass.hpp

#include iostream

using namespace std;

int
main( int argc, char *argv[] ) {

  cout  Creating an Instance of the Testclass \n;
  Testclass * testclass = new Testclass();

  if ( !testclass-Init() ) {
cout  Initialization of ecore_ipc failed.\n;
  } else {
cout  Initialization of ecore_ipc succeded.\n;
  }

  cout  Delete the Instance of the Testclass\n;
  delete testclass;
  return 0;
}


Makefile
Description: Binary data
#include Testclass.hpp

#include iostream

// Boost
#include boost/format.hpp
using boost::format;

using namespace std;

/**
 * ipc_server_add - when we connect to the ipc daemon
 * @data -
 * @type - 
 * @event - the Ecore_Ipc_Event_Server_Add that triggered us
 */
int
ipc_server_add( void *data, int type, void *event ) {
  Ecore_Ipc_Event_Server_Add * e;

  e = ( Ecore_Ipc_Event_Server_Add * ) event;
  cout  format( Server add \n );
  return 1;
}

/**
 * ipc_server_del - when we disconnect from the ipc daemon
 * @data -
 * @type - 
 * @event - the Ecore_Ipc_Event_Server_Del that triggered us
 */
int
ipc_server_del( void *data, int type, void *event ) {
  Ecore_Ipc_Event_Server_Del * e;

  e = ( Ecore_Ipc_Event_Server_Del * ) event;
  cout  format( Server del \n );
  return 1;
}

/**
 * ipc_server_data - 
 * @data -
 * @type - 
 * @event - the Ecore_Ipc_Event_Server_Data that triggered us
 */
int
ipc_server_data( void *data, int type, void *event ) {
  Ecore_Ipc_Event_Server_Data * e;

  e = ( Ecore_Ipc_Event_Server_Data * ) event;
  cout  format( Server sent [%i] [%i] (%i) \%s\\n ) % e-major % e-minor % e-size % e-data;
  return 1;
}

Testclass::Testclass()
: server( NULL ) {}
Testclass::~Testclass() {

  if ( server != NULL ) {
// ecore_ipc_server_del( server );
  }
}

bool
Testclass::Init() {

  if ( ecore_ipc_init()  1 ) {
return 0;
  }


  // Create a IPC Server
  server = ecore_ipc_server_add( ECORE_IPC_LOCAL_USER, Testclass IPC Server, 0, NULL );
  if ( server == NULL ) {
cout  Creating new IPC server failed\n;
return 0;
  }

  // Here is my Problem, i didn't get a valid Pointer to one of my Memberfunctions
  // My Tries looks like these:
  //   ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, boost::bind( boost::typeint(), Testclass::ipc_server_add ), NULL );
  //   ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, boost::bind( boost::typeint(), Testclass::ipc_server_add, _1, _2, _3 ), NULL );

  ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_ADD, ipc_server_add, NULL );
  ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DEL, ipc_server_del, NULL );
  ecore_event_handler_add( ECORE_IPC_EVENT_SERVER_DATA, ipc_server_data, NULL );

  char buf[ 512 ];
  char *msg = Hello World;
  int 

Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-07-31 Thread xnowfall
ecore_* takes a pointer to a function whereas boost::bind returns an 
object (that can be used as a function by operator overloading). to use 
a member function you need both a pointer to an object instance and a 
pointer to the function, which boost::bind wraps up in an object, but 
which the efl can't use.


it would be nice to use stuff like boost::bind, but that's a c++ thing 
and the efl is c




---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-07-31 Thread Der Lockruf des Kaos
 ecore_* takes a pointer to a function whereas boost::bind returns an 
 object (that can be used as a function by operator overloading). to use 
 a member function you need both a pointer to an object instance and a 
 pointer to the function, which boost::bind wraps up in an object, but 
 which the efl can't use.
 
 it would be nice to use stuff like boost::bind, but that's a c++ thing 
 and the efl is c

Ok so i must use something else then i guess.
Thanks for this good Explanation! 
I didn't realize this.

So i guess i must code a Mini IPC Thing or think about restructuring my 
Framework in another Fashion. ;)

BtW: Enlightenment rocks!

Greets,
Christian



---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-07-31 Thread The Rasterman
On Sun, 31 Jul 2005 22:08:37 +0200 Der Lockruf des Kaos
[EMAIL PROTECTED] babbled:

  ecore_* takes a pointer to a function whereas boost::bind returns an 
  object (that can be used as a function by operator overloading). to use 
  a member function you need both a pointer to an object instance and a 
  pointer to the function, which boost::bind wraps up in an object, but 
  which the efl can't use.
  
  it would be nice to use stuff like boost::bind, but that's a c++ thing 
  and the efl is c
 
 Ok so i must use something else then i guess.
 Thanks for this good Explanation! 
 I didn't realize this.

yeah - basically you will need to write a c callback to c++ boost::bind style
calling to make it work. one side of this must me a standard C function call of
the prototype ecore expects as handler callbacks. it is possible as you can
create a generic callback handler that uses the data pointer as the pointer to
the boots:bind: object and then proceeds to call down further from there using
c++ as the object you gety is both an object AND a callback (from boost::bind).

btw - just theorising here - no practical examples for you.

remember efl is c and done in a c way making it easy for c. c++ is often very
similar and it is possible to bridge the 2 BUT when you jump into heavily OO c++
construct systems like boost::bind the separation between c and it gets larger
and harder to bridge.

 So i guess i must code a Mini IPC Thing or think about restructuring my
 Framework in another Fashion. ;)
 
 BtW: Enlightenment rocks!
 
 Greets,
   Christian
 
 
 
 ---
 SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
 from IBM. Find simple to follow Roadmaps, straightforward articles,
 informative Webcasts and more! Get everything you need to get up to
 speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
 ___
 enlightenment-users mailing list
 enlightenment-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/enlightenment-users
 


-- 
- Codito, ergo sum - I code, therefore I am --
The Rasterman (Carsten Haitzler)[EMAIL PROTECTED]
裸好多  [EMAIL PROTECTED]
Tokyo, Japan (東京 日本)


---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users


Re: [e-users] Problem using boost::bind and ecore_ipc from Enlightenment

2005-07-31 Thread xnowfall
i'm not sure how you mean to use a smart_ptr - maybe we're talking about 
different things here? a smart_ptr is also an object and can't be passed 
to a function expecting a function pointer.


as for the example, i'm guessing you mean the SignalHandler class? i 
don't really see the point of that template at all; have you tried 
calling that constructor with anything other than a function for the 
CallBack type?



Vincent Torri wrote:

Can't you wrap ecore objects with a boost::smart_ptr ? I use the smart_ptr
to wrap objects of the Gstreamer library without any problem. After that,
I think it is not difficult to use the C++ stuff of boost. For examples,
maybe you can have a look there:

http://cvs.sourceforge.net/viewcvs.py/avisynth2/avisynth/src/gstreamer/?only_with_tag=avisynth_3_0

Hope this helps

Vincent

On Sun, 31 Jul 2005, xnowfall wrote:



ecore_* takes a pointer to a function whereas boost::bind returns an
object (that can be used as a function by operator overloading). to use
a member function you need both a pointer to an object instance and a
pointer to the function, which boost::bind wraps up in an object, but
which the efl can't use.

it would be nice to use stuff like boost::bind, but that's a c++ thing
and the efl is c



---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users







---
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477alloc_id=16492op=click
___
enlightenment-users mailing list
enlightenment-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-users