Home Alert System
Dependencies: PWM_Tone_Library DHT
mbed/Stream.h@5:569a4894abc1, 2019-03-08 (annotated)
- Committer:
- aziz111
- Date:
- Fri Mar 08 17:15:02 2019 +0000
- Revision:
- 5:569a4894abc1
- Parent:
- 3:78f223d34f36
Final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ethaderu | 3:78f223d34f36 | 1 | /* mbed Microcontroller Library |
ethaderu | 3:78f223d34f36 | 2 | * Copyright (c) 2006-2013 ARM Limited |
ethaderu | 3:78f223d34f36 | 3 | * |
ethaderu | 3:78f223d34f36 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ethaderu | 3:78f223d34f36 | 5 | * you may not use this file except in compliance with the License. |
ethaderu | 3:78f223d34f36 | 6 | * You may obtain a copy of the License at |
ethaderu | 3:78f223d34f36 | 7 | * |
ethaderu | 3:78f223d34f36 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ethaderu | 3:78f223d34f36 | 9 | * |
ethaderu | 3:78f223d34f36 | 10 | * Unless required by applicable law or agreed to in writing, software |
ethaderu | 3:78f223d34f36 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
ethaderu | 3:78f223d34f36 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ethaderu | 3:78f223d34f36 | 13 | * See the License for the specific language governing permissions and |
ethaderu | 3:78f223d34f36 | 14 | * limitations under the License. |
ethaderu | 3:78f223d34f36 | 15 | */ |
ethaderu | 3:78f223d34f36 | 16 | #ifndef MBED_STREAM_H |
ethaderu | 3:78f223d34f36 | 17 | #define MBED_STREAM_H |
ethaderu | 3:78f223d34f36 | 18 | |
ethaderu | 3:78f223d34f36 | 19 | #include "platform.h" |
ethaderu | 3:78f223d34f36 | 20 | #include "FileLike.h" |
ethaderu | 3:78f223d34f36 | 21 | #include <cstdarg> |
ethaderu | 3:78f223d34f36 | 22 | |
ethaderu | 3:78f223d34f36 | 23 | namespace mbed { |
ethaderu | 3:78f223d34f36 | 24 | |
ethaderu | 3:78f223d34f36 | 25 | extern void mbed_set_unbuffered_stream(FILE *_file); |
ethaderu | 3:78f223d34f36 | 26 | extern int mbed_getc(FILE *_file); |
ethaderu | 3:78f223d34f36 | 27 | extern char* mbed_gets(char *s, int size, FILE *_file); |
ethaderu | 3:78f223d34f36 | 28 | |
ethaderu | 3:78f223d34f36 | 29 | class Stream : public FileLike { |
ethaderu | 3:78f223d34f36 | 30 | |
ethaderu | 3:78f223d34f36 | 31 | public: |
ethaderu | 3:78f223d34f36 | 32 | Stream(const char *name=NULL); |
ethaderu | 3:78f223d34f36 | 33 | virtual ~Stream(); |
ethaderu | 3:78f223d34f36 | 34 | |
ethaderu | 3:78f223d34f36 | 35 | int putc(int c); |
ethaderu | 3:78f223d34f36 | 36 | int puts(const char *s); |
ethaderu | 3:78f223d34f36 | 37 | int getc(); |
ethaderu | 3:78f223d34f36 | 38 | char *gets(char *s, int size); |
ethaderu | 3:78f223d34f36 | 39 | int printf(const char* format, ...); |
ethaderu | 3:78f223d34f36 | 40 | int scanf(const char* format, ...); |
ethaderu | 3:78f223d34f36 | 41 | int vprintf(const char* format, std::va_list args); |
ethaderu | 3:78f223d34f36 | 42 | int vscanf(const char* format, std::va_list args); |
ethaderu | 3:78f223d34f36 | 43 | |
ethaderu | 3:78f223d34f36 | 44 | operator std::FILE*() {return _file;} |
ethaderu | 3:78f223d34f36 | 45 | |
ethaderu | 3:78f223d34f36 | 46 | protected: |
ethaderu | 3:78f223d34f36 | 47 | virtual int close(); |
ethaderu | 3:78f223d34f36 | 48 | virtual ssize_t write(const void* buffer, size_t length); |
ethaderu | 3:78f223d34f36 | 49 | virtual ssize_t read(void* buffer, size_t length); |
ethaderu | 3:78f223d34f36 | 50 | virtual off_t lseek(off_t offset, int whence); |
ethaderu | 3:78f223d34f36 | 51 | virtual int isatty(); |
ethaderu | 3:78f223d34f36 | 52 | virtual int fsync(); |
ethaderu | 3:78f223d34f36 | 53 | virtual off_t flen(); |
ethaderu | 3:78f223d34f36 | 54 | |
ethaderu | 3:78f223d34f36 | 55 | virtual int _putc(int c) = 0; |
ethaderu | 3:78f223d34f36 | 56 | virtual int _getc() = 0; |
ethaderu | 3:78f223d34f36 | 57 | |
ethaderu | 3:78f223d34f36 | 58 | std::FILE *_file; |
ethaderu | 3:78f223d34f36 | 59 | |
ethaderu | 3:78f223d34f36 | 60 | /* disallow copy constructor and assignment operators */ |
ethaderu | 3:78f223d34f36 | 61 | private: |
ethaderu | 3:78f223d34f36 | 62 | Stream(const Stream&); |
ethaderu | 3:78f223d34f36 | 63 | Stream & operator = (const Stream&); |
ethaderu | 3:78f223d34f36 | 64 | }; |
ethaderu | 3:78f223d34f36 | 65 | |
ethaderu | 3:78f223d34f36 | 66 | } // namespace mbed |
ethaderu | 3:78f223d34f36 | 67 | |
ethaderu | 3:78f223d34f36 | 68 | #endif |