Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
msg.h
1
2
/***************************************************************************
3
* msg.h - IPC message queue
4
*
5
* Generated: Mon Mar 13 17:37:49 2006 (from FireVision)
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_MSG_H_
25
#define __UTILS_IPC_MSG_H_
26
27
namespace
fawkes {
28
29
30
class
IPCMessageQueueData;
31
32
class
IPCMessageQueue
{
33
public
:
34
35
static
const
int
MaxMessageSize
;
36
37
/** This is the struct of the messages that has to be fed to send and
38
* receive methods.
39
*/
40
typedef
struct
{
41
long
int
mtype
;
/**< type of the message */
42
char
mtext[1];
/**< content of the message, can be of arbitrary
43
* size up to MaxMessageSize
44
*/
45
}
MessageStruct
;
46
47
IPCMessageQueue
(
const
char
*path,
char
id
,
48
bool
create =
false
,
49
bool
destroy_on_delete
=
false
);
50
51
IPCMessageQueue
(
int
id
,
52
bool
create =
false
,
53
bool
destroy_on_delete
=
false
);
54
55
~IPCMessageQueue
();
56
57
bool
isValid
();
58
bool
recv
(
long
mtype
,
MessageStruct
*msg,
unsigned
int
data_size);
59
bool
recvNext
(
MessageStruct
*msg,
unsigned
int
max_data_size,
int
*data_size);
60
bool
send
(
MessageStruct
*msg,
unsigned
int
data_size);
61
62
/** Get the message type
63
* @param buffer the buffer of the message as returned by getMessage()
64
* @return the message type
65
*/
66
static
inline
long
67
mtype
(
char
*buffer)
68
{
69
return
(((
MessageStruct
*)buffer)->
mtype
);
70
}
71
72
protected
:
73
bool
destroy_on_delete
;
74
75
private
:
76
IPCMessageQueueData *data;
77
78
};
79
80
81
}
// end namespace fawkes
82
83
#endif
src
libs
utils
ipc
msg.h
Generated by
1.8.1.2