Urbi SDK Remote for C++  2.7.5
urbi::impl::UContextImpl Class Reference

#include <ucontext-impl.hh>

Inheritance diagram for urbi::impl::UContextImpl:
Collaboration diagram for urbi::impl::UContextImpl:

List of all members.

Classes

class  CleanupStack
 Cleanup Stack RAII. More...

Public Types

typedef boost::unordered_map
< std::string, UObject * > 
objects_type
typedef boost::unordered_map
< std::string, UObjectHub * > 
hubs_type
typedef void(* RTPSend )(UObject *rtp, const UValue &v)
 RTP hooks for performance.
typedef void(* RTPSendGrouped )(UObject *rtp, const std::string &, const UValue &, libport::utime_t)

Public Member Functions

virtual ~UContextImpl ()=0
void init ()
 Inject all loaded uobjects in the system by calling newUObjectClass.
bool bind (const std::string &name, std::string rename=std::string())
 Inject a specific uobject.
virtual void newUObjectClass (urbi::baseURBIStarter *s)=0
 Called to instanciate the first Object of class.
virtual void newUObjectHubClass (urbi::baseURBIStarterHub *s)=0
virtual UObjectHubgetUObjectHub (const std::string &n)
 Retrieve a UObjectHub based on its name or return 0 if not found.
virtual UObjectgetUObject (const std::string &n)
 Retrieve a UObject based on its name or return 0 if not found.
virtual void uobject_unarmorAndSend (const char *str)=0
 Send Urbi code (ghost connection in plugin mode, default connection in remote mode).
virtual void send (const char *str)=0
 Send the string to the connection hosting the UObject.
virtual void send (const void *buf, size_t size)=0
 Send buf to the connection hosting the UObject.
void send (const std::string &s)
 Bouncing overload.
virtual void call (const std::string &object, const std::string &method, UAutoValue v1=UAutoValue(), UAutoValue v2=UAutoValue(), UAutoValue v3=UAutoValue(), UAutoValue v4=UAutoValue(), UAutoValue v5=UAutoValue(), UAutoValue v6=UAutoValue())=0
virtual void declare_event (const UEvent *owner)=0
virtual void emit (const std::string &object, UAutoValue &v1, UAutoValue &v2, UAutoValue &v3, UAutoValue &v4, UAutoValue &v5, UAutoValue &v6, UAutoValue &v7)=0
virtual UObjectMode getRunningMode () const =0
 The mode in which the code is running.
virtual std::pair< int, int > kernelVersion () const =0
 The kernel major,minor version.
virtual void yield () const =0
 Yield execution until next cycle.
virtual void yield_until (libport::utime_t deadline) const =0
 Yield execution until deadline is met (see libport::utime()).
virtual void yield_for (libport::utime_t delay) const
 Yield execution for delay.
virtual void yield_until_things_changed () const =0
 Yield execution until something else is scheduled, or until a message is received in remote mode.
virtual void side_effect_free_set (bool s)=0
 If s is true, mark the current task as having no side effect.
virtual bool side_effect_free_get () const =0
 Get the current side_effect_free state.
virtual UVarImplgetVarImpl ()=0
virtual UObjectImplgetObjectImpl ()=0
virtual UGenericCallbackImplgetGenericCallbackImpl ()=0
virtual void registerObject (UObject *o)
 Default implementations appends to 'objects'.
virtual TimerHandle setTimer (UTimerCallback *cb)=0
virtual void registerHub (UObjectHub *)
virtual void removeHub (UObjectHub *)=0
virtual void setHubUpdate (UObjectHub *, ufloat)=0
virtual void instanciated (UObject *)=0
 Called by the urbiStarter after each UObject instanciation.
template<typename T >
void addCleanup (T *ptr)
 Add ptr to the list of objects to delete whean cleanup() is called.
void addCleanup (boost::function0< void > op)
 Add an arbitrary operation to perform at cleanup() time.
void pushCleanupStack ()
 Push a new cleanup stack.
void popCleanupStack ()
 Delete all pointers passed to addCleanup in current stack and pop.
virtual void lock ()=0
 Request a context lock from another thread to perform multiple operations.
virtual void unlock ()=0
 Release lock acquired with lock()
virtual boost::asio::io_service & getIoService ()=0
 The io_service used by this context.

Public Attributes

objects_type objects
hubs_type hubs
std::set< void * > initialized
RTPSend rtpSend
RTPSendGrouped rtpSendGrouped

Private Types

typedef std::vector
< std::vector
< boost::function0< void > > > 
CleanupList

Private Attributes

boost::thread_specific_ptr
< CleanupList
cleanup_list_

Detailed Description

Definition at line 34 of file ucontext-impl.hh.


Member Typedef Documentation

