Fawkes API Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * shm_exceptions.cpp - exceptions thrown in shmem utils, do NOT put your own 00004 * application specific exceptions here! 00005 * 00006 * Created: Sat Nov 11 14:15:19 2006 (on train from Hamburg to Aachen) 00007 * Copyright 2005-2006 Tim Niemueller [www.niemueller.de] 00008 * 00009 ****************************************************************************/ 00010 00011 /* This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License as published by 00013 * the Free Software Foundation; either version 2 of the License, or 00014 * (at your option) any later version. A runtime exception applies to 00015 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Library General Public License for more details. 00021 * 00022 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00023 */ 00024 00025 #include <utils/ipc/shm_exceptions.h> 00026 00027 #include <core/threading/mutex.h> 00028 00029 #ifndef _GNU_SOURCE 00030 #define _GNU_SOURCE 00031 #endif 00032 #include <stdio.h> 00033 00034 namespace fawkes { 00035 00036 00037 /** @class ShmCouldNotAttachException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00038 * Could not attach to shared memory segment. 00039 */ 00040 /** Constructor. 00041 * @param msg message why we could not attach 00042 */ 00043 ShmCouldNotAttachException::ShmCouldNotAttachException(const char *msg) 00044 : Exception(msg) 00045 { 00046 } 00047 00048 /** @class ShmNoHeaderException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00049 * No shared memory header set before attach() 00050 */ 00051 /** Constructor. */ 00052 ShmNoHeaderException::ShmNoHeaderException() 00053 : Exception("No SharedMemoryHeader, cannot attach") 00054 { 00055 } 00056 00057 00058 /** @class ShmInconsistentSegmentSizeException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00059 * Memory size does not match 00060 */ 00061 /** Constructor 00062 * @param desired_mem The exepcted memory size 00063 * @param act_mem The actual memory size 00064 */ 00065 ShmInconsistentSegmentSizeException::ShmInconsistentSegmentSizeException(unsigned int desired_mem, 00066 unsigned int act_mem) 00067 : Exception("Inconsistent shared mem segment found in memory " 00068 "(memory size does not match, desired: %u, actual: %u)", 00069 desired_mem, act_mem) 00070 { 00071 } 00072 00073 00074 /** @class ShmDoesNotExistException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00075 * Shared memory segment does not exist. 00076 */ 00077 /** Constructor */ 00078 ShmDoesNotExistException::ShmDoesNotExistException() 00079 : Exception("The given shared memory segment does not exist.") 00080 { 00081 } 00082 00083 00084 /** @class ShmCouldNotAttachAddrDepException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00085 * The shared memory is set adress-dependend but could not be opened at the appropriate 00086 * address. 00087 */ 00088 /** Constructor. */ 00089 ShmCouldNotAttachAddrDepException::ShmCouldNotAttachAddrDepException() 00090 : Exception("Could not attach to the shared memory " 00091 "segment with the appropriate address") 00092 { 00093 } 00094 00095 00096 /** @class ShmAddrOutOfBoundsException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00097 * The address points out of the shared memory. 00098 */ 00099 /** Constructor. */ 00100 ShmAddrOutOfBoundsException::ShmAddrOutOfBoundsException() 00101 : Exception("The address you tried to transform points " 00102 "out of the shared memory segment") 00103 { 00104 } 00105 00106 00107 /** @class ShmPtrOutOfBoundsException shm_exceptions.h <utils/ipc/shm_exceptions.h> 00108 * The pointer does not point inside the shared memory. 00109 */ 00110 /** Constructor. */ 00111 ShmPtrOutOfBoundsException::ShmPtrOutOfBoundsException() 00112 : Exception("The pointer you tried to transform does not " 00113 "point inside the shared memory segment") 00114 { 00115 } 00116 00117 } // end namespace fawkes