Fawkes API  Fawkes Development Version
shm_exceptions.cpp
1 
2 /***************************************************************************
3  * shm_exceptions.cpp - exceptions thrown in shmem utils, do NOT put your own
4  * application specific exceptions here!
5  *
6  * Created: Sat Nov 11 14:15:19 2006 (on train from Hamburg to Aachen)
7  * Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version. A runtime exception applies to
15  * this software (see LICENSE.GPL_WRE file mentioned below for details).
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Library General Public License for more details.
21  *
22  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
23  */
24 
25 #include <core/threading/mutex.h>
26 #include <utils/ipc/shm_exceptions.h>
27 
28 #ifndef _GNU_SOURCE
29 # define _GNU_SOURCE
30 #endif
31 #include <stdio.h>
32 
33 namespace fawkes {
34 
35 /** @class ShmCouldNotAttachException shm_exceptions.h <utils/ipc/shm_exceptions.h>
36  * Could not attach to shared memory segment.
37  */
38 /** Constructor.
39  * @param msg message why we could not attach
40  */
42 {
43 }
44 
45 /** @class ShmNoHeaderException shm_exceptions.h <utils/ipc/shm_exceptions.h>
46  * No shared memory header set before attach()
47  */
48 /** Constructor. */
49 ShmNoHeaderException::ShmNoHeaderException() : Exception("No SharedMemoryHeader, cannot attach")
50 {
51 }
52 
53 /** @class ShmInconsistentSegmentSizeException shm_exceptions.h <utils/ipc/shm_exceptions.h>
54  * Memory size does not match
55  */
56 /** Constructor
57  * @param desired_mem The exepcted memory size
58  * @param act_mem The actual memory size
59  */
61  unsigned int act_mem)
62 : Exception("Inconsistent shared mem segment found in memory "
63  "(memory size does not match, desired: %u, actual: %u)",
64  desired_mem,
65  act_mem)
66 {
67 }
68 
69 /** @class ShmDoesNotExistException shm_exceptions.h <utils/ipc/shm_exceptions.h>
70  * Shared memory segment does not exist.
71  */
72 /** Constructor */
74 : Exception("The given shared memory segment does not exist.")
75 {
76 }
77 
78 /** @class ShmCouldNotAttachAddrDepException shm_exceptions.h <utils/ipc/shm_exceptions.h>
79  * The shared memory is set adress-dependend but could not be opened at the appropriate
80  * address.
81  */
82 /** Constructor. */
84 : Exception("Could not attach to the shared memory "
85  "segment with the appropriate address")
86 {
87 }
88 
89 /** @class ShmAddrOutOfBoundsException shm_exceptions.h <utils/ipc/shm_exceptions.h>
90  * The address points out of the shared memory.
91  */
92 /** Constructor. */
94 : Exception("The address you tried to transform points "
95  "out of the shared memory segment")
96 {
97 }
98 
99 /** @class ShmPtrOutOfBoundsException shm_exceptions.h <utils/ipc/shm_exceptions.h>
100  * The pointer does not point inside the shared memory.
101  */
102 /** Constructor. */
104 : Exception("The pointer you tried to transform does not "
105  "point inside the shared memory segment")
106 {
107 }
108 
109 } // end namespace fawkes
fawkes::ShmDoesNotExistException::ShmDoesNotExistException
ShmDoesNotExistException()
Constructor.
Definition: shm_exceptions.cpp:72
fawkes::ShmCouldNotAttachException::ShmCouldNotAttachException
ShmCouldNotAttachException(const char *msg)
Constructor.
Definition: shm_exceptions.cpp:40
fawkes::ShmInconsistentSegmentSizeException::ShmInconsistentSegmentSizeException
ShmInconsistentSegmentSizeException(unsigned int desired_mem, unsigned int act_mem)
Constructor.
Definition: shm_exceptions.cpp:59
fawkes::ShmCouldNotAttachAddrDepException::ShmCouldNotAttachAddrDepException
ShmCouldNotAttachAddrDepException()
Constructor.
Definition: shm_exceptions.cpp:82
fawkes
fawkes::ShmPtrOutOfBoundsException::ShmPtrOutOfBoundsException
ShmPtrOutOfBoundsException()
Constructor.
Definition: shm_exceptions.cpp:102
fawkes::ShmAddrOutOfBoundsException::ShmAddrOutOfBoundsException
ShmAddrOutOfBoundsException()
Constructor.
Definition: shm_exceptions.cpp:92
fawkes::ShmNoHeaderException::ShmNoHeaderException
ShmNoHeaderException()
Constructor.
Definition: shm_exceptions.cpp:48
fawkes::Exception
Definition: exception.h:39