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

#include <remote-ucontext-impl.hh>

Inheritance diagram for urbi::impl::RemoteUContextImpl:
Collaboration diagram for urbi::impl::RemoteUContextImpl:

List of all members.

Public Types

typedef boost::unordered_map
< std::string, std::pair
< libport::AsyncCallHandler,
UTimerCallback * > > 
TimerMap
typedef boost::unordered_map
< std::string, UObject * > 
RTPLinks

Public Member Functions

 RemoteUContextImpl (USyncClient *client)
 Setup to work on given client.
virtual ~RemoteUContextImpl ()
virtual void newUObjectClass (baseURBIStarter *s)
 Called to instanciate the first Object of class.
virtual void newUObjectHubClass (baseURBIStarterHub *s)
virtual void uobject_unarmorAndSend (const char *str)
 Send Urbi code (ghost connection in plugin mode, default connection in remote mode).
virtual void send (const char *str)
 Send the string to the connection hosting the UObject.
virtual void send (const void *buf, size_t size)
 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())
virtual void declare_event (const UEvent *owner)
virtual void emit (const std::string &object, UAutoValue &v1, UAutoValue &v2, UAutoValue &v3, UAutoValue &v4, UAutoValue &v5, UAutoValue &v6, UAutoValue &v7)
virtual UObjectMode getRunningMode () const
 The mode in which the code is running.
virtual std::pair< int, int > kernelVersion () const
 The kernel major,minor version.
virtual void yield () const
 Yield execution until next cycle.
virtual void yield_until (libport::utime_t deadline) const
 Yield execution until deadline is met (see libport::utime()).
virtual void yield_until_things_changed () const
 Yield execution until something else is scheduled, or until a message is received in remote mode.
virtual void side_effect_free_set (bool s)
 If s is true, mark the current task as having no side effect.
virtual bool side_effect_free_get () const
 Get the current side_effect_free state.
virtual UVarImplgetVarImpl ()
virtual UObjectImplgetObjectImpl ()
virtual UGenericCallbackImplgetGenericCallbackImpl ()
virtual TimerHandle setTimer (UTimerCallback *cb)
virtual void registerHub (UObjectHub *)
virtual void removeHub (UObjectHub *)
virtual void setHubUpdate (UObjectHub *, ufloat)
virtual void instanciated (UObject *obj)
 Called by the urbiStarter after each UObject instanciation.
virtual void lock ()
 Request a context lock from another thread to perform multiple operations.
virtual void unlock ()
 Release lock acquired with lock()
virtual boost::asio::io_service & getIoService ()
 The io_service used by this context.
UCallbackAction dispatcher (const UMessage &msg)
 Dispatch a message on our connection.
USyncClientgetClient ()
void makeRTPLink (const std::string &key)
 Make a new RTP link with the engine, using hash key key.
void assignMessage (const std::string &name, const UValue &v, time_t ts, bool bypass=false, UValue *target=0, time_t *tsTarget=0)
 Handle an assignment request.
void evalFunctionMessage (const std::string &name, const std::string &var, UList &args)
 Handle a function call.
void setRTPMessage (const std::string &varname, int state)
 Handle a RTP enable/disable message.
void setSerializationMode (bool)
 Enable/disable binary serialization mode.
UMessagesyncGet (const std::string &exp, libport::utime_t timeout=0)
 Return the result of the evaluation of the given expression.
void markDataSent ()
 Notify that data was sent.
std::string hookPointName ()
 Return the name of the hook-point UObject for UVar notifies with unknown source.
 TABLE (UTable, accessmap)
 TABLE (UTable, eventmap)
 TABLE (UTable, eventendmap)
 TABLE (UTable, functionmap)
 TABLE (UTable, monitormap)
 TABLE (UVarTable, varmap)
 TABLE (UTimerTable, timermap)
UValue localCall (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(), UAutoValue v7=UAutoValue(), UAutoValue v8=UAutoValue())
UTabletableByName (const std::string &n)
UCallbackAction clientError (const UMessage &)
UCallbackAction onRTPListenMessage (const UMessage &)
UObjectgetDummyUObject ()
void onTimer (UTimerCallback *cb)

