1 /* 2 * This code is (c) 2012 Johannes Thoma 3 * 4 * This file is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This file is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this file. If not, see <http://www.gnu.org/licenses/>. 16 * 17 */ 18 19 #ifndef _MMAP_EXCEPTION 20 #define _MMAP_EXCEPTION 21 22 #include "mmap_access_mode.h" 23 #include <stdexcept> 24 25 namespace mmap_allocator_namespace 26 { 27 class mmap_allocator_exception: public std::runtime_error { 28 public: mmap_allocator_exception(const char * msg_param)29 mmap_allocator_exception(const char *msg_param) throw(): 30 std::runtime_error(msg_param) 31 { 32 if (get_verbosity() > 0) { 33 fprintf(stderr, "Throwing exception %s\n", msg_param); 34 } 35 } 36 throw()37 mmap_allocator_exception(std::string msg_param) throw(): 38 std::runtime_error(msg_param) 39 { 40 if (get_verbosity() > 0) { 41 fprintf(stderr, "Throwing exception %s\n", msg_param.c_str()); 42 } 43 } 44 ~mmap_allocator_exception(void)45 virtual ~mmap_allocator_exception(void) throw() 46 { 47 } 48 private: 49 }; 50 } 51 52 #endif 53