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