Public Attributes

USyncClientbackend_
bool closed_
 True if we received a clientError message.
libport::Lockable tableLock
UObjectdummyUObject
TimerMap timerMap
libport::Lockable mapLock
RTPLinks rtpLinks
bool enableRTP
unsigned int dispatchDepth
LockableOstreamoutputStream
bool dataSent
bool serializationMode
libport::serialize::BinaryOSerializer * oarchive
libport::PackageInfo::Version version
std::string hookPointName_
UObjectsharedRTP_

Detailed Description

Definition at line 24 of file remote-ucontext-impl.hh.


Member Typedef Documentation

typedef boost::unordered_map<std::string, UObject*> urbi::impl::RemoteUContextImpl::RTPLinks

Definition at line 166 of file remote-ucontext-impl.hh.

typedef boost::unordered_map<std::string, std::pair<libport::AsyncCallHandler, UTimerCallback*> > urbi::impl::RemoteUContextImpl::TimerMap

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


Constructor & Destructor Documentation

urbi::impl::RemoteUContextImpl::~RemoteUContextImpl ( ) [virtual]

Definition at line 233 of file uobject.cc.


Member Function Documentation

void urbi::impl::RemoteUContextImpl::assignMessage ( const std::string &  name,
const UValue v,
time_t  ts,
bool  bypass = false,
UValue target = 0,
time_t *  tsTarget = 0 
)
void urbi::impl::RemoteUContextImpl::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() 
) [virtual]
UCallbackAction urbi::impl::RemoteUContextImpl::clientError ( const UMessage )
void urbi::impl::RemoteUContextImpl::declare_event ( const UEvent owner) [virtual]

Implements urbi::impl::UContextImpl.

Definition at line 884 of file uobject.cc.

References markDataSent(), outputStream, and URBI_SEND_PIPED_COMMAND_C.

void urbi::impl::RemoteUContextImpl::emit ( const std::string &  object,
UAutoValue v1,
UAutoValue v2,
UAutoValue v3,
UAutoValue v4,
UAutoValue v5,
UAutoValue v6,
UAutoValue v7 
) [virtual]
void urbi::impl::RemoteUContextImpl::evalFunctionMessage ( const std::string &  name,
const std::string &  var,
UList args 
)

Handle a function call.

Parameters:
namefunction name (should be array[1])
varwhere to store the result (should be array[2])
argsan array which *will* shitfed by 3 to find the function call arguments.

Definition at line 762 of file uobject.cc.

References urbi::impl::call_result(), urbi::UGenericCallback::eval(), urbi::name(), urbi::UList::setOffset(), and tableLock.

Referenced by dispatcher().

USyncClient * urbi::impl::RemoteUContextImpl::getClient ( )

Definition at line 242 of file uobject.cc.

References backend_.

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

UObject * urbi::impl::RemoteUContextImpl::getDummyUObject ( )

Definition at line 248 of file uobject.cc.

References dummyUObject.

UGenericCallbackImpl * urbi::impl::RemoteUContextImpl::getGenericCallbackImpl ( ) [virtual]

Implements urbi::impl::UContextImpl.

Definition at line 982 of file uobject.cc.

boost::asio::io_service & urbi::impl::RemoteUContextImpl::getIoService ( ) [virtual]

The io_service used by this context.

Implements urbi::impl::UContextImpl.

Definition at line 348 of file uobject.cc.

References backend_.

UObjectImpl * urbi::impl::RemoteUContextImpl::getObjectImpl ( ) [virtual]

Implements urbi::impl::UContextImpl.

Definition at line 976 of file uobject.cc.

UObjectMode urbi::impl::RemoteUContextImpl::getRunningMode ( ) const [virtual]

The mode in which the code is running.

Implements urbi::impl::UContextImpl.

Definition at line 299 of file uobject.cc.

References urbi::MODE_REMOTE.

