00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ARIAUTIL_H
00028 #define ARIAUTIL_H
00029
00030 #include <string>
00031 #include <list>
00032 #include <math.h>
00033 #include <stdarg.h>
00034 #ifdef WIN32
00035 #include <sys/timeb.h>
00036 #include <sys/stat.h>
00037 #endif // win32
00038 #ifndef WIN32
00039 #include <sys/types.h>
00040 #include <sys/stat.h>
00041 #include <sys/time.h>
00042 #include <unistd.h>
00043 #endif // ifndef win32
00044 #include "ariaTypedefs.h"
00045 #include "ArLog.h"
00046 #include "ArFunctor.h"
00047 #include "ArArgumentParser.h"
00048
00049 #include "ariaOSDef.h"
00050
00051 #ifndef M_PI
00052 #define M_PI 3.1415927
00053 #endif // of M_PI, windows has a function call instead of a define
00054
00056 class ArUtil
00057 {
00058 public:
00060 enum BITS {
00061 BIT0 = 0x1,
00062 BIT1 = 0x2,
00063 BIT2 = 0x4,
00064 BIT3 = 0x8,
00065 BIT4 = 0x10,
00066 BIT5 = 0x20,
00067 BIT6 = 0x40,
00068 BIT7 = 0x80,
00069 BIT8 = 0x100,
00070 BIT9 = 0x200,
00071 BIT10 = 0x400,
00072 BIT11 = 0x800,
00073 BIT12 = 0x1000,
00074 BIT13 = 0x2000,
00075 BIT14 = 0x4000,
00076 BIT15 = 0x8000,
00077 };
00078
00080 static void sleep(unsigned int ms);
00081
00083 static unsigned int getTime(void);
00084
00086
00091 template<class T> static void deleteSet(T begin, T end)
00092 {
00093 for (; begin != end; ++begin)
00094 {
00095 delete (*begin);
00096 }
00097 }
00098
00100
00105 template<class T> static void deleteSetPairs(T begin, T end)
00106 {
00107 for (; begin != end; ++begin)
00108 {
00109 delete (*begin).second;
00110 }
00111 }
00112
00114 static int findMin(int first, int second)
00115 { if (first < second) return first; else return second; }
00117 static int findMax(int first, int second)
00118 { if (first > second) return first; else return second; }
00119
00121 static double findMin(double first, double second)
00122 { if (first < second) return first; else return second; }
00124 static double findMax(double first, double second)
00125 { if (first > second) return first; else return second; }
00126
00128 static long sizeFile(const char *fileName);
00129
00131 static long sizeFile(std::string fileName);
00132
00134 static bool findFile(const char *fileName);
00135
00136
00137
00138
00139
00140
00141
00142
00143
00145 static void appendSlash(char *path, size_t pathLength);
00146
00148 static void fixSlashes(char *path, size_t pathLength);
00149
00151 static void fixSlashesForward(char *path, size_t pathLength);
00152
00154 static void fixSlashesBackward(char *path, size_t pathLength);
00155
00157 static void addDirectories(char *dest, size_t destLength,
00158 const char *baseDir,
00159 const char *insideDir);
00160
00162 static int strcmp(std::string str, std::string str2);
00163
00165 static int strcmp(std::string str, const char *str2);
00166
00168 static int strcmp(const char *str, std::string str2);
00169
00171 static int strcmp(const char *str, const char *str2);
00172
00174 static int strcasecmp(std::string str, std::string str2);
00175
00177 static int strcasecmp(std::string str, const char *str2);
00178
00180 static int strcasecmp(const char *str, std::string str2);
00181
00183 static int strcasecmp(const char *str, const char *str2);
00184
00186 static void escapeSpaces(char *dest, const char *src,
00187 size_t maxLen);
00188
00190 static bool stripQuotes(char *dest, const char *src,size_t destLen);
00191
00193 static void lower(char *dest, const char *src,
00194 size_t maxLen);
00196 static bool isOnlyAlphaNumeric(const char *str);
00197
00199 static double atof(const char *nptr);
00200
00202 static const char *convertBool(int val);
00203
00205 static void functorPrintf(ArFunctor1<const char *> *functor,
00206 char *str, ...);
00207
00209 static void writeToFile(const char *str, FILE *file);
00210
00212 static bool getStringFromFile(const char *fileName,
00213 char *str, size_t strLen);
00217 enum REGKEY {
00218 REGKEY_CLASSES_ROOT,
00219 REGKEY_CURRENT_CONFIG,
00220 REGKEY_CURRENT_USER,
00221 REGKEY_LOCAL_MACHINE,
00222 REGKEY_USERS
00223 };
00224
00226 static bool getStringFromRegistry(REGKEY root,
00227 const char *key,
00228 const char *value,
00229 char *str,
00230 int len);
00231
00233 static bool findFirstStringInRegistry(const char* key, const char* value, char* str, int len) {
00234 if(!getStringFromRegistry(REGKEY_CURRENT_USER, key, value, str, len))
00235 return getStringFromRegistry(REGKEY_LOCAL_MACHINE, key, value, str, len);
00236 return true;
00237 }
00238
00239 static const char *COM1;
00240 static const char *COM2;
00241 static const char *COM3;
00242 static const char *COM4;
00243 static const char *TRUESTRING;
00244 static const char *FALSESTRING;
00245
00246 };
00247
00249 class ArMath
00250 {
00251 public:
00252
00254
00260 static double addAngle(double ang1, double ang2)
00261 { return fixAngle(ang1 + ang2); }
00262
00264
00271 static double subAngle(double ang1, double ang2)
00272 { return fixAngle(ang1 - ang2); }
00273
00275
00281 static double fixAngle(double angle)
00282 {
00283 if (angle >= 360)
00284 angle = angle - 360.0 * (double)((int)angle / 360);
00285 if (angle < -360)
00286 angle = angle + 360.0 * (double)((int)angle / -360);
00287 if (angle <= -180)
00288 angle = + 180.0 + (angle + 180.0);
00289 if (angle > 180)
00290 angle = - 180.0 + (angle - 180.0);
00291 return angle;
00292 }
00293
00295
00300 static double degToRad(double deg) { return deg * M_PI / 180.0; }
00301
00303
00308 static double radToDeg(double rad) { return rad * 180.0 / M_PI; }
00309
00311
00316 static double cos(double angle) { return ::cos(ArMath::degToRad(angle)); }
00317
00319
00324 static double sin(double angle) { return ::sin(ArMath::degToRad(angle)); }
00325
00327
00332 static double atan2(double y, double x)
00333 { return ArMath::radToDeg(::atan2(y, x)); }
00335 static bool angleBetween(double angle, double startAngle, double endAngle)
00336 {
00337 angle = fixAngle(angle);
00338 startAngle = fixAngle(startAngle);
00339 endAngle = fixAngle(endAngle);
00340 if ((startAngle < endAngle && angle > startAngle && angle < endAngle) ||
00341 (startAngle > endAngle && (angle > startAngle || angle < endAngle)))
00342 return true;
00343 else
00344 return false;
00345 }
00346
00348
00352 static double fabs(double val)
00353 {
00354 if (val < 0.0)
00355 return -val;
00356 else
00357 return val;
00358 }
00359
00361
00366 static int roundInt(double val)
00367 {
00368 val += .49;
00369 if (val > INT_MAX)
00370 return (int) INT_MAX;
00371 else if (val < INT_MIN)
00372 return (int) INT_MIN;
00373 else
00374 return((int) floor(val));
00375 }
00376
00378
00383 static short roundShort(double val)
00384 {
00385 val += .49;
00386 if (val > 32767)
00387 return (short) 32767;
00388 else if (val < -32768)
00389 return (short) -32768;
00390 else
00391 return((short) floor(val));
00392 }
00393
00394
00396 static void pointRotate(double *x, double *y, double th)
00397 {
00398 double cs, sn, xt, yt;
00399 cs = cos(th);
00400 sn = sin(th);
00401 xt = *x;
00402 yt = *y;
00403 *x = cs*xt + sn*yt;
00404 *y = cs*yt - sn*xt;
00405 }
00406
00408 static long random(void)
00409 {
00410 #ifdef WIN32
00411 return(rand());
00412 #else
00413 return(lrand48());
00414 #endif
00415 }
00417
00424 static double distanceBetween(double x1, double y1, double x2, double y2)
00425 { return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); }
00426
00428
00436 static double squaredDistanceBetween(double x1, double y1, double x2, double y2)
00437 { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); }
00438
00440 static double log2(double x)
00441 {
00442 #ifdef WIN32
00443 return log10(x) / 0.3010303;
00444 #else
00445 return log2(x);
00446 #endif
00447 }
00448 };
00449
00451
00456 class ArPose
00457 {
00458 public:
00460
00467 ArPose(double x = 0, double y = 0, double th = 0)
00468 { myX = x; myY = y; myTh = th; }
00470 ArPose(const ArPose &pose) :
00471 myX(pose.myX), myY(pose.myY), myTh(pose.myTh) {}
00472
00474 virtual ~ArPose() {}
00476
00483 virtual void setPose(double x, double y, double th = 0)
00484 { setX(x); setY(y); setTh(th); }
00486
00487 virtual void setPose(ArPose position)
00488 {
00489 setX(position.getX());
00490 setY(position.getY());
00491 setTh(position.getTh());
00492 }
00494 void setX(double x) { myX = x; }
00496 void setY(double y) { myY = y; }
00498 void setTh(double th) { myTh = ArMath::fixAngle(th); }
00500 void setThRad(double th) { myTh = ArMath::fixAngle(ArMath::radToDeg(th)); }
00502 double getX(void) const { return myX; }
00504 double getY(void) const { return myY; }
00506 double getTh(void) const { return myTh; }
00508 double getThRad(void) const { return ArMath::degToRad(myTh); }
00510
00520 void getPose(double *x, double *y, double *th = NULL) const
00521 {
00522 if (x != NULL)
00523 *x = myX;
00524 if (y != NULL)
00525 *y = myY;
00526 if (th != NULL)
00527 *th = myTh;
00528 }
00530
00534 virtual double findDistanceTo(ArPose position) const
00535 {
00536 return ArMath::distanceBetween(getX(), getY(),
00537 position.getX(),
00538 position.getY());
00539 }
00540
00542
00549 virtual double squaredFindDistanceTo(ArPose position) const
00550 {
00551 return ArMath::squaredDistanceBetween(getX(), getY(),
00552 position.getX(),
00553 position.getY());
00554 }
00556
00560 virtual double findAngleTo(ArPose position) const
00561 {
00562 return ArMath::radToDeg(atan2(position.getY() - getY(),
00563 position.getX() - getX()));
00564 }
00566 virtual void log(void) const
00567 { ArLog::log(ArLog::Terse, "%.0f %.0f %.1f", myX, myY, myTh); }
00568 protected:
00569 double myX;
00570 double myY;
00571 double myTh;
00572 };
00573
00574
00576
00584 class ArTime
00585 {
00586 public:
00588 ArTime() { setToNow(); }
00590 ~ArTime() {}
00591
00593 long mSecSince(ArTime since) const
00594 {
00595 long timeSince, timeThis;
00596
00597 timeSince = since.getSec() * 1000 + since.getMSec();
00598 timeThis = mySec * 1000 + myMSec;
00599 return timeSince - timeThis;
00600 }
00602 long secSince(ArTime since) const
00603 {
00604 return mSecSince(since)/1000;
00605 }
00607 long mSecTo(void) const
00608 {
00609 ArTime now;
00610 now.setToNow();
00611 return -mSecSince(now);
00612 }
00614 long secTo(void) const
00615 {
00616 return mSecTo()/1000;
00617 }
00619 long mSecSince(void) const
00620 {
00621 ArTime now;
00622 now.setToNow();
00623 return mSecSince(now);
00624 }
00626 long secSince(void) const
00627 {
00628 return mSecSince()/1000;
00629 }
00631 bool isBefore(ArTime testTime) const
00632 {
00633 if (mSecSince(testTime) < 0)
00634 return true;
00635 else
00636 return false;
00637 }
00639 bool isAt(ArTime testTime) const
00640 {
00641 if (mSecSince(testTime) == 0)
00642 return true;
00643 else
00644 return false;
00645 }
00647 bool isAfter(ArTime testTime) const
00648 {
00649 if (mSecSince(testTime) > 0)
00650 return true;
00651 else
00652 return false;
00653 }
00655 void setToNow(void)
00656 {
00657 #ifdef WIN32
00658
00659
00660
00661
00662
00663
00664
00665
00666
00667 long timeNow;
00668 timeNow = timeGetTime();
00669 mySec = timeNow / 1000;
00670 myMSec = timeNow % 1000;
00671 #else // if not win32
00672 struct timeval timeNow;
00673
00674 if (gettimeofday(&timeNow, NULL) == 0)
00675 {
00676 mySec = timeNow.tv_sec;
00677 myMSec = timeNow.tv_usec / 1000;
00678 }
00679 else
00680 ArLog::log(ArLog::Terse, "ArTime::setToNow: invalid return from gettimeofday.\n");
00681 #endif //linux
00682 }
00684 void addMSec(long ms)
00685 {
00686 unsigned long timeThis;
00687 timeThis = mySec * 1000 + myMSec;
00688 if (ms < 0 && (unsigned)abs(ms) > timeThis)
00689 {
00690 ArLog::log(ArLog::Terse, "ArTime::addMsec: tried to subtract too many milliseconds, would result in a negative time.");
00691 mySec = 0;
00692 myMSec = 0;
00693 }
00694 else
00695 {
00696 timeThis += ms;
00697 mySec = timeThis / 1000;
00698 myMSec = timeThis % 1000;
00699 }
00700 }
00702 void setSec(time_t sec) { mySec = sec; }
00704 void setMSec(time_t msec) { myMSec = msec; }
00706 time_t getSec(void) const { return mySec; }
00708 time_t getMSec(void) const { return myMSec; }
00710 void log(void) const
00711 { ArLog::log(ArLog::Terse, "Time: %ld.%ld", getSec(), getMSec()); }
00712 protected:
00713 time_t mySec;
00714 time_t myMSec;
00715
00716 };
00717
00719
00722 class ArPoseWithTime : public ArPose
00723 {
00724 public:
00725 ArPoseWithTime(double x = 0, double y = 0, double th = 0,
00726 ArTime thisTime = ArTime()) : ArPose(x, y, th)
00727 { myTime = thisTime; }
00728 virtual ~ArPoseWithTime() {}
00729 void setTime(ArTime newTime) { myTime = newTime; }
00730 void setTimeToNow(void) { myTime.setToNow(); }
00731 ArTime getTime(void) const { return myTime; }
00732 protected:
00733 ArTime myTime;
00734 };
00735
00737
00744 class ArSectors
00745 {
00746 public:
00748 ArSectors(int numSectors = 8)
00749 {
00750 mySectorSize = 360/numSectors;
00751 mySectors = new int[numSectors];
00752 myNumSectors = numSectors;
00753 clear();
00754 }
00756 virtual ~ArSectors() { delete mySectors; }
00758 void clear(void)
00759 {
00760 int i;
00761 for (i = 0; i < myNumSectors; i++)
00762 mySectors[i] = false;
00763 }
00765 void update(double angle)
00766 {
00767 int angleInt;
00768 angleInt = ArMath::roundInt(ArMath::fixAngle(angle) + 180);
00769 mySectors[angleInt / mySectorSize] = true;
00770 }
00772 bool didAll(void) const
00773 {
00774 int i;
00775 for (i = 0; i < myNumSectors; i++)
00776 if (mySectors[i] == false)
00777 return false;
00778 return true;
00779 }
00780 protected:
00781 int *mySectors;
00782 int myNumSectors;
00783 int mySectorSize;
00784 };
00785
00786
00787
00788
00790
00795 class ArLine
00796 {
00797 public:
00799 ArLine() {}
00801 ArLine(double a, double b, double c) { newParameters(a, b, c); }
00803 ArLine(double x1, double y1, double x2, double y2)
00804 { newParametersFromEndpoints(x1, y1, x2, y2); }
00806 virtual ~ArLine() {}
00808 void newParameters(double a, double b, double c)
00809 { myA = a; myB = b; myC = c; }
00811 void newParametersFromEndpoints(double x1, double y1, double x2, double y2)
00812 { myA = y1 - y2; myB = x2 - x1; myC = (y2 *x1) - (x2 * y1); }
00814 const double getA(void) const { return myA; }
00816 const double getB(void) const { return myB; }
00818 const double getC(void) const { return myC; }
00820
00825 bool intersects(const ArLine *line, ArPose *pose)
00826 {
00827 double x, y;
00828 double n;
00829 n = (line->getB() * getA()) - (line->getA() * getB());
00830
00831 if (fabs(n) < .0000000000001)
00832 {
00833 return false;
00834 }
00835
00836 x = ((line->getC() * getB()) - (line->getB() * getC())) / n;
00837 y = ((getC() * line->getA()) - (getA() * line->getC())) / n;
00838 pose->setPose(x, y);
00839 return true;
00840 }
00842 void makeLinePerp(const ArPose *pose, ArLine *line) const
00843 {
00844 line->newParameters(getB(), -getA(),
00845 (getA() * pose->getY()) - (getB() * pose->getX()));
00846 }
00847 protected:
00848 double myA, myB, myC;
00849 };
00850
00852 class ArLineSegment
00853 {
00854 public:
00855 #ifndef SWIG
00856
00857 ArLineSegment() {}
00859 ArLineSegment(double x1, double y1, double x2, double y2)
00860 { newEndPoints(x1, y1, x2, y2); }
00862 ArLineSegment(ArPose pose1, ArPose pose2)
00863 { newEndPoints(pose1.getX(), pose1.getY(), pose2.getX(), pose2.getY()); }
00864 #endif // SWIG
00865
00866 virtual ~ArLineSegment() {}
00868 void newEndPoints(double x1, double y1, double x2, double y2)
00869 {
00870 myX1 = x1; myY1 = y1; myX2 = x2; myY2 = y2;
00871 myLine.newParametersFromEndpoints(myX1, myY1, myX2, myY2);
00872 }
00874 ArPose getEndPoint1(void) const { return ArPose(myX1, myY1); }
00876 ArPose getEndPoint2(void) const { return ArPose(myX2, myY2); }
00878
00883 bool intersects(const ArLine *line, ArPose *pose)
00884 {
00885
00886 if (myLine.intersects(line, &myIntersection) &&
00887 linePointIsInSegment(&myIntersection))
00888 {
00889 pose->setPose(myIntersection);
00890 return true;
00891 }
00892 else
00893 return false;
00894 }
00895
00897
00902 bool intersects(ArLineSegment *line, ArPose *pose)
00903 {
00904
00905 if (myLine.intersects(line->getLine(), &myIntersection) &&
00906 linePointIsInSegment(&myIntersection) &&
00907 line->linePointIsInSegment(&myIntersection))
00908 {
00909 pose->setPose(myIntersection);
00910 return true;
00911 }
00912 else
00913 return false;
00914 }
00915 #ifndef SWIG
00916
00917
00923 bool getPerpPoint(ArPose pose, ArPose *perpPoint)
00924 {
00925 myLine.makeLinePerp(&pose, &myPerpLine);
00926 return intersects(&myPerpLine, perpPoint);
00927 }
00928 #endif
00929
00930
00939 bool getPerpPoint(const ArPose *pose, ArPose *perpPoint)
00940 {
00941 myLine.makeLinePerp(pose, &myPerpLine);
00942 return intersects(&myPerpLine, perpPoint);
00943 }
00945
00952 double getPerpDist(const ArPose pose)
00953 {
00954 ArPose perpPose;
00955 myLine.makeLinePerp(&pose, &myPerpLine);
00956 if (!intersects(&myPerpLine, &perpPose))
00957 return -1;
00958 return (perpPose.findDistanceTo(pose));
00959 }
00961
00966 double getDistToLine(const ArPose pose)
00967 {
00968 ArPose perpPose;
00969 myLine.makeLinePerp(&pose, &myPerpLine);
00970 if (!intersects(&myPerpLine, &perpPose))
00971 {
00972 return ArUtil::findMin(
00973 ArMath::roundInt(getEndPoint1().findDistanceTo(pose)),
00974 ArMath::roundInt(getEndPoint2().findDistanceTo(pose)));
00975 }
00976 return (perpPose.findDistanceTo(pose));
00977 }
00979 const double getX1(void) const { return myX1; }
00981 const double getY1(void) const { return myY1; }
00983 const double getX2(void) const { return myX2; }
00985 const double getY2(void) const { return myY2; }
00987 const double getA(void) const { return myLine.getA(); }
00989 const double getB(void) const { return myLine.getB(); }
00991 const double getC(void) const { return myLine.getC(); }
00993 const bool linePointIsInSegment(ArPose *pose) const
00994 {
00995 return (((myX1 == myX2) ||
00996 (pose->getX() >= myX1 && pose->getX() <= myX2) ||
00997 (pose->getX() <= myX1 && pose->getX() >= myX2)) &&
00998 ((myY1 == myY2) ||
00999 (pose->getY() >= myY1 && pose->getY() <= myY2) ||
01000 (pose->getY() <= myY1 && pose->getY() >= myY2)));
01001 }
01002 const ArLine *getLine(void) const { return &myLine; }
01003 protected:
01005 double myX1, myY1, myX2, myY2;
01006 ArLine myLine;
01007 ArPose myIntersection;
01008 ArLine myPerpLine;
01009 };
01010
01012 class ArRunningAverage
01013 {
01014 public:
01016 ArRunningAverage(size_t numToAverage);
01018 ~ArRunningAverage();
01020 double getAverage(void) const;
01022 void add(double val);
01024 void clear(void);
01026 size_t getNumToAverage(void) const;
01028 void setNumToAverage(size_t numToAverage);
01029 protected:
01030 size_t myNumToAverage;
01031 double myTotal;
01032 size_t myNum;
01033 std::list<double> myVals;
01034 };
01035
01036
01037
01038 struct ArStrCaseCmpOp
01039 {
01040 public:
01041 bool operator() (const std::string &s1, const std::string &s2) const
01042 {
01043 return strcasecmp(s1.c_str(), s2.c_str()) < 0;
01044 }
01045 };
01046
01047 #if !defined(WIN32) && !defined(SWIG)
01048
01049 class ArDaemonizer
01050 {
01051 public:
01053 ArDaemonizer(int *argc, char **argv);
01055 ~ArDaemonizer();
01057 bool daemonize(void);
01059 bool forceDaemonize(void);
01061 void logOptions(void);
01063 bool isDaemonized(void) { return myIsDaemonized; }
01064 protected:
01065 ArArgumentParser myParser;
01066 bool myIsDaemonized;
01067 };
01068 #endif // !win32 && !swig
01069
01070
01071
01073 class ArPriority
01074 {
01075 public:
01076 enum Priority
01077 {
01078 IMPORTANT,
01079 NORMAL,
01080 DETAILED,
01081 TRIVIAL = DETAILED,
01082
01083 LAST_PRIORITY = DETAILED
01084 };
01085
01086 enum {
01087 PRIORITY_COUNT = LAST_PRIORITY + 1
01088 };
01089
01090 static const char * getPriorityName(Priority priority);
01091 protected:
01092 static bool ourStringsInited;
01093 static std::map<Priority, std::string> ourPriorityNames;
01094 static std::string ourUnknownPriorityName;
01095 };
01096
01098
01101 class ArStringInfoHolder
01102 {
01103 public:
01105 ArStringInfoHolder(const char *name, ArTypes::UByte2 maxLength,
01106 ArFunctor2<char *, ArTypes::UByte2> *functor)
01107 { myName = name; myMaxLength = maxLength; myFunctor = functor; }
01109 virtual ~ArStringInfoHolder() {}
01111 const char *getName(void) { return myName.c_str(); }
01113 ArTypes::UByte2 getMaxLength(void) { return myMaxLength; }
01115 ArFunctor2<char *, ArTypes::UByte2> *getFunctor(void) { return myFunctor; }
01116 protected:
01117 std::string myName;
01118 ArTypes::UByte2 myMaxLength;
01119 ArFunctor2<char *, ArTypes::UByte2> *myFunctor;
01120 };
01121
01123 class ArStringInfoHolderFunctions
01124 {
01125 public:
01126 static void intWrapper(char * buffer, ArTypes::UByte2 bufferLen,
01127 ArRetFunctor<int> *functor, const char *format)
01128 { snprintf(buffer, bufferLen, format, functor->invokeR()); }
01129 static void doubleWrapper(char * buffer, ArTypes::UByte2 bufferLen,
01130 ArRetFunctor<double> *functor, const char *format)
01131 { snprintf(buffer, bufferLen, format, functor->invokeR()); }
01132 static void boolWrapper(char * buffer, ArTypes::UByte2 bufferLen,
01133 ArRetFunctor<bool> *functor, const char *format)
01134 { snprintf(buffer, bufferLen, format,
01135 ArUtil::convertBool(functor->invokeR())); }
01136 static void stringWrapper(char * buffer, ArTypes::UByte2 bufferLen,
01137 ArRetFunctor<const char *> *functor,
01138 const char *format)
01139 { snprintf(buffer, bufferLen, format, functor->invokeR()); }
01140
01141 };
01142
01143 #endif // ARIAUTIL_H
01144
01145