aboutsummaryrefslogtreecommitdiffstats
path: root/core/opt_exception.hpp
blob: 027f783d34651d2ad322d5feb0c321b01c529d08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/**
   \file opt_exception.hpp
*/

#ifndef OPT_EXCEPTION
#define OPT_EXCEPTION
#define OPT_HEADER
#include <string>
#include <exception>
namespace opt_utilities
{
  /**
     \brief the root class of exception used in opt_utilities
   */
  class opt_exception
    :public std::exception
  {
  private:
    std::string _what;
  public:
    opt_exception()
    {};
    
    ~opt_exception()throw()
    {}
    
    opt_exception(const std::string& str)
      :_what(str)
    {}

    const char* what()const throw()
    {
      return _what.c_str();
    }
  };
  
  /**
     When objection is not defined in optimizer, and optimizion is performing,
     this exception will be thrown
   */
  class object_function_undefined
    :public opt_exception
  {
  public:
    object_function_undefined()
      :opt_exception("object function undefined")
    {}
  };

  /**
     When the opt_method is not defined before the optimization is performing,
     this exception will be thrown.
   */
  class opt_method_undefined
    :public opt_exception
  {
  public:
    opt_method_undefined()
      :opt_exception("opt method undefined")
    {}
  };
  
  /**
     When fitter is not attached in a model, statistic, and other objects,
     this exception will be thrown.
   */
  class fitter_unset
    :public opt_exception
  {
  public:
    fitter_unset()
      :opt_exception("fitter_unset")
    {}
  };


  /**
     When the model is not set before the model fitting,
     this exception will be thrown.
   */
  class model_undefined
    :public opt_exception
  {
  public:
    model_undefined()
      :opt_exception("model_undefined")
    {}
  };


  /**
     When the data set is not loaded before the model fitting,
     this exception will be thrown.
   */
  class data_unloaded
    :public opt_exception
  {
  public:
    data_unloaded()
      :opt_exception("data not loaded")
    {}
  };


  /**
     When the statistic is not set before the model fitting,
     this exception will be thrown.
   */
  class statistic_undefined
    :public opt_exception
  {
  public:
    statistic_undefined()
      :opt_exception("statistic undefined")
    {}
  };
  

  /**
     If a parameter is not found by the name or other information,
     this exception will be thrown.
   */
  class param_not_found
    :public opt_exception
  {
  public:
    param_not_found()
      :opt_exception("param name invalid")
    {}
  };
  

  /**
     If param_modifier is not defined, and the user tries to get the 
     param_modifer, this exception will be thrown.
   */
  class param_modifier_undefined
    :public opt_exception
  {
  public:
    param_modifier_undefined()
      :opt_exception("param modifier undefined")
    {}
  };

}


#endif
//EOF