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

 

         

libs/orcaice/context.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_COMPONENT_CONTEXT_H
00012 #define ORCAICE_COMPONENT_CONTEXT_H
00013 
00014 // We carefully select the minimum subset of Ice include file we commonly need.
00015 // It would be easier to just include <Ice/Ice.h> at the expense of more includes
00016 // and slower compilation. We are trying to be careful because this file is included
00017 // by practically everything in Orca.
00018 #include <Ice/Communicator.h>
00019 #include <Ice/ObjectAdapter.h>
00020 #include <Ice/Properties.h>
00021 #include <Ice/LocalException.h>
00022 
00023 #include <orca/ocm.h>
00024 #include <orcaice/home.h>
00025 #include <gbxutilacfr/tracer.h>
00026 #include <gbxutilacfr/status.h>
00027 #include <hydroutil/history.h>
00028 #include <hydroutil/context.h>
00029 
00030 namespace orcaice
00031 {
00032 
00033 class Component;
00034 
00058 class Context
00059 {
00060 friend class Component;
00061 
00062 public:
00063     // We need the empty constructor because the original one is constucted a bit at a time
00064     // during component initialization.
00065     // We don't document this constuctor because the user typically only sees the copy constructor.
00066     Context();
00067 
00069     const std::string&     tag() const { return tag_; };
00070 
00072     const orca::FQComponentName& name() const { return name_; };
00073 
00077     bool                   isApplication() const { return isApplication_; };
00078 
00080     Ice::CommunicatorPtr   communicator() const { return communicator_; };
00081 
00083     Ice::ObjectAdapterPtr  adapter() const { return adapter_; };
00084 
00087     Ice::PropertiesPtr     properties() const { return communicator_->getProperties(); };
00088 
00090     orcaice::Home&         home() const { return *home_; };
00092     gbxutilacfr::Tracer&     tracer() const { return *tracer_; };
00094     gbxutilacfr::Status&     status() const { return *status_; };
00096     hydroutil::History&    history() const { return *history_; };
00097 
00098 
00105     void activate();
00106 
00109     bool isDeactivating();
00110 
00115     void shutdown() const;
00116 
00117     // WARNING to internal developers:
00118     // Do not call these functions before the context is fully initialized, i.e.
00119     // before Component::start() is called.
00125     hydroutil::Context toHydroContext( const std::string &prefixToStrip ) const;
00126 
00129     hydroutil::Context toHydroContext() const;
00130 
00132     std::string toString() const;
00133 
00134 private:
00135 
00136     // this function should only be called by Component (it can because it's a friend)
00137     void init( const orca::FQComponentName& name,
00138                const bool isApp,
00139                const Ice::ObjectAdapterPtr& adapter );
00140 
00141     std::string            tag_;
00142     orca::FQComponentName  name_;
00143     bool                   isApplication_;
00144     Ice::CommunicatorPtr   communicator_;
00145     Ice::ObjectAdapterPtr  adapter_;
00146 
00147     // Context does not take responsibility for these objects, i.e. does not destroy them
00148     orcaice::Home*         home_;
00149     gbxutilacfr::Tracer*   tracer_;
00150     gbxutilacfr::Status*   status_;
00151     hydroutil::History*    history_;
00152 };
00153 
00154 } // end namespace
00155 
00156 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5