typedef std::vector<std::vector<boost::function0<void> > > urbi::impl::UContextImpl::CleanupList [private]

Definition at line 169 of file ucontext-impl.hh.

typedef boost::unordered_map<std::string, UObjectHub*> urbi::impl::UContextImpl::hubs_type

Definition at line 122 of file ucontext-impl.hh.

typedef boost::unordered_map<std::string, UObject*> urbi::impl::UContextImpl::objects_type

Definition at line 120 of file ucontext-impl.hh.

typedef void(* urbi::impl::UContextImpl::RTPSend)(UObject *rtp, const UValue &v)

RTP hooks for performance.

Definition at line 162 of file ucontext-impl.hh.

typedef void(* urbi::impl::UContextImpl::RTPSendGrouped)(UObject *rtp, const std::string &, const UValue &, libport::utime_t)

Definition at line 163 of file ucontext-impl.hh.


Constructor & Destructor Documentation

urbi::impl::UContextImpl::~UContextImpl ( ) [inline, pure virtual]

Definition at line 26 of file ucontext-impl.hxx.


Member Function Documentation

template<typename T >
void urbi::impl::UContextImpl::addCleanup ( T *  ptr)

Add ptr to the list of objects to delete whean cleanup() is called.

Definition at line 73 of file ucontext-impl.hxx.

Referenced by urbi::impl::RemoteUObjectImpl::initialize(), urbi::uvalue_caster< UVar >::operator()(), and urbi::impl::RemoteUVarImpl::unnotify().

void urbi::impl::UContextImpl::addCleanup ( boost::function0< void >  op) [inline]

Add an arbitrary operation to perform at cleanup() time.

Definition at line 79 of file ucontext-impl.hxx.

References cleanup_list_.

bool urbi::impl::UContextImpl::bind ( const std::string &  name,
std::string  rename = std::string() 
)

Inject a specific uobject.

Definition at line 342 of file uobject-common.cc.

References urbi::baseURBIStarter::instanciate(), urbi::baseURBIStarter::list(), and urbi::baseURBIStarter::name.

virtual void urbi::impl::UContextImpl::call ( const std::string &  object,
const std::string &  method,
UAutoValue  v1 = UAutoValue(),
UAutoValue  v2 = UAutoValue(),
UAutoValue  v3 = UAutoValue(),
UAutoValue  v4 = UAutoValue(),
UAutoValue  v5 = UAutoValue(),
UAutoValue  v6 = UAutoValue() 
) [pure virtual]
virtual void urbi::impl::UContextImpl::declare_event ( const UEvent owner) [pure virtual]
virtual void urbi::impl::UContextImpl::emit ( const std::string &  object,
UAutoValue v1,
UAutoValue v2,
UAutoValue v3,
UAutoValue v4,
UAutoValue v5,
UAutoValue v6,
UAutoValue v7 
) [pure virtual]

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UEvent::emit().

virtual UGenericCallbackImpl* urbi::impl::UContextImpl::getGenericCallbackImpl ( ) [pure virtual]
virtual boost::asio::io_service& urbi::impl::UContextImpl::getIoService ( ) [pure virtual]

The io_service used by this context.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::getIoService().

virtual UObjectImpl* urbi::impl::UContextImpl::getObjectImpl ( ) [pure virtual]
virtual UObjectMode urbi::impl::UContextImpl::getRunningMode ( ) const [pure virtual]

The mode in which the code is running.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::getRunningMode().

UObject * urbi::impl::UContextImpl::getUObject ( const std::string &  n) [virtual]

Retrieve a UObject based on its name or return 0 if not found.

Definition at line 392 of file uobject-common.cc.

References objects.

Referenced by urbi::UContext::getUObject(), urbi::getUObject(), and urbi::impl::RemoteUContextImpl::onRTPListenMessage().

UObjectHub * urbi::impl::UContextImpl::getUObjectHub ( const std::string &  n) [virtual]

Retrieve a UObjectHub based on its name or return 0 if not found.

Definition at line 386 of file uobject-common.cc.

References hubs.

Referenced by urbi::UContext::getUObjectHub(), and urbi::getUObjectHub().

virtual UVarImpl* urbi::impl::UContextImpl::getVarImpl ( ) [pure virtual]

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UVar::__init().

void urbi::impl::UContextImpl::init ( )
virtual void urbi::impl::UContextImpl::instanciated ( UObject ) [pure virtual]

Called by the urbiStarter after each UObject instanciation.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::URBIStarter< T >::instanciate().

virtual std::pair<int, int> urbi::impl::UContextImpl::kernelVersion ( ) const [pure virtual]

The kernel major,minor version.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::kernelVersion().

virtual void urbi::impl::UContextImpl::lock ( ) [pure virtual]

