GaudiPython

From Daya Bay
Jump to navigation Jump to search

This topic describes how to use Gaudi from/with Python.

Exposing Interfaces

When you define an Interface class it is useful to expose it to Python so you can easily test it. To do that these steps must be taken:

  • The Interface header file must be in the public header area for the package:
MyPackageName/MyPackageName/IMyInterfaceClass.h
  • Create an XML file holding which classes you want to export in the dict/classes.xml subdirectory of your package. It should look like:
<lcgdict>
   <class name="IMyInterfaceClass"/>
 </lcgdict>
  • Create a header file that includes all needed headers also in dict/headers.h. It should look like:
#include "MyPackageName/IMyInterfaceClass.h"
  • Add these lines to your cmt/requirements file
apply_pattern reflex_dictionary dictionary=MyPackageName \
              headerfiles=$(MYPACKAGENAMEROOT)/dict/headers.h \
              selectionfile=../dict/classes.xml