opspace/include/opspace/parse_yaml.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2011 The Board of Trustees of The Leland Stanford Junior University. All rights reserved.
00003  *
00004  * Author: Roland Philippsen
00005  *         http://cs.stanford.edu/group/manips/
00006  *
00007  * This program is free software: you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation, either version 3 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this program.  If not, see
00019  * <http://www.gnu.org/licenses/>
00020  */
00021 
00022 #ifndef OPSPACE_PARSE_YAML_HPP
00023 #define OPSPACE_PARSE_YAML_HPP
00024 
00025 #include <yaml-cpp/yaml.h>
00026 #include <opspace/Factory.hpp>
00027 #include <jspace/wrap_eigen.hpp>
00028 
00029 namespace opspace {
00030 
00031   using jspace::Vector;
00032   
00033   
00034   class Parser
00035   {
00036   public:
00037     Parser(Factory const & factory, std::ostream * optional_dbg_os = 0);
00038     virtual ~Parser();
00039     
00040     Factory const & factory;
00041     std::ostream * dbg;
00042   };
00043   
00044   
00045   class TaskParser
00046     : public Parser
00047   {
00048   public:
00049     TaskParser(Factory const & factory, std::ostream * optional_dbg_os = 0);
00050     
00051     std::string type;
00052     std::string name;
00053     
00061     Task * task;
00062   };
00063   
00064   
00065   class SkillParser
00066     : public Parser
00067   {
00068   public:
00069     SkillParser(Factory const & factory, std::ostream * optional_dbg_os = 0);
00070     
00071     std::string type;
00072     std::string name;
00073     
00081     Skill * skill;
00082   };
00083   
00084   
00085   class TaskTableParser
00086     : public Parser
00087   {
00088   public:
00089     TaskTableParser(Factory const & factory,
00090         Factory::task_table_t & task_table,
00091         std::ostream * optional_dbg_os = 0);
00092     
00093     TaskParser task_parser;    
00094     Factory::task_table_t & task_table;
00095   };
00096   
00097   
00098   class SkillTableParser
00099     : public Parser
00100   {
00101   public:
00102     SkillTableParser(Factory const & factory,
00103       Factory::skill_table_t & skill_table,
00104       std::ostream * optional_dbg_os = 0);
00105     
00106     SkillParser skill_parser;    
00107     Factory::skill_table_t & skill_table;
00108   };  
00109   
00110   
00111   void operator >> (YAML::Node const & node, Vector & vector);
00112   
00113   void operator >> (YAML::Node const & node, TaskParser & parser);
00114   
00115   void operator >> (YAML::Node const & node, SkillParser & parser);
00116   
00117   void operator >> (YAML::Node const & node, TaskTableParser & parser);
00118   
00119   void operator >> (YAML::Node const & node, SkillTableParser & parser);
00120   
00121 }
00122 
00123 #endif // OPSPACE_PARSE_YAML_HPP

Generated on Fri Aug 26 01:31:16 2011 for Stanford Whole-Body Control Framework by  doxygen 1.5.4