INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

defparser.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2009 Alex Brooks, Alexei Makarenko, Tobias Kaupp
00005  *
00006  * This copy of Orca is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010 #ifndef ORCADEF_DEF_PARSER_H
00011 #define ORCADEF_DEF_PARSER_H
00012 
00013 #include <Ice/Properties.h>
00014 #include <string>
00015 #include <orcadef/componentdefinition.h>
00016 
00017 namespace orcadef {
00018 
00028 void parseDefFile( const std::string &filename, ComponentDef &def );
00029 
00030 // THIS CLASS IS NOT PART OF THE PUBLIC API. USE orcadef::parseDefFile()
00031 /*
00032     @brief Parses .def files.
00033     
00034     @author Alex Brooks
00035 */
00036 class DefParser
00037 {
00038 
00039 public: 
00040 
00041     /*
00042         Opens the .def (component definition) file and parses it.
00043     
00044         May throw exceptions:
00045         - orcadef::FileException:   if the def file can't be opened
00046         - orcadef::ParseException   if the def file is badly-formed.
00047         
00048         To generate .def files, just follow this example:
00049         @include src/utils/orcadef/def_test_input.def
00050     */
00051     DefParser( std::string filename, orcadef::ComponentDef &def );
00052     ~DefParser();
00053 
00054     // Access
00056     const ComponentDef &componentDefinition() const { return def_; }
00057 
00058 private: 
00059 
00060     void parse();
00061 
00062     void listAllPropertiesForPrefix( std::string prefix );
00063     void initValidTypes();
00064 
00065     void getComponentComments();
00066     // interfaceType="Provides" or "Requires" (no ".")
00067     void getInterfaceTags( const std::string        &interfaceType, 
00068                            std::vector<std::string> &tagList);
00069     void getProvidedInterfaceDetails( const std::vector<std::string> &tags, 
00070                                       std::vector<ProvidedDef>       &p );
00071     void getRequiredInterfaceDetails( const std::vector<std::string> &tags, 
00072                                       std::vector<RequiredDef>       &p );
00073     
00074     // configType="Config" or "ExternaConfig" (no ".")
00075     void getConfigTags( const std::string        &configType, 
00076                         std::vector<std::string> &configTags );
00077     // configType="Config" or "ExternaConfig" (no ".")
00078     void getConfigDetails( const std::string        &configType,
00079                            const std::vector<std::string>  &tags,
00080                            std::vector<ConfigDef>          &p );
00081 
00082     // Throws an exception if it's not found.
00083     std::string forceGetProperty( std::string key );
00084 
00085     ComponentDef &def_;
00086 
00087     Ice::PropertiesPtr props_;
00088 
00089     // Constants
00091 
00092     std::vector<std::string> validConfigTypes_;
00093 
00094     int verbose_;
00095 };
00096 
00097 }
00098 
00099 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5