ewmscp  ..
Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
inotify_event_wrapper Class Reference

wrapper for inotify_event with nicer interface. More...

Public Member Functions

 inotify_event_wrapper ()=delete
 
 ~inotify_event_wrapper ()=delete
 
int wd () const
 
uint32_t mask () const
 
uint32_t cookie () const
 
uint32_t len () const
 
const char * name () const
 
const inotify_event_wrappernext () const
 
size_t size () const
 

Static Public Member Functions

static const inotify_event_wrapperfromChar (char *pointer)
 

Private Attributes

inotify_event data
 

Friends

std::ostream & operator<< (std::ostream &out, const inotify_event_wrapper &aEvent)
 

Detailed Description

wrapper for inotify_event with nicer interface.

The wrapper is used to provide functions to hide the pointer arithmetics needed to go from a generic buffer to individual events and to go to the next one. Also allows nice << style IO. The original struct is a member and NOT inherited from because that does not properly work due to the variable size name member of the struct. The wrapper has per design exactly the same layout as the struct, that must not be changed!

Definition at line 132 of file inotify_watch.cpp.

Constructor & Destructor Documentation

◆ inotify_event_wrapper()

inotify_event_wrapper::inotify_event_wrapper ( )
delete

◆ ~inotify_event_wrapper()

inotify_event_wrapper::~inotify_event_wrapper ( )
delete

Member Function Documentation

◆ cookie()

uint32_t inotify_event_wrapper::cookie ( ) const
inline

Definition at line 143 of file inotify_watch.cpp.

143  {
144  return data.cookie;
145  }

References data.

Referenced by inotify_event_copy::forget(), and inotify_event_copy::getPartner().

Here is the caller graph for this function:

◆ fromChar()

static const inotify_event_wrapper* inotify_event_wrapper::fromChar ( char *  pointer)
inlinestatic

Definition at line 158 of file inotify_watch.cpp.

158  {
159  return reinterpret_cast<const inotify_event_wrapper*>(pointer);
160  }

Referenced by main().

Here is the caller graph for this function:

◆ len()

uint32_t inotify_event_wrapper::len ( ) const
inline

Definition at line 146 of file inotify_watch.cpp.

146  {
147  return data.len;
148  }

References data.

Referenced by next(), and size().

Here is the caller graph for this function:

◆ mask()

uint32_t inotify_event_wrapper::mask ( ) const
inline

Definition at line 140 of file inotify_watch.cpp.

140  {
141  return data.mask;
142  }

References data.

◆ name()

const char* inotify_event_wrapper::name ( ) const
inline

Definition at line 149 of file inotify_watch.cpp.

149  {
150  return data.name;
151  }

References data.

Referenced by main().

Here is the caller graph for this function:

◆ next()

const inotify_event_wrapper* inotify_event_wrapper::next ( ) const
inline

Definition at line 152 of file inotify_watch.cpp.

152  {
153  return reinterpret_cast<const inotify_event_wrapper*>(&data.name[0] + len());
154  }

References data, and len().

Here is the call graph for this function:

◆ size()

size_t inotify_event_wrapper::size ( ) const
inline

Definition at line 155 of file inotify_watch.cpp.

155  {
156  return sizeof(inotify_event) + len();
157  }

References len().

Here is the call graph for this function:

◆ wd()

int inotify_event_wrapper::wd ( ) const
inline

Definition at line 137 of file inotify_watch.cpp.

137  {
138  return data.wd;
139  }

References data.

Referenced by main().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const inotify_event_wrapper aEvent 
)
friend

Definition at line 161 of file inotify_watch.cpp.

161  {
162  out << " mask: ";
163  maskName::print(out, aEvent.mask());
164  out << "(" << aEvent.mask() << ")";
165  return out;
166  }

Member Data Documentation

◆ data

inotify_event inotify_event_wrapper::data
private

Definition at line 133 of file inotify_watch.cpp.

Referenced by cookie(), len(), mask(), name(), next(), and wd().


The documentation for this class was generated from the following file:
inotify_event_wrapper::len
uint32_t len() const
Definition: inotify_watch.cpp:146
inotify_event_wrapper::mask
uint32_t mask() const
Definition: inotify_watch.cpp:140
inotify_event_wrapper
wrapper for inotify_event with nicer interface.
Definition: inotify_watch.cpp:132
maskName::print
static void print(std::ostream &out, uint32_t mask)
Definition: inotify_watch.cpp:91
inotify_event_wrapper::data
inotify_event data
Definition: inotify_watch.cpp:133