Class holding the unique templates manager class singleton. More...
Public Member Functions | |
| void | acquirePython (void) |
| void | addIcon (const std::string &iconFile) |
| void | addTemplateToGC (MTemplate *t) |
| void | calculateHashesDiffs (templatesHashesMap *remote, templatesHashesMap *out_of_date, templatesHashesMap *invalid) |
| std::string | calculateIconMD5 (const std::string &iconPath) |
| void | calculateIconsHashesDiffs (iconsHashesMap *remote, iconsHashesMap *out_of_date, iconsHashesMap *invalid) |
| void | calculateMD5 (MTemplate *t) |
| MClientLib::MTextFileMarker | checkForLineParsingOverrides (MClientLib::MJob *job, MClientLib::MChunk *chunk, const char *line, int lineNum) |
| void | clear (void) |
| void | clearIcons () |
| void | copyFrom (MManager *) |
| void | deallocateTemplate (MTemplate *t) |
| bool | decodeTemplate (const std::string &content, int &id, std::string &md5Hash, std::string &filename, std::string &templateBuffer, std::string &versionsBuffer, std::string ¯osBuffer, std::string &environmentsBuffer, std::string &parserBuffer) |
| void | deleteHashesMap (templatesHashesMap *) |
| void | deleteIconsHashesMap (iconsHashesMap *) |
| std::string | encodeTemplate (MTemplate *t) |
| void | fillIconsHashesMap (const std::string &iconPath) |
| void | fillInternalHashesMap () |
| void | flushGC (void) |
| MTemplate * | getFirstTemplate () |
| iconsHashesMap * | getIconsHashesMap () |
| templatesHashesMap * | getInternalHashesMap () |
| int | getNextFreeUID () |
| MTemplate * | getNextTemplate (int previous_uid) |
| std::string | getPyExceptionStr () |
| MTemplate * | getTemplate (const char *name) |
| MTemplate * | getTemplate (int id) |
| MTemplate * | getTemplateAt (int num) |
| MTemplate * | getTemplateByFilename (const char *filename) |
| int | getTemplatesCount () |
| std::set< int > | getTemplatesID () |
| bool | installTemplate (MTemplate *templateClass) |
| bool | loadEnvironmentsFromBuffer (MTemplate *t, const std::string &buffer) |
| bool | loadEnvironmentsFromFile (MTemplate *t, const std::string &filePath) |
| bool | loadMacrosFromBuffer (MTemplate *t, const std::string &buffer) |
| bool | loadMacrosFromFile (MTemplate *t, const std::string &filePath) |
| bool | loadParserFromBuffer (MTemplate *t, const std::string &buffer) |
| bool | loadParserFromFile (MTemplate *t, const std::string &filePath) |
| bool | loadTemplateFromFile (const std::string &filePath, const std::string &basePath, const std::string &baseName, const std::string &versionsFilePath, const std::string ¯oFilePath, const std::string &environmentsFilePath, const std::string &logParserFilePath, bool moveToInvalidFolders, bool &moved, std::string &err) |
| bool | loadVersionsFromBuffer (MTemplate *t, const std::string &buffer) |
| bool | loadVersionsFromFile (MTemplate *t, const std::string &filePath) |
| void | Lock (void) |
| void | makeHashesMap (templatesHashesMap *) |
| void | makeIconsHashesMap (iconsHashesMap *, const std::string &iconPath) |
| std::string | marshallHashesMap (templatesHashesMap *) |
| std::string | marshallIconsHashesMap (iconsHashesMap *) |
| bool | normalizeTemplatesDirectories (const std::string &basePath, std::string &versionsFilePath, std::string ¯oFilePath, std::string &environmentsFilePath, std::string &logParserFilePath) |
| void | onPythonStderr (const char *out) |
| void | onPythonStderrFlush () |
| void | onPythonStdout (const char *out) |
| void | onPythonStdoutFlush () |
| MTemplate * | parsePython (const char *template_buf, const char *template_filename, bool _recache, MClientLib::MStringRef &err, bool store=true) |
| void | registerPythonOutputCallbacks (redirectionFuncPtr, redirectionFuncPtr) |
| void | releasePython (void) |
| void | removeIcon (const std::string &iconFile) |
| std::string | resolveMappingToJob (int template_id, const char *key) |
| std::string | resolveMappingToTemplate (int template_id, const char *key) |
| bool | runPythonFile (const char *path, MClientLib::MStringRef &_err) |
| bool | runPythonString (const char *buffer, const char *sourceFile, MClientLib::MStringRef &_err) |
| bool | saveEnvironmentsToBuffer (MTemplate *t, std::string &buffer) |
| bool | saveEnvironmentsToFile (MTemplate *t, const std::string &filePath) |
| bool | saveMacrosToBuffer (MTemplate *t, std::string &buffer) |
| bool | saveMacrosToFile (MTemplate *t, const std::string &filePath) |
| bool | saveParserToBuffer (MTemplate *t, std::string &buffer) |
| bool | saveParserToFile (MTemplate *t, const std::string &filePath) |
| bool | saveTemplateToFile (const std::string &filePath, const std::string &baseName, const std::string &basePath, const std::string &versionsFilePath, const std::string ¯oFilePath, const std::string &environmentsFilePath, const std::string &logParserFilePath, MTemplate *templateClass) |
| bool | saveVersionsToBuffer (MTemplate *t, std::string &buffer) |
| bool | saveVersionsToFile (MTemplate *t, const std::string &filePath) |
| void | sortListByField (const std::string &field, std::list< MTemplate * > *list) |
| void | unloadTemplate (int id) |
| void | Unlock (void) |
| void | unmarshallHashesMap (templatesHashesMap *, const char *) |
| void | unmarshallIconsHashesMap (iconsHashesMap *, const char *) |
| bool | validateJobSubmission (MClientLib::MJob &job, MClientLib::MStringRef &err) |
Static Public Member Functions | |
| static MManager * | allocateClass (void) |
| static void | destroyClass (MManager *) |
| static void | destroyUniqueClass (void) |
| static std::string | getInterpreterModuleName () |
| static std::string | getPythonPath () |
| static MManager * | getUniqueClass (bool allocNewClass=true) |
| static void | initializePythonPath (bool showPath=false, std::string moduleName=std::string()) |
| static void | setIsMacBundle (bool isMacBundle) |
| static void | setPythonPath (const std::string &_pythonPath) |
Detailed Description
Class holding the unique templates manager class singleton.
The MTemplateEngine::MManager class is a global singleton accessible trought MTemplateEngine::MManager::getUniqueClass() that exposes global class members to load, save, encode, decode, and install the Muster templates It also contains all the Python binding functions
Definition at line 185 of file MManager.h.
Member Function Documentation
| void acquirePython | ( | void | ) |
Acquire python execution. Required before invoking any Python commands
| void addTemplateToGC | ( | MTemplate * | t | ) |
Adds a template to the garbage collector
|
static |
Allocates a custom manager class
| void calculateHashesDiffs | ( | templatesHashesMap * | remote, |
| templatesHashesMap * | out_of_date, | ||
| templatesHashesMap * | invalid | ||
| ) |
Calculates the differences between two hashes maps
| std::string calculateIconMD5 | ( | const std::string & | iconPath | ) |
Calculates the MD5 hash for an icon file
| void calculateIconsHashesDiffs | ( | iconsHashesMap * | remote, |
| iconsHashesMap * | out_of_date, | ||
| iconsHashesMap * | invalid | ||
| ) |
Calculates the differences between two hashes maps
| void calculateMD5 | ( | MTemplate * | t | ) |
Calculates the MD5 hash for the template and its settings
| MClientLib::MTextFileMarker checkForLineParsingOverrides | ( | MClientLib::MJob * | job, |
| MClientLib::MChunk * | chunk, | ||
| const char * | line, | ||
| int | lineNum | ||
| ) |
Returns a list of errors overrides from the supplied line
| void clear | ( | void | ) |
Clears the template manager content
| void copyFrom | ( | MManager * | ) |
Duplicates a template manager class
| void deallocateTemplate | ( | MTemplate * | t | ) |
Deallocates a template class
| bool decodeTemplate | ( | const std::string & | content, |
| int & | id, | ||
| std::string & | md5Hash, | ||
| std::string & | filename, | ||
| std::string & | templateBuffer, | ||
| std::string & | versionsBuffer, | ||
| std::string & | macrosBuffer, | ||
| std::string & | environmentsBuffer, | ||
| std::string & | parserBuffer | ||
| ) |
Decodes an MTemplate class from a string
| void deleteHashesMap | ( | templatesHashesMap * | ) |
Deletes an hashes map
| void deleteIconsHashesMap | ( | iconsHashesMap * | ) |
Deletes an hashes map
|
static |
Destroy a specific singleton
|
static |
Destroy the manager singleton
| void fillIconsHashesMap | ( | const std::string & | iconPath | ) |
Rebuilds the internal templates hashes map
| void fillInternalHashesMap | ( | ) |
Rebuilds the internal templates hashes map
| void flushGC | ( | void | ) |
Forces a Garbage collector flush
| MTemplate* getFirstTemplate | ( | ) |
Get the first available template. Used for enumeration
| iconsHashesMap* getIconsHashesMap | ( | ) |
Gets the internal templates hashes map
| templatesHashesMap* getInternalHashesMap | ( | ) |
Gets the internal templates hashes map
|
static |
Gets the running module name
| int getNextFreeUID | ( | ) |
Gets the next free UID
| MTemplate* getNextTemplate | ( | int | previous_uid | ) |
Get the next available template. Used for enumeration
| std::string getPyExceptionStr | ( | ) |
Returns the latest Python exception string
|
static |
Gets the Python path
| MTemplate* getTemplate | ( | const char * | name | ) |
Gets a template by name
| MTemplate* getTemplate | ( | int | id | ) |
Gets a template by ID
| MTemplate* getTemplateAt | ( | int | num | ) |
Gets a template by index
| MTemplate* getTemplateByFilename | ( | const char * | filename | ) |
Gets a template by filename
| int getTemplatesCount | ( | ) |
Gets the total number of installed templates
| std::set<int> getTemplatesID | ( | ) |
Get a list of the installed templates IDs
|
static |
Returns the manager singleton
|
static |
Initialize the Python path with the default values
| bool installTemplate | ( | MTemplate * | templateClass | ) |
Installs a new template into the manager
| bool loadEnvironmentsFromBuffer | ( | MTemplate * | t, |
| const std::string & | buffer | ||
| ) |
Loads the template environments configuration from the specified buffer
| bool loadEnvironmentsFromFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Loads the template environments configuration from the specified file
| bool loadMacrosFromBuffer | ( | MTemplate * | t, |
| const std::string & | buffer | ||
| ) |
Loads the template macros configuration from the specified buffer
| bool loadMacrosFromFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Loads the template macros configuration from the specified file
| bool loadParserFromBuffer | ( | MTemplate * | t, |
| const std::string & | buffer | ||
| ) |
Loads the template log parser configuration from the specified buffer
| bool loadParserFromFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Loads the template log parser configuration from the specified file
| bool loadTemplateFromFile | ( | const std::string & | filePath, |
| const std::string & | basePath, | ||
| const std::string & | baseName, | ||
| const std::string & | versionsFilePath, | ||
| const std::string & | macroFilePath, | ||
| const std::string & | environmentsFilePath, | ||
| const std::string & | logParserFilePath, | ||
| bool | moveToInvalidFolders, | ||
| bool & | moved, | ||
| std::string & | err | ||
| ) |
Loads and install a template from the specified path
| bool loadVersionsFromBuffer | ( | MTemplate * | t, |
| const std::string & | buffer | ||
| ) |
Loads the template versions configuration from the specified buffer
| bool loadVersionsFromFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Loads the template versions configuration from the specified file
| void Lock | ( | void | ) |
Locks the manager. Required in multi-threading environments
| void makeHashesMap | ( | templatesHashesMap * | ) |
Build an hashes map
| void makeIconsHashesMap | ( | iconsHashesMap * | , |
| const std::string & | iconPath | ||
| ) |
Build an hashes map
| std::string marshallHashesMap | ( | templatesHashesMap * | ) |
Marshall the internal hashes map
| std::string marshallIconsHashesMap | ( | iconsHashesMap * | ) |
Marshall the internal hashes map
| bool normalizeTemplatesDirectories | ( | const std::string & | basePath, |
| std::string & | versionsFilePath, | ||
| std::string & | macroFilePath, | ||
| std::string & | environmentsFilePath, | ||
| std::string & | logParserFilePath | ||
| ) |
Ensures templates state directories exists or create them
| void onPythonStderr | ( | const char * | out | ) |
Proxy method to redirect Python stderr.!
| void onPythonStderrFlush | ( | ) |
Proxy method to flush Python output.
| void onPythonStdout | ( | const char * | out | ) |
Proxy method to redirect Python output.!
| void onPythonStdoutFlush | ( | ) |
Proxy method to flush Python stderr.
| MTemplate* parsePython | ( | const char * | template_buf, |
| const char * | template_filename, | ||
| bool | _recache, | ||
| MClientLib::MStringRef & | err, | ||
| bool | store = true |
||
| ) |
Parses a Python template file and returns the expected template class
| void registerPythonOutputCallbacks | ( | redirectionFuncPtr | , |
| redirectionFuncPtr | |||
| ) |
Registers two callbacks of type redirectionFuncPtr to redirect the Python output
| void releasePython | ( | void | ) |
Release python execution. Required before invoking any Python commands
| std::string resolveMappingToJob | ( | int | template_id, |
| const char * | key | ||
| ) |
Resolves template built-in fields with Muster ones
| std::string resolveMappingToTemplate | ( | int | template_id, |
| const char * | key | ||
| ) |
Resolves Muster built-in fields with templates ones
| bool runPythonFile | ( | const char * | path, |
| MClientLib::MStringRef & | _err | ||
| ) |
Runs a Python file
| bool runPythonString | ( | const char * | buffer, |
| const char * | sourceFile, | ||
| MClientLib::MStringRef & | _err | ||
| ) |
Runs a Python string
| bool saveEnvironmentsToBuffer | ( | MTemplate * | t, |
| std::string & | buffer | ||
| ) |
Saves the template environments configuration to the specified buffer
| bool saveEnvironmentsToFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Saves the template environments configuration to the specified file
| bool saveMacrosToBuffer | ( | MTemplate * | t, |
| std::string & | buffer | ||
| ) |
Saves the template macros configuration to the specified buffer
| bool saveMacrosToFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Saves the template macros configuration to the specified file
| bool saveParserToBuffer | ( | MTemplate * | t, |
| std::string & | buffer | ||
| ) |
Saves the template log parser configuration to the specified buffer
| bool saveParserToFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Saves the template log parser configuration to the specified file
| bool saveTemplateToFile | ( | const std::string & | filePath, |
| const std::string & | baseName, | ||
| const std::string & | basePath, | ||
| const std::string & | versionsFilePath, | ||
| const std::string & | macroFilePath, | ||
| const std::string & | environmentsFilePath, | ||
| const std::string & | logParserFilePath, | ||
| MTemplate * | templateClass | ||
| ) |
Saves a template to the specified path
| bool saveVersionsToBuffer | ( | MTemplate * | t, |
| std::string & | buffer | ||
| ) |
Saves the template versions configuration to the specified buffer
| bool saveVersionsToFile | ( | MTemplate * | t, |
| const std::string & | filePath | ||
| ) |
Saves the template versions configuration to the specified file
|
static |
Tells the manager is it's invoked from a Mac bundle. Required for Python paths discovery
|
static |
Sets the path to the Python distribution required by the template manager
| void sortListByField | ( | const std::string & | field, |
| std::list< MTemplate * > * | list | ||
| ) |
Sorts a template list
| void unloadTemplate | ( | int | id | ) |
Unloads a template by ID
| void Unlock | ( | void | ) |
Unlocks the manager. Required in multi-threading environments
| void unmarshallHashesMap | ( | templatesHashesMap * | , |
| const char * | |||
| ) |
Unmarshall an hashes map
| void unmarshallIconsHashesMap | ( | iconsHashesMap * | , |
| const char * | |||
| ) |
Unmarshall an hashes map
| bool validateJobSubmission | ( | MClientLib::MJob & | job, |
| MClientLib::MStringRef & | err | ||
| ) |
Validates a job submission
The documentation for this class was generated from the following file:
- MTemplate/MManager.h
