aboutsummaryrefslogtreecommitdiff
path: root/src/fifo.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fifo.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/fifo.h b/src/fifo.h
new file mode 100644
index 0000000..4989839
--- /dev/null
+++ b/src/fifo.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2007-2008 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#ifndef BU_FIFO_H
9#define BU_FIFO_H
10
11#include <stdint.h>
12#include <sys/types.h>
13#include <stdlib.h>
14
15#include "bu/stream.h"
16#include "bu/fstring.h"
17
18namespace Bu
19{
20 /**
21 * A fifo stream.
22 *@ingroup Streams
23 */
24 class Fifo : public Bu::Stream
25 {
26 public:
27 Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc=-1 );
28 virtual ~Fifo();
29
30 virtual void close();
31 virtual size_t read( void *pBuf, size_t nBytes );
32 virtual size_t write( const void *pBuf, size_t nBytes );
33 using Stream::write;
34
35 virtual long tell();
36 virtual void seek( long offset );
37 virtual void setPos( long pos );
38 virtual void setPosEnd( long pos );
39 virtual bool isEOS();
40 virtual bool isOpen();
41
42 virtual void flush();
43
44 virtual bool canRead();
45 virtual bool canWrite();
46
47 virtual bool isReadable();
48 virtual bool isWritable();
49 virtual bool isSeekable();
50
51 virtual bool isBlocking();
52 virtual void setBlocking( bool bBlocking=true );
53
54 enum {
55 Read = 0x01,
56 Write = 0x02,
57 Create = 0x04,
58 Delete = 0x08,
59 NonBlock = 0x10
60 };
61
62 private:
63 int iFlags;
64 int iIn;
65 int iOut;
66 };
67}
68
69#endif