|
orca-robotics INTRODUCTION Overview Download and Install Quick Start Documentation Publications REPOSITORY Interfaces Components Libraries Utilities Software Map DEVELOPER Tutorials Examples Dev Guide Dashboard Wiki login/pass: orca/orca PEOPLE Contributors Users Project Download Mailing lists
|
componentdefinition.h00001 /* 00002 * Orca-Robotics Project: Components for robotics 00003 * http://orca-robotics.sf.net/ 00004 * Copyright (c) 2004-2008 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 00011 #ifndef ORCADEF_COMPONENT_DEFINITION_H 00012 #define ORCADEF_COMPONENT_DEFINITION_H 00013 00014 #include <string> 00015 #include <vector> 00016 00017 #include <orca/common.h> 00018 #include <orca/ocm.h> 00019 00020 namespace orcadef 00021 { 00022 00023 // 00024 // Notes: 00025 // 00026 // - 'Defaults' are the default values to use in the config files. 00027 // - Optional Definition fields can be left empty. They'll be filled 00028 // out with reasonable values when .cfg files are generated. 00029 // 00030 00031 00032 // 00033 // Component Definition: these bits are static for a given component 00034 // 00036 00038 class InterfaceDef 00039 { 00040 public: 00042 std::string tag; 00044 std::string type; 00045 }; 00046 00048 class ProvidedDef : public InterfaceDef 00049 { 00050 public: 00052 std::string name; 00053 }; 00054 00056 class RequiredDef : public InterfaceDef 00057 { 00058 public: 00060 std::string proxy; 00061 // orca::FQInterfaceName fqname; 00062 }; 00063 00065 struct ConfigDef 00066 { 00068 std::string tag; 00070 std::string value; 00072 std::string comment; 00074 std::string type; 00077 bool isExternal; 00078 }; 00079 00085 struct ComponentDef 00086 { 00088 std::string filename; 00089 00091 std::string tag; 00093 std::string endpoints; 00095 bool isSpecialEndpoints; 00097 std::vector<std::string> comments; 00098 00100 std::vector<ProvidedDef> provided; 00102 std::vector<RequiredDef> required; 00104 std::vector<ConfigDef> configs; 00106 std::vector<ConfigDef> externalConfigs; 00107 }; 00108 00109 // 00110 // Component Configuration: these bits are user-edittable. 00111 // 00113 00115 class InterfaceCfg 00116 { 00117 public: 00119 std::string tag; 00120 }; 00121 00123 class ProvidedCfg : public InterfaceCfg 00124 { 00125 public: 00127 std::string name; 00128 }; 00129 00131 class RequiredCfg : public InterfaceCfg 00132 { 00133 public: 00135 std::string proxy; 00136 // orca::FQInterfaceName fqname; 00137 }; 00138 00140 struct ConfigCfg 00141 { 00143 std::string tag; 00145 std::string value; 00146 }; 00147 00153 struct ComponentCfg 00154 { 00156 orca::FQComponentName fqname; 00158 orca::FQExecutableName fqexecutable; 00160 std::string endpoints; 00162 std::vector<ProvidedCfg> provided; 00164 std::vector<RequiredCfg> required; 00166 std::vector<ConfigCfg> configs; 00168 std::vector<ConfigCfg> externalConfigs; 00169 }; 00170 00175 ComponentCfg toCfg( const ComponentDef & def ); 00176 00181 const std::string toCfgText( const ComponentDef & def ); 00182 00186 const std::string toCfgTextWithHeaders( const ComponentDef &def, const std::vector<std::string> & headers ); 00187 00192 const std::string toXmlText( const ComponentDef & def, bool withTemplate=false ); 00193 00198 const std::string toXmlTemplateText( const ComponentDef & def ); 00199 00205 ComponentDef invertDef( const ComponentDef & def, const std::string & invTag ); 00206 00211 const std::string toDefText( const ComponentDef & def ); 00212 00213 // Debugging functions: see the entire contents of the ComponentDef. 00214 const std::string toString( const ProvidedDef &def ); 00215 const std::string toString( const RequiredDef &def ); 00216 const std::string toString( const ConfigDef &def ); 00217 const std::string toString( const ComponentDef &def ); 00218 00219 // Debugging functions: see the entire contents of the ComponentCfg. 00220 const std::string toString( const ProvidedCfg &c ); 00221 const std::string toString( const RequiredCfg &c ); 00222 const std::string toString( const ConfigCfg &c ); 00223 const std::string toString( const ComponentCfg &c ); 00224 00225 } // namespace 00226 00227 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)
1.4.5