- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionManager.h
More file actions
Latest commit
69 lines (60 loc) · 2.03 KB
/
Copy pathFunctionManager.h
File metadata and controls
69 lines (60 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#include"ScriptableFunction.h"
#include"ScriptParser.h"
#include"FunctionManager.h"
#include"ScriptableFunctions.h"
#include"FileManager.h"
/**
* \brief Helper for managing dynamic functions.
*/
classFunctionManager
{
public:
/**
* \brief This constructor adds some dynamically callable functions to our functionContainer map.
*/
FunctionManager();
/**
* \brief Default deconstructor.
*/
~FunctionManager();
/**
* \brief Dynamically run a function which exists in the functionContainer map by passing it's name & args.
* \param functionName Name of the dynamic function to run (must exist in the functionContainer)
* \param args List of arguments to pass into the function.
*/
voidInvoke(const std::string& functionName, std::vector<std::string>& args);
/**
* \brief Dynamically run a function which exists in the functionContainer map by passing it's name & args.
* \param scriptableFunction Name of the dynamic function to run (must exist in the functionContainer)
* \param args List of arguments to pass into the function.
*/
voidInvoke(const ScriptableFunction& scriptableFunction);
/**
* \brief Runs all functions in the functionObject collection.
*/
voidInvokeAll();
/**
* \brief Parses and runs all functions in a script file.
* \param scriptPath The path on disk where the script can be found.
*/
voidRunScript(const std::string& scriptPath);
/**
* \brief Dynamically run a function which exists in the functionContainer map by passing it an actual ScriptableFunction object.
* \param event_function ScriptableFunction to dynamically run.
*/
std::vector<ScriptableFunction*> functionObjects;
/**
* \brief Contains dynamic variables available to scripts.
*/
std::map<std::string, std::string> variableMap;
private:
/**
* \brief Generic template type for adding dynamic methods to a map.
*/
typedefvoid (*genericTemplate)();
/**
* \brief Map definition of dynamic functions that can be called.
*/
std::map<std::string, genericTemplate> functionContainer;
};