CigiExceptions.h

Go to the documentation of this file.
00001 
00047 #if ! defined( _CIGI_EXCEPTIONS_INCLUDED_)
00048 #define _CIGI_EXCEPTIONS_INCLUDED_
00049     
00050     
00051 #include "CigiException.h"
00052 #include <string.h>
00053 #include <stdio.h>
00054 
00055 
00056 //=========================================================
00061 class CIGI_SPEC CigiAllocFailedException : public CigiException
00062 {
00063 
00064 public:
00065 
00066    //=========================================================
00070    CigiAllocFailedException(void)
00071    {
00072       memcpy(ErrMsg,"Allocation Failure\n",21);
00073       Msg = ErrMsg;
00074       ErrorCode = CIGI_ERROR_ALLOC_FAILED;
00075    }
00076 
00077    //=========================================================
00081    virtual ~CigiAllocFailedException(void) throw() { };
00082 
00083 protected:
00084 
00085    char ErrMsg[25];
00086 
00087 };
00088 
00089 //=========================================================
00093 class CIGI_SPEC CigiBufferOverrunException : public CigiException
00094 {
00095 
00096 public:
00097 
00098    //=========================================================
00102    CigiBufferOverrunException(void)
00103    {
00104       memcpy(ErrMsg,"Buffer Overrun Error\n",22);
00105       Msg = ErrMsg;
00106       ErrorCode = CIGI_ERROR_BUFFER_OVERRUN;
00107    }
00108 
00109    //=========================================================
00113    virtual ~CigiBufferOverrunException(void) throw() { };
00114 
00115 protected:
00116 
00117    char ErrMsg[25];
00118 
00119 };
00120 
00121 //=========================================================
00125 class CIGI_SPEC CigiBufferTooSmallException : public CigiException
00126 {
00127 
00128 public:
00129 
00130    //=========================================================
00134    CigiBufferTooSmallException(void)
00135    {
00136       memcpy(ErrMsg,"Buffer Too Small Error\n",26);
00137       Msg = ErrMsg;
00138       ErrorCode = CIGI_ERROR_BUFFER_TOO_SMALL;
00139    }
00140 
00141 
00142    //=========================================================
00146    virtual ~CigiBufferTooSmallException(void) throw() { };
00147 
00148 protected:
00149 
00150    char ErrMsg[30];
00151 
00152 };
00153 
00154 //=========================================================
00159 class CIGI_SPEC CigiCalledOutOfSequenceException : public CigiException
00160 {
00161 
00162 public:
00163 
00164    //=========================================================
00168    CigiCalledOutOfSequenceException(void)
00169    {
00170       memcpy(ErrMsg,"Routine Call Out Of Sequence Error\n",38);
00171       Msg = ErrMsg;
00172       ErrorCode = CIGI_ERROR_CALLED_OUT_OF_SEQUENCE;
00173    }
00174 
00175    //=========================================================
00179    virtual ~CigiCalledOutOfSequenceException(void) throw() { };
00180 
00181 protected:
00182 
00183    char ErrMsg[40];
00184 
00185 };
00186 
00187 //=========================================================
00191 class CIGI_SPEC CigiInvalidOpcodeException : public CigiException
00192 {
00193 
00194 public:
00195 
00196    //=========================================================
00200    CigiInvalidOpcodeException(void)
00201    {
00202       memcpy(ErrMsg,"Invalid Packet ID\n",21);
00203       Msg = ErrMsg;
00204       ErrorCode = CIGI_ERROR_INVALID_OPCODE;
00205    }
00206 
00207    //=========================================================
00211    virtual ~CigiInvalidOpcodeException(void) throw() { };
00212 
00213 protected:
00214 
00215    char ErrMsg[25];
00216 
00217 };
00218 
00219 //=========================================================
00223 class CIGI_SPEC CigiInvalidPacketException : public CigiException
00224 {
00225 
00226 public:
00227 
00228    //=========================================================
00232    CigiInvalidPacketException(void)
00233    {
00234       memcpy(ErrMsg,"Invalid Packet\n",18);
00235       Msg = ErrMsg;
00236       ErrorCode = CIGI_ERROR_INVALID_PACKET;
00237    }
00238 
00239    //=========================================================
00243    virtual ~CigiInvalidPacketException(void) throw() { };
00244 
00245 protected:
00246 
00247    char ErrMsg[25];
00248 
00249 };
00250 
00251 //=========================================================
00255 class CIGI_SPEC CigiInvalidPacketSizeException : public CigiException
00256 {
00257 
00258 public:
00259 
00260    //=========================================================
00264    CigiInvalidPacketSizeException(void)
00265    {
00266       memcpy(ErrMsg,"Invalid Packet Size\n",23);
00267       Msg = ErrMsg;
00268       ErrorCode = CIGI_ERROR_INVALID_PACKET_SIZE;
00269    }
00270 
00271    //=========================================================
00275    virtual ~CigiInvalidPacketSizeException(void) throw() { };
00276 
00277 protected:
00278 
00279    char ErrMsg[25];
00280 
00281 };
00282 
00283 //=========================================================
00287 class CIGI_SPEC CigiInvalidSessionException : public CigiException
00288 {
00289 
00290 public:
00291 
00292    //=========================================================
00296    CigiInvalidSessionException(void) 
00297    {
00298       memcpy(ErrMsg,"Invalid Session\n",19);
00299       Msg = ErrMsg;
00300       ErrorCode = CIGI_ERROR_INVALID_SESSION;
00301    }
00302 
00303    //=========================================================
00307    virtual ~CigiInvalidSessionException(void) throw() { };
00308 
00309 protected:
00310 
00311    char ErrMsg[25];
00312 
00313 };
00314 
00315 //=========================================================
00319 class CIGI_SPEC CigiInvalidSessionTypeException : public CigiException
00320 {
00321 
00322 public:
00323 
00324    //=========================================================
00328    CigiInvalidSessionTypeException(void) 
00329    {
00330       memcpy(ErrMsg,"Invalid Session Type\n",24);
00331       Msg = ErrMsg;
00332       ErrorCode = CIGI_ERROR_INVALID_SESSION_TYPE;
00333    }
00334 
00335    //=========================================================
00339    virtual ~CigiInvalidSessionTypeException(void) throw() { };
00340 
00341 protected:
00342 
00343    char ErrMsg[25];
00344 
00345 };
00346 
00347 //=========================================================
00351 class CIGI_SPEC CigiMaxSessionsException : public CigiException
00352 {
00353 
00354 public:
00355 
00356    //=========================================================
00360    CigiMaxSessionsException(void) 
00361    {
00362       memcpy(ErrMsg,"Requested Number Of Sessions Exceeds Maximum\n",48);
00363       Msg = ErrMsg;
00364       ErrorCode = CIGI_ERROR_MAX_SESSIONS;
00365    }
00366 
00367    //=========================================================
00371    virtual ~CigiMaxSessionsException(void) throw() { };
00372 
00373 protected:
00374 
00375    char ErrMsg[50];
00376 
00377 };
00378 
00379 //=========================================================
00383 class CIGI_SPEC CigiMissingIgControlException : public CigiException
00384 {
00385 
00386 public:
00387 
00388    //=========================================================
00392    CigiMissingIgControlException(void) 
00393    {
00394       memcpy(ErrMsg,"The Message Is Missing The IG Control Packet\n",48);
00395       Msg = ErrMsg;
00396       ErrorCode = CIGI_ERROR_MISSING_IG_CONTROL_PACKET;
00397    }
00398 
00399    //=========================================================
00403    virtual ~CigiMissingIgControlException(void) throw() { };
00404 
00405 protected:
00406 
00407    char ErrMsg[50];
00408 
00409 };
00410 
00411 //=========================================================
00416 class CIGI_SPEC CigiMissingStartOfFrameException : public CigiException
00417 {
00418 
00419 public:
00420 
00421    //=========================================================
00425    CigiMissingStartOfFrameException(void) 
00426    {
00427       memcpy(ErrMsg,"The Message Is Missing The Start Of Frame Packet\n",52);
00428       Msg = ErrMsg;
00429       ErrorCode = CIGI_ERROR_MISSING_SOF_PACKET;
00430    }
00431 
00432    //=========================================================
00436    virtual ~CigiMissingStartOfFrameException(void) throw() { };
00437 
00438 protected:
00439 
00440    char ErrMsg[55];
00441 
00442 };
00443 
00444 //=========================================================
00448 class CIGI_SPEC CigiNotImplementedException : public CigiException
00449 {
00450 
00451 public:
00452 
00453    //=========================================================
00457    CigiNotImplementedException(void) 
00458    {
00459       memcpy(ErrMsg,"Not Implemented Error\n",25);
00460       Msg = ErrMsg;
00461       ErrorCode = CIGI_ERROR_NOT_IMPLEMENTED;
00462    }
00463 
00464    //=========================================================
00468    virtual ~CigiNotImplementedException(void) throw() { };
00469 
00470 protected:
00471 
00472    char ErrMsg[30];
00473 
00474 };
00475 
00476 //=========================================================
00480 class CIGI_SPEC CigiNullPointerException : public CigiException
00481 {
00482 
00483 public:
00484 
00485    //=========================================================
00489    CigiNullPointerException(void) 
00490    {
00491       memcpy(ErrMsg,"Null Pointer Error\n",21);
00492       Msg = ErrMsg;
00493       ErrorCode = CIGI_ERROR_UNEXPECTED_NULL;
00494    }
00495 
00496    //=========================================================
00500    virtual ~CigiNullPointerException(void) throw() { };
00501 
00502 protected:
00503 
00504    char ErrMsg[25];
00505 
00506 };
00507 
00508 //=========================================================
00512 class CIGI_SPEC CigiPacketTooLargeException : public CigiException
00513 {
00514 
00515 public:
00516 
00517    //=========================================================
00521    CigiPacketTooLargeException(void) 
00522    {
00523       memcpy(ErrMsg,"Packet Is Too Large\n",23);
00524       Msg = ErrMsg;
00525       ErrorCode = CIGI_ERROR_PACKET_TOO_LARGE;
00526    }
00527 
00528    //=========================================================
00532    virtual ~CigiPacketTooLargeException(void) throw() { };
00533 
00534 protected:
00535 
00536    char ErrMsg[25];
00537 
00538 };
00539 
00540 //=========================================================
00545 class CIGI_SPEC CigiValueOutOfRangeException : public CigiException
00546 {
00547 
00548 public:
00549 
00550    //=========================================================
00554    CigiValueOutOfRangeException(void) 
00555    {
00556       memcpy(ErrMsg,"Value Out Of Range\n",23);
00557       Msg = ErrMsg;
00558       ErrorCode = CIGI_ERROR_VALUE_OUT_OF_RANGE;
00559    }
00560 
00561    //=========================================================
00565    CigiValueOutOfRangeException(char *ParameterName, int Value, int Low, int High) 
00566    {
00567 
00568       if(strlen(ParameterName) < 75)
00569          PrtPname = ParameterName;
00570       else
00571       {
00572          memcpy(SubPname,ParameterName,74);
00573          SubPname[74] = 0;
00574          PrtPname = SubPname;
00575       }
00576 
00577       sprintf(ErrMsg,"Parameter Out of Range: Parameter %s is %d. The valid range is from %d to %d.\n",
00578               PrtPname, Value, Low, High);
00579 
00580       Msg = ErrMsg;
00581       ErrorCode = CIGI_ERROR_VALUE_OUT_OF_RANGE;
00582    }
00583 
00584    //=========================================================
00588    CigiValueOutOfRangeException(char *ParameterName, double Value, double Low, double High) 
00589    {
00590       if(strlen(ParameterName) < 75)
00591          PrtPname = ParameterName;
00592       else
00593       {
00594          memcpy(SubPname,ParameterName,74);
00595          SubPname[74] = 0;
00596          PrtPname = SubPname;
00597       }
00598 
00599       sprintf(ErrMsg,"Parameter Out of Range: Parameter %s is %g. The valid range is from %g to %g.\n",
00600               PrtPname, Value, Low, High);
00601 
00602       Msg = ErrMsg;
00603       ErrorCode = CIGI_ERROR_VALUE_OUT_OF_RANGE;
00604    }
00605 
00606    //=========================================================
00610    CigiValueOutOfRangeException(char *ParameterName, double Value, char *Mod, double Limit) 
00611    {
00612       if(strlen(ParameterName) < 75)
00613          PrtPname = ParameterName;
00614       else
00615       {
00616          memcpy(SubPname,ParameterName,74);
00617          SubPname[74] = 0;
00618          PrtPname = SubPname;
00619       }
00620 
00621       sprintf(ErrMsg,"Parameter Out of Range: Parameter %s is %g. The valid range is %s %g.\n",
00622               PrtPname, Value, Mod, Limit);
00623 
00624       Msg = ErrMsg;
00625       ErrorCode = CIGI_ERROR_VALUE_OUT_OF_RANGE;
00626    }
00627 
00628    //=========================================================
00632    virtual ~CigiValueOutOfRangeException(void) throw() { };
00633 
00634 protected:
00635 
00636    char ErrMsg[255];
00637    char SubPname[75];
00638    char *PrtPname;
00639 
00640 };
00641 
00642 //=========================================================
00646 class CIGI_SPEC CigiWrongVersionException : public CigiException
00647 {
00648 
00649 public:
00650 
00651    //=========================================================
00655    CigiWrongVersionException(void) 
00656    {
00657       memcpy(ErrMsg,"Wrong Cigi Version Used\n",28);
00658       Msg = ErrMsg;
00659       ErrorCode = CIGI_ERROR_WRONG_VERSION;
00660    }
00661 
00662    //=========================================================
00666    virtual ~CigiWrongVersionException(void) throw() { };
00667 
00668 protected:
00669 
00670    char ErrMsg[30];
00671 
00672 };
00673 
00674 
00675 //=========================================================
00679 class CIGI_SPEC CigiInvalidUserPacketException : public CigiException
00680 {
00681 
00682 public:
00683 
00684    //=========================================================
00688    CigiInvalidUserPacketException(void) 
00689    {
00690       memcpy(ErrMsg,"Cigi User Defined Packets Must Have an ID above 199\n",56);
00691       Msg = ErrMsg;
00692       ErrorCode = CIGI_ERROR_INVALID_USER_PACKET;
00693    }
00694 
00695 
00696    //=========================================================
00699    CigiInvalidUserPacketException(Cigi_uint8 PacketID)
00700    {
00701       int IPacketID = (int)PacketID;
00702       sprintf(ErrMsg,"Cigi User Defined Packets Must Have an ID above 199\nUsed ID was %d\n",IPacketID);
00703       Msg = ErrMsg;
00704       ErrorCode = CIGI_ERROR_INVALID_USER_PACKET;
00705    }
00706 
00707 
00708    //=========================================================
00712    virtual ~CigiInvalidUserPacketException(void) throw() { };
00713 
00714 protected:
00715 
00716    char ErrMsg[90];
00717 
00718 };
00719 
00720 
00721 
00722 //=========================================================
00726 class CIGI_SPEC CigiImproperPacketException : public CigiException
00727 {
00728 
00729 public:
00730 
00731    //=========================================================
00735    CigiImproperPacketException(void) 
00736    {
00737       memcpy(ErrMsg,"Improper packet for Session Type\n",37);
00738       Msg = ErrMsg;
00739       ErrorCode = CIGI_ERROR_IMPROPER_PACKET;
00740    }
00741 
00742 
00743    //=========================================================
00747    virtual ~CigiImproperPacketException(void) throw() { };
00748 
00749 protected:
00750 
00751    char ErrMsg[40];
00752 
00753 };
00754 
00755 #endif // #if ! defined(_CIGI_EXCEPTIONS_INCLUDED_)

Generated on Wed Apr 29 08:59:56 2009 for CCL by  doxygen 1.4.7