#!/bin/sh
# This script generates a c++/c wrapper for the class it is
# given, under strict ccaffeine assumptions. That is the wrapper
# includes only the spec headers
# and the component's class file header, and fully abstract
# headers we propose.
genid="\$Id: genDLWrapperOpaque,v 1.2 2004/10/16 05:53:23 baallan Exp $"
genidnocvs=`echo $genid | sed -e 's/Id//g'`
idString="$1 built strict by $USER@$HOST in `pwd` on `date`."
cat << __EOF1
// This is a generated file. Do not commit to CVS.
#include "dc/export/AllExport.hh"
#include "$1.hh"
#include <stdlib.h>
#include <stdio.h>

extern "C" {

ccafeopq::Component * create_$1() {
        ccafeopq::Component * c;
	$1 * component;
	component = new $1();
	c = dynamic_cast< ccafeopq::Component * >(component); 
	if (!c) {
          ::fprintf(stderr,"dynamic_cast failed at %s:%d.\n",__FILE__,__LINE__);
          ::exit(2);
        }

	return c;
    }    

char **getComponentList() {
	static char *list[2];
	list[0] = "create_$1 $1";
	list[1] = 0;
	return list;
}

}
static char id[]="$genidnocvs";
__EOF1

exit 0
