|
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
|
context.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_COMPONENT_CONTEXT_H 00012 #define ORCAICE_COMPONENT_CONTEXT_H 00013 00014 #include <Ice/Ice.h> 00015 00016 #include <orca/ocm.h> 00017 #include <orcaice/home.h> 00018 #include <gbxutilacfr/tracer.h> 00019 #include <gbxutilacfr/status.h> 00020 #include <hydroutil/history.h> 00021 #include <hydroutil/context.h> 00022 00023 namespace orcaice 00024 { 00025 00026 class Component; 00027 00051 class Context 00052 { 00053 friend class Component; 00054 00055 public: 00056 // We need the empty constructor because the original one is constucted a bit at a time 00057 // during component initialization. 00058 // We don't document this constuctor because the user typically only sees the copy constructor. 00059 Context(); 00060 00062 const std::string& tag() const { return tag_; }; 00063 00065 const orca::FQComponentName& name() const { return name_; }; 00066 00070 bool isApplication() const { return isApplication_; }; 00071 00073 Ice::CommunicatorPtr communicator() const { return communicator_; }; 00074 00076 Ice::ObjectAdapterPtr adapter() const { return adapter_; }; 00077 00080 Ice::PropertiesPtr properties() const { return communicator_->getProperties(); }; 00081 00083 orcaice::Home& home() const { return *home_; }; 00085 gbxutilacfr::Tracer& tracer() const { return *tracer_; }; 00087 gbxutilacfr::Status& status() const { return *status_; }; 00089 hydroutil::History& history() const { return *history_; }; 00090 00091 00095 void activate(); 00096 00099 bool isDeactivating(); 00100 00105 void shutdown() const; 00106 00107 // WARNING to internal developers: 00108 // Do not call these functions before the context is fully initialized, i.e. 00109 // before Component::start() is called. 00115 hydroutil::Context toHydroContext( const std::string &prefixToStrip ) const; 00116 00119 hydroutil::Context toHydroContext() const; 00120 00122 std::string toString() const; 00123 00124 private: 00125 00126 // this function should only be called by Component (it can because it's a friend) 00127 void init( const orca::FQComponentName& name, 00128 const bool isApp, 00129 const Ice::ObjectAdapterPtr& adapter ); 00130 00131 std::string tag_; 00132 orca::FQComponentName name_; 00133 bool isApplication_; 00134 Ice::CommunicatorPtr communicator_; 00135 Ice::ObjectAdapterPtr adapter_; 00136 00137 // Context does not take responsibility for these objects, i.e. does not destroy them 00138 orcaice::Home* home_; 00139 gbxutilacfr::Tracer* tracer_; 00140 gbxutilacfr::Status* status_; 00141 hydroutil::History* history_; 00142 }; 00143 00144 } // end namespace 00145 00146 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)
1.4.5