|
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
|
privateutils.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 ORCAICE_PRIVATE_UTILITIES_H 00012 #define ORCAICE_PRIVATE_UTILITIES_H 00013 00014 // include defnition of Ice runtime 00015 #include <Ice/Ice.h> 00016 #include <string> 00017 00018 #include <orca/common.h> 00019 #include <orca/ocm.h> 00020 #include <orcaice/context.h> 00021 00022 // This file contains only internal functions used inside libOrcaIce 00023 // Don't make Doxygen tags so these functions are not included in the public documentation. 00024 00025 namespace orcaice 00026 { 00027 class Component; 00028 namespace detail 00029 { 00030 // Transfer a property from one property set to another 00031 // returns: 00032 // 0 if it was transferred successfully 00033 // 1 if the property already existed in the target set and it was left untouched 00034 // -1 if the property was not set in the source set, the target was left untouched 00035 int 00036 transferProperty( const Ice::PropertiesPtr &fromProperties, 00037 const Ice::PropertiesPtr &toProperties, 00038 const std::string &fromKey, 00039 const std::string &toKey, 00040 bool force ); 00041 00042 // Transfer a property from one property set to another 00043 // returns: 00044 // 0 if it was transferred successfully 00045 // 1 if the property already existed in the target set and it was left untouched 00046 int 00047 transferProperty( const Ice::PropertiesPtr& toProperties, 00048 const std::string& fromKey, 00049 const std::string& fromValue, 00050 const std::string& toKey, 00051 bool force ); 00052 00053 // Internal helper function. 00054 // behaves like transferProperty. if key is missing, sets the toValue to defaultValue. 00055 void transferPropertyWithDefault( const Ice::PropertiesPtr &fromProperties, 00056 const Ice::PropertiesPtr &toProperties, 00057 const std::string &fromKey, 00058 const std::string &toKey, 00059 const std::string &defaultValue, 00060 bool force ); 00061 00062 void setFactoryProperties( Ice::PropertiesPtr&properties, const std::string& compTag ); 00063 00064 // throws gbxutilacfr::Exception if can't load the file 00065 void setGlobalProperties( Ice::PropertiesPtr& properties, const std::string& filename ); 00066 00067 // throws gbxutilacfr::Exception if can't load the file 00068 void setComponentPropertiesFromFile( Ice::PropertiesPtr& properties, const std::string& filename ); 00069 00070 // Appends network properties to those currently held by Context. 00071 // throws gbxutilacfr::Exception if anything goes wrong (in particular, failes to connect to the property server) 00072 void setComponentPropertiesFromServer( const Context& context ); 00073 00074 /* 00075 TODO: document this 00076 - Sets defaults for component and platform name properties. 00077 - Converts adapter ID property (if specified) to platform and component names. 00078 - Replaces empty platform name with 'local' 00079 - Replaces special platform 'local' with host name. 00080 - Replaces empty component name with component tag converted to low case 00081 - Combines platform and component names into adapter ID property. 00082 */ 00083 // orca::FQComponentName 00084 void postProcessComponentProperties( const Ice::PropertiesPtr& properties, const std::string& compTag ); 00085 00086 // Prints out contents of component's context 00087 void printComponentContext( const orcaice::Context& context ); 00088 00089 // Prints out all component properties. Tag is used only for tracing. 00090 void printComponentProperties( const Ice::PropertiesPtr& properties, const std::string& compTag ); 00091 00092 // Prints Ice, Orca, and (if not empty) Project version. 00093 // Project version is obatained from the component, this allows for non-orca projects 00094 void printAllVersions( const Component& component ); 00095 00096 // Use for 'Application's: 00097 // adds to the set of properties by reading from the component's config file 00098 void addPropertiesFromApplicationConfigFile( Ice::PropertiesPtr &properties, 00099 const Ice::StringSeq &commandLineArgs, 00100 const std::string &compTag ); 00101 00102 // Use for 'Service's: 00103 // adds to the set of properties by reading from the component's config file 00104 void addPropertiesFromServiceConfigFile( Ice::PropertiesPtr &properties, 00105 const Ice::StringSeq &commandLineArgs, 00106 const std::string &compTag ); 00107 00108 // adds to the set of properties by reading from the global config file 00109 void addPropertiesFromGlobalConfigFile( Ice::PropertiesPtr &properties, 00110 const std::string &compTag ); 00111 00112 // Make Home a well-known object, by adding it to the registry 00113 // Catches and ignores CommunicatorDestroyedException. 00114 // Throws various Ice exceptions on failure. 00115 void registerHomeInterface( const Context& context ); 00116 00117 } // namespace 00118 } // namespace 00119 00120 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)
1.4.5