AURobotServers
4
|
#include <urespool.h>
Public Member Functions | |
bool | addResource (UResBase *resource) |
int | getResCnt () |
int | getResFunc (int ressIndex) |
UResBase * | getResource (int resIndex) |
UResBase * | getResource (const char *resID) |
bool | handleReplay () |
void | print (const char *preString) |
void | print (const char *preString, char *buff, int buffCnt) |
UResBase * | removeResourceFunc (int funcIndex) |
UResBase * | removeResourceIndex (int resIndex) |
void | saveSettings () |
void | stop (bool andWait) |
UResPool () | |
~UResPool () | |
Protected Attributes | |
UResBase * | res [MAX_RESOURCE_POINTERS] |
int | resCnt |
Resource pool for server. It holds the resource pointer, and the resource name and the function responcible for the resource.
UResPool::UResPool | ( | ) |
Constructor
References resCnt.
UResPool::~UResPool | ( | ) |
Destructor
bool UResPool::addResource | ( | UResBase * | resource | ) |
Add a resource. Returns true if resource is added. Returns false if no more space.
References MAX_RESOURCE_POINTERS, res, and resCnt.
Referenced by UCmdExe::addResource(), and UCmdExe::UCmdExeInit().
|
inline |
Get highest number of items in resource pool
References getResFunc(), handleReplay(), print(), resCnt, saveSettings(), and stop().
Referenced by UCmdExe::addNewRessources(), UCmdExe::deleteFunction(), UCmdExe::resourcesUpdate(), UCmdExe::resourcesUpdated(), and UCmdExe::sysServerHelp().
int UResPool::getResFunc | ( | int | ressIndex | ) |
Get owner index of this resource
References UResBase::getResFuncIdx(), res, and resCnt.
Referenced by getResCnt(), and UCmdExe::resourcesUpdate().
UResBase * UResPool::getResource | ( | int | resIndex | ) |
Get resource with this index. Returns also a pointer to the resource ID string.
Referenced by UCmdExe::addNewRessources(), UCmdExe::deleteFunction(), UCmdExe::getStaticResource(), UCmdExe::isResourceOwner(), UCmdExe::resourcesUpdate(), and UCmdExe::resourcesUpdated().
UResBase * UResPool::getResource | ( | const char * | resID | ) |
Get resource based on ID string. Returns resource pointer if found. Returns NULL if not found.
References UResBase::isA(), res, and resCnt.
bool UResPool::handleReplay | ( | ) |
Handle any pending replay update and allow other resources to update to the same replay time.
References UReplay::isReplay(), UReplay::replayTimeAdvancePending, UReplay::replayTimeNow, UReplay::replayToTime(), res, and resCnt.
Referenced by getResCnt(), and UCmdExe::run().
void UResPool::print | ( | const char * | preString | ) |
Print short status
Referenced by getResCnt(), UCmdExe::printRess(), and UCmdExe::sysModuleCmd().
void UResPool::print | ( | const char * | preString, |
char * | buff, | ||
int | buffCnt | ||
) |
Print status to string buffer. Prestring is added at the start and at max 'bufCnt' characters are written.
References UCmdExe::getResClassID(), UResBase::getResID(), UResBase::getResVersion(), UResBase::isA(), UResBase::print(), res, and resCnt.
UResBase * UResPool::removeResourceFunc | ( | int | funcIndex | ) |
remove a resource by function index. Returns a pointer to the removed resource. One function index may own more than one resource, so call this function until a NULL is returned to remove all owned resources. Returns NULL is no resource with this index exist
References UResBase::getResFuncIdx(), res, and resCnt.
Referenced by UCmdExe::deleteFunction().
UResBase * UResPool::removeResourceIndex | ( | int | resIndex | ) |
void UResPool::saveSettings | ( | ) |
Tell all resources to save settings as needed
References res, resCnt, and UResBase::saveSettings().
Referenced by getResCnt(), and UCmdExe::unloadAllModules().
void UResPool::stop | ( | bool | andWait | ) |
Tell all resources to stop all running threads
References res, resCnt, UResBase::stop(), and Wait().
Referenced by getResCnt(), and UCmdExe::unloadAllModules().
|
protected |
Array of resource pointers
Referenced by addResource(), getResFunc(), getResource(), handleReplay(), print(), removeResourceFunc(), removeResourceIndex(), saveSettings(), and stop().
|
protected |
Count of highest resource number in use
Referenced by addResource(), getResCnt(), getResFunc(), getResource(), handleReplay(), print(), removeResourceFunc(), removeResourceIndex(), saveSettings(), stop(), and UResPool().