comparison src/Support/ModuleTree.h @ 121:3cdaa81c3aca

- Massive refactoring to make module tree stuff work. In theory we now support configuration files again. The graphics stuff is untested as yet.
author tomwalters
date Mon, 18 Oct 2010 04:42:28 +0000
parents 89e4facffd93
children 0db637cac96b
comparison
equal deleted inserted replaced
120:89e4facffd93 121:3cdaa81c3aca
22 /*! \author: Thomas Walters <tom@acousticscale.org> 22 /*! \author: Thomas Walters <tom@acousticscale.org>
23 * \date 2010/08/08 23 * \date 2010/08/08
24 * \version \$Id: $ 24 * \version \$Id: $
25 */ 25 */
26 26
27 #include <boost/scoped_ptr.hpp> 27 #include <iostream>
28 #include <hash_map> 28 #include <map>
29 #include <string> 29 #include <string>
30
31 #include "Support/Common.h"
32 #include "Support/Module.h"
33 #include "Support/Parameters.h"
34 #include "Support/SignalBank.h"
35 #include "Support/linked_ptr.h"
30 36
31 namespace aimc { 37 namespace aimc {
32 using std::string; 38 using std::string;
33 class Module; 39 using std::map;
34 class Parameters; 40 using std::ostream;
35 41
36 class ModuleTree { 42 class ModuleTree {
37 public: 43 public:
38 bool ParseConfigFile(const string &filename); 44 ModuleTree();
39 bool ParseConfigText(const string &config_text); 45 bool LoadConfigFile(const string &filename);
40 string GetFullConfig() 46 bool LoadConfigText(const string &config_text);
47 string GetFullConfig();
48 bool Initialize(Parameters *global_parameters);
49 void Reset();
50 void PrintConfiguration(ostream &out);
51 void Process();
52 void MakeDotGraph(ostream &out);
41 void set_output_filename_prefix(const string &prefix) { 53 void set_output_filename_prefix(const string &prefix) {
42 output_filename_prefix_ = prefix; 54 output_filename_prefix_ = prefix;
43 } 55 };
44 string output_filename_prefix() { 56 string output_filename_prefix() {
45 return output_filename_prefix_; 57 return output_filename_prefix_;
46 } 58 };
47 private: 59 private:
48 Paramters config_; 60 bool ConstructTree();
61 Parameters config_;
62 SignalBank s_;
49 string output_filename_prefix_; 63 string output_filename_prefix_;
50 hash_map<string, scoped_ptr<Module> > modules_; 64 map<string, linked_ptr<Module> > modules_;
51 hash_map<string, scoped_ptr<Parameters> > parameters_; 65 Module *root_module_;
52 string root_name_; 66 map<string, linked_ptr<Parameters> > parameters_;
67 bool initialized_;
53 DISALLOW_COPY_AND_ASSIGN(ModuleTree); 68 DISALLOW_COPY_AND_ASSIGN(ModuleTree);
54 }; 69 };
55 } // namespace aimc 70 } // namespace aimc