Commits

Anonymous committed 4560d01

simple C-wrapper around C++HepMc - mainly for HepMC::IO_HERWIG

  • Participants

Comments (0)

Files changed (3)

File includes/c-hepmc/hepmcio.h

+#ifndef CHEPMC_CHEPMCIO_H
+#define CHEPMC_CHEPMCIO_H 1
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+///
+/// \class  IO_HERWIG
+/// IO class for reading the HEPEVT common block from 
+///  the Herwig monte carlo program.
+///
+typedef void *CHepMC_IO_HERWIG;
+
+CHepMC_IO_HERWIG
+CHepMC_IO_HERWIG_new();
+
+void
+CHepMC_IO_HERWIG_delete(CHepMC_IO_HERWIG self);
+
+void
+CHepMC_IO_HERWIG_repair_hepevt(CHepMC_IO_HERWIG self);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*!CHEPMC_CHEPMCIO_H */

File src/hepmcio.cxx

+#include "c-hepmc/hepmcio.h"
+
+#include "HepMC/IO_HERWIG.h"
+
+CHepMC_IO_HERWIG
+CHepMC_IO_HERWIG_new()
+{
+  HepMC::IO_HERWIG *self = new HepMC::IO_HERWIG;
+  return (CHepMC_IO_HERWIG)self;
+}
+
+void
+CHepMC_IO_HERWIG_delete(CHepMC_IO_HERWIG self)
+{
+  HepMC::IO_HERWIG *io = (HepMC::IO_HERWIG*)self;
+  delete io;
+  self = 0;
+}
+
+void
+CHepMC_IO_HERWIG_repair_hepevt(CHepMC_IO_HERWIG self)
+{
+  ((HepMC::IO_HERWIG*)self)->repair_hepevt();
+}
+
+// EOF
+
+#
+
+top = '.'
+out = '__build__'
+
+def options(ctx):
+    ctx.load('compiler_c')
+    ctx.load('compiler_cxx')
+    
+def configure(ctx):
+    ctx.load('compiler_c')
+    ctx.load('compiler_cxx')
+    
+def build(ctx):
+
+    ctx(features='cxx cxxshlib',
+        name    = 'c-hepmcio',
+        source  = 'src/hepmcio.cxx',
+        target  = 'c-hepmcio',
+        includes= ['includes'],
+        export_includes=['includes'],
+        use     = ['HepMC','HepMCfio'],
+        lib     = ['gfortran','m',],
+        install_path='${LIBDIR}',
+        cxxflags = ['-fPIC',],
+        )
+
+    inc_dir = ctx.path.find_node('includes')
+    ctx.install_files('${PREFIX}/include/c-hepmc',
+                      inc_dir.ant_glob('c-hepmc/**.h'),
+                      relative_trick=False)