Last change
on this file since 1093 was 989, checked in by ansari, 25 years ago |
Creation du module Eval/COS - Tests compilos/OS - Reza 2/5/2000
|
File size:
788 bytes
|
Line | |
---|
1 | #include <iostream.h>
|
---|
2 | #include <exception>
|
---|
3 | #include <string>
|
---|
4 |
|
---|
5 | #define ExcLongMessage(a) BuildFLExcMsg(a,__FILE__,__LINE__)
|
---|
6 |
|
---|
7 | inline string BuildFLExcMsg(const char * s, const char *file, int line)
|
---|
8 | {
|
---|
9 | char buff[32];
|
---|
10 | sprintf(buff," Line=%d", line);
|
---|
11 | string rs=s;
|
---|
12 | rs += " File="; rs += file; rs += buff;
|
---|
13 | return(rs);
|
---|
14 | }
|
---|
15 |
|
---|
16 | class myException {
|
---|
17 | public:
|
---|
18 | myException(const char * s) {_msg= s;}
|
---|
19 | myException(string const & s) {_msg =s; }
|
---|
20 | // ~myExecption() {}
|
---|
21 | string Msg() { return _msg; }
|
---|
22 | private:
|
---|
23 | string _msg;
|
---|
24 | };
|
---|
25 |
|
---|
26 |
|
---|
27 | class Toto {
|
---|
28 | public:
|
---|
29 | Toto(int n);
|
---|
30 | virtual ~Toto();
|
---|
31 | inline double Value(int k)
|
---|
32 | { if ((k<0) || (k>=size) )
|
---|
33 | throw( myException(ExcLongMessage("Toto::Value()-OutOfBound")) ) ;
|
---|
34 | else return(data[k]);
|
---|
35 | }
|
---|
36 | protected:
|
---|
37 | int size;
|
---|
38 | double * data;
|
---|
39 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.