annotate src/Support/ModuleTree.h @ 611:0fbaf443ec82

Carfac C++ revision 3, indluding more style improvements. The output structs are now classes again, and have separate storage methods for each output structure along with flags in the Run and RunSegment methods to allow for only storing NAPs if desired.
author alexbrandmeyer
date Fri, 17 May 2013 19:52:45 +0000
parents af531fc3f280
children
rev   line source
tomwalters@84 1 // Copyright 2010, Thomas Walters
tomwalters@84 2 //
tomwalters@84 3 // AIM-C: A C++ implementation of the Auditory Image Model
tomwalters@84 4 // http://www.acousticscale.org/AIMC
tomwalters@84 5 //
tomwalters@84 6 // Licensed under the Apache License, Version 2.0 (the "License");
tomwalters@84 7 // you may not use this file except in compliance with the License.
tomwalters@84 8 // You may obtain a copy of the License at
tomwalters@84 9 //
tomwalters@84 10 // http://www.apache.org/licenses/LICENSE-2.0
tomwalters@84 11 //
tomwalters@84 12 // Unless required by applicable law or agreed to in writing, software
tomwalters@84 13 // distributed under the License is distributed on an "AS IS" BASIS,
tomwalters@84 14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tomwalters@84 15 // See the License for the specific language governing permissions and
tomwalters@84 16 // limitations under the License.
tomwalters@84 17
tomwalters@84 18 /*! \file
tomwalters@84 19 * \brief Parse a configuration file to generate a tree of modules.
tomwalters@84 20 */
tomwalters@84 21
tomwalters@84 22 /*! \author: Thomas Walters <tom@acousticscale.org>
tomwalters@84 23 * \date 2010/08/08
tomwalters@84 24 * \version \$Id: $
tomwalters@84 25 */
tomwalters@84 26
tomwalters@232 27 #include <iostream>
tomwalters@232 28 #include <map>
tomwalters@84 29 #include <string>
tomwalters@84 30
tomwalters@232 31 #include "Support/Common.h"
tomwalters@232 32 #include "Support/Module.h"
tomwalters@232 33 #include "Support/Parameters.h"
tomwalters@232 34 #include "Support/SignalBank.h"
tomwalters@232 35 #include "Support/linked_ptr.h"
tomwalters@232 36
tomwalters@84 37 namespace aimc {
tomwalters@84 38 using std::string;
tomwalters@232 39 using std::map;
tomwalters@232 40 using std::ostream;
tomwalters@231 41
tomwalters@84 42 class ModuleTree {
tomwalters@84 43 public:
tomwalters@232 44 ModuleTree();
tomwalters@232 45 bool LoadConfigFile(const string &filename);
tomwalters@232 46 bool LoadConfigText(const string &config_text);
tomwalters@232 47 string GetFullConfig();
tomwalters@232 48 bool Initialize(Parameters *global_parameters);
tomwalters@232 49 void Reset();
tomwalters@232 50 void PrintConfiguration(ostream &out);
tomwalters@232 51 void Process();
tomwalters@232 52 void MakeDotGraph(ostream &out);
tomwalters@225 53 void set_output_filename_prefix(const string &prefix) {
tomwalters@225 54 output_filename_prefix_ = prefix;
tomwalters@232 55 };
tomwalters@84 56 string output_filename_prefix() {
tomwalters@84 57 return output_filename_prefix_;
tomwalters@232 58 };
tomwalters@84 59 private:
tomwalters@232 60 bool ConstructTree();
tomwalters@232 61 Parameters config_;
tomwalters@232 62 SignalBank s_;
tomwalters@84 63 string output_filename_prefix_;
tomwalters@232 64 map<string, linked_ptr<Module> > modules_;
tomwalters@232 65 Module *root_module_;
tomwalters@232 66 map<string, linked_ptr<Parameters> > parameters_;
tomwalters@232 67 bool initialized_;
tomwalters@84 68 DISALLOW_COPY_AND_ASSIGN(ModuleTree);
tomwalters@84 69 };
tomwalters@84 70 } // namespace aimc