+
+
+/* *******************************
+ * Accessors for the Functions map
+ */
+
+Function* InformationManager::getFunction(uint64_t address) {
+ auto it = functions.find(address);
+ if (it != functions.end())
+ return it->second;
+ else
+ return NULL;
+}
+
+std::map<uint64_t, Function*>::const_iterator InformationManager::beginFunctions() {
+ return functions.begin();
+}
+std::map<uint64_t, Function*>::const_iterator InformationManager::endFunctions() {
+ return functions.end();
+}
+
+
+/* *********************************
+ * Accessors for the BasicBlocks map
+ */
+
+BasicBlock* InformationManager::getBasicBlock(uint64_t address) {
+ auto it = blocks.find(address);
+ if (it != blocks.end())
+ return it->second;
+ else
+ return NULL;
+}
+
+std::map<uint64_t, BasicBlock*>::const_iterator InformationManager::beginBasicBlocks() {
+ return blocks.begin();
+}
+std::map<uint64_t, BasicBlock*>::const_iterator InformationManager::endBasicBlocks() {
+ return blocks.end();
+}
+
+
+/* *********************************
+ * Accessors for the Interpreter map
+ */
+
+Interpreter* InformationManager::getInterpreter(const std::string& name) {
+ auto it = interpreters.find(name);
+ if (it != interpreters.end())
+ return it->second;
+ else
+ return NULL;
+}
+
+std::map<std::string, Interpreter*>::const_iterator InformationManager::beginInterpreters() {
+ return interpreters.begin();
+}
+std::map<std::string, Interpreter*>::const_iterator InformationManager::endInterpreters() {
+ return interpreters.end();
+}
+
+
+/* ********************************
+ * Factory methods for data classes
+ */
+
+Function* InformationManager::newFunction(uint64_t address) {
+ Function* fun = new Function(address, false, this);
+ functions.insert(std::make_pair(address, fun));
+ return fun;
+}
+
+Function* InformationManager::newDynamicFunction(uint64_t address) {
+ Function* fun = new Function(address, true, this);
+ functions.insert(std::make_pair(address, fun));
+ return fun;
+}
+
+BasicBlock* InformationManager::newBasicBlock(uint64_t address) {
+ BasicBlock* block = new BasicBlock(address, this);
+ blocks.insert(std::make_pair(address, block));
+ return block;
+}
+
+Comment* InformationManager::newGlobalComment(uint64_t address) {
+ Comment* comment = new Comment(address, this);
+ comments.insert(std::make_pair(address, comment));
+ return comment;
+}
+
+Comment* InformationManager::newLocalComment(uint64_t address, Function* f) {
+ Comment* comment = new Comment(address, this);
+ comments.insert(std::make_pair(address, comment));
+ return comment;
+}
+
+void InformationManager::finishFunction(Function* fun) {
+ LOG4CXX_DEBUG(logger, "Finishing function " << fun->getName());
+ for (auto b : fun->blocks()) {
+ BasicBlock* bl = b.second;
+ blocks.insert(std::make_pair(bl->getStartAddress(), bl));
+ }
+ NewFunctionEvent event(fun->getStartAddress(), fun);
+ dispatch(&event);
+}
+
+void InformationManager::finishBasicBlock(BasicBlock*) {
+}
+
+void InformationManager::finnishComment(Comment* c) {
+}
+
+void InformationManager::deleteFunction(Function* f) {
+ functions.erase(f->getStartAddress());
+ delete f;
+}
+
+void InformationManager::deleteBasicBlock(BasicBlock* b) {
+ blocks.erase(b->getStartAddress());
+ delete b;
+}
+
+void InformationManager::deleteComment(Comment* c) {
+ auto range = comments.equal_range(c->getAddress());
+ for (auto it = range.first; it != range.second; ++it) {
+ if (it->second == c) {
+ comments.erase(it);
+ break;
+ }
+ }
+ delete c;
+}