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 class SharedMemoryHeader;
30 
31 /** Format list output for shared memory segments.
32  * Implement this function specific to your SharedMemoryHeader to printout
33  * data about the shared memory segments.
34  * @ingroup IPC
35  * @author Tim Niemueller
36  */
37 class SharedMemoryLister
38 {
39 public:
40  /** virtual destructor */
41  virtual ~SharedMemoryLister()
42  {
43  }
44 
45  /** Print header of the table.
46  * This should fit on the terminal and thus have a width of at most
47  * 79 columns.
48  */
49  virtual void print_header() = 0;
50 
51  /** Print footer of the table.
52  * This should fit on the terminal and thus have a width of at most
53  * 79 columns.
54  */
55  virtual void print_footer() = 0;
56 
57  /** Print this if no matching segment was found.
58  * Called by SharedMemory if no matching segment could be found.
59  */
60  virtual void print_no_segments() = 0;
61 
62  /** Print this if no matching orphaned segment was found.
63  * Called by SharedMemory::erase_orphaned() if no matching segment
64  * could be found.
65  */
66  virtual void print_no_orphaned_segments() = 0;
67 
68  /** Print info about segment.
69  * This method is called for every matching shared memory segment.
70  * You should print a line of information (maybe more than one line
71  * if needed) about the segment.
72  * @param header The data-specific header
73  * @param shm_id The id of the shared memory segment
74  * @param semaphore Semaphore key of the given shared memory segment
75  * @param mem_size the total memory size
76  * @param memptr pointer to the data segment.
77  */
78  virtual void print_info(const SharedMemoryHeader *header,
79  int shm_id,
80  int semaphore,
81  unsigned int mem_size,
82  const void * memptr) = 0;
83 };
84 
85 } // end namespace fawkes
86 
87 #endif
fawkes::SharedMemoryHeader
Definition: shm.h:39
fawkes::SharedMemoryLister::print_no_segments
virtual void print_no_segments()=0
Print this if no matching segment was found.
fawkes::SharedMemoryLister::print_info
virtual void print_info(const SharedMemoryHeader *header, int shm_id, int semaphore, unsigned int mem_size, const void *memptr)=0
Print info about segment.
fawkes::SharedMemoryLister::print_no_orphaned_segments
virtual void print_no_orphaned_segments()=0
Print this if no matching orphaned segment was found.
fawkes::SharedMemoryLister::~SharedMemoryLister
virtual ~SharedMemoryLister()
virtual destructor
Definition: shm_lister.h:47
fawkes
fawkes::SharedMemoryLister::print_footer
virtual void print_footer()=0
Print footer of the table.
fawkes::SharedMemoryLister::print_header
virtual void print_header()=0
Print header of the table.