From 3d7b4d3a5f6c17823bb79490256661ddb5e7ab83 Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Thu, 12 Mar 2015 13:45:41 +0100 Subject: [PATCH] Complete accessors for InformationManager managed objects --- src/core/InformationManager.cxx | 31 +++++++++++++++++++++++++++++++ src/core/InformationManager.hxx | 14 +++++++++++--- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/src/core/InformationManager.cxx b/src/core/InformationManager.cxx index 711d47a..61daa3d 100644 --- a/src/core/InformationManager.cxx +++ b/src/core/InformationManager.cxx @@ -112,6 +112,12 @@ void InformationManager::save(const std::string& filename) { void InformationManager::signal_new_function(Function* fun) { } + + +/* ******************************* + * Accessors for the Functions map + */ + Function* InformationManager::getFunction(uint64_t address) { auto it = functions.find(address); if (it != functions.end()) @@ -120,6 +126,18 @@ Function* InformationManager::getFunction(uint64_t address) { return NULL; } +std::map::const_iterator InformationManager::beginFunctions() { + return functions.begin(); +} +std::map::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()) @@ -128,6 +146,19 @@ BasicBlock* InformationManager::getBasicBlock(uint64_t address) { return NULL; } +std::map::const_iterator InformationManager::beginBasicBlocks() { + return blocks.begin(); +} +std::map::const_iterator InformationManager::endBasicBlocks() { + return blocks.end(); +} + + + +/* ******************************** + * Factory methods for data classes + */ + Function* InformationManager::newFunction(uint64_t address) { Function* fun = new Function(address, this); functions.insert(std::make_pair(address, fun)); diff --git a/src/core/InformationManager.hxx b/src/core/InformationManager.hxx index 86e4d8c..555070a 100644 --- a/src/core/InformationManager.hxx +++ b/src/core/InformationManager.hxx @@ -13,11 +13,11 @@ class Function; class BasicBlock; class Comment; +class RenameFunctionEvent; + class QString; class QTemporaryFile; -class RenameFunctionEvent; - class InformationManager { public: InformationManager(); @@ -53,9 +53,17 @@ public: void dispatch(RenameFunctionEvent* event) { rename_function_signal(event); } + Function* getFunction(uint64_t address); - BasicBlock* getBasicBlock(uint64_t address); bool hasFunctions() const {return functions.size() != 0;} + std::map::const_iterator beginFunctions(); + std::map::const_iterator endFunctions(); + + BasicBlock* getBasicBlock(uint64_t address); + bool hasBasicBlocks() const {return blocks.size() != 0;} + std::map::const_iterator beginBasicBlocks(); + std::map::const_iterator endBasicBlocks(); + /* Protocoll: * -- 2.39.2