-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathfunctionStructuresManager.cpp
54 lines (40 loc) · 1.56 KB
/
functionStructuresManager.cpp
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
#include <functionStructuresManager.h>
#include <global.h>
time_t FunctionStructuresManager::getTimestamp(const char* functionName)
{
time_t timestamp = 0;
functionStructureNameToTimestamp.retrieve(functionName, ×tamp);
return timestamp ? timestamp : 0;
}
void FunctionStructuresManager::addFunctionStructure(FunctionStructure* functionStructure, time_t timestamp)
{
const char* functionName = functionStructure->name.chars();
unsigned int id;
if (functionStructureNameToFunctionStructureID.retrieve(functionName, &id))
{
//delete functionsStructures->at(id);
functionStructures.at(id) = functionStructure;
Global::FunctionManagerObj->tryToRemove(functionName);
}
else
{
id = functionStructures.length();
functionStructures.append(functionStructure);
}
functionStructureNameToFunctionStructureID.replace(functionName, id);
functionStructureNameToTimestamp.replace(functionName, timestamp);
}
unsigned short int FunctionStructuresManager::makeFunction(FunctionStructure* functionStructure, void* address)
{
Function* function = new Function(address, functionStructure->argumentsHandlers, functionStructure->argumentsCount, functionStructure->returnHandler, functionStructure->library, functionStructure->isMethod);
return Global::FunctionManagerObj->addFunction(functionStructure->name.chars(), function, 0);
}
FunctionStructure* FunctionStructuresManager::getFunctionStructure(const char* functionName)
{
unsigned int id;
if (functionStructureNameToFunctionStructureID.retrieve(functionName, &id))
{
return functionStructures.at(id);
}
return NULL;
}