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/orca.h> 00018 00019 namespace orcadef 00020 { 00021 00022 // 00023 // Notes: 00024 // 00025 // - 'Defaults' are the default values to use in the config files. 00026 // - Optional Definition fields can be left empty. They'll be filled 00027 // out with reasonable values when .cfg files are generated. 00028 // 00029 00030 00031 // 00032 // Component Definition: these bits are static for a given component 00033 // 00035 00037 class InterfaceDef 00038 { 00039 public: 00041 std::string tag; 00043 std::string type; 00044 }; 00045 00047 class ProvidedDef : public InterfaceDef 00048 { 00049 public: 00051 std::string name; 00052 }; 00053 00055 class RequiredDef : public InterfaceDef 00056 { 00057 public: 00059 std::string proxy; 00060 // orca::FQInterfaceName fqname; 00061 }; 00062 00064 struct ConfigDef 00065 { 00067 std::string tag; 00069 std::string value; 00071 std::string comment; 00073 std::string type; 00076 bool isExternal; 00077 }; 00078 00084 struct ComponentDef 00085 { 00087 std::string filename; 00088 00090 std::string tag; 00092 std::string endpoints; 00094 bool isSpecialEndpoints; 00096 std::vector<std::string> comments; 00097 00099 std::vector<ProvidedDef> provided; 00101 std::vector<RequiredDef> required; 00103 std::vector<ConfigDef> configs; 00105 std::vector<ConfigDef> externalConfigs; 00106 }; 00107 00108 // 00109 // Component Configuration: these bits are user-edittable. 00110 // 00112 00114 class InterfaceCfg 00115 { 00116 public: 00118 std::string tag; 00119 }; 00120 00122 class ProvidedCfg : public InterfaceCfg 00123 { 00124 public: 00126 std::string name; 00127 }; 00128 00130 class RequiredCfg : public InterfaceCfg 00131 { 00132 public: 00134 std::string proxy; 00135 // orca::FQInterfaceName fqname; 00136 }; 00137 00139 struct ConfigCfg 00140 { 00142 std::string tag; 00144 std::string value; 00145 }; 00146 00152 struct ComponentCfg 00153 { 00155 orca::FQComponentName fqname; 00157 orca::FQExecutableName fqexecutable; 00159 std::string endpoints; 00161 std::vector<ProvidedCfg> provided; 00163 std::vector<RequiredCfg> required; 00165 std::vector<ConfigCfg> configs; 00167 std::vector<ConfigCfg> externalConfigs; 00168 }; 00169 00174 ComponentCfg toCfg( const ComponentDef & def ); 00175 00180 const std::string toCfgText( const ComponentDef & def ); 00181 00185 const std::string toCfgTextWithHeaders( const ComponentDef &def, const std::vector<std::string> & headers ); 00186 00191 const std::string toXmlText( const ComponentDef & def, bool withTemplate=false ); 00192 00197 const std::string toXmlTemplateText( const ComponentDef & def ); 00198 00204 ComponentDef invertDef( const ComponentDef & def, const std::string & invTag ); 00205 00210 const std::string toDefText( const ComponentDef & def ); 00211 00212 // Debugging functions: see the entire contents of the ComponentDef. 00213 const std::string toString( const ProvidedDef &def ); 00214 const std::string toString( const RequiredDef &def ); 00215 const std::string toString( const ConfigDef &def ); 00216 const std::string toString( const ComponentDef &def ); 00217 00218 // Debugging functions: see the entire contents of the ComponentCfg. 00219 const std::string toString( const ProvidedCfg &c ); 00220 const std::string toString( const RequiredCfg &c ); 00221 const std::string toString( const ConfigCfg &c ); 00222 const std::string toString( const ComponentCfg &c ); 00223 00224 } // namespace 00225 00226 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)