Retrieve a Attribute by name. Returns zero if no Attribute by that name exists.
#ifndef ORO_TASK_CONTEXT_HPP
#define ORO_TASK_CONTEXT_HPP
#include "rtt-config.h"
#include <boost/make_shared.hpp>
#include <string>
#include <map>
{
    class RTT_API TaskContext
        : public base::TaskCore
    {
    public:
        typedef std::vector< std::string > PeerList;
        TaskContext( const std::string& name, TaskState initial_state = Stopped );
        virtual ~TaskContext();
        virtual const std::string& getName() const { return tcservice->getName(); }
        bool setActivity( base::ActivityInterface* new_act );
        base::ActivityInterface* getActivity();
        template<typename T>
        T* getActivity() { return dynamic_cast<T*>(getActivity()); }
        virtual void clear();
        virtual bool ready();
        virtual bool start();
        virtual bool stop();
        virtual bool addPeer( TaskContext* peer, std::string alias = "" );
        virtual void removePeer( const std::string& name );
        virtual void removePeer( TaskContext* peer );
        virtual void disconnect();
        virtual void disconnectPeers( const std::string& name );
        virtual PeerList getPeerList() const;
        virtual bool hasPeer( const std::string& peer_name ) const;
        virtual TaskContext* getPeer(const std::string& peer_name ) const;
        Service::shared_ptr provides(
const std::string& service_name) { 
return tcservice->provides(service_name); }
             return tcrequests->requires(service_name);
        }
        virtual bool connectServices( TaskContext* peer);
        template<class ServiceType>
        boost::shared_ptr<ServiceType> getProvider(const std::string& name) {
            if (!prepareProvide(name)) return boost::shared_ptr<ServiceType>();
            LocalServices::iterator it = localservs.find(name);
            if (  it != localservs.end() ) {
                return boost::dynamic_pointer_cast<ServiceType>(it->second);
            }
            boost::shared_ptr<ServiceType> st = boost::make_shared<ServiceType>(this);
            st->connectTo( provides(name) );
            localservs[name] = st;
            return st;
        }
        bool loadService(const std::string& service_name);
        template<class Signature>
        Operation<Signature>& addOperation( Operation<Signature>& op )
        {
            return tcservice->addOperation(op);
        }
        template<class Func, class Service>
        Operation< typename internal::GetSignature<Func>::Signature >&
        {
            return tcservice->addOperation(name,func, serv, et);
        }
        template<class Signature>
        Operation< Signature >&
        {
            return tcservice->addOperation(name, func, et);
        }
        OperationInterfacePart* getOperation( std::string name )
        {
            return tcservice->getOperation(name);
        }
        OperationInterface* operations() { return this->provides().get(); }
        template<class T>
        bool addAttribute( 
const std::string& name, T& 
attr) {
             return tcservice->addAttribute(name, attr);
        }
        template<class T>
        bool addConstant( const std::string& name, const T& attr) {
            return tcservice->addConstant(name, attr);
        }
        bool addAttribute( base::AttributeBase& a )
        {
            return tcservice->addAttribute(a);
        }
        base::AttributeBase* getAttribute( const std::string& name ) const
        {
            return tcservice->getAttribute(name);
        }
        ConfigurationInterface* attributes() { return this->provides().get(); }
        template<class T>
        Property<T>& addProperty( const std::string& name, T& attr) {
            return tcservice->addProperty(name, attr);
        }
        bool addProperty( base::PropertyBase& pb ) {
            return tcservice->addProperty(pb);
        }
        base::PropertyBase* getProperty(const std::string& name) const
        {
            return tcservice->getProperty(name);
        }
        PropertyBag* properties() { return this->provides()->properties(); }
        base::PortInterface& addPort(const std::string& name, base::PortInterface& port) {
            port.setName(name);
            return ports()->addPort(port);
        }
        base::PortInterface& addPort(base::PortInterface& port) {
            return ports()->addPort(port);
        }
        typedef boost::function<void(base::PortInterface*)> SlotFunction;
        base::InputPortInterface& addEventPort(const std::string& name, base::InputPortInterface& port, SlotFunction callback = SlotFunction() ) {
            port.setName(name);
            return ports()->addEventPort(port,callback);
        }
        base::InputPortInterface& addEventPort(base::InputPortInterface& port, SlotFunction callback = SlotFunction() ) {
            return ports()->addEventPort(port,callback);
        }
        base::PortInterface* getPort(const std::string& name) const {
            return ports()->getPort(name);
        }
        DataFlowInterface* ports() {
            return tcservice.get();
        }
        const DataFlowInterface* ports() const {
            return tcservice.get();
        }
    protected:
        void forceActivity( base::ActivityInterface* new_act);
        virtual bool dataOnPortHook( base::PortInterface* port );
        virtual void dataOnPortCallback( base::PortInterface* port );
        
        friend class ExecutionEngine;
    private:
        typedef std::map< std::string, TaskContext* > PeerMap;
        typedef std::vector< TaskContext* > Users;
        PeerMap         _task_map;
        Users         musers;
        void addUser(TaskContext* user);
        void removeUser(TaskContext* user);
        void setup();
        friend class DataFlowInterface;
        typedef std::map<base::PortInterface*, SlotFunction > UserCallbacks;
        UserCallbacks user_callbacks;
        void dataOnPort(base::PortInterface* port);
        void setDataOnPortCallback(base::InputPortInterface* port, SlotFunction callback);
        void removeDataOnPortCallback(base::PortInterface* port);
        bool prepareProvide(const std::string& name);
        typedef std::map<std::string, boost::shared_ptr<ServiceRequester> > LocalServices;
        LocalServices localservs;
        os::Mutex mportlock;
        
        TaskContext( TaskContext& );
    };
}
#endif