AURobotServers  4
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
UImagePool Class Reference

#include <uimagepool.h>

Inheritance diagram for UImagePool:
Inheritance graph

Public Member Functions

void createBaseVar ()
 
int createdImages ()
 
virtual void createResources ()
 
virtual bool decodeReplayLine (char *line)
 
virtual UImagegetImage (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)
 
UVarPooladdStruct (const char *name, const char *comment, bool copy=false)
 
UVariableaddVar (const char *name, const double initialValue, const char *type, const char *comment)
 
UVariableaddVar (const char *name, const char *initialValue, const char *type, const char *comment)
 
UVariableaddVarA (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)
 
UVarCalcgetVarPool ()
 
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)
 
UCmdExegetCorePointer ()
 
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

UCmdExecmdexe
 
UImgPushimages [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
 
UReplayreplayParent
 
UTime replayTimeNext
 

Private Attributes

UVariablevarImgCnt
 variable in image pool More...
 
UVariablevarImgList
 list of images available More...
 
UVariablevarLog
 should image updates be logged More...
 
UVariablevarReplayLine
 replay status More...
 
UVariablevarShowDefault
 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
UResBasegetStaticResource (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...
 

Detailed Description

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.

Author
Christian Andersen

Constructor & Destructor Documentation

UImagePool::UImagePool ( )
inline
UImagePool::~UImagePool ( )
virtual

Destructor

References release().

Referenced by UImagePool().

Member Function Documentation

void UImagePool::createBaseVar ( )
int UImagePool::createdImages ( )

Number of created images

References images, and imagesCnt.

Referenced by getResClassID().

void UImagePool::createResources ( )
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().

bool UImagePool::decodeReplayLine ( char *  line)
virtual

Decode this replay line, that is assumed to be valid - has got a time stamp.

Parameters
lineis a pointer to the line.
Returns
true if the line is valid and used (step is successful).
false if line is not a valid step.

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().

UImage * UImagePool::getImage ( unsigned int  source,
bool  mayCreate,
const unsigned int  height = 0,
const unsigned int  width = 0,
const int  channels = 3,
const int  depth = 8 
)
virtual

Get image and create if needed.

Parameters
sourceis image number in the image pool
mayCreateif 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)
Returns
a pointer to the image in the image pool (or NULL if the image do not exist and mayCreate is false)

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().

int UImagePool::getImageCnt ( )
inline

Get number of used handles

References imagesCnt.

Referenced by UFunctionImgPool::handleImageListCommand().

int UImagePool::getMaxImageCnt ( )
inline

Get maximum imagecount in image pool

References gotAllResources(), MAX_IMAGES_IN_POOL, and print().

Referenced by UFunctionImgPool::handleImageGetCommand().

static const char* UImagePool::getResClassID ( )
inlinestatic
bool UImagePool::gotAllResources ( char *  missingThese,
int  missingTheseCnt 
)
virtual

Test if image pool has all needed resources.

Reimplemented from UResVarPool.

References cmdexe, and UCmdExe::getResClassID().

Referenced by getMaxImageCnt().

bool UImagePool::isCreated ( unsigned int  idx)
inline

does this image exist

Parameters
idxis index to image pool, must be less than MAX_IMAGES_IN_POOL.
Returns
true if image is created.

References createBaseVar(), images, and MAX_IMAGES_IN_POOL.

const char * UImagePool::print ( const char *  preString,
char *  buff,
int  buffCnt 
)
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().

void UImagePool::setCmdExe ( UCmdExe server)
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

Parameters
imgSourceis image number to set logging fore.
doLogstop logging if false
intervallog images at this interval (0 = never)
Returns
true if set as requested

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().

bool UImagePool::setResource ( UResBase resource,
bool  remove 
)
virtual

Set resource (core pointer needed by push functionality)

Reimplemented from UResVarPool.

References cmdexe, UCmdExe::getResClassID(), and UResBase::isA().

Referenced by setCmdExe().

void UImagePool::showImagesAsDefault ( bool  show)
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 ( )
void UImagePool::updateReplayStatus ( )
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().

Member Data Documentation

UCmdExe* UImagePool::cmdexe
protected

Command executor for poll push

Referenced by getImage(), gotAllResources(), setCmdExe(), setResource(), and UImagePoolInit().

UImgPush* UImagePool::images[MAX_IMAGES_IN_POOL]
protected

Pool of image pointers

Referenced by createdImages(), getImage(), isCreated(), print(), release(), and UImagePoolInit().

int UImagePool::imagesCnt
protected

max number of image created with highest number until now

Referenced by createdImages(), getImage(), getImageCnt(), print(), release(), and UImagePoolInit().

UImageLog UImagePool::imgLog
protected

Image logfile for image-pool logging

Referenced by setLogImg(), and UImagePoolInit().

UVariable* UImagePool::varImgCnt
private

variable in image pool

Referenced by createBaseVar(), getImage(), and UImagePoolInit().

UVariable* UImagePool::varImgList
private

list of images available

Referenced by createBaseVar(), getImage(), and UImagePoolInit().

UVariable* UImagePool::varLog
private

should image updates be logged

Referenced by createBaseVar(), and setLogImg().

UVariable* UImagePool::varReplayLine
private

replay status

Referenced by createBaseVar(), decodeReplayLine(), and updateReplayStatus().

UVariable* UImagePool::varShowDefault
private

should images in image-pool be shown as default.

Referenced by createBaseVar(), getImage(), showImagesAsDefault(), and UImagePoolInit().


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