AURobotServers  4
Public Member Functions | Protected Attributes | List of all members
UServerPushImplement Class Reference

#include <userverpush.h>

Inheritance diagram for UServerPushImplement:
Inheritance graph

Public Member Functions

bool addPushWatch (UServerPush *obj)
 Add an server push object to watch list. This is called by a combined resource-push object when the object is updated and thus a push command may need triggering. More...
 
void event ()
 
virtual bool executePushFunction (int, UServerInMsg *, void *)
 
virtual int findFunctionOwner (const char *)
 
int getFunctionOwner (UServerInMsg *msg)
 
virtual UResBasegetStaticResource (const char *, bool, bool)
 get a pointer to a static resource. More...
 
virtual bool isClientAlive (int, double)
 
 UServerPushImplement ()
 
virtual ~UServerPushImplement ()
 

Protected Attributes

sem_t actionFlag
 flag to be posted, when an event has happend More...
 
UServerPushpushWatch [MAX_PUSH_WATCH_CNT]
 
int pushWatchCnt
 
ULock pushWatchLock
 

Detailed Description

Base class for a push implement handler

Constructor & Destructor Documentation

UServerPushImplement::UServerPushImplement ( )
inline

Constructor

References actionFlag, and pushWatchCnt.

virtual UServerPushImplement::~UServerPushImplement ( )
inlinevirtual

Constructor

Member Function Documentation

bool UServerPushImplement::addPushWatch ( UServerPush obj)

Add an server push object to watch list. This is called by a combined resource-push object when the object is updated and thus a push command may need triggering.

Parameters
objis the serverPush object that need to be consulted for pending commands
Returns
true if the object were added, and false if it existed already.

References event(), ULock::lock(), MAX_PUSH_WATCH_CNT, pushWatch, pushWatchCnt, pushWatchLock, and ULock::unlock().

Referenced by executePushFunction().

void UServerPushImplement::event ( )
inline

Notifies server that an event has occurred, this may have triggered on-event commands, a call will wake main thread (if idle)

References actionFlag.

Referenced by addPushWatch(), UServerPort::messageReceived(), UCmdExe::postCommand(), and UCmdExe::runIdle().

virtual bool UServerPushImplement::executePushFunction ( int  ,
UServerInMsg ,
void *   
)
inlinevirtual

Ececute a push function with this index. The command is in msg, an XML formatted function.

Parameters
functionIndexthe index returned by findFunctionOwner(tagName)
msgThe XMK reading structure with the command.
extramay be a pointer to a relevant object (laserscan, imega or other object usable by the function)
Returns
true if the function were executed successfully - ie image found and processed - this is used to count good commands.

Reimplemented in UCmdExe.

References addPushWatch().

virtual int UServerPushImplement::findFunctionOwner ( const char *  )
inlinevirtual

Service function for push queue - to find index of owner of function described in this tag

Reimplemented in UCmdExe, and UResCron.

References getFunctionOwner().

Referenced by getFunctionOwner().

int UServerPushImplement::getFunctionOwner ( UServerInMsg msg)

Find index for function, that handles this message, but taking the full XML tag as parameter

References findFunctionOwner(), USmlTagIn::getTagName(), and UServerInMsg::tag.

Referenced by UPush::addPushCommand(), findFunctionOwner(), UCmdExe::handleOneMessageFromQueue(), and UCmdExe::handleServerPushCommand().

virtual UResBase* UServerPushImplement::getStaticResource ( const char *  ,
bool  ,
bool   
)
inlinevirtual

get a pointer to a static resource.

Get pointer to server Push implement structure (test - fix)

Parameters
resNameThe name of the resource to be acquired.
mayCreateif set to true, then the resource will be created if it do not exist.
staticOnlyget only if a static resource (default). Getting non-static resources may be dangerous of not within same plugin, if not compiled against the same source (headerfilles).
Returns
NULL if not found, else a bointer to an existing type

Reimplemented in UCmdExe.

virtual bool UServerPushImplement::isClientAlive ( int  ,
double   
)
inlinevirtual

Test to see if client is alive

Reimplemented in UCmdExe.

Member Data Documentation

sem_t UServerPushImplement::actionFlag
protected

flag to be posted, when an event has happend

Referenced by event(), UCmdExe::run(), and UServerPushImplement().

UServerPush* UServerPushImplement::pushWatch[MAX_PUSH_WATCH_CNT]
protected

Push watch object

Referenced by addPushWatch(), and UCmdExe::run().

int UServerPushImplement::pushWatchCnt
protected

Number of watches in store

Referenced by addPushWatch(), UCmdExe::run(), UCmdExe::UCmdExeInit(), and UServerPushImplement().

ULock UServerPushImplement::pushWatchLock
protected

Lock for watches - as there may be added watched from another thread

Referenced by addPushWatch(), and UCmdExe::run().


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