SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ShogunException.cpp
Go to the documentation of this file.
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 
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 
36 {
37 #ifndef WIN32
39 #endif
40 
41  init(str);
42 }
43 
45 { init(orig.val); }
46 

SHOGUN Machine Learning Toolbox - Documentation