Embedded Template Library  1.0
 All Classes Files Functions Variables Typedefs Friends Modules Pages
error_handler.h
Go to the documentation of this file.
1 
3 
4 /******************************************************************************
5 The MIT License(MIT)
6 
7 Embedded Template Library.
8 
9 Copyright(c) 2014 jwellbelove
10 
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files(the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions :
17 
18 The above copyright notice and this permission notice shall be included in all
19 copies or substantial portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
24 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 SOFTWARE.
28 ******************************************************************************/
29 
30 #ifndef __ETL_ERROR_HANDLER__
31 #define __ETL_ERROR_HANDLER__
32 
36 
37 #include "exception.h"
38 #include "function.h"
39 
40 namespace etl
41 {
42  //***************************************************************************
45  //***************************************************************************
47  {
48  public:
49 
50  //*************************************************************************
52  //*************************************************************************
53  struct free_function : public function<void, const exception&>
54  {
55  free_function(void (*p_function)(const exception&))
57  {
58  }
59  };
60 
61  //*************************************************************************
63  //*************************************************************************
64  template <typename TObject>
65  struct member_function : public function<TObject, const exception&>
66  {
67  member_function(TObject& object, void(TObject::*p_function)(const exception&))
68  : function<TObject, const exception&>(object, p_function)
69  {
70  }
71  };
72 
74  static void error(const exception& e);
75 
76  private:
77 
78  static ifunction<const exception&>* p_ifunction;
79  };
80 }
81 
82 #endif
83 
static void set_callback(ifunction< const exception & > &f)
Definition: error_handler.cpp:41
Definition: error_handler.h:46
Callback class for member handler functions.
Definition: error_handler.h:65
Definition: algorithm.h:43
Definition: exception.h:42
Definition: function.h:83
static void error(const exception &e)
Definition: error_handler.cpp:50
Callback class for free handler functions.
Definition: error_handler.h:53