SHOGUN
3.2.1
首页
相关页面
模块
类
文件
文件列表
文件成员
全部
类
命名空间
文件
函数
变量
类型定义
枚举
枚举值
友元
宏定义
组
页
src
shogun
lib
ShogunException.cpp
浏览该文件的文档.
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License as published by
4
* the Free Software Foundation; either version 3 of the License, or
5
* (at your option) any later version.
6
*
7
* Written (W) 1999-2009 Soeren Sonnenburg
8
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
9
*/
10
11
#include <
shogun/lib/ShogunException.h
>
12
#include <
shogun/lib/Signal.h
>
13
14
#include <string.h>
15
#include <stdio.h>
16
#include <stdlib.h>
17
18
using namespace
shogun;
19
20
void
21
ShogunException::init(
const
char
* str)
22
{
23
size_t
n = strlen(str) + 1;
24
25
val = (
char
*) malloc(n);
26
if
(val)
27
strncpy(val, str, n);
28
else
{
29
fprintf(stderr,
"Could not even allocate memory for exception"
30
" - dying.\n"
);
31
exit(1);
32
}
33
}
34
35
ShogunException::ShogunException
(
const
char
* str)
36
{
37
#ifndef WIN32
38
CSignal::unset_handler
();
39
#endif
40
41
init(str);
42
}
43
44
ShogunException::ShogunException
(
const
ShogunException
& orig)
45
{ init(orig.val); }
46
47
ShogunException::~ShogunException
() { free(val); }
SHOGUN
机器学习工具包 - 项目文档