tomwalters@365: // Copyright 2010, Thomas Walters tomwalters@365: // tomwalters@365: // AIM-C: A C++ implementation of the Auditory Image Model tomwalters@365: // http://www.acousticscale.org/AIMC tomwalters@365: // tomwalters@365: // Licensed under the Apache License, Version 2.0 (the "License"); tomwalters@365: // you may not use this file except in compliance with the License. tomwalters@365: // You may obtain a copy of the License at tomwalters@365: // tomwalters@365: // http://www.apache.org/licenses/LICENSE-2.0 tomwalters@365: // tomwalters@365: // Unless required by applicable law or agreed to in writing, software tomwalters@365: // distributed under the License is distributed on an "AS IS" BASIS, tomwalters@365: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. tomwalters@365: // See the License for the specific language governing permissions and tomwalters@365: // limitations under the License. tomwalters@365: tomwalters@365: /*! \file tomwalters@365: * \brief Parse a configuration file to generate a tree of modules. tomwalters@365: */ tomwalters@365: tomwalters@365: /*! \author: Thomas Walters tomwalters@365: * \date 2010/08/08 tomwalters@365: * \version \$Id: $ tomwalters@365: */ tomwalters@365: tomwalters@402: #include tomwalters@402: #include tomwalters@365: #include tomwalters@365: tomwalters@402: #include "Support/Common.h" tomwalters@402: #include "Support/Module.h" tomwalters@402: #include "Support/Parameters.h" tomwalters@402: #include "Support/SignalBank.h" tomwalters@402: #include "Support/linked_ptr.h" tomwalters@402: tomwalters@365: namespace aimc { tomwalters@365: using std::string; tomwalters@402: using std::map; tomwalters@402: using std::ostream; tomwalters@401: tomwalters@365: class ModuleTree { tomwalters@365: public: tomwalters@402: ModuleTree(); tomwalters@402: bool LoadConfigFile(const string &filename); tomwalters@402: bool LoadConfigText(const string &config_text); tomwalters@402: string GetFullConfig(); tomwalters@402: bool Initialize(Parameters *global_parameters); tomwalters@402: void Reset(); tomwalters@402: void PrintConfiguration(ostream &out); tomwalters@402: void Process(); tomwalters@402: void MakeDotGraph(ostream &out); tomwalters@395: void set_output_filename_prefix(const string &prefix) { tomwalters@395: output_filename_prefix_ = prefix; tomwalters@402: }; tomwalters@365: string output_filename_prefix() { tomwalters@365: return output_filename_prefix_; tomwalters@402: }; tomwalters@365: private: tomwalters@402: bool ConstructTree(); tomwalters@402: Parameters config_; tomwalters@402: SignalBank s_; tomwalters@365: string output_filename_prefix_; tomwalters@402: map > modules_; tomwalters@402: Module *root_module_; tomwalters@402: map > parameters_; tomwalters@402: bool initialized_; tomwalters@365: DISALLOW_COPY_AND_ASSIGN(ModuleTree); tomwalters@365: }; tomwalters@365: } // namespace aimc