AURobotServers  4
Public Member Functions | Private Attributes | List of all members
UServerPush Class Reference

#include <userverpush.h>

Inheritance diagram for UServerPush:
Inheritance graph

Public Member Functions

int addPushCommand (UServerInMsg *msg)
 
virtual void callGotNewDataWithObject ()
 
bool doPushCall (UServerPushElement *pe, const char *value)
 
void flushClientCmds (int clientIdx)
 
UServerPushImplementgetImplementor ()
 
int getPushCmdCnt (int *cmdCnt, int *callCnt)
 
UServerPushQueuegetPushQueue ()
 
bool gotCmdExe ()
 
void gotNewData (void *pData)
 
bool isUpdated (int lastCnt, int *newCnt)
 
bool needNewData ()
 
void print (const char *preString)
 
void print (const char *preString, char *buff, int buffCnt)
 
void servicePendingPushCmds ()
 
void setCmdExe (UServerPushImplement *executor)
 
void setImplementor (UServerPushImplement *executor)
 
bool setResource (UResBase *resource, bool remove)
 
bool setUpdated (const char *value)
 Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More...
 
 UServerPush ()
 
virtual ~UServerPush ()
 

Private Attributes

UResVarPoolcallImpl
 
ULock callLock
 
UServerPushImplementcmdImpl
 
UServerPushQueue push
 
int updateCnt
 

Constructor & Destructor Documentation

UServerPush::UServerPush ( )

Constructor

Referenced by UResKeep::createResources(), and UKeepItem::UKeepItem().

UServerPush::~UServerPush ( )
virtual

Destructor

Member Function Documentation

int UServerPush::addPushCommand ( UServerInMsg msg)
virtual void UServerPush::callGotNewDataWithObject ( )
inlinevirtual

Called from push structure to get push object followed by a call to 'gotNewData(object)'. Should be overwritten by push object holder.

Reimplemented in UFuncTOF, ULaserDevice, UFuncTOF, UResV360, UFuncPTgrey, UFuncKinect, UFuncPiCam, UImgPush, UCamPush, and UFuncStereo.

bool UServerPush::doPushCall ( UServerPushElement pe,
const char *  value 
)

do the push call called for by this push element. Update the push element after the call.

Parameters
pethe push element to implement call for.
valueis the (optional) event value string to be used in the call
Returns
true if the call returned 1.0 or 2.0 as value.

References doPushCall().

Referenced by doPushCall().

void UServerPush::flushClientCmds ( int  clientIdx)

Flush all pending commands from this client

UServerPushImplement* UServerPush::getImplementor ( )
inline

get server core pointer (cmdExe)

Returns
the core pointer available in this object - may be NULL
int UServerPush::getPushCmdCnt ( int *  cmdCnt,
int *  callCnt 
)
inline

Get number of active push commands

Parameters
cmdCntis set to number of command-based commands
callCntis set to number of call-based commands.
Returns
total number of active event commands

Referenced by ULaserDevice::gotNewScan(), UFunctionCam::handleCamsGetCommand(), UFuncCron::handleCommand(), UFunctionIf::handleIfPush(), UFuncKeep::handleKeepPush(), UFunctionPoseHist::handlePoseHistPush(), UFuncRhdIf::handlePushCommand(), UFunctionLaser::handleScanPushCommand(), UFunctionSmrIf::handleSmrPush(), UFuncV360::handleV360Push(), and UFunctionVarPool::handleVarPush().

UServerPushQueue* UServerPush::getPushQueue ( )
inline
bool UServerPush::gotCmdExe ( )
inline

Has the push function got a cmdExe pointer

Returns
true if a core pointer is available

Referenced by UResPoseHist::gotAllResources(), UResVarPool::gotAllResources(), UFuncPlugBasePush::handlePush(), UFunctionVarPool::handleVarPush(), and UResPoseHist::setResource().

void UServerPush::gotNewData ( void *  pData)
bool UServerPush::isUpdated ( int  lastCnt,
int *  newCnt 
)
inline

test if the object has had an update since last check

Parameters
lastCntis the last saved count.
newCntis where the new count is saved (if not NULL) returns true if the update count (updateCnt) is different from lastCnt

Referenced by UResVarPool::isVarPoolUpdated().

bool UServerPush::needNewData ( )

A pretest when new data is available to request if it is needed, so that data extraction can be avoided if nothing is needed.

Returns
true if data is needed, and then expects that 'gotNewData(.)' is called with the appropriate pointer data.
false if noone needs data at this time, but update event counters as if 'gotNewData(.)' were called.

References UServerPushElement::activeCmd, UServerInMsg::client, UServerPushElement::events, UServerPushElement::interval, roundi(), and UServerPushElement::toDo.

Referenced by UCamPush::needNewPushData().

void UServerPush::print ( const char *  preString)
void UServerPush::print ( const char *  preString,
char *  buff,
int  buffCnt 
)

Debug print of camera status to a string buffer.

void UServerPush::servicePendingPushCmds ( )
inline

Test for push (just a more appropriate name for the call)

void UServerPush::setCmdExe ( UServerPushImplement executor)
inline
void UServerPush::setImplementor ( UServerPushImplement executor)
inline

Set command executor reference for push functions (same as setCmdExe())

Referenced by UKeepItem::setCore().

bool UServerPush::setResource ( UResBase resource,
bool  remove 
)

Called when a new resource is available (or is removed), local pointers to the resource should be updated as appropriate.

References UResVarPool::getResClassID(), UResBase::isA(), and UResBase::isAlsoA().

Referenced by UFuncPlugBasePush::setResource(), UResV360::setResource(), and UResRuleState::setResource().

bool UServerPush::setUpdated ( const char *  value)

Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread.

Returns
true if the command were added and false if the command were there already.

Referenced by UResPoseHist::addPoseHist(), UVarPool::addStruct(), UVarPool::addStructLink(), UVarPool::addStructLocal(), UFuncKinect::callGotNewDataWithObject(), UResCamIf::connectionChange(), UResLaserIf::connectionChange(), UResSmrIf::connectionChange(), UFuncKinect::decodeReplayLine(), ULaserDevice::gotNewScan(), UImgPush::imgUpdated(), UCamPush::imgUpdated(), UResIf::interfaceTick(), UFuncKinect::processDepthImages(), UFuncStereo::processImages(), UFuncPiCam::run(), UResRuleState::run(), UVarPool::setLocalVar(), UVarPool::setLocalVar3D(), UVarPool::setLocalVar6D(), UVarPool::setLocalVarAdd(), UVarPool::setLocalVarRot(), UVariable::setUpdated(), UKeepItem::tick(), UResRhdIf::tryConnect(), and UResV360::update().

Member Data Documentation

UResVarPool* UServerPush::callImpl
private

pointer to a varpool resource for push-calls

ULock UServerPush::callLock
private

Lock, to ensure that an update call triggers this update again - that is endless loop detection. This is done by a lock, if not lockable, then no calls are performed.

UServerPushImplement* UServerPush::cmdImpl
private

Pointer to push server queue

UServerPushQueue UServerPush::push
private

push queue when new push data gets available

int UServerPush::updateCnt
private

this variable is incremented on every call to setUpdated(), and can be used to test for potential new values by others than the push command handler.


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