source: Sophya/trunk/Eval/COS/lance.h@ 2798

Last change on this file since 2798 was 1571, checked in by ansari, 24 years ago

Compil avec SunOS-CC et ajout test vector,map de la STL (vecmapstl.cc) - Reza 12/7/2001

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