23 #ifdef MTEMPLATE_EXPORTS
24 #define MTEMPLATE_API __declspec(dllexport)
26 #define MTEMPLATE_API __declspec(dllimport)
30 #ifndef MTEMPLATE_EXPORTS
43 #define MThread uintptr_t
45 #define MThread pthread_t
56 #pragma warning(disable: 4251)
59 namespace MTemplateEngine {
101 std::string getMd5Hash();
102 std::string getFilename();
104 void setUid(
int _uid);
105 void setMd5Hash(std::string _hash);
106 void setFilename(std::string _filename);
124 static MManager* getUniqueClass(
bool alloc =
true);
125 static void destroyUniqueClass(
void);
126 static MManager* allocateClass(
void);
127 static void destroyClass(
MManager*);
128 static void setIsMacBundle(
bool isMacBundle);
129 static void setPythonPath(
const std::string& _pythonPath);
130 static std::string getPythonPath();
131 static void initializePythonPath(
bool showPath=
false);
133 bool installTemplate(
MTemplate* templateClass);
135 MTemplate* getNextTemplate(
int previous_uid);
136 std::string resolveMappingToJob(
int template_id,
const char* key) ;
137 std::string resolveMappingToTemplate(
int template_id,
const char* key) ;
141 void acquirePython(
void);
142 void releasePython(
void);
143 std::string getPyExceptionStr();
147 void onPythonStdout(
const char* out);
148 void onPythonStderr(
const char* out);
149 void onPythonStderrFlush();
150 void onPythonStdoutFlush();
152 bool _installPyTemplate(
void* templateClass);
159 MTemplate* getTemplate(
const char* name);
160 MTemplate* getTemplateByFilename(
const char* filename);
163 void unloadTemplate(
int id);
164 int getTemplatesCount();
165 int getNextFreeUID();
168 void fillInternalHashesMap();
175 void sortListByField(
const std::string& field, std::list<MTemplate*>* list);
183 static bool _isMacBundle;
184 static bool pythonFromHere;
185 static std::map<MThread,void*> threadStates;
186 static void* mainThreadState;
188 static void* m_PyFormatException;
189 static void* m_pMainModule;
190 static void* m_pMainDict;
191 static std::string pythonPath;
192 static std::list<MTemplate*> gc;
198 const std::string field;
199 sortFunctor(
const std::string& field) : field(field) {}