UVarImpl * urbi::impl::RemoteUContextImpl::getVarImpl ( ) [virtual]

Implements urbi::impl::UContextImpl.

Definition at line 970 of file uobject.cc.

std::string urbi::impl::RemoteUContextImpl::hookPointName ( )

Return the name of the hook-point UObject for UVar notifies with unknown source.

Definition at line 236 of file uobject.cc.

References hookPointName_.

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

void urbi::impl::RemoteUContextImpl::instanciated ( UObject ) [virtual]

Called by the urbiStarter after each UObject instanciation.

Implements urbi::impl::UContextImpl.

Definition at line 330 of file uobject.cc.

References send().

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

std::pair< int, int > urbi::impl::RemoteUContextImpl::kernelVersion ( ) const [virtual]
UValue urbi::impl::RemoteUContextImpl::localCall ( 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(),
UAutoValue  v7 = UAutoValue(),
UAutoValue  v8 = UAutoValue() 
)
void urbi::impl::RemoteUContextImpl::lock ( ) [virtual]

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

Implements urbi::impl::UContextImpl.

Definition at line 338 of file uobject.cc.

void urbi::impl::RemoteUContextImpl::makeRTPLink ( const std::string &  key)

Make a new RTP link with the engine, using hash key key.

The link is established asynchronously and is ready when RTPLinks[key] != 0. Check if initialization is not already in progress by calling RTPLinks.has(key) first.

Definition at line 170 of file uvar.cc.

References backend_, urbi::callback(), urbi::baseURBIStarter::instanciate(), localCall(), urbi::impl::makeLinkName(), urbi::impl::UContextImpl::objects, onRTPListenMessage(), outputStream, urbi::impl::rtp_id(), rtpLinks, urbi::UAbstractClient::setCallback(), URBI_REMOTE_RTP_INIT_CHANNEL, URBI_SEND_COMMA_COMMAND_C, and URBI_SEND_COMMAND_C.

Referenced by urbi::impl::RemoteUVarImpl::transmit().

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

Called to instanciate the first Object of class.

Implements urbi::impl::UContextImpl.

Definition at line 797 of file uobject.cc.

References urbi::baseURBIStarter::instanciate().

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

Implements urbi::impl::UContextImpl.

Definition at line 802 of file uobject.cc.

References urbi::baseURBIStarterHub::instanciate().

void urbi::impl::RemoteUContextImpl::onTimer ( UTimerCallback cb)
void urbi::impl::RemoteUContextImpl::registerHub ( UObjectHub ) [virtual]

Reimplemented from urbi::impl::UContextImpl.

Definition at line 1001 of file uobject.cc.

void urbi::impl::RemoteUContextImpl::removeHub ( UObjectHub ) [virtual]

Implements urbi::impl::UContextImpl.

Definition at line 997 of file uobject.cc.

void urbi::impl::RemoteUContextImpl::send ( const char *  str) [virtual]
void urbi::impl::RemoteUContextImpl::send ( const void *  buf,
size_t  size 
) [virtual]

Send buf to the connection hosting the UObject.

Implements urbi::impl::UContextImpl.

Definition at line 285 of file uobject.cc.

References backend_, closed_, urbi::UAbstractClient::endPack(), outputStream, and urbi::UAbstractClient::startPack().

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

Bouncing overload.

Reimplemented from urbi::impl::UContextImpl.

Definition at line 36 of file remote-ucontext-impl.hh.

References urbi::send().

void urbi::impl::RemoteUContextImpl::setHubUpdate ( UObjectHub ,
ufloat   
) [virtual]

Implements urbi::impl::UContextImpl.

Definition at line 992 of file uobject.cc.

void urbi::impl::RemoteUContextImpl::setRTPMessage ( const std::string &  varname,
int  state 
)

Handle a RTP enable/disable message.

Parameters:
varnamethe variable name on which it applies
stateenable rtp if nonzero

Definition at line 783 of file uobject.cc.

