SST  7.0.0
StructuralSimulationToolkit
element_python.h
1 // Copyright 2009-2017 Sandia Corporation. Under the terms
2 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2017, Sandia Corporation
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 
13 #ifndef SST_CORE_MODEL_ELEMENT_PYTHON_H
14 #define SST_CORE_MODEL_ELEMENT_PYTHON_H
15 
16 #include <vector>
17 #include <string>
18 
19 namespace SST {
20 
21 typedef void* (*genPythonModuleFunction)(void);
22 
23 
24 /** Base class for python modules in element libraries
25  */
27 
28 protected:
29  std::string library;
30  std::string pylibrary;
31  std::string sstlibrary;
32  char* primary_module;
33 
34  std::vector<std::pair<std::string,char*> > sub_modules;
35 
36  // Only needed for supporting the old ELI
38 
39 public:
40  virtual ~SSTElementPythonModule() {}
41 
42  SSTElementPythonModule(std::string library);
43 
44  void addPrimaryModule(char* file);
45  void addSubModule(std::string name, char* file);
46 
47  virtual void* load();
48 };
49 
50 // Class to use to support old ELI
52 private:
53  genPythonModuleFunction func;
54 
55 public:
56  SSTElementPythonModuleOldELI(genPythonModuleFunction func) :
58  func(func)
59  {
60  }
61 
62  void* load() override {
63  return (*func)();
64  }
65 };
66 
67 }
68 
69 #endif // SST_CORE_MODEL_ELEMENT_PYTHON_H
Definition: element_python.h:51
Definition: action.cc:17
Base class for python modules in element libraries.
Definition: element_python.h:26