temp

Dependencies:   mbed SDFileSystem MS5607 ADXL345_I2C FATFileSystem

Committer:
IKobayashi
Date:
Mon Mar 16 23:37:42 2020 +0900
Revision:
0:c88c3b616c00
copy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IKobayashi 0:c88c3b616c00 1 /* mbed Microcontroller Library
IKobayashi 0:c88c3b616c00 2 * Copyright (c) 2006-2013 ARM Limited
IKobayashi 0:c88c3b616c00 3 *
IKobayashi 0:c88c3b616c00 4 * Licensed under the Apache License, Version 2.0 (the "License");
IKobayashi 0:c88c3b616c00 5 * you may not use this file except in compliance with the License.
IKobayashi 0:c88c3b616c00 6 * You may obtain a copy of the License at
IKobayashi 0:c88c3b616c00 7 *
IKobayashi 0:c88c3b616c00 8 * http://www.apache.org/licenses/LICENSE-2.0
IKobayashi 0:c88c3b616c00 9 *
IKobayashi 0:c88c3b616c00 10 * Unless required by applicable law or agreed to in writing, software
IKobayashi 0:c88c3b616c00 11 * distributed under the License is distributed on an "AS IS" BASIS,
IKobayashi 0:c88c3b616c00 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
IKobayashi 0:c88c3b616c00 13 * See the License for the specific language governing permissions and
IKobayashi 0:c88c3b616c00 14 * limitations under the License.
IKobayashi 0:c88c3b616c00 15 */
IKobayashi 0:c88c3b616c00 16 #ifndef MBED_STREAM_H
IKobayashi 0:c88c3b616c00 17 #define MBED_STREAM_H
IKobayashi 0:c88c3b616c00 18
IKobayashi 0:c88c3b616c00 19 #include "platform/platform.h"
IKobayashi 0:c88c3b616c00 20 #include "drivers/FileLike.h"
IKobayashi 0:c88c3b616c00 21 #include <cstdarg>
IKobayashi 0:c88c3b616c00 22
IKobayashi 0:c88c3b616c00 23 namespace mbed {
IKobayashi 0:c88c3b616c00 24 /** \addtogroup drivers */
IKobayashi 0:c88c3b616c00 25 /** @{*/
IKobayashi 0:c88c3b616c00 26
IKobayashi 0:c88c3b616c00 27 extern void mbed_set_unbuffered_stream(FILE *_file);
IKobayashi 0:c88c3b616c00 28 extern int mbed_getc(FILE *_file);
IKobayashi 0:c88c3b616c00 29 extern char* mbed_gets(char *s, int size, FILE *_file);
IKobayashi 0:c88c3b616c00 30
IKobayashi 0:c88c3b616c00 31 /** File stream
IKobayashi 0:c88c3b616c00 32 *
IKobayashi 0:c88c3b616c00 33 * @Note Synchronization level: Set by subclass
IKobayashi 0:c88c3b616c00 34 */
IKobayashi 0:c88c3b616c00 35 class Stream : public FileLike {
IKobayashi 0:c88c3b616c00 36
IKobayashi 0:c88c3b616c00 37 public:
IKobayashi 0:c88c3b616c00 38 Stream(const char *name=NULL);
IKobayashi 0:c88c3b616c00 39 virtual ~Stream();
IKobayashi 0:c88c3b616c00 40
IKobayashi 0:c88c3b616c00 41 int putc(int c);
IKobayashi 0:c88c3b616c00 42 int puts(const char *s);
IKobayashi 0:c88c3b616c00 43 int getc();
IKobayashi 0:c88c3b616c00 44 char *gets(char *s, int size);
IKobayashi 0:c88c3b616c00 45 int printf(const char* format, ...);
IKobayashi 0:c88c3b616c00 46 int scanf(const char* format, ...);
IKobayashi 0:c88c3b616c00 47 int vprintf(const char* format, std::va_list args);
IKobayashi 0:c88c3b616c00 48 int vscanf(const char* format, std::va_list args);
IKobayashi 0:c88c3b616c00 49
IKobayashi 0:c88c3b616c00 50 operator std::FILE*() {return _file;}
IKobayashi 0:c88c3b616c00 51
IKobayashi 0:c88c3b616c00 52 protected:
IKobayashi 0:c88c3b616c00 53 virtual int close();
IKobayashi 0:c88c3b616c00 54 virtual ssize_t write(const void* buffer, size_t length);
IKobayashi 0:c88c3b616c00 55 virtual ssize_t read(void* buffer, size_t length);
IKobayashi 0:c88c3b616c00 56 virtual off_t lseek(off_t offset, int whence);
IKobayashi 0:c88c3b616c00 57 virtual int isatty();
IKobayashi 0:c88c3b616c00 58 virtual int fsync();
IKobayashi 0:c88c3b616c00 59 virtual off_t flen();
IKobayashi 0:c88c3b616c00 60
IKobayashi 0:c88c3b616c00 61 virtual int _putc(int c) = 0;
IKobayashi 0:c88c3b616c00 62 virtual int _getc() = 0;
IKobayashi 0:c88c3b616c00 63
IKobayashi 0:c88c3b616c00 64 std::FILE *_file;
IKobayashi 0:c88c3b616c00 65
IKobayashi 0:c88c3b616c00 66 /* disallow copy constructor and assignment operators */
IKobayashi 0:c88c3b616c00 67 private:
IKobayashi 0:c88c3b616c00 68 Stream(const Stream&);
IKobayashi 0:c88c3b616c00 69 Stream & operator = (const Stream&);
IKobayashi 0:c88c3b616c00 70 };
IKobayashi 0:c88c3b616c00 71
IKobayashi 0:c88c3b616c00 72 } // namespace mbed
IKobayashi 0:c88c3b616c00 73
IKobayashi 0:c88c3b616c00 74 #endif
IKobayashi 0:c88c3b616c00 75
IKobayashi 0:c88c3b616c00 76 /** @}*/