References urbi::UVar::RTP_NO, urbi::UVar::RTP_YES, tableLock, and urbi::UVar::useRTP().

Referenced by dispatcher().

void urbi::impl::RemoteUContextImpl::setSerializationMode ( bool  mode)

Enable/disable binary serialization mode.

Definition at line 1041 of file uobject.cc.

References backend_, urbi::USyncClient::lockQueue(), oarchive, outputStream, send(), serializationMode, and urbi::USyncClient::waitForTag().

Referenced by dispatcher().

TimerHandle urbi::impl::RemoteUContextImpl::setTimer ( UTimerCallback cb) [virtual]
bool urbi::impl::RemoteUContextImpl::side_effect_free_get ( ) const [virtual]

Get the current side_effect_free state.

Implements urbi::impl::UContextImpl.

Definition at line 488 of file uobject.cc.

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

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

This call has no effect in remote mode.

Implements urbi::impl::UContextImpl.

Definition at line 485 of file uobject.cc.

UMessage * urbi::impl::RemoteUContextImpl::syncGet ( const std::string &  exp,
libport::utime_t  timeout = 0 
)

Return the result of the evaluation of the given expression.

Definition at line 1074 of file uobject.cc.

References backend_, call(), urbi::USyncClient::lockQueue(), and urbi::USyncClient::waitForTag().

Referenced by urbi::impl::RemoteUVarImpl::getProp(), and urbi::impl::RemoteUVarImpl::sync().

urbi::impl::RemoteUContextImpl::TABLE ( UTable  ,
accessmap   
)
urbi::impl::RemoteUContextImpl::TABLE ( UTable  ,
eventmap   
)
urbi::impl::RemoteUContextImpl::TABLE ( UTable  ,
eventendmap   
)
urbi::impl::RemoteUContextImpl::TABLE ( UTable  ,
functionmap   
)
urbi::impl::RemoteUContextImpl::TABLE ( UTable  ,
monitormap   
)
urbi::impl::RemoteUContextImpl::TABLE ( UVarTable  ,
varmap   
)
urbi::impl::RemoteUContextImpl::TABLE ( UTimerTable  ,
timermap   
)
UTable & urbi::impl::RemoteUContextImpl::tableByName ( const std::string &  n)

Definition at line 305 of file uobject.cc.

References CHECK.

void urbi::impl::RemoteUContextImpl::unlock ( ) [virtual]

Release lock acquired with lock()

Implements urbi::impl::UContextImpl.

Definition at line 343 of file uobject.cc.

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

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

Implements urbi::impl::UContextImpl.

Definition at line 255 of file uobject.cc.

References backend_, urbi::UAbstractClient::endPack(), markDataSent(), outputStream, serializationMode, urbi::UAbstractClient::startPack(), and urbi::unarmorAndSend().

void urbi::impl::RemoteUContextImpl::yield ( ) const [virtual]

Yield execution until next cycle.

Process pending messages in remote mode.

Implements urbi::impl::UContextImpl.

Definition at line 456 of file uobject.cc.

References yield_until().

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

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

Implements urbi::impl::UContextImpl.

Definition at line 461 of file uobject.cc.

References backend_.

Referenced by yield().

void urbi::impl::RemoteUContextImpl::yield_until_things_changed ( ) const [virtual]

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

Implements urbi::impl::UContextImpl.

Definition at line 475 of file uobject.cc.

References backend_.


Member Data Documentation

True if we received a clientError message.

Definition at line 126 of file remote-ucontext-impl.hh.

Referenced by clientError(), dispatcher(), and send().

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

Referenced by dispatcher(), and markDataSent().

libport::serialize::BinaryOSerializer* urbi::impl::RemoteUContextImpl::oarchive

Definition at line 177 of file remote-ucontext-impl.hh.

Referenced by urbi::impl::call_result(), emit(), and setSerializationMode().

libport::PackageInfo::Version urbi::impl::RemoteUContextImpl::version

Definition at line 178 of file remote-ucontext-impl.hh.

Referenced by dispatcher(), and RemoteUContextImpl().


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