4S Device Communication Module Collection  Version 0.6-SNAPSHOT
Full documentation of the modules in the 4SDC collection (aimed at 4SDC module developers)
msgqueue.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2015 The 4S Foundation (www.4s-online.dk)
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
32 #ifndef MSGQUEUE_H
33 #define MSGQUEUE_H
34 
35 #include "handle.h"
36 #include "msgaddr.h"
37 #include <typeinfo>
38 
39 namespace FSYS
40 {
41  class MsgCallBack;
42 
69  class MsgQueue
70  {
71  public:
72 
85  static void addListenerToQueue(MsgAddr &receiverAddr,
86  const std::type_info &typeOfMsg,
87  MsgCallBack *msgCallBack);
88 
97  static void removeListenerFromQueue(MsgCallBack *msgCallBack);
98 
99 
108  static void waitUntilQueueHasData( void );
109 
134  static void emptyMsgQueue( int maxTimeMs=-1 );
135 
153  static void breakEmptyMsgQueue( void );
154 
163  static bool isEmpty( void );
164 
173  static Handle getHandle( void );
174  };
175 }
176 #endif // MSGQUEUE_H
static void waitUntilQueueHasData(void)
Function that halts the current thread execution.
Definition: msgqueue.cpp:49
Contains interface for a message address.
This is a wrapper class for the class that does all the hard work.
Definition: msgqueue.h:69
Class that holds and assigns handles.
Definition: handle.h:55
static void removeListenerFromQueue(MsgCallBack *msgCallBack)
Function that unregisters a listener from the message queue.
Definition: msgqueue.cpp:44
Contains interface declaration for the FSYS::Handle class.
static void breakEmptyMsgQueue(void)
Breaks out of emptyMsgQueue.
Definition: msgqueue.cpp:59
static void emptyMsgQueue(int maxTimeMs=-1)
The function will process messages on the message queue.
Definition: msgqueue.cpp:54
Definition: basemsg.h:38
static Handle getHandle(void)
Retrieves the handle of the queue for the current thread.
Definition: msgqueue.cpp:69
static void addListenerToQueue(MsgAddr &receiverAddr, const std::type_info &typeOfMsg, MsgCallBack *msgCallBack)
Function that registers a listener to the message queue.
Definition: msgqueue.cpp:35
static bool isEmpty(void)
Function to determine if there is data on the msg queue.
Definition: msgqueue.cpp:64
The MsgCallBack class is an internal class to the message system.
Definition: msgcallback.h:54
The MsgAddr class contains a unique address in the message system.
Definition: msgaddr.h:52