Fawkes API  Fawkes Development Version
shm_lister.h
1 
2 /***************************************************************************
3  * shm_lister.h - shared memory buffer lister
4  *
5  * Generated: Sun Sep 17 14:23:34 2006 (split from shm.h)
6  * Copyright 2005-2006 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __UTILS_IPC_SHM_LISTER_H_
25 #define __UTILS_IPC_SHM_LISTER_H_
26 
27 namespace fawkes {
28 
29 
30 class SharedMemoryHeader;
31 
32 /** Format list output for shared memory segments.
33  * Implement this function specific to your SharedMemoryHeader to printout
34  * data about the shared memory segments.
35  * @ingroup IPC
36  * @author Tim Niemueller
37  */
39  public:
40 
41  /** virtual destructor */
42  virtual ~SharedMemoryLister() {}
43 
44  /** Print header of the table.
45  * This should fit on the terminal and thus have a width of at most
46  * 79 columns.
47  */
48  virtual void print_header() = 0;
49 
50  /** Print footer of the table.
51  * This should fit on the terminal and thus have a width of at most
52  * 79 columns.
53  */
54  virtual void print_footer() = 0;
55 
56  /** Print this if no matching segment was found.
57  * Called by SharedMemory if no matching segment could be found.
58  */
59  virtual void print_no_segments() = 0;
60 
61  /** Print this if no matching orphaned segment was found.
62  * Called by SharedMemory::erase_orphaned() if no matching segment
63  * could be found.
64  */
65  virtual void print_no_orphaned_segments() = 0;
66 
67  /** Print info about segment.
68  * This method is called for every matching shared memory segment.
69  * You should print a line of information (maybe more than one line
70  * if needed) about the segment.
71  * @param header The data-specific header
72  * @param shm_id The id of the shared memory segment
73  * @param semaphore Semaphore key of the given shared memory segment
74  * @param mem_size the total memory size
75  * @param memptr pointer to the data segment.
76  */
77  virtual void print_info(const SharedMemoryHeader *header,
78  int shm_id, int semaphore,
79  unsigned int mem_size, const void *memptr) = 0;
80 };
81 
82 
83 } // end namespace fawkes
84 
85 #endif
virtual ~SharedMemoryLister()
virtual destructor
Definition: shm_lister.h:42
virtual void print_footer()=0
Print footer of the table.
Fawkes library namespace.
virtual void print_header()=0
Print header of the table.
Format list output for shared memory segments.
Definition: shm_lister.h:38
virtual void print_info(const SharedMemoryHeader *header, int shm_id, int semaphore, unsigned int mem_size, const void *memptr)=0
Print info about segment.
virtual void print_no_segments()=0
Print this if no matching segment was found.
Interface for shared memory header.
Definition: shm.h:33
virtual void print_no_orphaned_segments()=0
Print this if no matching orphaned segment was found.