annotate trunk/src/Support/ModuleTree.h @ 706:f8e90b5d85fd tip

Delete CARFAC code from this repository. It has been moved to https://github.com/google/carfac Please email me with your github username to get access. I've also created a new mailing list to discuss CARFAC development: https://groups.google.com/forum/#!forum/carfac-dev
author ronw@google.com
date Thu, 18 Jul 2013 20:56:51 +0000
parents 69466da9745e
children
rev   line source
tomwalters@365 1 // Copyright 2010, Thomas Walters
tomwalters@365 2 //
tomwalters@365 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@365 4 // http://www.acousticscale.org/AIMC
tomwalters@365 5 //
tomwalters@365 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@365 7 // you may not use this file except in compliance with the License.
tomwalters@365 8 // You may obtain a copy of the License at
tomwalters@365 9 //
tomwalters@365 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@365 11 //
tomwalters@365 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@365 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@365 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@365 15 // See the License for the specific language governing permissions and
tomwalters@365 16 // limitations under the License.
tomwalters@365 17
tomwalters@365 18 /*! \file
tomwalters@365 19 * \brief Parse a configuration file to generate a tree of modules.
tomwalters@365 20 */
tomwalters@365 21
tomwalters@365 22 /*! \author: Thomas Walters <tom@acousticscale.org>
tomwalters@365 23 * \date 2010/08/08
tomwalters@365 24 * \version \$Id: $
tomwalters@365 25 */
tomwalters@365 26
tomwalters@402 27 #include <iostream>
tomwalters@402 28 #include <map>
tomwalters@365 29 #include <string>
tomwalters@365 30
tomwalters@402 31 #include "Support/Common.h"
tomwalters@402 32 #include "Support/Module.h"
tomwalters@402 33 #include "Support/Parameters.h"
tomwalters@402 34 #include "Support/SignalBank.h"
tomwalters@402 35 #include "Support/linked_ptr.h"
tomwalters@402 36
tomwalters@365 37 namespace aimc {
tomwalters@365 38 using std::string;
tomwalters@402 39 using std::map;
tomwalters@402 40 using std::ostream;
tomwalters@401 41
tomwalters@365 42 class ModuleTree {
tomwalters@365 43 public:
tomwalters@402 44 ModuleTree();
tomwalters@402 45 bool LoadConfigFile(const string &filename);
tomwalters@402 46 bool LoadConfigText(const string &config_text);
tomwalters@402 47 string GetFullConfig();
tomwalters@402 48 bool Initialize(Parameters *global_parameters);
tomwalters@402 49 void Reset();
tomwalters@402 50 void PrintConfiguration(ostream &out);
tomwalters@402 51 void Process();
tomwalters@402 52 void MakeDotGraph(ostream &out);
tomwalters@395 53 void set_output_filename_prefix(const string &prefix) {
tomwalters@395 54 output_filename_prefix_ = prefix;
tomwalters@402 55 };
tomwalters@365 56 string output_filename_prefix() {
tomwalters@365 57 return output_filename_prefix_;
tomwalters@402 58 };
tomwalters@365 59 private:
tomwalters@402 60 bool ConstructTree();
tomwalters@402 61 Parameters config_;
tomwalters@402 62 SignalBank s_;
tomwalters@365 63 string output_filename_prefix_;
tomwalters@402 64 map<string, linked_ptr<Module> > modules_;
tomwalters@402 65 Module *root_module_;
tomwalters@402 66 map<string, linked_ptr<Parameters> > parameters_;
tomwalters@402 67 bool initialized_;
tomwalters@365 68 DISALLOW_COPY_AND_ASSIGN(ModuleTree);
tomwalters@365 69 };
tomwalters@365 70 } // namespace aimc