00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef CONFIGURATIONEXCEPTIONS_H
00022 #define CONFIGURATIONEXCEPTIONS_H
00023
00024 #include <typeinfo>
00025 #include <exception>
00026 #include <cstring>
00027 #include <cstdio>
00028 #include "baseexception.h"
00029
00030
00031
00032 #if defined(_MSC_VER)
00033 #pragma warning(push)
00034 #pragma warning(disable:4996)
00035 #endif
00036
00037 namespace farsa {
00038
00039
00040
00041
00042
00043
00048 class FARSA_CONF_TEMPLATE ClassNameNotRegisteredException : public BaseException
00049 {
00050 public:
00058 ClassNameNotRegisteredException(const char* className) throw() :
00059 BaseException()
00060 {
00061 strncpy(m_className, className, 256);
00062 m_className[255] = '\0';
00063 sprintf(m_errorMessage, "No class \"%s\" registered into Factory", m_className);
00064 m_errorMessage[511] = '\0';
00065 }
00066
00072 ClassNameNotRegisteredException(const ClassNameNotRegisteredException& other) throw() :
00073 BaseException(other)
00074 {
00075 strncpy(m_className, other.m_className, 256);
00076 m_className[255] = '\0';
00077 strncpy(m_errorMessage, other.m_errorMessage, 512);
00078 m_errorMessage[511] = '\0';
00079 }
00080
00086 ClassNameNotRegisteredException& operator=(const ClassNameNotRegisteredException& other) throw()
00087 {
00088 if (&other == this) {
00089 return *this;
00090 }
00091
00092 BaseException::operator=(other);
00093 strncpy(m_className, other.m_className, 256);
00094 m_className[255] = '\0';
00095 strncpy(m_errorMessage, other.m_errorMessage, 512);
00096 m_errorMessage[511] = '\0';
00097
00098 return *this;
00099 }
00100
00104 virtual ~ClassNameNotRegisteredException() throw()
00105 {
00106 }
00107
00113 virtual const char *what() const throw()
00114 {
00115 return m_errorMessage;
00116 }
00117
00123 const char *className() const throw()
00124 {
00125 return m_className;
00126 }
00127
00132 EXCEPTION_HELPER_FUNCTIONS(ClassNameNotRegisteredException)
00133
00134 private:
00138 char m_className[256];
00139
00143 char m_errorMessage[512];
00144 };
00145
00150 class FARSA_CONF_TEMPLATE CannotConvertToTypeException : public BaseException
00151 {
00152 public:
00160 CannotConvertToTypeException(const char* className, const std::type_info& destTypeId) throw() :
00161 BaseException(),
00162 m_destTypeId(&destTypeId)
00163 {
00164 strncpy(m_className, className, 256);
00165 m_className[255] = '\0';
00166
00167 char tmp[256];
00168 strncpy(tmp, m_destTypeId->name(), 256);
00169 tmp[255] = '\0';
00170 sprintf(m_errorMessage, "Impossible to convert object of type \"%s\" to type \"%s\"", m_className, tmp);
00171 m_errorMessage[1023] = '\0';
00172 }
00173
00179 CannotConvertToTypeException(const CannotConvertToTypeException& other) throw() :
00180 BaseException(other),
00181 m_destTypeId(other.m_destTypeId)
00182 {
00183 strncpy(m_className, other.m_className, 256);
00184 m_className[255] = '\0';
00185 strncpy(m_errorMessage, other.m_errorMessage, 1024);
00186 m_errorMessage[1023] = '\0';
00187 }
00188
00194 CannotConvertToTypeException& operator=(const CannotConvertToTypeException& other) throw()
00195 {
00196 if (&other == this) {
00197 return *this;
00198 }
00199
00200 BaseException::operator=(other);
00201 strncpy(m_className, other.m_className, 256);
00202 m_className[255] = '\0';
00203 m_destTypeId = other.m_destTypeId;
00204 strncpy(m_errorMessage, other.m_errorMessage, 1024);
00205 m_errorMessage[1023] = '\0';
00206
00207 return *this;
00208 }
00209
00213 virtual ~CannotConvertToTypeException() throw()
00214 {
00215 }
00216
00222 virtual const char *what() const throw()
00223 {
00224 return m_errorMessage;
00225 }
00226
00232 const char *className() const throw()
00233 {
00234 return m_className;
00235 }
00236
00244 const std::type_info& destTypeName() const throw()
00245 {
00246 return *m_destTypeId;
00247 }
00248
00253 EXCEPTION_HELPER_FUNCTIONS(CannotConvertToTypeException)
00254
00255 private:
00259 char m_className[256];
00260
00265 const std::type_info* m_destTypeId;
00266
00270 char m_errorMessage[1024];
00271 };
00272
00277 class FARSA_CONF_TEMPLATE CannotFindTypeParameterException : public BaseException
00278 {
00279 public:
00286 CannotFindTypeParameterException(const char* groupName) throw() :
00287 BaseException()
00288 {
00289 strncpy(m_groupName, groupName, 256);
00290 m_groupName[255] = '\0';
00291 sprintf(m_errorMessage, "No \"type\" parameter in the given parameter object under the \"%s\" group", m_groupName);
00292 m_errorMessage[511] = '\0';
00293 }
00294
00300 CannotFindTypeParameterException(const CannotFindTypeParameterException& other) throw() :
00301 BaseException(other)
00302 {
00303 strncpy(m_groupName, other.m_groupName, 256);
00304 m_groupName[255] = '\0';
00305 strncpy(m_errorMessage, other.m_errorMessage, 512);
00306 m_errorMessage[511] = '\0';
00307 }
00308
00314 CannotFindTypeParameterException& operator=(const CannotFindTypeParameterException& other) throw()
00315 {
00316 if (&other == this) {
00317 return *this;
00318 }
00319
00320 BaseException::operator=(other);
00321 strncpy(m_groupName, other.m_groupName, 256);
00322 m_groupName[255] = '\0';
00323 strncpy(m_errorMessage, other.m_errorMessage, 512);
00324 m_errorMessage[511] = '\0';
00325
00326 return *this;
00327 }
00328
00332 virtual ~CannotFindTypeParameterException() throw()
00333 {
00334 }
00335
00341 virtual const char *what() const throw()
00342 {
00343 return m_errorMessage;
00344 }
00345
00351 const char *groupName() const throw()
00352 {
00353 return m_groupName;
00354 }
00355
00360 EXCEPTION_HELPER_FUNCTIONS(CannotFindTypeParameterException)
00361
00362 private:
00367 char m_groupName[256];
00368
00372 char m_errorMessage[512];
00373 };
00374
00379 class FARSA_CONF_TEMPLATE PrefixNotGroupException : public BaseException
00380 {
00381 public:
00387 PrefixNotGroupException(const char* prefix) throw() :
00388 BaseException()
00389 {
00390 strncpy(m_prefix, prefix, 256);
00391 m_prefix[255] = '\0';
00392 sprintf(m_errorMessage, "The provided prefix (\"%s\") is not a group name, cannot ceate object", m_prefix);
00393 m_errorMessage[511] = '\0';
00394 }
00395
00401 PrefixNotGroupException(const PrefixNotGroupException& other) throw() :
00402 BaseException(other)
00403 {
00404 strncpy(m_prefix, other.m_prefix, 256);
00405 m_prefix[255] = '\0';
00406 strncpy(m_errorMessage, other.m_errorMessage, 512);
00407 m_errorMessage[511] = '\0';
00408 }
00409
00415 PrefixNotGroupException& operator=(const PrefixNotGroupException& other) throw()
00416 {
00417 if (&other == this) {
00418 return *this;
00419 }
00420
00421 BaseException::operator=(other);
00422 strncpy(m_prefix, other.m_prefix, 256);
00423 m_prefix[255] = '\0';
00424 strncpy(m_errorMessage, other.m_errorMessage, 512);
00425 m_errorMessage[511] = '\0';
00426
00427 return *this;
00428 }
00429
00433 virtual ~PrefixNotGroupException() throw()
00434 {
00435 }
00436
00442 virtual const char *what() const throw()
00443 {
00444 return m_errorMessage;
00445 }
00446
00452 const char *prefix() const throw()
00453 {
00454 return m_prefix;
00455 }
00456
00461 EXCEPTION_HELPER_FUNCTIONS(PrefixNotGroupException)
00462
00463 private:
00467 char m_prefix[256];
00468
00472 char m_errorMessage[512];
00473 };
00474
00479 class FARSA_CONF_TEMPLATE CyclicDependencyException : public BaseException
00480 {
00481 public:
00489 CyclicDependencyException(const char* groupName) throw() :
00490 BaseException()
00491 {
00492 strncpy(m_groupName, groupName, 256);
00493 m_groupName[255] = '\0';
00494 sprintf(m_errorMessage, "Cyclic dependency discovered when creating/configuring object for group \"%s\"", m_groupName);
00495 m_errorMessage[511] = '\0';
00496 }
00497
00503 CyclicDependencyException(const CyclicDependencyException& other) throw() :
00504 BaseException(other)
00505 {
00506 strncpy(m_groupName, other.m_groupName, 256);
00507 m_groupName[255] = '\0';
00508 strncpy(m_errorMessage, other.m_errorMessage, 512);
00509 m_errorMessage[511] = '\0';
00510 }
00511
00517 CyclicDependencyException& operator=(const CyclicDependencyException& other) throw()
00518 {
00519 if (&other == this) {
00520 return *this;
00521 }
00522
00523 BaseException::operator=(other);
00524 strncpy(m_groupName, other.m_groupName, 256);
00525 m_groupName[255] = '\0';
00526 strncpy(m_errorMessage, other.m_errorMessage, 512);
00527 m_errorMessage[511] = '\0';
00528
00529 return *this;
00530 }
00531
00535 virtual ~CyclicDependencyException() throw()
00536 {
00537 }
00538
00544 virtual const char *what() const throw()
00545 {
00546 return m_errorMessage;
00547 }
00548
00555 const char *groupName() const throw()
00556 {
00557 return m_groupName;
00558 }
00559
00564 EXCEPTION_HELPER_FUNCTIONS(CyclicDependencyException)
00565
00566 private:
00570 char m_groupName[256];
00571
00575 char m_errorMessage[512];
00576 };
00577
00581 class FARSA_CONF_TEMPLATE CopyDuringObjectCreationException : public BaseException
00582 {
00583 public:
00587 CopyDuringObjectCreationException() throw() :
00588 BaseException()
00589 {
00590 sprintf(m_errorMessage, "Trying to perform a copy of ConfigurationParameter objects during calls to getObjectFromGroup");
00591 m_errorMessage[255] = '\0';
00592 }
00593
00599 CopyDuringObjectCreationException(const CopyDuringObjectCreationException& other) throw() :
00600 BaseException(other)
00601 {
00602 strncpy(m_errorMessage, other.m_errorMessage, 256);
00603 m_errorMessage[255] = '\0';
00604 }
00605
00611 CopyDuringObjectCreationException& operator=(const CopyDuringObjectCreationException& other) throw()
00612 {
00613 if (&other == this) {
00614 return *this;
00615 }
00616
00617 BaseException::operator=(other);
00618 strncpy(m_errorMessage, other.m_errorMessage, 256);
00619 m_errorMessage[255] = '\0';
00620
00621 return *this;
00622 }
00623
00627 virtual ~CopyDuringObjectCreationException() throw()
00628 {
00629 }
00630
00636 virtual const char *what() const throw()
00637 {
00638 return m_errorMessage;
00639 }
00640
00645 EXCEPTION_HELPER_FUNCTIONS(CopyDuringObjectCreationException)
00646
00647 private:
00651 char m_errorMessage[256];
00652 };
00653
00659 class FARSA_CONF_TEMPLATE OtherObjectBeingCreatedException : public BaseException
00660 {
00661 public:
00670 OtherObjectBeingCreatedException(const char* groupName) throw() :
00671 BaseException()
00672 {
00673 strncpy(m_groupName, groupName, 256);
00674 m_groupName[255] = '\0';
00675 sprintf(m_errorMessage, "A new object is requested for group \"%s\" while another one is being created or has been created but not configured", m_groupName);
00676 m_errorMessage[511] = '\0';
00677 }
00678
00684 OtherObjectBeingCreatedException(const OtherObjectBeingCreatedException& other) throw() :
00685 BaseException(other)
00686 {
00687 strncpy(m_groupName, other.m_groupName, 256);
00688 m_groupName[255] = '\0';
00689 strncpy(m_errorMessage, other.m_errorMessage, 512);
00690 m_errorMessage[511] = '\0';
00691 }
00692
00698 OtherObjectBeingCreatedException& operator=(const OtherObjectBeingCreatedException& other) throw()
00699 {
00700 if (&other == this) {
00701 return *this;
00702 }
00703
00704 BaseException::operator=(other);
00705 strncpy(m_groupName, other.m_groupName, 256);
00706 m_groupName[255] = '\0';
00707 strncpy(m_errorMessage, other.m_errorMessage, 512);
00708 m_errorMessage[511] = '\0';
00709
00710 return *this;
00711 }
00712
00716 virtual ~OtherObjectBeingCreatedException() throw()
00717 {
00718 }
00719
00725 virtual const char *what() const throw()
00726 {
00727 return m_errorMessage;
00728 }
00729
00736 const char *groupName() const throw()
00737 {
00738 return m_groupName;
00739 }
00740
00745 EXCEPTION_HELPER_FUNCTIONS(OtherObjectBeingCreatedException)
00746
00747 private:
00751 char m_groupName[256];
00752
00756 char m_errorMessage[512];
00757 };
00758
00763 class FARSA_CONF_TEMPLATE NoRuntimeModifiableParameter : public BaseException
00764 {
00765 public:
00773 NoRuntimeModifiableParameter(const char* paramName) throw() :
00774 BaseException()
00775 {
00776 strncpy(m_paramName, paramName, 256);
00777 m_paramName[255] = '\0';
00778 sprintf(m_errorMessage, "The parameter \"%s\" is not marked as runtime modifiable", m_paramName);
00779 m_errorMessage[511] = '\0';
00780 }
00781
00787 NoRuntimeModifiableParameter(const NoRuntimeModifiableParameter& other) throw() :
00788 BaseException(other)
00789 {
00790 strncpy(m_paramName, other.m_paramName, 256);
00791 m_paramName[255] = '\0';
00792 strncpy(m_errorMessage, other.m_errorMessage, 512);
00793 m_errorMessage[511] = '\0';
00794 }
00795
00801 NoRuntimeModifiableParameter& operator=(const NoRuntimeModifiableParameter& other) throw()
00802 {
00803 if (&other == this) {
00804 return *this;
00805 }
00806
00807 BaseException::operator=(other);
00808 strncpy(m_paramName, other.m_paramName, 256);
00809 m_paramName[255] = '\0';
00810 strncpy(m_errorMessage, other.m_errorMessage, 512);
00811 m_errorMessage[511] = '\0';
00812
00813 return *this;
00814 }
00815
00819 virtual ~NoRuntimeModifiableParameter() throw()
00820 {
00821 }
00822
00828 virtual const char *what() const throw()
00829 {
00830 return m_errorMessage;
00831 }
00832
00838 const char *paramName() const throw()
00839 {
00840 return m_paramName;
00841 }
00842
00847 EXCEPTION_HELPER_FUNCTIONS(NoRuntimeModifiableParameter)
00848
00849 private:
00853 char m_paramName[256];
00854
00858 char m_errorMessage[512];
00859 };
00860
00865 class FARSA_CONF_TEMPLATE TypeMismatchOnSettingRuntimeModifiableParameter : public BaseException
00866 {
00867 public:
00879 TypeMismatchOnSettingRuntimeModifiableParameter(const char* paramName, const char* paramType, const char* requestType) throw() :
00880 BaseException()
00881 {
00882 strncpy(m_paramName, paramName, 256);
00883 m_paramName[255] = '\0';
00884 strncpy(m_paramType, paramType, 256);
00885 m_paramType[255] = '\0';
00886 strncpy(m_requestType, requestType, 256);
00887 m_requestType[255] = '\0';
00888 sprintf(m_errorMessage, "Type mismatch on setting parameter \"%s\" - expected \"%s\" - requested \"%s\"", m_paramName, m_paramType, m_requestType);
00889 m_errorMessage[1023] = '\0';
00890 }
00891
00897 TypeMismatchOnSettingRuntimeModifiableParameter(const TypeMismatchOnSettingRuntimeModifiableParameter& other) throw() :
00898 BaseException(other)
00899 {
00900 strncpy(m_paramName, other.m_paramName, 256);
00901 m_paramName[255] = '\0';
00902 strncpy(m_paramType, other.m_paramType, 256);
00903 m_paramType[255] = '\0';
00904 strncpy(m_requestType, other.m_requestType, 256);
00905 m_requestType[255] = '\0';
00906 strncpy(m_errorMessage, other.m_errorMessage, 1024);
00907 m_errorMessage[1023] = '\0';
00908 }
00909
00915 TypeMismatchOnSettingRuntimeModifiableParameter& operator=(const TypeMismatchOnSettingRuntimeModifiableParameter& other) throw()
00916 {
00917 if (&other == this) {
00918 return *this;
00919 }
00920
00921 BaseException::operator=(other);
00922 strncpy(m_paramName, other.m_paramName, 256);
00923 m_paramName[255] = '\0';
00924 strncpy(m_paramType, other.m_paramType, 256);
00925 m_paramType[255] = '\0';
00926 strncpy(m_requestType, other.m_requestType, 256);
00927 m_requestType[255] = '\0';
00928 strncpy(m_errorMessage, other.m_errorMessage, 1024);
00929 m_errorMessage[1023] = '\0';
00930
00931 return *this;
00932 }
00933
00937 virtual ~TypeMismatchOnSettingRuntimeModifiableParameter() throw()
00938 {
00939 }
00940
00946 virtual const char *what() const throw()
00947 {
00948 return m_errorMessage;
00949 }
00950
00956 const char *paramName() const throw()
00957 {
00958 return m_paramName;
00959 }
00960
00966 const char *paramType() const throw()
00967 {
00968 return m_paramType;
00969 }
00970
00976 const char *requestType() const throw()
00977 {
00978 return m_requestType;
00979 }
00980
00985 EXCEPTION_HELPER_FUNCTIONS(TypeMismatchOnSettingRuntimeModifiableParameter)
00986
00987 private:
00991 char m_paramName[256];
00992
00996 char m_paramType[256];
00997
01001 char m_requestType[256];
01002
01006 char m_errorMessage[1024];
01007 };
01008
01017 class FARSA_CONF_TEMPLATE UserDefinedCheckFailureException : public BaseException
01018 {
01019 public:
01033 UserDefinedCheckFailureException(const char* paramName, const char* paramValue, const char* description) throw() :
01034 BaseException()
01035 {
01036 strncpy(m_paramName, paramName, 256);
01037 m_paramName[255] = '\0';
01038 strncpy(m_paramValue, paramValue, 256);
01039 m_paramValue[255] = '\0';
01040 strncpy(m_description, description, 256);
01041 m_description[255] = '\0';
01042 sprintf(m_errorMessage, "User check failed on parameter \"%s\" - parameter value: \"%s\" - error description: %s", m_paramName, m_paramValue, m_description);
01043 m_errorMessage[1023] = '\0';
01044 }
01045
01051 UserDefinedCheckFailureException(const UserDefinedCheckFailureException& other) throw() :
01052 BaseException(other)
01053 {
01054 strncpy(m_paramName, other.m_paramName, 256);
01055 m_paramName[255] = '\0';
01056 strncpy(m_paramValue, other.m_paramValue, 256);
01057 m_paramValue[255] = '\0';
01058 strncpy(m_description, other.m_description, 256);
01059 m_description[255] = '\0';
01060 strncpy(m_errorMessage, other.m_errorMessage, 1024);
01061 m_errorMessage[1023] = '\0';
01062 }
01063
01069 UserDefinedCheckFailureException& operator=(const UserDefinedCheckFailureException& other) throw()
01070 {
01071 if (&other == this) {
01072 return *this;
01073 }
01074
01075 BaseException::operator=(other);
01076 strncpy(m_paramName, other.m_paramName, 256);
01077 m_paramName[255] = '\0';
01078 strncpy(m_paramValue, other.m_paramValue, 256);
01079 m_paramValue[255] = '\0';
01080 strncpy(m_description, other.m_description, 256);
01081 m_description[255] = '\0';
01082 strncpy(m_errorMessage, other.m_errorMessage, 1024);
01083 m_errorMessage[1023] = '\0';
01084
01085 return *this;
01086 }
01087
01091 virtual ~UserDefinedCheckFailureException() throw()
01092 {
01093 }
01094
01100 virtual const char *what() const throw()
01101 {
01102 return m_errorMessage;
01103 }
01104
01110 const char *paramName() const throw()
01111 {
01112 return m_paramName;
01113 }
01114
01120 const char *paramValue() const throw()
01121 {
01122 return m_paramValue;
01123 }
01124
01130 const char *description() const throw()
01131 {
01132 return m_description;
01133 }
01134
01139 EXCEPTION_HELPER_FUNCTIONS(UserDefinedCheckFailureException)
01140
01141 private:
01145 char m_paramName[256];
01146
01150 char m_paramValue[256];
01151
01155 char m_description[256];
01156
01160 char m_errorMessage[1024];
01161 };
01162
01166 class FARSA_CONF_TEMPLATE ResourceNotDeclaredException : public BaseException
01167 {
01168 public:
01176 ResourceNotDeclaredException(const char* resourceName) throw() :
01177 BaseException()
01178 {
01179 strncpy(m_resourceName, resourceName, 256);
01180 m_resourceName[255] = '\0';
01181 sprintf(m_errorMessage, "No resource declared with name \"%s\"", m_resourceName);
01182 m_errorMessage[511] = '\0';
01183 }
01184
01190 ResourceNotDeclaredException(const ResourceNotDeclaredException& other) throw() :
01191 BaseException(other)
01192 {
01193 strncpy(m_resourceName, other.m_resourceName, 256);
01194 m_resourceName[255] = '\0';
01195 strncpy(m_errorMessage, other.m_errorMessage, 512);
01196 m_errorMessage[511] = '\0';
01197 }
01198
01204 ResourceNotDeclaredException& operator=(const ResourceNotDeclaredException& other) throw()
01205 {
01206 if (&other == this) {
01207 return *this;
01208 }
01209
01210 BaseException::operator=(other);
01211 strncpy(m_resourceName, other.m_resourceName, 256);
01212 m_resourceName[255] = '\0';
01213 strncpy(m_errorMessage, other.m_errorMessage, 512);
01214 m_errorMessage[511] = '\0';
01215
01216 return *this;
01217 }
01218
01222 virtual ~ResourceNotDeclaredException() throw()
01223 {
01224 }
01225
01231 virtual const char *what() const throw()
01232 {
01233 return m_errorMessage;
01234 }
01235
01241 const char *resourceName() const throw()
01242 {
01243 return m_resourceName;
01244 }
01245
01250 EXCEPTION_HELPER_FUNCTIONS(ResourceNotDeclaredException)
01251
01252 private:
01256 char m_resourceName[256];
01257
01261 char m_errorMessage[512];
01262 };
01263
01271 class FARSA_CONF_TEMPLATE ResourceNotUsableException : public BaseException
01272 {
01273 public:
01281 ResourceNotUsableException(const char* resourceName) throw() :
01282 BaseException()
01283 {
01284 strncpy(m_resourceName, resourceName, 256);
01285 m_resourceName[255] = '\0';
01286 sprintf(m_errorMessage, "The resource named \"%s\" was not declared as usable before being used", m_resourceName);
01287 m_errorMessage[511] = '\0';
01288 }
01289
01295 ResourceNotUsableException(const ResourceNotUsableException& other) throw() :
01296 BaseException(other)
01297 {
01298 strncpy(m_resourceName, other.m_resourceName, 256);
01299 m_resourceName[255] = '\0';
01300 strncpy(m_errorMessage, other.m_errorMessage, 512);
01301 m_errorMessage[511] = '\0';
01302 }
01303
01309 ResourceNotUsableException& operator=(const ResourceNotUsableException& other) throw()
01310 {
01311 if (&other == this) {
01312 return *this;
01313 }
01314
01315 BaseException::operator=(other);
01316 strncpy(m_resourceName, other.m_resourceName, 256);
01317 m_resourceName[255] = '\0';
01318 strncpy(m_errorMessage, other.m_errorMessage, 512);
01319 m_errorMessage[511] = '\0';
01320
01321 return *this;
01322 }
01323
01327 virtual ~ResourceNotUsableException() throw()
01328 {
01329 }
01330
01336 virtual const char *what() const throw()
01337 {
01338 return m_errorMessage;
01339 }
01340
01346 const char *resourceName() const throw()
01347 {
01348 return m_resourceName;
01349 }
01350
01355 EXCEPTION_HELPER_FUNCTIONS(ResourceNotUsableException)
01356
01357 private:
01361 char m_resourceName[256];
01362
01366 char m_errorMessage[512];
01367 };
01368
01373 class FARSA_CONF_TEMPLATE ResourceTypeMismatchException : public BaseException
01374 {
01375 public:
01386 ResourceTypeMismatchException(const char* resourceName, const char* typeName) throw() :
01387 BaseException()
01388 {
01389 strncpy(m_resourceName, resourceName, 256);
01390 m_resourceName[255] = '\0';
01391 strncpy(m_typeName, typeName, 256);
01392 m_typeName[255] = '\0';
01393 sprintf(m_errorMessage, "Wrong type when requesting a resource; The type of the resource \"%s\" is not \"%s\"", m_resourceName, m_typeName);
01394 m_errorMessage[1023] = '\0';
01395 }
01396
01402 ResourceTypeMismatchException(const ResourceTypeMismatchException& other) throw() :
01403 BaseException(other)
01404 {
01405 strncpy(m_resourceName, other.m_resourceName, 256);
01406 m_resourceName[255] = '\0';
01407 strncpy(m_typeName, other.m_typeName, 256);
01408 m_typeName[255] = '\0';
01409 strncpy(m_errorMessage, other.m_errorMessage, 1024);
01410 m_errorMessage[1023] = '\0';
01411 }
01412
01418 ResourceTypeMismatchException& operator=(const ResourceTypeMismatchException& other) throw()
01419 {
01420 if (&other == this) {
01421 return *this;
01422 }
01423
01424 BaseException::operator=(other);
01425 strncpy(m_resourceName, other.m_resourceName, 256);
01426 m_resourceName[255] = '\0';
01427 strncpy(m_typeName, other.m_typeName, 256);
01428 m_typeName[255] = '\0';
01429 strncpy(m_errorMessage, other.m_errorMessage, 1024);
01430 m_errorMessage[1023] = '\0';
01431
01432 return *this;
01433 }
01434
01438 virtual ~ResourceTypeMismatchException() throw()
01439 {
01440 }
01441
01447 virtual const char *what() const throw()
01448 {
01449 return m_errorMessage;
01450 }
01451
01457 const char *resourceName() const throw()
01458 {
01459 return m_resourceName;
01460 }
01461
01467 const char *typeName() const throw()
01468 {
01469 return m_typeName;
01470 }
01471
01476 EXCEPTION_HELPER_FUNCTIONS(ResourceTypeMismatchException)
01477
01478 private:
01482 char m_resourceName[256];
01483
01487 char m_typeName[256];
01488
01492 char m_errorMessage[1024];
01493 };
01494
01504 class FARSA_CONF_TEMPLATE UserRequiredResourceMissingException : public BaseException
01505 {
01506 public:
01517 UserRequiredResourceMissingException(const char* resourceName, const char* description) throw() :
01518 BaseException()
01519 {
01520 strncpy(m_resourceName, resourceName, 256);
01521 m_resourceName[255] = '\0';
01522 strncpy(m_description, description, 256);
01523 m_description[255] = '\0';
01524 sprintf(m_errorMessage, "The user requested a resource named \"%s\" which cannot be found. Error description: %s", m_resourceName, m_description);
01525 m_errorMessage[1023] = '\0';
01526 }
01527
01533 UserRequiredResourceMissingException(const UserRequiredResourceMissingException& other) throw() :
01534 BaseException(other)
01535 {
01536 strncpy(m_resourceName, other.m_resourceName, 256);
01537 m_resourceName[255] = '\0';
01538 strncpy(m_description, other.m_description, 256);
01539 m_description[255] = '\0';
01540 strncpy(m_errorMessage, other.m_errorMessage, 1024);
01541 m_errorMessage[1023] = '\0';
01542 }
01543
01549 UserRequiredResourceMissingException& operator=(const UserRequiredResourceMissingException& other) throw()
01550 {
01551 if (&other == this) {
01552 return *this;
01553 }
01554
01555 BaseException::operator=(other);
01556 strncpy(m_resourceName, other.m_resourceName, 256);
01557 m_resourceName[255] = '\0';
01558 strncpy(m_description, other.m_description, 256);
01559 m_description[255] = '\0';
01560 strncpy(m_errorMessage, other.m_errorMessage, 1024);
01561 m_errorMessage[1023] = '\0';
01562
01563 return *this;
01564 }
01565
01569 virtual ~UserRequiredResourceMissingException() throw()
01570 {
01571 }
01572
01578 virtual const char *what() const throw()
01579 {
01580 return m_errorMessage;
01581 }
01582
01588 const char *resourceName() const throw()
01589 {
01590 return m_resourceName;
01591 }
01592
01598 const char *description() const throw()
01599 {
01600 return m_description;
01601 }
01602
01607 EXCEPTION_HELPER_FUNCTIONS(UserRequiredResourceMissingException)
01608
01609 private:
01613 char m_resourceName[256];
01614
01618 char m_description[256];
01619
01623 char m_errorMessage[1024];
01624 };
01625
01631 class FARSA_CONF_TEMPLATE WrongResourceLockStatusForOperation : public BaseException
01632 {
01633 public:
01645 WrongResourceLockStatusForOperation(const char* operationName, bool lockStatusLocked) throw() :
01646 BaseException(),
01647 m_lockStatusLocked(lockStatusLocked)
01648 {
01649 strncpy(m_operationName, operationName, 256);
01650 m_operationName[255] = '\0';
01651 sprintf(m_errorMessage, "The operation \"%s\" could not be performed because the lock on resources %s but it %s have been", m_operationName, (m_lockStatusLocked ? "was held" : "wasn't held"), (m_lockStatusLocked ? "shouldn't" : "should"));
01652 m_errorMessage[511] = '\0';
01653 }
01654
01660 WrongResourceLockStatusForOperation(const WrongResourceLockStatusForOperation& other) throw() :
01661 BaseException(other),
01662 m_lockStatusLocked(other.m_lockStatusLocked)
01663 {
01664 strncpy(m_operationName, other.m_operationName, 256);
01665 m_operationName[255] = '\0';
01666 strncpy(m_errorMessage, other.m_errorMessage, 512);
01667 m_errorMessage[511] = '\0';
01668 }
01669
01675 WrongResourceLockStatusForOperation& operator=(const WrongResourceLockStatusForOperation& other) throw()
01676 {
01677 if (&other == this) {
01678 return *this;
01679 }
01680
01681 BaseException::operator=(other);
01682 m_lockStatusLocked = other.m_lockStatusLocked;
01683 strncpy(m_operationName, other.m_operationName, 256);
01684 m_operationName[255] = '\0';
01685 strncpy(m_errorMessage, other.m_errorMessage, 512);
01686 m_errorMessage[511] = '\0';
01687
01688 return *this;
01689 }
01690
01694 virtual ~WrongResourceLockStatusForOperation() throw()
01695 {
01696 }
01697
01703 virtual const char *what() const throw()
01704 {
01705 return m_errorMessage;
01706 }
01707
01714 bool lockStatusLocked() const throw()
01715 {
01716 return m_lockStatusLocked;
01717 }
01718
01724 const char *operationName() const throw()
01725 {
01726 return m_operationName;
01727 }
01728
01733 EXCEPTION_HELPER_FUNCTIONS(WrongResourceLockStatusForOperation)
01734
01735 private:
01740 bool m_lockStatusLocked;
01741
01745 char m_operationName[256];
01746
01750 char m_errorMessage[512];
01751 };
01752
01753 }
01754
01755
01756 #if defined(_MSC_VER)
01757 #pragma warning(pop)
01758 #endif
01759
01760 #endif