Request a context lock from another thread to perform multiple operations.

Implemented in urbi::impl::RemoteUContextImpl.

virtual void urbi::impl::UContextImpl::newUObjectClass ( urbi::baseURBIStarter s) [pure virtual]

Called to instanciate the first Object of class.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by init().

virtual void urbi::impl::UContextImpl::newUObjectHubClass ( urbi::baseURBIStarterHub s) [pure virtual]

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by init().

void urbi::impl::UContextImpl::popCleanupStack ( ) [inline]

Delete all pointers passed to addCleanup in current stack and pop.

Definition at line 99 of file ucontext-impl.hxx.

References cleanup_list_.

void urbi::impl::UContextImpl::pushCleanupStack ( ) [inline]

Push a new cleanup stack.

Definition at line 87 of file ucontext-impl.hxx.

References cleanup_list_.

Referenced by urbi::impl::UContextImpl::CleanupStack::CleanupStack().

void urbi::impl::UContextImpl::registerHub ( UObjectHub u) [virtual]

Reimplemented in urbi::impl::RemoteUContextImpl.

Definition at line 380 of file uobject-common.cc.

References urbi::UObjectHub::get_name(), and hubs.

Referenced by urbi::UObjectHub::UObjectHub().

void urbi::impl::UContextImpl::registerObject ( UObject o) [virtual]

Default implementations appends to 'objects'.

Definition at line 356 of file uobject-common.cc.

References urbi::UObject::__name, urbi::UObject::cloner, and objects.

Referenced by urbi::impl::RemoteUObjectImpl::initialize().

virtual void urbi::impl::UContextImpl::removeHub ( UObjectHub ) [pure virtual]
virtual void urbi::impl::UContextImpl::send ( const char *  str) [pure virtual]

Send the string to the connection hosting the UObject.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::send(), send(), and urbi::send().

virtual void urbi::impl::UContextImpl::send ( const void *  buf,
size_t  size 
) [pure virtual]

Send buf to the connection hosting the UObject.

Implemented in urbi::impl::RemoteUContextImpl.

void urbi::impl::UContextImpl::send ( const std::string &  s) [inline]

Bouncing overload.

Reimplemented in urbi::impl::RemoteUContextImpl.

Definition at line 31 of file ucontext-impl.hxx.

References send().

virtual void urbi::impl::UContextImpl::setHubUpdate ( UObjectHub ,
ufloat   
) [pure virtual]
virtual TimerHandle urbi::impl::UContextImpl::setTimer ( UTimerCallback cb) [pure virtual]
virtual bool urbi::impl::UContextImpl::side_effect_free_get ( ) const [pure virtual]

Get the current side_effect_free state.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::side_effect_free_get().

virtual void urbi::impl::UContextImpl::side_effect_free_set ( bool  s) [pure virtual]

If s is true, mark the current task as having no side effect.

This call has no effect in remote mode.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::side_effect_free_set().

virtual void urbi::impl::UContextImpl::unlock ( ) [pure virtual]

Release lock acquired with lock()

Implemented in urbi::impl::RemoteUContextImpl.

virtual void urbi::impl::UContextImpl::uobject_unarmorAndSend ( const char *  str) [pure virtual]

Send Urbi code (ghost connection in plugin mode, default connection in remote mode).

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::uobject_unarmorAndSend(), and urbi::uobject_unarmorAndSend().

virtual void urbi::impl::UContextImpl::yield ( ) const [pure virtual]

Yield execution until next cycle.

Process pending messages in remote mode.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::yield().

void urbi::impl::UContextImpl::yield_for ( libport::utime_t  delay) const [inline, virtual]

Yield execution for delay.

Bounces to yield_until.

Definition at line 60 of file ucontext-impl.hxx.

References yield_until().

Referenced by urbi::UContext::yield_for(), and urbi::UObjectSocket::~UObjectSocket().

virtual void urbi::impl::UContextImpl::yield_until ( libport::utime_t  deadline) const [pure virtual]

Yield execution until deadline is met (see libport::utime()).

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by yield_for(), and urbi::UContext::yield_until().

virtual void urbi::impl::UContextImpl::yield_until_things_changed ( ) const [pure virtual]

Yield execution until something else is scheduled, or until a message is received in remote mode.

Implemented in urbi::impl::RemoteUContextImpl.

Referenced by urbi::UContext::yield_until_things_changed().


Member Data Documentation

boost::thread_specific_ptr<CleanupList> urbi::impl::UContextImpl::cleanup_list_ [private]

Definition at line 170 of file ucontext-impl.hh.

Referenced by addCleanup(), popCleanupStack(), and pushCleanupStack().

Definition at line 124 of file ucontext-impl.hh.

Referenced by init().


The documentation for this class was generated from the following files: