c++, singletons, macros, and automake.



Hi,
  I have been hacking away on a wrapper for bonobo that lets me make components without the need to copy heaps of boilerplate code... though my solution was inspired by the echo sample.

The main thing that I am now doing, and the reason for this email is I am making automake/conf I little easier to setup for new components. My current designed solution is to append cruft to Makefile.am in a bonbon_newc.sh script that will make idl/.c/uuid/oafinfo files for me, and was wondering if there might be a better solution to this (or if anyone else has already made one). Other than that I might move to using Makefile.am.m4 so that I can cut down the amount of cruft that must be done to use idl files of ones own with bonobo. (and make the resulting Makefile.am.m4 a tad more readable / maintainable).

One requires c++ to use my wrapper. An example would be the echo component, which results in the following code. There is a generic server that one can compile/link to aswell (no code changes are needed in server). This basically removes all the factory, epv, et al. code so that it brings to coder back to raw C CORBA coding and they get a bonobo component out of the deal (also I avoid gtk+ code scattered everywhere ;-).

I am just hoping to remove/shorten the many lines of Makefile.am that is needed to compile an idl and make the static lib etc, so that I don't end up with a Makefile.am that is 5 KLOC long.

//
// compiles to similar exe as samples/echo
//
#include "Echo.h"

#include <string>
#include <vector>

/* These must change for each component. */
#define COMPONENT_CORBA_OBJECT   Demo_Echo
#define COMPONENT_OAFID "OAFIID:demo_echo:5aca39ba-b09b-49c9-a758-4bcb13ca86c5"

/************************************************************************/
/************************************************************************/
#include "bonbon_component.h"
/************************************************************************/
/************************************************************************/
/************************************************************************/
/************************************************************************/


BONBON_IDLF( echo, void, impl_echo_echo,
(PortableServer_Servant  servant,
const CORBA_char       *string,
CORBA_Environment      *ev))

{
COMPONENT_OBJECT* echo = ECHO (bonobo_object_from_servant (servant));

printf ("Echo message XXX XXX received: %s \n", string);
}




Use what talents you possess: the woods would be very silent if no birds
sang there except those that sang best.
-- Henry Van Dyke


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]