Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
platform/Stream.h@170:54ff26da7eb6, 2017-07-04 (annotated)
- Committer:
- thedo
- Date:
- Tue Jul 04 06:23:13 2017 +0000
- Revision:
- 170:54ff26da7eb6
- Parent:
- 166:3a9487d57a5c
project opencv 3.1 on GR PEACH board, no use SD card.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedo | 166:3a9487d57a5c | 1 | /* mbed Microcontroller Library |
thedo | 166:3a9487d57a5c | 2 | * Copyright (c) 2006-2013 ARM Limited |
thedo | 166:3a9487d57a5c | 3 | * |
thedo | 166:3a9487d57a5c | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
thedo | 166:3a9487d57a5c | 5 | * you may not use this file except in compliance with the License. |
thedo | 166:3a9487d57a5c | 6 | * You may obtain a copy of the License at |
thedo | 166:3a9487d57a5c | 7 | * |
thedo | 166:3a9487d57a5c | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
thedo | 166:3a9487d57a5c | 9 | * |
thedo | 166:3a9487d57a5c | 10 | * Unless required by applicable law or agreed to in writing, software |
thedo | 166:3a9487d57a5c | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
thedo | 166:3a9487d57a5c | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
thedo | 166:3a9487d57a5c | 13 | * See the License for the specific language governing permissions and |
thedo | 166:3a9487d57a5c | 14 | * limitations under the License. |
thedo | 166:3a9487d57a5c | 15 | */ |
thedo | 166:3a9487d57a5c | 16 | #ifndef MBED_STREAM_H |
thedo | 166:3a9487d57a5c | 17 | #define MBED_STREAM_H |
thedo | 166:3a9487d57a5c | 18 | |
thedo | 166:3a9487d57a5c | 19 | #include "platform/platform.h" |
thedo | 166:3a9487d57a5c | 20 | #include "platform/FileLike.h" |
thedo | 166:3a9487d57a5c | 21 | #include "platform/FileHandle.h" |
thedo | 166:3a9487d57a5c | 22 | #include <cstdio> |
thedo | 166:3a9487d57a5c | 23 | #include <cstdarg> |
thedo | 166:3a9487d57a5c | 24 | |
thedo | 166:3a9487d57a5c | 25 | namespace mbed { |
thedo | 166:3a9487d57a5c | 26 | /** \addtogroup platform */ |
thedo | 166:3a9487d57a5c | 27 | /** @{*/ |
thedo | 166:3a9487d57a5c | 28 | |
thedo | 166:3a9487d57a5c | 29 | extern void mbed_set_unbuffered_stream(std::FILE *_file); |
thedo | 166:3a9487d57a5c | 30 | extern int mbed_getc(std::FILE *_file); |
thedo | 166:3a9487d57a5c | 31 | extern char* mbed_gets(char *s, int size, std::FILE *_file); |
thedo | 166:3a9487d57a5c | 32 | /** @}*/ |
thedo | 166:3a9487d57a5c | 33 | |
thedo | 166:3a9487d57a5c | 34 | /** File stream |
thedo | 166:3a9487d57a5c | 35 | * |
thedo | 166:3a9487d57a5c | 36 | * @note Synchronization level: Set by subclass |
thedo | 166:3a9487d57a5c | 37 | * @ingroup platform |
thedo | 166:3a9487d57a5c | 38 | */ |
thedo | 166:3a9487d57a5c | 39 | class Stream : public FileLike { |
thedo | 166:3a9487d57a5c | 40 | |
thedo | 166:3a9487d57a5c | 41 | public: |
thedo | 166:3a9487d57a5c | 42 | Stream(const char *name=NULL); |
thedo | 166:3a9487d57a5c | 43 | virtual ~Stream(); |
thedo | 166:3a9487d57a5c | 44 | |
thedo | 166:3a9487d57a5c | 45 | int putc(int c); |
thedo | 166:3a9487d57a5c | 46 | int puts(const char *s); |
thedo | 166:3a9487d57a5c | 47 | int getc(); |
thedo | 166:3a9487d57a5c | 48 | char *gets(char *s, int size); |
thedo | 166:3a9487d57a5c | 49 | int printf(const char* format, ...); |
thedo | 166:3a9487d57a5c | 50 | int scanf(const char* format, ...); |
thedo | 166:3a9487d57a5c | 51 | int vprintf(const char* format, std::va_list args); |
thedo | 166:3a9487d57a5c | 52 | int vscanf(const char* format, std::va_list args); |
thedo | 166:3a9487d57a5c | 53 | |
thedo | 166:3a9487d57a5c | 54 | operator std::FILE*() {return _file;} |
thedo | 166:3a9487d57a5c | 55 | |
thedo | 166:3a9487d57a5c | 56 | protected: |
thedo | 166:3a9487d57a5c | 57 | virtual int close(); |
thedo | 166:3a9487d57a5c | 58 | virtual ssize_t write(const void* buffer, size_t length); |
thedo | 166:3a9487d57a5c | 59 | virtual ssize_t read(void* buffer, size_t length); |
thedo | 166:3a9487d57a5c | 60 | virtual off_t seek(off_t offset, int whence); |
thedo | 166:3a9487d57a5c | 61 | virtual off_t tell(); |
thedo | 166:3a9487d57a5c | 62 | virtual void rewind(); |
thedo | 166:3a9487d57a5c | 63 | virtual int isatty(); |
thedo | 166:3a9487d57a5c | 64 | virtual int sync(); |
thedo | 166:3a9487d57a5c | 65 | virtual off_t size(); |
thedo | 166:3a9487d57a5c | 66 | |
thedo | 166:3a9487d57a5c | 67 | virtual int _putc(int c) = 0; |
thedo | 166:3a9487d57a5c | 68 | virtual int _getc() = 0; |
thedo | 166:3a9487d57a5c | 69 | |
thedo | 166:3a9487d57a5c | 70 | std::FILE *_file; |
thedo | 166:3a9487d57a5c | 71 | |
thedo | 166:3a9487d57a5c | 72 | /** Acquire exclusive access to this object. |
thedo | 166:3a9487d57a5c | 73 | */ |
thedo | 166:3a9487d57a5c | 74 | virtual void lock() { |
thedo | 166:3a9487d57a5c | 75 | // Stub |
thedo | 166:3a9487d57a5c | 76 | } |
thedo | 166:3a9487d57a5c | 77 | |
thedo | 166:3a9487d57a5c | 78 | /** Release exclusive access to this object. |
thedo | 166:3a9487d57a5c | 79 | */ |
thedo | 166:3a9487d57a5c | 80 | virtual void unlock() { |
thedo | 166:3a9487d57a5c | 81 | // Stub |
thedo | 166:3a9487d57a5c | 82 | } |
thedo | 166:3a9487d57a5c | 83 | |
thedo | 166:3a9487d57a5c | 84 | /* disallow copy constructor and assignment operators */ |
thedo | 166:3a9487d57a5c | 85 | private: |
thedo | 166:3a9487d57a5c | 86 | Stream(const Stream&); |
thedo | 166:3a9487d57a5c | 87 | Stream & operator = (const Stream&); |
thedo | 166:3a9487d57a5c | 88 | }; |
thedo | 166:3a9487d57a5c | 89 | |
thedo | 166:3a9487d57a5c | 90 | } // namespace mbed |
thedo | 166:3a9487d57a5c | 91 | |
thedo | 166:3a9487d57a5c | 92 | #endif |
thedo | 166:3a9487d57a5c | 93 | |
thedo | 166:3a9487d57a5c | 94 |