Commit | Line | Data |
---|---|---|
d4ee6ee2 JM |
1 | #ifndef _COMMANDQUEUE_H_ |
2 | #define _COMMANDQUEUE_H_ | |
3 | ||
4 | #ifdef __cplusplus | |
5 | ||
6 | #include "fifo.h" | |
7 | #include <string> | |
8 | ||
0d9c5e2a | 9 | class StreamOutput; |
d4ee6ee2 JM |
10 | |
11 | class CommandQueue | |
12 | { | |
13 | public: | |
14 | CommandQueue(); | |
15 | ~CommandQueue(); | |
16 | bool pop(); | |
17 | int add(const char* cmd, StreamOutput *pstream); | |
18 | int size() {return q.size();} | |
19 | static CommandQueue* getInstance(); | |
20 | ||
21 | private: | |
22 | typedef struct {char* str; StreamOutput *pstream; } cmd_t; | |
23 | Fifo<cmd_t> q; | |
24 | static CommandQueue *instance; | |
25 | StreamOutput *null_stream; | |
26 | }; | |
27 | ||
28 | #else | |
29 | ||
30 | extern int network_add_command(const char * cmd, void *pstream); | |
31 | #endif | |
32 | ||
33 | #endif |