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

 

         

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

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


Generated for Orca Robotics by  doxygen 1.4.5