AURobotServers
4
|
#include <uimagepool.h>
Public Member Functions | |
void | createBaseVar () |
int | createdImages () |
virtual void | createResources () |
virtual bool | decodeReplayLine (char *line) |
virtual UImage * | getImage (unsigned int source, bool mayCreate, const unsigned int height=0, const unsigned int width=0, const int channels=3, const int depth=8) |
int | getImageCnt () |
int | getMaxImageCnt () |
virtual bool | gotAllResources (char *missingThese, int missingTheseCnt) |
bool | isCreated (unsigned int idx) |
virtual const char * | print (const char *preString, char *buff, int buffCnt) |
void | release () |
void | setCmdExe (UCmdExe *server) |
bool | setLogImg (const int imgSource, const bool doLog, const int interval) |
bool | setResource (UResBase *resource, bool remove) |
void | showImagesAsDefault (bool show) |
UImagePool () | |
void | UImagePoolInit () |
virtual void | updateReplayStatus () |
virtual | ~UImagePool () |
Public Member Functions inherited from UResVarPool | |
int | addMethod (const char *formalName, const char *paramTypes, const char *comment) |
int | addMethodV (const char *formalName, const char *paramTypes, const char *comment) |
UVarPool * | addStruct (const char *name, const char *comment, bool copy=false) |
UVariable * | addVar (const char *name, const double initialValue, const char *type, const char *comment) |
UVariable * | addVar (const char *name, const char *initialValue, const char *type, const char *comment) |
UVariable * | addVarA (const char *name, const char *initialValue, const char *type, const char *comment) |
bool | callGlobal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
bool | callGlobalV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt) |
Call a method from the root var pool scope It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More... | |
bool | callLocal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt) |
bool | callVS (const char *function, const char *stringParam) |
int | callVSCD (const char *function, const char *strPar, UDataBase *data, int cooSys) |
void | createBaseVar () |
virtual bool | createVarSpace (const int varCnt, const int structCnt, const int methCnt, const char *note, bool copy=false) |
bool | getGlobalString (const char *name, const char **value) |
bool | getGlobalValue (const char *name, double *value) |
bool | getGlobalValue (const char *name, const char **value) |
bool | getGlobalValue (const char *name, bool *value) |
bool | getGlobalValue (const char *name, UTime *value) |
bool | getLocalValue (const char *name, double *value) |
get a value in this variable tree More... | |
bool | getLocalValue (const char *name, bool *value) |
bool | getLocalValue (const char *name, UTime *value) |
double | getLocalValue (int idx) |
UPosition | getLocalValue3D (int idx) |
UPosRot | getLocalValue6D (int idx) |
bool | getLocalValueBool (int idx) |
int | getLocalValueInt (int idx) |
UTime | getLocalValueTime (int idx) |
const char * | getLogFileName () |
const char * | getVarDescription (int idx) |
UVarCalc * | getVarPool () |
bool | isLogFileOpen () |
bool | isLogFileOpen (const char *structName) |
bool | isVarPoolUpdated (int lastCnt, int *newCnt) |
void | logFileClose () |
bool | logFileOpen () |
void | logFileStart (const char *structName, bool open) |
virtual bool | methodCall (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct=NULL, int *returnStructCnt=NULL) |
bool | setGlobalVar (const char *name, const double value, bool mayAdd) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar (int idx, double value, const int element) |
bool | setLocalVar (const char *name, const double value, bool mayAdd) |
Assigns a value to a variable. The variable may be a part of a structure. More... | |
bool | setLocalVar3D (int idx, UPosition *value) |
bool | setLocalVar6D (int idx, UPosRot *value) |
bool | setLocalVarAdd (int idx, double value, const int element) |
bool | setLocalVarPose (int idx, UPose *value) |
void | setVarPool (UVarCalc *sharedVarPool) |
int | updateQTvars (int structIdx) |
UResVarPool () | |
virtual | ~UResVarPool () |
Public Member Functions inherited from UResBase | |
void | createReplayVar (UVarPool *pool) |
UCmdExe * | getCorePointer () |
char * | getLogFileName (char *fn, const int fnCnt) |
int | getResFuncIdx () |
const char * | getResID () |
int | getResVersion () |
bool | isA (const char *idStr) |
bool | isAlsoA (const char *id) |
virtual void | print (const char *preString) |
virtual void | saveSettings () |
void | setCorePointer (UCmdExe *serverCore) |
void | setResFuncIdx (int idx) |
virtual void | setResID (const char *id, const int version) |
virtual void | stop (bool) |
UResBase () | |
virtual | ~UResBase () |
Public Member Functions inherited from UReplay | |
void | addChild (UReplay *child) |
char * | getLogFileName (char *fn, const int fnCnt) |
char * | getReplayFileName (char *fn, const int fnCnt) |
int | getReplayLogLine () |
bool | isReplay () |
bool | isReplayFileOpen () |
void | removeChild (UReplay *child) |
virtual void | replayAdvanceTime (UTime untilTime) |
void | replaySetBaseFileName (const char *name, const char *preName="") |
void | replaySetFileName (const char *name) |
virtual bool | replayStep () |
int | replayStep (int steps) |
virtual bool | replayToTime (UTime untilTime) |
void | setParent (UReplay *parent) |
bool | setReplay (bool value) |
UReplay () | |
virtual | ~UReplay () |
Public Member Functions inherited from ULock | |
bool | lock () |
void | lockInit () |
void | post () |
bool | tryLock () |
bool | tryWait () |
ULock () | |
void | unlock () |
bool | wait () |
~ULock () | |
Public Member Functions inherited from UVarMethodImplement | |
virtual bool | methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt) |
virtual | ~UVarMethodImplement () |
Static Public Member Functions | |
static const char * | getResClassID () |
Static Public Member Functions inherited from UResVarPool | |
static const char * | getResClassID () |
Protected Attributes | |
UCmdExe * | cmdexe |
UImgPush * | images [MAX_IMAGES_IN_POOL] |
int | imagesCnt |
UImageLog | imgLog |
Protected Attributes inherited from UResBase | |
int | resFuncIdx |
char | resID [MAX_RESOURCE_ID_LENGTH] |
char | resIsAlso [MAX_RESOURCE_ISALSO_LENGTH] |
int | resVersion |
Protected Attributes inherited from UReplay | |
bool | replay |
FILE * | replayFile |
char | replayFileName [REPLAY_FILE_NAME_LENGTH] |
replay filename More... | |
char | replayLine [MAX_LOG_LINE_LENGTH] |
int | replayLogLine |
UReplay * | replayParent |
UTime | replayTimeNext |
Private Attributes | |
UVariable * | varImgCnt |
variable in image pool More... | |
UVariable * | varImgList |
list of images available More... | |
UVariable * | varLog |
should image updates be logged More... | |
UVariable * | varReplayLine |
replay status More... | |
UVariable * | varShowDefault |
should images in image-pool be shown as default. More... | |
Additional Inherited Members | |
Public Attributes inherited from UReplay | |
bool | replayTimeAdvancePending |
UTime | replayTimeNow |
Protected Member Functions inherited from UResVarPool | |
void | setDescription (const char *note, bool copy=false) |
Protected Member Functions inherited from UResBase | |
UResBase * | getStaticResource (const char *resName, bool mayCreate, bool staticOnly=true) |
get a pointer to a static resource. More... | |
Static Protected Attributes inherited from UReplay | |
static const int | MAX_LOG_LINE_LENGTH = 10000 |
static const int | REPLAY_FILE_NAME_LENGTH = 264 |
max length of replay filename More... | |
Stores up to 100 images (UImage type) for general purpose. Each image kan trigger events (push events), when the image user calls the update function for the image. Each image is identified on the number, and thus the image number should be selected in a series that do not generate conflicts with other image producing plugins. Reserved images are up to 30, that is used for camera device number (0-9 for USB camera and 10..19 for firewire cameras. The class creates image space on demand (on heap) and releases on exit.
|
inline |
constructor
References getResClassID(), UResBase::setResID(), UImagePoolInit(), and ~UImagePool().
|
virtual |
void UImagePool::createBaseVar | ( | ) |
Make the variables that will be available to other plugins
References UResVarPool::addVar(), UResVarPool::addVarA(), appName, MAX_IMAGES_IN_POOL, UResVarPool::setDescription(), UVariable::setInt(), varImgCnt, varImgList, varLog, varReplayLine, and varShowDefault.
Referenced by createResources(), and isCreated().
int UImagePool::createdImages | ( | ) |
|
virtual |
Called by server after this module is integrated into the server core structure, i.e. all core services are in place, but no commands are serviced for this module yet. Create any resources that this modules needs.
Reimplemented from UResBase.
References createBaseVar().
Referenced by getResClassID().
|
virtual |
Decode this replay line, that is assumed to be valid - has got a time stamp.
line | is a pointer to the line. |
Reimplemented from UReplay.
References UVariable::add(), UImage::camDevice, getImage(), UImage::imageNumber, img, UImage::imgTime, UResBase::line, UImage::loadBMP(), ULock::lock(), replayPath, UImage::setName(), UTime::setTimeTod(), ULock::unlock(), UImage::updated(), and varReplayLine.
Referenced by showImagesAsDefault().
|
virtual |
Get image and create if needed.
source | is image number in the image pool |
mayCreate | if this is false, and the image is not created yet, then a NULL pointer is returned. |
height | (optional) number of rows in the image (only set when an image is created) |
width | (optional) number of columns in the image (only set when an image is created) |
channels | (optional) may to either 1 (BW), 3 (e.g. RGB) or 4 (eg RGBA) (only set when an image is created) |
depth | (optional - default is 8) is number of bytes for each channel in each pixel (may be 8,16,24 or 32) (set only if mayCreate is true) |
References UVariable::add(), UResVarPool::addStruct(), cmdexe, UImgPush::createLocalVariables(), UVariable::getBool(), UVariable::getInt(), images, imagesCnt, UImgPush::imgPoolNumber, MAX_IMAGES_IN_POOL, maxi(), UServerPush::setCmdExe(), UVariable::setInt(), UImgPush::setTcpPort(), UImage::source, UImgPush::startShowing(), varImgCnt, varImgList, and varShowDefault.
Referenced by UResObj3d::addGroundObjects(), UCalibrate::allocateBufferImages(), UFuncCog::calculateCOG(), UFuncKinect::callGotNewDataWithObject(), UFuncCog::centerOfGravity(), UFuncKinect::decodeReplayLine(), decodeReplayLine(), UCamPool::decodeReplayLine(), UResObj3d::do3dVoxels(), UFuncGndAna::doAnalysis(), UFuncFz::doClassify(), UFuncFocus::doFocus(), UResObj3d::doGndPlaneMask(), UFuncImSeg::doGrayLevelCooccurenceMatrix(), UFuncImSeg::doLBPhistogramMatch(), UFuncBallKL::filterMask(), UFuncPiPi::filterMask(), UFuncCropRow::filterMask(), UFuncBall::filterMask(), UFuncBall_improved::filterMask(), UFuncLinefinder::filterMask(), UFuncImgPoly::findAreaFromSeedRGB(), UFuncBallKL::findBall(), UFuncPiPi::findBall(), UFuncBall::findBall(), UFuncBall_improved::findBall(), UFuncImSeg::findBestCoooccurrence(), UFunctionCamPath::findPath(), UFuncTracking::FirstImage(), UFunctionCamBase::getCamAndRawImage(), UFunctionCamBase::getImage(), UResCamIfImg::getImageBuffer(), getResClassID(), UFuncKinect::GetXYZCoordinates(), UFuncRectify::handleCommand(), UFuncBall_improved::handleCommand(), UFuncPiPi::handleCommand(), UFuncBallKL::handleCommand(), UFuncCropRow::handleCommand(), UFuncStraightLine::handleCommand(), UFuncLinefinder::handleCommand(), UFuncFz::handleCommand(), UFunctionCamGmk::handleGmkGetCommand(), UFunctionImage::handleImageGetCommand(), UFunctionImgPool::handleImageGetCommand(), UFunctionImgPool::handleImageListCommand(), UFunctionImgPool::handleImageSetCommand(), UFuncImgPoly::handleImgPolyCommand(), UFunctionCamPath::handlePathGetCommand(), UFunctionImgPool::handlePoolPushCommand(), UFuncLinefinder::houghTest(), UFunctionCamPath::initializeFindPath(), UFuncImgPoly::initializeFindPath(), UResObj3d::makeGroundPlaneProfileImage(), UFuncImSeg::makeLBPimage(), UFuncPCLTest::MakeMap(), UFuncKinect::makeObj3Dcloud(), UFuncBallKL::maskColors(), UFuncBall::maskColors(), UFuncLinefinder::maskColors(), UFuncImSeg::meanShiftSegment(), UNavPaint::paint(), UResObj3d::paintGndPlane(), UFuncTOF::processChannel8(), UFuncKinect::processDepthImages(), UFuncStereo::processImages(), UFuncTOF::processImages(), UFuncPTgrey::Receiver(), UFuncPiCam::run(), UFuncV4lGst::run(), setLogImg(), UCamPool::setResource(), testImgPool(), UFuncTracking::TrackObjects(), UFuncKinect::updateCloud(), UQtgui::updateImg(), and MainWindow::updateImg().
|
inline |
Get number of used handles
References imagesCnt.
Referenced by UFunctionImgPool::handleImageListCommand().
|
inline |
Get maximum imagecount in image pool
References gotAllResources(), MAX_IMAGES_IN_POOL, and print().
Referenced by UFunctionImgPool::handleImageGetCommand().
|
inlinestatic |
Fixed name of this resource type
References createdImages(), createResources(), getImage(), and release().
Referenced by UResCamIfImg::gotAllResources(), UResDisp::gotAllResources(), UFunctionImgBase::setResource(), UNavPaint::setResource(), UFuncView::setResource(), UResCamIfImg::setResource(), UResDisp::setResource(), UCamPool::setResource(), UNavView::setResource(), and UImagePool().
|
virtual |
Test if image pool has all needed resources.
Reimplemented from UResVarPool.
References cmdexe, and UCmdExe::getResClassID().
Referenced by getMaxImageCnt().
|
inline |
does this image exist
idx | is index to image pool, must be less than MAX_IMAGES_IN_POOL. |
References createBaseVar(), images, and MAX_IMAGES_IN_POOL.
|
virtual |
Print short list of available images to a string buffer
Reimplemented from UResVarPool.
References images, imagesCnt, and MAX_IMAGES_IN_POOL.
Referenced by getMaxImageCnt().
void UImagePool::release | ( | ) |
Free images to release heap space
References images, and imagesCnt.
Referenced by getResClassID(), and ~UImagePool().
|
inline |
Set command executor for use when a new image is created then this image will be assigned this command executor.
References cmdexe, server, and setResource().
Referenced by UFunctionImgBase::setCmdHandler().
bool UImagePool::setLogImg | ( | const int | imgSource, |
const bool | doLog, | ||
const int | interval | ||
) |
Set logging for this image
imgSource | is image number to set logging fore. |
doLog | stop logging if false |
interval | log images at this interval (0 = never) |
References UImageLog::camPool, getImage(), UResBase::getStaticResource(), img, imgLog, ULogFile::isOpen(), UImageLog::openLog(), UVariable::setBool(), UImgPush::setImgLog(), UImgPush::setLogInterval(), and varLog.
Referenced by UFunctionImgPool::handleImageSetCommand(), and showImagesAsDefault().
|
virtual |
Set resource (core pointer needed by push functionality)
Reimplemented from UResVarPool.
References cmdexe, UCmdExe::getResClassID(), and UResBase::isA().
Referenced by setCmdExe().
|
inline |
Show images as default - intended for use by client only
References decodeReplayLine(), UResBase::line, UVariable::setBool(), setLogImg(), updateReplayStatus(), and varShowDefault.
Referenced by UFunctionImgBase::showImagesAsDefault().
void UImagePool::UImagePoolInit | ( | ) |
Initialization of image pool class
References cmdexe, UResBase::getResVersion(), images, imagesCnt, imgLog, MAX_IMAGES_IN_POOL, UResBase::resVersion, ULogFile::setLogName(), UImageLog::setPng(), varImgCnt, varImgList, and varShowDefault.
Referenced by UImagePool().
|
virtual |
is called when it is time to update replay status (after a step in some replay file)
Reimplemented from UResBase.
References UReplay::isReplay(), UVariable::setBool(), and varReplayLine.
Referenced by showImagesAsDefault().
|
protected |
Command executor for poll push
Referenced by getImage(), gotAllResources(), setCmdExe(), setResource(), and UImagePoolInit().
|
protected |
Pool of image pointers
Referenced by createdImages(), getImage(), isCreated(), print(), release(), and UImagePoolInit().
|
protected |
max number of image created with highest number until now
Referenced by createdImages(), getImage(), getImageCnt(), print(), release(), and UImagePoolInit().
|
protected |
Image logfile for image-pool logging
Referenced by setLogImg(), and UImagePoolInit().
|
private |
variable in image pool
Referenced by createBaseVar(), getImage(), and UImagePoolInit().
|
private |
list of images available
Referenced by createBaseVar(), getImage(), and UImagePoolInit().
|
private |
should image updates be logged
Referenced by createBaseVar(), and setLogImg().
|
private |
replay status
Referenced by createBaseVar(), decodeReplayLine(), and updateReplayStatus().
|
private |
should images in image-pool be shown as default.
Referenced by createBaseVar(), getImage(), showImagesAsDefault(), and UImagePoolInit().