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_FILEBASE_H
IKobayashi 0:c88c3b616c00 17 #define MBED_FILEBASE_H
IKobayashi 0:c88c3b616c00 18
IKobayashi 0:c88c3b616c00 19 typedef int FILEHANDLE;
IKobayashi 0:c88c3b616c00 20
IKobayashi 0:c88c3b616c00 21 #include <cstdio>
IKobayashi 0:c88c3b616c00 22 #include <cstring>
IKobayashi 0:c88c3b616c00 23
IKobayashi 0:c88c3b616c00 24 #if defined(__ARMCC_VERSION) || defined(__ICCARM__)
IKobayashi 0:c88c3b616c00 25 # define O_RDONLY 0
IKobayashi 0:c88c3b616c00 26 # define O_WRONLY 1
IKobayashi 0:c88c3b616c00 27 # define O_RDWR 2
IKobayashi 0:c88c3b616c00 28 # define O_CREAT 0x0200
IKobayashi 0:c88c3b616c00 29 # define O_TRUNC 0x0400
IKobayashi 0:c88c3b616c00 30 # define O_APPEND 0x0008
IKobayashi 0:c88c3b616c00 31
IKobayashi 0:c88c3b616c00 32 # define NAME_MAX 255
IKobayashi 0:c88c3b616c00 33
IKobayashi 0:c88c3b616c00 34 typedef int mode_t;
IKobayashi 0:c88c3b616c00 35 typedef int ssize_t;
IKobayashi 0:c88c3b616c00 36 typedef long off_t;
IKobayashi 0:c88c3b616c00 37
IKobayashi 0:c88c3b616c00 38 #else
IKobayashi 0:c88c3b616c00 39 # include <sys/fcntl.h>
IKobayashi 0:c88c3b616c00 40 # include <sys/types.h>
IKobayashi 0:c88c3b616c00 41 # include <sys/syslimits.h>
IKobayashi 0:c88c3b616c00 42 #endif
IKobayashi 0:c88c3b616c00 43
IKobayashi 0:c88c3b616c00 44 #include "platform/platform.h"
IKobayashi 0:c88c3b616c00 45 #include "platform/SingletonPtr.h"
IKobayashi 0:c88c3b616c00 46 #include "platform/PlatformMutex.h"
IKobayashi 0:c88c3b616c00 47
IKobayashi 0:c88c3b616c00 48 namespace mbed {
IKobayashi 0:c88c3b616c00 49 /** \addtogroup drivers */
IKobayashi 0:c88c3b616c00 50 /** @{*/
IKobayashi 0:c88c3b616c00 51
IKobayashi 0:c88c3b616c00 52 typedef enum {
IKobayashi 0:c88c3b616c00 53 FilePathType,
IKobayashi 0:c88c3b616c00 54 FileSystemPathType
IKobayashi 0:c88c3b616c00 55 } PathType;
IKobayashi 0:c88c3b616c00 56
IKobayashi 0:c88c3b616c00 57 class FileBase {
IKobayashi 0:c88c3b616c00 58 public:
IKobayashi 0:c88c3b616c00 59 FileBase(const char *name, PathType t);
IKobayashi 0:c88c3b616c00 60
IKobayashi 0:c88c3b616c00 61 virtual ~FileBase();
IKobayashi 0:c88c3b616c00 62
IKobayashi 0:c88c3b616c00 63 const char* getName(void);
IKobayashi 0:c88c3b616c00 64 PathType getPathType(void);
IKobayashi 0:c88c3b616c00 65
IKobayashi 0:c88c3b616c00 66 static FileBase *lookup(const char *name, unsigned int len);
IKobayashi 0:c88c3b616c00 67
IKobayashi 0:c88c3b616c00 68 static FileBase *get(int n);
IKobayashi 0:c88c3b616c00 69
IKobayashi 0:c88c3b616c00 70 /* disallow copy constructor and assignment operators */
IKobayashi 0:c88c3b616c00 71 private:
IKobayashi 0:c88c3b616c00 72 static FileBase *_head;
IKobayashi 0:c88c3b616c00 73 static SingletonPtr<PlatformMutex> _mutex;
IKobayashi 0:c88c3b616c00 74
IKobayashi 0:c88c3b616c00 75 FileBase *_next;
IKobayashi 0:c88c3b616c00 76 const char * const _name;
IKobayashi 0:c88c3b616c00 77 const PathType _path_type;
IKobayashi 0:c88c3b616c00 78 FileBase(const FileBase&);
IKobayashi 0:c88c3b616c00 79 FileBase & operator = (const FileBase&);
IKobayashi 0:c88c3b616c00 80 };
IKobayashi 0:c88c3b616c00 81
IKobayashi 0:c88c3b616c00 82 } // namespace mbed
IKobayashi 0:c88c3b616c00 83
IKobayashi 0:c88c3b616c00 84 #endif
IKobayashi 0:c88c3b616c00 85
IKobayashi 0:c88c3b616c00 86 /** @}*/