[1224] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
[1237] | 2 | // Classe CxxExecutor : Dynamic C++ compile/execution in piapp
|
---|
[1224] | 3 | // (c) DAPNIA (CEA) LAL (IN2P3/CNRS)
|
---|
| 4 | // C. Magneville 10/2000
|
---|
| 5 |
|
---|
| 6 | #ifndef CXXEXECUTOR_H_SEEN
|
---|
| 7 | #define CXXEXECUTOR_H_SEEN
|
---|
| 8 |
|
---|
| 9 | #include "machdefs.h"
|
---|
| 10 | #include <stdio.h>
|
---|
| 11 | #include <stdlib.h>
|
---|
| 12 | #include <iostream.h>
|
---|
| 13 |
|
---|
| 14 | #include <vector>
|
---|
| 15 | #include <string>
|
---|
| 16 |
|
---|
| 17 | #include "piacmd.h"
|
---|
| 18 | #include "nobjmgr.h"
|
---|
| 19 |
|
---|
| 20 | class CxxExecutor : public CmdExecutor {
|
---|
| 21 | public:
|
---|
| 22 | CxxExecutor(PIACmd* piac, PIStdImgApp* app);
|
---|
| 23 | virtual ~CxxExecutor();
|
---|
[1230] | 24 |
|
---|
[1224] | 25 | virtual int Execute(string& keyw,vector<string>& args);
|
---|
| 26 |
|
---|
[1262] | 27 | int ExecuteCxx(string const & code);
|
---|
| 28 |
|
---|
[1224] | 29 | int CrFile(string cfilename="cxx_spiapp.cc",string func="usercxx");
|
---|
| 30 | void PutInclude(ofstream& os);
|
---|
| 31 | void PutIncludeUser(ofstream& os);
|
---|
| 32 | void PutObject(ofstream& os);
|
---|
| 33 | void PutVar(ofstream& os);
|
---|
| 34 |
|
---|
| 35 | int FillUserCode(vector<string>& usercode,uint_4 first);
|
---|
| 36 | int FillUserCode(string filename);
|
---|
[1230] | 37 |
|
---|
[1224] | 38 | int Compile(string rootfilename="cxx_spiapp");
|
---|
| 39 | int CrMakefile(void);
|
---|
[1230] | 40 |
|
---|
[1224] | 41 | int Link(string libname="cxx_spiapp.so",string func="usercxx");
|
---|
| 42 | int Call(string func="usercxx");
|
---|
| 43 |
|
---|
[1230] | 44 | void FillArgs(vector<string>& args);
|
---|
| 45 | void FillArgs(string& args);
|
---|
| 46 | string GetArgs(void);
|
---|
| 47 |
|
---|
| 48 | void FillInclude(vector<string>& inc);
|
---|
| 49 | void FillInclude(string& inc);
|
---|
| 50 | string GetInclude(void);
|
---|
| 51 |
|
---|
| 52 | void FillCompileOpt(vector<string>& copt);
|
---|
| 53 | void FillCompileOpt(string& copt);
|
---|
| 54 | string GetCompileOpt(void);
|
---|
| 55 |
|
---|
| 56 | void FillLinkOpt(vector<string>& lopt);
|
---|
| 57 | void FillLinkOpt(string& lopt);
|
---|
| 58 | string GetLinkOpt(void);
|
---|
| 59 |
|
---|
| 60 | void FillLinkLibs(vector<string>& llibs);
|
---|
| 61 | void FillLinkLibs(string& llibs);
|
---|
| 62 | string GetLinkLibs(void);
|
---|
| 63 |
|
---|
[1224] | 64 | private:
|
---|
[1237] | 65 | string mUserCodeFn;
|
---|
[1224] | 66 | string mCompOpt;
|
---|
| 67 | string mLinkOpt;
|
---|
| 68 | string mMyLibs;
|
---|
| 69 | vector<string> mIncList;
|
---|
| 70 | vector<string> mCallArgs;
|
---|
| 71 | };
|
---|
| 72 |
|
---|
| 73 | #endif
|
---|