Subversion Repositories gelsvn

Rev

Rev 595 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 595 Rev 630
1
/** @file ExceptionStandard.h
1
/** @file ExceptionStandard.h
2
 * @brief Exceptions are not much used in CGLA, but these classes define what we throw.
2
 * @brief Exceptions are not much used in CGLA, but these classes define what we throw.
3
 */
3
 */
4
 
4
 
5
/* ----------------------------------------------------------------------- *
5
/* ----------------------------------------------------------------------- *
6
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
6
 * This file is part of GEL, http://www.imm.dtu.dk/GEL
7
 * Copyright (C) the authors and DTU Informatics
7
 * Copyright (C) the authors and DTU Informatics
8
 * For license and list of authors, see ../../doc/intro.pdf
8
 * For license and list of authors, see ../../doc/intro.pdf
9
 * @brief Exceptions are not much used in CGLA, but these classes define what we throw.
9
 * @brief Exceptions are not much used in CGLA, but these classes define what we throw.
10
 * ----------------------------------------------------------------------- */
10
 * ----------------------------------------------------------------------- */
11
 
11
 
12
#ifndef __CGLA_EXCEPTIONSTANDARD_H__
12
#ifndef __CGLA_EXCEPTIONSTANDARD_H__
13
#define __CGLA_EXCEPTIONSTANDARD_H__
13
#define __CGLA_EXCEPTIONSTANDARD_H__
14
 
14
 
15
#include <string>
15
#include <string>
16
#include <iostream>
16
#include <iostream>
17
 
17
 
18
namespace CGLA
18
namespace CGLA
19
{
19
{
20
 
20
 
21
	class CGLAMotherException
21
	class CGLAMotherException
22
	{
22
	{
23
		std::string str;
23
		std::string str;
24
	public:
24
	public:
25
		CGLAMotherException(const std::string s)
25
		CGLAMotherException(const std::string s)
26
			{
26
			{
27
				str = s;
27
				str = s;
28
			}
28
			}
29
  
29
  
30
		void print(std::ostream& os) const 
30
		void print(std::ostream& os) const 
31
		{
31
		{
32
			os << str << std::endl; 
32
			os << str << std::endl; 
33
		}
33
		}
34
	};
34
	};
35
 
35
 
36
#define CGLA_DERIVEEXCEPTION(nameoe)															\
36
#define CGLA_DERIVEEXCEPTION(nameoe)															\
37
	class nameoe: public CGLAMotherException									\
37
	class nameoe: public CGLAMotherException									\
38
	{																													\
38
	{																													\
39
	public:																										\
39
	public:																										\
40
		nameoe(const std::string& s): CGLAMotherException(s) {}	\
40
		nameoe(const std::string& s): CGLAMotherException(s) {}	\
41
	};																												\
41
	};																												\
42
 
42
 
43
}
43
}
44
 
44
 
45
#endif
45
#endif
46
 
46