IoT Home Alarm System
Dependents: IoTBurglar_and_Fire_AlarmSystem
Stream.h@0:2f388b030837, 2016-04-29 (annotated)
- Committer:
- kbrahmbhatt6
- Date:
- Fri Apr 29 06:59:59 2016 +0000
- Revision:
- 0:2f388b030837
1
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| kbrahmbhatt6 | 0:2f388b030837 | 1 | /* mbed Microcontroller Library |
| kbrahmbhatt6 | 0:2f388b030837 | 2 | * Copyright (c) 2006-2013 ARM Limited |
| kbrahmbhatt6 | 0:2f388b030837 | 3 | * |
| kbrahmbhatt6 | 0:2f388b030837 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| kbrahmbhatt6 | 0:2f388b030837 | 5 | * you may not use this file except in compliance with the License. |
| kbrahmbhatt6 | 0:2f388b030837 | 6 | * You may obtain a copy of the License at |
| kbrahmbhatt6 | 0:2f388b030837 | 7 | * |
| kbrahmbhatt6 | 0:2f388b030837 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| kbrahmbhatt6 | 0:2f388b030837 | 9 | * |
| kbrahmbhatt6 | 0:2f388b030837 | 10 | * Unless required by applicable law or agreed to in writing, software |
| kbrahmbhatt6 | 0:2f388b030837 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| kbrahmbhatt6 | 0:2f388b030837 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| kbrahmbhatt6 | 0:2f388b030837 | 13 | * See the License for the specific language governing permissions and |
| kbrahmbhatt6 | 0:2f388b030837 | 14 | * limitations under the License. |
| kbrahmbhatt6 | 0:2f388b030837 | 15 | */ |
| kbrahmbhatt6 | 0:2f388b030837 | 16 | #ifndef MBED_STREAM_H |
| kbrahmbhatt6 | 0:2f388b030837 | 17 | #define MBED_STREAM_H |
| kbrahmbhatt6 | 0:2f388b030837 | 18 | |
| kbrahmbhatt6 | 0:2f388b030837 | 19 | #include "platform.h" |
| kbrahmbhatt6 | 0:2f388b030837 | 20 | #include "FileLike.h" |
| kbrahmbhatt6 | 0:2f388b030837 | 21 | |
| kbrahmbhatt6 | 0:2f388b030837 | 22 | namespace mbed { |
| kbrahmbhatt6 | 0:2f388b030837 | 23 | |
| kbrahmbhatt6 | 0:2f388b030837 | 24 | class Stream : public FileLike { |
| kbrahmbhatt6 | 0:2f388b030837 | 25 | |
| kbrahmbhatt6 | 0:2f388b030837 | 26 | public: |
| kbrahmbhatt6 | 0:2f388b030837 | 27 | Stream(const char *name=NULL); |
| kbrahmbhatt6 | 0:2f388b030837 | 28 | virtual ~Stream(); |
| kbrahmbhatt6 | 0:2f388b030837 | 29 | |
| kbrahmbhatt6 | 0:2f388b030837 | 30 | int putc(int c); |
| kbrahmbhatt6 | 0:2f388b030837 | 31 | int puts(const char *s); |
| kbrahmbhatt6 | 0:2f388b030837 | 32 | int getc(); |
| kbrahmbhatt6 | 0:2f388b030837 | 33 | char *gets(char *s, int size); |
| kbrahmbhatt6 | 0:2f388b030837 | 34 | int printf(const char* format, ...); |
| kbrahmbhatt6 | 0:2f388b030837 | 35 | int scanf(const char* format, ...); |
| kbrahmbhatt6 | 0:2f388b030837 | 36 | |
| kbrahmbhatt6 | 0:2f388b030837 | 37 | operator std::FILE*() {return _file;} |
| kbrahmbhatt6 | 0:2f388b030837 | 38 | |
| kbrahmbhatt6 | 0:2f388b030837 | 39 | protected: |
| kbrahmbhatt6 | 0:2f388b030837 | 40 | virtual int close(); |
| kbrahmbhatt6 | 0:2f388b030837 | 41 | virtual ssize_t write(const void* buffer, size_t length); |
| kbrahmbhatt6 | 0:2f388b030837 | 42 | virtual ssize_t read(void* buffer, size_t length); |
| kbrahmbhatt6 | 0:2f388b030837 | 43 | virtual off_t lseek(off_t offset, int whence); |
| kbrahmbhatt6 | 0:2f388b030837 | 44 | virtual int isatty(); |
| kbrahmbhatt6 | 0:2f388b030837 | 45 | virtual int fsync(); |
| kbrahmbhatt6 | 0:2f388b030837 | 46 | virtual off_t flen(); |
| kbrahmbhatt6 | 0:2f388b030837 | 47 | |
| kbrahmbhatt6 | 0:2f388b030837 | 48 | virtual int _putc(int c) = 0; |
| kbrahmbhatt6 | 0:2f388b030837 | 49 | virtual int _getc() = 0; |
| kbrahmbhatt6 | 0:2f388b030837 | 50 | |
| kbrahmbhatt6 | 0:2f388b030837 | 51 | std::FILE *_file; |
| kbrahmbhatt6 | 0:2f388b030837 | 52 | }; |
| kbrahmbhatt6 | 0:2f388b030837 | 53 | |
| kbrahmbhatt6 | 0:2f388b030837 | 54 | } // namespace mbed |
| kbrahmbhatt6 | 0:2f388b030837 | 55 | |
| kbrahmbhatt6 | 0:2f388b030837 | 56 | #endif |