Last change
on this file since 4026 was
3615,
checked in by ldelgass, 12 years ago
|
Remove enclosing Rappture namespace from vtkvis. Remove outline and outline
color subcommands from dataset in vtkvis protocol -- they are replaced by the
outline object. Translate heightmap to dataset z plane (client is doing this
right now).
|
-
Property svn:eol-style set to
native
|
File size:
1.7 KB
|
Line | |
---|
1 | /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */ |
---|
2 | /* |
---|
3 | * Copyright (C) 2004-2012 HUBzero Foundation, LLC |
---|
4 | * |
---|
5 | * Author: George A. Howlett <gah@purdue.edu> |
---|
6 | */ |
---|
7 | |
---|
8 | #include <cstdlib> |
---|
9 | |
---|
10 | #ifndef VTKVIS_READBUFFER_H |
---|
11 | #define VTKVIS_READBUFFER_H |
---|
12 | |
---|
13 | namespace VtkVis { |
---|
14 | |
---|
15 | /** |
---|
16 | * \brief Buffered input for reading socket |
---|
17 | */ |
---|
18 | class ReadBuffer |
---|
19 | { |
---|
20 | public: |
---|
21 | enum BufferStatus { |
---|
22 | ENDFILE=-1, |
---|
23 | OK, |
---|
24 | ERROR, |
---|
25 | CONTINUE, |
---|
26 | }; |
---|
27 | |
---|
28 | ReadBuffer(int fd, size_t bufferSize); |
---|
29 | |
---|
30 | virtual ~ReadBuffer(); |
---|
31 | |
---|
32 | BufferStatus getLine(size_t *numBytesPtr, unsigned char **bytesPtr); |
---|
33 | |
---|
34 | BufferStatus followingData(unsigned char *out, size_t numBytes); |
---|
35 | |
---|
36 | /** |
---|
37 | * \brief Check if buffer contains data ending in a newline |
---|
38 | * |
---|
39 | * \return bool indicating if getLine can be called without blocking |
---|
40 | */ |
---|
41 | bool isLineAvailable() |
---|
42 | { |
---|
43 | return (nextNewLine() > 0); |
---|
44 | } |
---|
45 | |
---|
46 | /** |
---|
47 | * \brief Get the file descriptor this object reads from |
---|
48 | */ |
---|
49 | int file() |
---|
50 | { |
---|
51 | return _fd; |
---|
52 | } |
---|
53 | |
---|
54 | /** |
---|
55 | * \brief Get the status of the last read |
---|
56 | */ |
---|
57 | BufferStatus status() |
---|
58 | { |
---|
59 | return _lastStatus; |
---|
60 | } |
---|
61 | |
---|
62 | private: |
---|
63 | unsigned char *_bytes; /**< New-ed buffer to hold read |
---|
64 | * characters. */ |
---|
65 | size_t _bufferSize; /**< # of bytes allocated for buffer */ |
---|
66 | size_t _fill; /**< # of bytes used in the buffer */ |
---|
67 | size_t _mark; /**< Starting point of the unconsumed |
---|
68 | * data in the buffer. */ |
---|
69 | int _fd; /**< File descriptor to get data. */ |
---|
70 | BufferStatus _lastStatus; /**< Status of last read operation. */ |
---|
71 | |
---|
72 | BufferStatus doFill(); |
---|
73 | |
---|
74 | void flush() |
---|
75 | { |
---|
76 | _fill = _mark = 0; |
---|
77 | } |
---|
78 | |
---|
79 | size_t nextNewLine(); |
---|
80 | }; |
---|
81 | |
---|
82 | } |
---|
83 | |
---|
84 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.