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 #include "ArExport.h"
00027 #include "ariaOSDef.h"
00028 #include "ArConfigArg.h"
00029 #include "ArLog.h"
00030 #include "ArArgumentBuilder.h"
00031
00032 AREXPORT ArConfigArg::ArConfigArg()
00033 {
00034 clear();
00035 }
00036
00038 AREXPORT ArConfigArg::ArConfigArg(const char * name, int *pointer,
00039 const char * description, int minInt, int maxInt)
00040 {
00041 clear();
00042 set(INT, name, description);
00043
00044 myIntType = INT_INT;
00045 myMinInt = minInt;
00046 myMaxInt = maxInt;
00047 myIntPointer = pointer;
00048 }
00049
00051 AREXPORT ArConfigArg::ArConfigArg(const char * name, short *pointer,
00052 const char * description, int minInt, int maxInt)
00053
00054 {
00055 clear();
00056 set(INT, name, description);
00057
00058 myIntType = INT_SHORT;
00059 myMinInt = minInt;
00060 myMaxInt = maxInt;
00061 myIntShortPointer = pointer;
00062 }
00063
00065 AREXPORT ArConfigArg::ArConfigArg(const char * name, unsigned short *pointer,
00066 const char * description, int minInt, int maxInt)
00067 {
00068 clear();
00069 set(INT, name, description);
00070
00071 myIntType = INT_UNSIGNED_SHORT;
00072 myMinInt = minInt;
00073 myMaxInt = maxInt;
00074 myIntUnsignedShortPointer = pointer;
00075 }
00076
00078 AREXPORT ArConfigArg::ArConfigArg(const char * name, unsigned char *pointer,
00079 const char * description, int minInt, int maxInt)
00080 {
00081 clear();
00082 set(INT, name, description);
00083
00084 myIntType = INT_UNSIGNED_CHAR;
00085 myMinInt = minInt;
00086 myMaxInt = maxInt;
00087 myIntUnsignedCharPointer = pointer;
00088 }
00089
00091 AREXPORT ArConfigArg::ArConfigArg(const char * name, double *pointer,
00092 const char * description, double minDouble,
00093 double maxDouble)
00094 {
00095 clear();
00096 set(DOUBLE, name, description);
00097
00098 myMinDouble = minDouble;
00099 myMaxDouble = maxDouble;
00100 myDoublePointer = pointer;
00101 }
00102
00104 AREXPORT ArConfigArg::ArConfigArg(const char * name, bool *pointer,
00105 const char * description)
00106
00107 {
00108 clear();
00109 set(BOOL, name, description);
00110
00111 myBoolPointer = pointer;
00112 }
00113
00114
00116 AREXPORT ArConfigArg::ArConfigArg(const char * name, int val,
00117 const char * description, int minInt, int maxInt)
00118 {
00119 clear();
00120 set(INT, name, description);
00121
00122 myIntType = INT_INT;
00123 myMinInt = minInt;
00124 myMaxInt = maxInt;
00125 myIntPointer = new int;
00126 *myIntPointer = val;
00127 myOwnPointedTo = true;
00128 }
00129
00131 AREXPORT ArConfigArg::ArConfigArg(const char * name, double val,
00132 const char * description, double minDouble,
00133 double maxDouble)
00134 {
00135 clear();
00136 set(DOUBLE, name, description);
00137
00138 myMinDouble = minDouble;
00139 myMaxDouble = maxDouble;
00140 myDoublePointer = new double;
00141 *myDoublePointer = val;
00142 myOwnPointedTo = true;
00143 }
00144
00146 AREXPORT ArConfigArg::ArConfigArg(const char * name, bool val,
00147 const char * description)
00148 {
00149 clear();
00150 set(BOOL, name, description);
00151
00152 myBoolPointer = new bool;
00153 *myBoolPointer = val;
00154 myOwnPointedTo = true;
00155 }
00156
00168 AREXPORT ArConfigArg::ArConfigArg(const char * name, char *str,
00169 const char * description, size_t maxStrLen)
00170 {
00171 clear();
00172 set(STRING, name, description);
00173
00174 if (maxStrLen == 0)
00175 {
00176 myUsingOwnedString = true;
00177 myString = str;
00178 }
00179 else
00180 {
00181 myStringPointer = str;
00182 myMaxStrLen = maxStrLen;
00183 }
00184 }
00185
00206 AREXPORT ArConfigArg::ArConfigArg(const char *name,
00207 ArRetFunctor1<bool, ArArgumentBuilder *> *setFunctor,
00208 ArRetFunctor<const std::list<ArArgumentBuilder *> *> *getFunctor,
00209 const char *description)
00210 {
00211 clear();
00212 set(FUNCTOR, name, description);
00213
00214 mySetFunctor = setFunctor;
00215 myGetFunctor = getFunctor;
00216 }
00217
00218 AREXPORT ArConfigArg::ArConfigArg(const char * str, Type type)
00219 {
00220 clear();
00221 if (type == DESCRIPTION_HOLDER)
00222 {
00223 myType = DESCRIPTION_HOLDER;
00224 myDescription = str;
00225 }
00226 else
00227 {
00228 ArLog::log(ArLog::Terse, "ArConfigArg: Bad type %d for '%s'", type, str);
00229 }
00230 }
00231
00236 AREXPORT ArConfigArg::ArConfigArg(Type type)
00237 {
00238 clear();
00239 set(type, "", "");
00240 }
00241
00242 AREXPORT ArConfigArg::ArConfigArg(const char *name, const char *str)
00243 {
00244 clear();
00245 set(STRING_HOLDER, name, "");
00246 myUsingOwnedString = true;
00247 myString = str;
00248 }
00249
00250 AREXPORT ArConfigArg::ArConfigArg(const ArConfigArg & arg)
00251 {
00252 copy(arg);
00253 }
00254
00255 AREXPORT ArConfigArg &ArConfigArg::operator=(const ArConfigArg & arg)
00256 {
00257 if (this != &arg)
00258 {
00259 copy(arg);
00260 }
00261 return *this;
00262 }
00263
00264 void ArConfigArg::copy(const ArConfigArg &arg)
00265 {
00266 clear();
00267 set(arg.myType,
00268 arg.myName.c_str(),
00269 arg.myDescription.c_str());
00270
00271 myIntType = arg.myIntType;
00272 myOwnPointedTo = arg.myOwnPointedTo;
00273 if (arg.myOwnPointedTo && arg.myIntPointer != NULL)
00274 {
00275 myIntPointer = new int;
00276 *myIntPointer = *arg.myIntPointer;
00277 }
00278 else
00279 {
00280 myIntPointer = arg.myIntPointer;
00281 }
00282 if (arg.myOwnPointedTo && arg.myIntShortPointer != NULL)
00283 {
00284 myIntShortPointer = new short;
00285 *myIntShortPointer = *arg.myIntShortPointer;
00286 }
00287 else
00288 {
00289 myIntShortPointer = arg.myIntShortPointer;
00290 }
00291 if (arg.myOwnPointedTo && arg.myIntUnsignedShortPointer != NULL)
00292 {
00293 myIntUnsignedShortPointer = new unsigned short;
00294 *myIntUnsignedShortPointer = *arg.myIntUnsignedShortPointer;
00295 }
00296 else
00297 {
00298 myIntUnsignedShortPointer = arg.myIntUnsignedShortPointer;
00299 }
00300 if (arg.myOwnPointedTo && arg.myIntUnsignedCharPointer != NULL)
00301 {
00302 myIntUnsignedCharPointer = new unsigned char;
00303 *myIntUnsignedCharPointer = *arg.myIntUnsignedCharPointer;
00304 }
00305 else
00306 {
00307 myIntUnsignedCharPointer = arg.myIntUnsignedCharPointer;
00308 }
00309 if (arg.myOwnPointedTo && arg.myDoublePointer != NULL)
00310 {
00311 myDoublePointer = new double;
00312 *myDoublePointer = *arg.myDoublePointer;
00313 }
00314 else
00315 {
00316 myDoublePointer = arg.myDoublePointer;
00317 }
00318 if (arg.myOwnPointedTo && arg.myBoolPointer != NULL)
00319 {
00320 myBoolPointer = new bool;
00321 *myBoolPointer = *arg.myBoolPointer;
00322 }
00323 else
00324 {
00325 myBoolPointer = arg.myBoolPointer;
00326 }
00327 myStringPointer = arg.myStringPointer;
00328 myMinInt = arg.myMinInt;
00329 myMaxInt = arg.myMaxInt;
00330 myMinDouble = arg.myMinDouble;
00331 myMaxDouble = arg.myMaxDouble;
00332 myMaxStrLen = arg.myMaxStrLen;
00333 mySetFunctor = arg.mySetFunctor;
00334 myGetFunctor = arg.myGetFunctor;
00335 myUsingOwnedString = arg.myUsingOwnedString;
00336 myString = arg.myString;
00337 myConfigPriority = arg.myConfigPriority;
00338 myIgnoreBounds = arg.myIgnoreBounds;
00339 myDisplayHint = arg.myDisplayHint;
00340 }
00341
00342 AREXPORT ArConfigArg::~ArConfigArg()
00343 {
00344 clear();
00345 }
00346
00347 void ArConfigArg::clear(void)
00348 {
00349 set(INVALID, "", "");
00350
00351 myIntType = INT_NOT;
00352 myOwnPointedTo = false;
00353 if (myOwnPointedTo && myIntPointer != NULL)
00354 delete myIntPointer;
00355 myIntPointer = NULL;
00356 if (myOwnPointedTo && myIntShortPointer != NULL)
00357 delete myIntShortPointer;
00358 myIntShortPointer = NULL;
00359 if (myOwnPointedTo && myIntUnsignedShortPointer != NULL)
00360 delete myIntUnsignedShortPointer;
00361 myIntUnsignedShortPointer = NULL;
00362 if (myOwnPointedTo && myIntUnsignedCharPointer != NULL)
00363 delete myIntUnsignedCharPointer;
00364 myIntUnsignedCharPointer = NULL;
00365 if (myOwnPointedTo && myDoublePointer != NULL)
00366 delete myDoublePointer;
00367 myDoublePointer = NULL;
00368 if (myOwnPointedTo && myBoolPointer != NULL)
00369 delete myBoolPointer;
00370 myBoolPointer = NULL;
00371 myStringPointer = NULL;
00372 myUsingOwnedString = false;
00373 myString = "";
00374 myMinInt = INT_MIN;
00375 myMaxInt = INT_MAX;
00376 myMinDouble = -HUGE_VAL;
00377 myMaxDouble = HUGE_VAL;
00378 myMaxStrLen = 0;
00379 mySetFunctor = NULL;
00380 myGetFunctor = NULL;
00381 myConfigPriority = ArPriority::NORMAL;
00382 myIgnoreBounds = false;
00383 myDisplayHint = "";
00384 myValueSet = false;
00385 }
00386
00387 void ArConfigArg::set(ArConfigArg::Type type,
00388 const char *name,
00389 const char *description)
00390 {
00391 myType = type;
00392 myName = name;
00393 myDescription = description;
00394 }
00395
00402 AREXPORT ArConfigArg::Type ArConfigArg::getType(void) const
00403 {
00404 return myType;
00405 }
00406
00407 AREXPORT int ArConfigArg::getMinInt(void) const
00408 {
00409 return myMinInt;
00410 }
00411
00412 AREXPORT int ArConfigArg::getMaxInt(void) const
00413 {
00414 return myMaxInt;
00415 }
00416
00417 AREXPORT double ArConfigArg::getMinDouble(void) const
00418 {
00419 return myMinDouble;
00420 }
00421
00422 AREXPORT double ArConfigArg::getMaxDouble(void) const
00423 {
00424 return myMaxDouble;
00425 }
00426
00427 AREXPORT const char *ArConfigArg::getName(void) const
00428 {
00429 return myName.c_str();
00430 }
00431
00432 AREXPORT const char *ArConfigArg::getDescription(void) const
00433 {
00434 return myDescription.c_str();
00435 }
00436
00437 AREXPORT int ArConfigArg::getInt(void) const
00438 {
00439
00440 if (myIntPointer != NULL)
00441 return *myIntPointer;
00442 else if (myIntShortPointer != NULL)
00443 return *myIntShortPointer;
00444 else if (myIntUnsignedShortPointer != NULL)
00445 return *myIntUnsignedShortPointer;
00446 else if (myIntUnsignedCharPointer != NULL)
00447 return *myIntUnsignedCharPointer;
00448 else
00449 return 0;
00450 }
00451
00452 AREXPORT double ArConfigArg::getDouble(void) const
00453 {
00454 if (myDoublePointer != NULL)
00455 return *myDoublePointer;
00456 else
00457 return 0;
00458 }
00459
00460 AREXPORT bool ArConfigArg::getBool(void) const
00461 {
00462 if (myBoolPointer != NULL)
00463 return *myBoolPointer;
00464 else
00465 return false;
00466 }
00467
00468 AREXPORT const char *ArConfigArg::getString(void) const
00469 {
00470 if (myUsingOwnedString)
00471 return myString.c_str();
00472 else if (myStringPointer != NULL)
00473 return myStringPointer;
00474 else
00475 return NULL;
00476 }
00477
00478 AREXPORT const std::list<ArArgumentBuilder *> *ArConfigArg::getArgsWithFunctor(void) const
00479 {
00480 if (myGetFunctor == NULL)
00481 return NULL;
00482 else
00483 return myGetFunctor->invokeR();
00484 }
00485
00486 AREXPORT bool ArConfigArg::setInt(int val, char *errorBuffer,
00487 size_t errorBufferLen, bool doNotSet)
00488 {
00489 myValueSet = true;
00490 if (!myIgnoreBounds && val < myMinInt)
00491 {
00492 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setInt value %d below range [%d, %d]", getName(), val, myMinInt, myMaxInt);
00493 if (errorBuffer != NULL)
00494 snprintf(errorBuffer, errorBufferLen, "%s value of %d is below minimum of %d.", getName(), val, myMinInt);
00495 return false;
00496 }
00497 if (!myIgnoreBounds && val > myMaxInt)
00498 {
00499 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setInt value %d above range [%d, %d]", getName(), val, myMinInt, myMaxInt);
00500 if (errorBuffer != NULL)
00501 snprintf(errorBuffer, errorBufferLen, "%s value of %d is above maximum of %d.", getName(), val, myMaxInt);
00502 return false;
00503 }
00504 if ((myIntType == INT_INT && myIntPointer == NULL) ||
00505 (myIntType == INT_SHORT && myIntShortPointer == NULL) ||
00506 (myIntType == INT_UNSIGNED_SHORT &&
00507 myIntUnsignedShortPointer == NULL) ||
00508 (myIntType == INT_UNSIGNED_CHAR && myIntUnsignedCharPointer == NULL))
00509 {
00510 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setInt called with NULL int pointer.", getName());
00511 if (errorBuffer != NULL)
00512 snprintf(errorBuffer, errorBufferLen, "%s pointer is NULL.", getName());
00513 return false;
00514 }
00515
00516 if (!doNotSet)
00517 {
00518 if (myIntType == INT_INT)
00519 *myIntPointer = val;
00520 else if (myIntType == INT_SHORT)
00521 *myIntShortPointer = val;
00522 else if (myIntType == INT_UNSIGNED_SHORT)
00523 *myIntUnsignedShortPointer = val;
00524 else if (myIntType == INT_UNSIGNED_CHAR)
00525 *myIntUnsignedCharPointer = val;
00526 else
00527 {
00528 ArLog::log(ArLog::Normal, "ArConfigArg of %s: int is bad type.", getName());
00529 if (errorBuffer != NULL)
00530 snprintf(errorBuffer, errorBufferLen, "%s int is bad type (%d).", getName(), myIntType);
00531 return false;
00532 }
00533 }
00534 return true;
00535 }
00536
00537 AREXPORT bool ArConfigArg::setDouble(double val, char *errorBuffer,
00538 size_t errorBufferLen, bool doNotSet)
00539 {
00540 myValueSet = true;
00541 if (!myIgnoreBounds && val < myMinDouble)
00542 {
00543 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setDouble value %g below range [%g, %g]", getName(), val, myMinDouble, myMaxDouble);
00544 if (errorBuffer != NULL)
00545 snprintf(errorBuffer, errorBufferLen, "%s value of %g is below minimum of %g.", getName(), val, myMinDouble);
00546 return false;
00547 }
00548 if (!myIgnoreBounds && val > myMaxDouble)
00549 {
00550 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setDouble value %g above range [%g, %g]", getName(), val, myMinDouble, myMaxDouble);
00551 if (errorBuffer != NULL)
00552 snprintf(errorBuffer, errorBufferLen, "%s value of %g is above maximum of %g.", getName(), val, myMaxDouble);
00553 return false;
00554 }
00555 if (myDoublePointer == NULL)
00556 {
00557 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setDouble called with NULL pointer.", getName());
00558 if (errorBuffer != NULL)
00559 snprintf(errorBuffer, errorBufferLen, "%s pointer is NULL.", getName());
00560 return false;
00561 }
00562
00563 if (!doNotSet)
00564 *myDoublePointer = val;
00565 return true;
00566 }
00567
00568
00569 AREXPORT bool ArConfigArg::setBool(bool val, char *errorBuffer,
00570 size_t errorBufferLen, bool doNotSet)
00571 {
00572 myValueSet = true;
00573 if (myBoolPointer == NULL)
00574 {
00575 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setBool called with NULL pointer.", getName());
00576 if (errorBuffer != NULL)
00577 snprintf(errorBuffer, errorBufferLen, "%s pointer is NULL.", getName());
00578 return false;
00579 }
00580 if (!doNotSet)
00581 *myBoolPointer = val;
00582 return true;
00583 }
00584
00585 AREXPORT bool ArConfigArg::setString(const char *str, char *errorBuffer,
00586 size_t errorBufferLen, bool doNotSet)
00587 {
00588 myValueSet = true;
00589 size_t len;
00590 if (myUsingOwnedString)
00591 {
00592 myString = str;
00593 return true;
00594 }
00595 if (myStringPointer == NULL)
00596 {
00597 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setString called with NULL pointer.", getName());
00598 if (errorBuffer != NULL)
00599 snprintf(errorBuffer, errorBufferLen, "%s pointer is NULL.", getName());
00600 return false;
00601 }
00602
00603
00604 if ((len = strlen(str)) >= myMaxStrLen)
00605 {
00606 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setString called with argument %d long, when max length is %d.", getName(), len, myMaxStrLen);
00607 if (errorBuffer != NULL)
00608 snprintf(errorBuffer, errorBufferLen, "%s string is %d long when max length is %d.", getName(), len, myMaxStrLen);
00609 return false;
00610 }
00611 if (!doNotSet)
00612 strcpy(myStringPointer, str);
00613 return true;
00614 }
00615
00616 AREXPORT bool ArConfigArg::setArgWithFunctor(ArArgumentBuilder *argument,
00617 char *errorBuffer,
00618 size_t errorBufferLen,
00619 bool doNotSet)
00620 {
00621 myValueSet = true;
00622 bool ret = true;
00623 if (mySetFunctor == NULL)
00624 {
00625 ArLog::log(ArLog::Normal, "ArConfigArg of %s: setArgWithFunctor called with NULL pointer.", getName());
00626 if (errorBuffer != NULL)
00627 snprintf(errorBuffer, errorBufferLen, "%s pointer is NULL.", getName());
00628 return false;
00629 }
00630 if (!doNotSet)
00631 ret = mySetFunctor->invokeR(argument);
00632 return ret;
00633 }
00634
00635
00636 AREXPORT void ArConfigArg::log(bool verbose) const
00637 {
00638 std::list<ArArgumentBuilder *>::const_iterator it;
00639 const std::list<ArArgumentBuilder *> *argList;
00640 std::string intType;
00641
00642 switch (getType())
00643 {
00644 case ArConfigArg::INVALID:
00645 ArLog::log(ArLog::Terse,
00646 "\tType: %10s. This argument was not created properly.",
00647 "invalid");
00648 case ArConfigArg::INT:
00649 if (myIntType == INT_NOT)
00650 intType = "Not";
00651 else if (myIntType == INT_INT)
00652 intType = "Int";
00653 else if (myIntType == INT_SHORT)
00654 intType = "Short";
00655 else if (myIntType == INT_UNSIGNED_SHORT)
00656 intType = "Unsigned Short";
00657 else if (myIntType == INT_UNSIGNED_CHAR)
00658 intType = "Unsigned Short";
00659 else
00660 intType = "Unknown";
00661 ArLog::log(ArLog::Terse, "\tType: %10s name: %12s value: %d intType: %s",
00662 "int", getName(), getInt(), intType.c_str());
00663 if (strlen(getDescription()) != 0)
00664 ArLog::log(ArLog::Terse, "\t\tDescription: %s",
00665 getDescription());
00666 if (verbose)
00667 ArLog::log(ArLog::Terse, "\t\tMin: %10d Max: %10d",
00668 myMinInt, myMaxInt);
00669 break;
00670 case ArConfigArg::DOUBLE:
00671 ArLog::log(ArLog::Terse, "\tType: %10s name: %12s value: %f", "double",
00672 getName(), getDouble());
00673 if (strlen(getDescription()) != 0)
00674 ArLog::log(ArLog::Terse, "\t\tDescription: %s",
00675 getDescription());
00676 if (verbose)
00677 ArLog::log(ArLog::Terse, "\t\tMin: %10g Max: %10g",
00678 myMinDouble, myMaxDouble);
00679 break;
00680 case ArConfigArg::STRING:
00681 ArLog::log(ArLog::Terse, "\tType: %10s name: %12s value: %s", "string",
00682 getName(), getString());
00683 if (strlen(getDescription()) != 0)
00684 ArLog::log(ArLog::Terse, "\t\tDescription: %s",
00685 getDescription());
00686 if (verbose)
00687 ArLog::log(ArLog::Terse, "\t\tLength: %d", myMaxStrLen);
00688 break;
00689 case ArConfigArg::BOOL:
00690 ArLog::log(ArLog::Terse, "\tType: %10s name: %12s value: %d", "bool",
00691 getName(), getBool());
00692 if (strlen(getDescription()) != 0)
00693 ArLog::log(ArLog::Terse, "\t\tDescription: %s",
00694 getDescription());
00695 break;
00696 case ArConfigArg::FUNCTOR:
00697 ArLog::log(ArLog::Terse, "\tType: %10s name: %12s",
00698 "functor", getName());
00699 if (strlen(getDescription()) != 0)
00700 ArLog::log(ArLog::Terse, "\t\tDescription: %s",
00701 getDescription());
00702 ArLog::log(ArLog::Terse, "\t\tValues:");
00703 argList = myGetFunctor->invokeR();
00704 for (it = argList->begin(); it != argList->end(); it++)
00705 ArLog::log(ArLog::Terse, "\t\t\t%s", (*it)->getFullString());
00706 break;
00707 case ArConfigArg::DESCRIPTION_HOLDER:
00708 ArLog::log(ArLog::Terse, "\tType: %20s Description: %s",
00709 "description_holder", getDescription());
00710
00711 default:
00712 ArLog::log(ArLog::Terse,
00713 "\tType: %10s. This type doesn't have a case in ArConfigArg::print.",
00714 "unknown");
00715 break;
00716 }
00717
00718 ArLog::log(ArLog::Terse, "\t\tPriority: %s",
00719 ArPriority::getPriorityName(myConfigPriority));
00720 }
00721
00725 AREXPORT ArPriority::Priority ArConfigArg::getConfigPriority(void) const
00726 {
00727 return myConfigPriority;
00728 }
00729
00734 AREXPORT void ArConfigArg::setConfigPriority(ArPriority::Priority priority)
00735 {
00736 myConfigPriority = priority;
00737 }
00738
00739
00740 AREXPORT const char *ArConfigArg::getDisplayHint() const
00741 {
00742 if (myDisplayHint.length() > 0) {
00743 return myDisplayHint.c_str();
00744 }
00745 else {
00746 return NULL;
00747 }
00748 }
00749
00750
00799 AREXPORT void ArConfigArg::setDisplayHint(const char *hintText)
00800 {
00801 if (hintText != NULL) {
00802 myDisplayHint = hintText;
00803 }
00804 else {
00805 myDisplayHint = "";
00806 }
00807 }
00808
00809
00810
00815 AREXPORT void ArConfigArg::setIgnoreBounds(bool ignoreBounds)
00816 {
00817 myIgnoreBounds = ignoreBounds;
00818 }
00819
00820 AREXPORT bool ArConfigArg::isValueEqual(const ArConfigArg &other) const
00821 {
00822 if (strcmp(getName(), other.getName()) != 0) {
00823 return false;
00824 }
00825 Type t = getType();
00826 if (t != other.getType()) {
00827 return false;
00828 }
00829 bool isEqual = false;
00830
00831 switch (t) {
00832 case INVALID:
00833 isEqual = true;
00834 break;
00835
00836 case INT:
00837 isEqual = (getInt() == other.getInt());
00838 break;
00839
00840 case DOUBLE:
00841 isEqual = (getDouble() == other.getDouble());
00842 break;
00843
00844 case STRING:
00845 isEqual = (strcmp(getString(), other.getString()) == 0);
00846 break;
00847
00848 case BOOL:
00849 isEqual = (getBool() == other.getBool());
00850 break;
00851
00852 case SEPARATOR:
00853 isEqual = true;
00854
00855 case FUNCTOR:
00856
00857
00858 isEqual = ((mySetFunctor == other.mySetFunctor) &&
00859 (myGetFunctor == other.myGetFunctor));
00860 break;
00861
00862 case DESCRIPTION_HOLDER:
00863 isEqual = (strcmp(getDescription(), other.getDescription()) == 0);
00864 break;
00865
00866 default:
00867 isEqual = false;
00868 break;
00869
00870 }
00871
00872 return isEqual;
00873
00874 }