fft

Dependencies:   BSP_DISCO_F746NG SDFileSystem_Warning_Fixed

Committer:
aria19970520
Date:
Fri Mar 06 06:52:14 2020 +0000
Revision:
3:6f7e05dd8d15
Parent:
0:3e46577dc273
fft

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MikamiUitOpen 0:3e46577dc273 1 /* mbed Microcontroller Library
MikamiUitOpen 0:3e46577dc273 2 * Copyright (c) 2006-2013 ARM Limited
MikamiUitOpen 0:3e46577dc273 3 *
MikamiUitOpen 0:3e46577dc273 4 * Licensed under the Apache License, Version 2.0 (the "License");
MikamiUitOpen 0:3e46577dc273 5 * you may not use this file except in compliance with the License.
MikamiUitOpen 0:3e46577dc273 6 * You may obtain a copy of the License at
MikamiUitOpen 0:3e46577dc273 7 *
MikamiUitOpen 0:3e46577dc273 8 * http://www.apache.org/licenses/LICENSE-2.0
MikamiUitOpen 0:3e46577dc273 9 *
MikamiUitOpen 0:3e46577dc273 10 * Unless required by applicable law or agreed to in writing, software
MikamiUitOpen 0:3e46577dc273 11 * distributed under the License is distributed on an "AS IS" BASIS,
MikamiUitOpen 0:3e46577dc273 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MikamiUitOpen 0:3e46577dc273 13 * See the License for the specific language governing permissions and
MikamiUitOpen 0:3e46577dc273 14 * limitations under the License.
MikamiUitOpen 0:3e46577dc273 15 */
MikamiUitOpen 0:3e46577dc273 16 #ifndef MBED_FILESYSTEMLIKE_H
MikamiUitOpen 0:3e46577dc273 17 #define MBED_FILESYSTEMLIKE_H
MikamiUitOpen 0:3e46577dc273 18
MikamiUitOpen 0:3e46577dc273 19 #include "platform.h"
MikamiUitOpen 0:3e46577dc273 20
MikamiUitOpen 0:3e46577dc273 21 #include "FileBase.h"
MikamiUitOpen 0:3e46577dc273 22 #include "FileHandle.h"
MikamiUitOpen 0:3e46577dc273 23 #include "DirHandle.h"
MikamiUitOpen 0:3e46577dc273 24
MikamiUitOpen 0:3e46577dc273 25 namespace mbed {
MikamiUitOpen 0:3e46577dc273 26
MikamiUitOpen 0:3e46577dc273 27 /** A filesystem-like object is one that can be used to open files
MikamiUitOpen 0:3e46577dc273 28 * though it by fopen("/name/filename", mode)
MikamiUitOpen 0:3e46577dc273 29 *
MikamiUitOpen 0:3e46577dc273 30 * Implementations must define at least open (the default definitions
MikamiUitOpen 0:3e46577dc273 31 * of the rest of the functions just return error values).
MikamiUitOpen 0:3e46577dc273 32 */
MikamiUitOpen 0:3e46577dc273 33 class FileSystemLike : public FileBase {
MikamiUitOpen 0:3e46577dc273 34
MikamiUitOpen 0:3e46577dc273 35 public:
MikamiUitOpen 0:3e46577dc273 36 /** FileSystemLike constructor
MikamiUitOpen 0:3e46577dc273 37 *
MikamiUitOpen 0:3e46577dc273 38 * @param name The name to use for the filesystem.
MikamiUitOpen 0:3e46577dc273 39 */
MikamiUitOpen 0:3e46577dc273 40 FileSystemLike(const char *name);
MikamiUitOpen 0:3e46577dc273 41
MikamiUitOpen 0:3e46577dc273 42 virtual ~FileSystemLike();
MikamiUitOpen 0:3e46577dc273 43
MikamiUitOpen 0:3e46577dc273 44 static DirHandle *opendir();
MikamiUitOpen 0:3e46577dc273 45 friend class BaseDirHandle;
MikamiUitOpen 0:3e46577dc273 46
MikamiUitOpen 0:3e46577dc273 47 /** Opens a file from the filesystem
MikamiUitOpen 0:3e46577dc273 48 *
MikamiUitOpen 0:3e46577dc273 49 * @param filename The name of the file to open.
MikamiUitOpen 0:3e46577dc273 50 * @param flags One of O_RDONLY, O_WRONLY, or O_RDWR, OR'd with
MikamiUitOpen 0:3e46577dc273 51 * zero or more of O_CREAT, O_TRUNC, or O_APPEND.
MikamiUitOpen 0:3e46577dc273 52 *
MikamiUitOpen 0:3e46577dc273 53 * @returns
MikamiUitOpen 0:3e46577dc273 54 * A pointer to a FileHandle object representing the
MikamiUitOpen 0:3e46577dc273 55 * file on success, or NULL on failure.
MikamiUitOpen 0:3e46577dc273 56 */
MikamiUitOpen 0:3e46577dc273 57 virtual FileHandle *open(const char *filename, int flags) = 0;
MikamiUitOpen 0:3e46577dc273 58
MikamiUitOpen 0:3e46577dc273 59 /** Remove a file from the filesystem.
MikamiUitOpen 0:3e46577dc273 60 *
MikamiUitOpen 0:3e46577dc273 61 * @param filename the name of the file to remove.
MikamiUitOpen 0:3e46577dc273 62 * @param returns 0 on success, -1 on failure.
MikamiUitOpen 0:3e46577dc273 63 */
MikamiUitOpen 0:3e46577dc273 64 virtual int remove(const char *filename) { return -1; };
MikamiUitOpen 0:3e46577dc273 65
MikamiUitOpen 0:3e46577dc273 66 /** Rename a file in the filesystem.
MikamiUitOpen 0:3e46577dc273 67 *
MikamiUitOpen 0:3e46577dc273 68 * @param oldname the name of the file to rename.
MikamiUitOpen 0:3e46577dc273 69 * @param newname the name to rename it to.
MikamiUitOpen 0:3e46577dc273 70 *
MikamiUitOpen 0:3e46577dc273 71 * @returns
MikamiUitOpen 0:3e46577dc273 72 * 0 on success,
MikamiUitOpen 0:3e46577dc273 73 * -1 on failure.
MikamiUitOpen 0:3e46577dc273 74 */
MikamiUitOpen 0:3e46577dc273 75 virtual int rename(const char *oldname, const char *newname) { return -1; };
MikamiUitOpen 0:3e46577dc273 76
MikamiUitOpen 0:3e46577dc273 77 /** Opens a directory in the filesystem and returns a DirHandle
MikamiUitOpen 0:3e46577dc273 78 * representing the directory stream.
MikamiUitOpen 0:3e46577dc273 79 *
MikamiUitOpen 0:3e46577dc273 80 * @param name The name of the directory to open.
MikamiUitOpen 0:3e46577dc273 81 *
MikamiUitOpen 0:3e46577dc273 82 * @returns
MikamiUitOpen 0:3e46577dc273 83 * A DirHandle representing the directory stream, or
MikamiUitOpen 0:3e46577dc273 84 * NULL on failure.
MikamiUitOpen 0:3e46577dc273 85 */
MikamiUitOpen 0:3e46577dc273 86 virtual DirHandle *opendir(const char *name) { return NULL; };
MikamiUitOpen 0:3e46577dc273 87
MikamiUitOpen 0:3e46577dc273 88 /** Creates a directory in the filesystem.
MikamiUitOpen 0:3e46577dc273 89 *
MikamiUitOpen 0:3e46577dc273 90 * @param name The name of the directory to create.
MikamiUitOpen 0:3e46577dc273 91 * @param mode The permissions to create the directory with.
MikamiUitOpen 0:3e46577dc273 92 *
MikamiUitOpen 0:3e46577dc273 93 * @returns
MikamiUitOpen 0:3e46577dc273 94 * 0 on success,
MikamiUitOpen 0:3e46577dc273 95 * -1 on failure.
MikamiUitOpen 0:3e46577dc273 96 */
MikamiUitOpen 0:3e46577dc273 97 virtual int mkdir(const char *name, mode_t mode) { return -1; }
MikamiUitOpen 0:3e46577dc273 98
MikamiUitOpen 0:3e46577dc273 99 // TODO other filesystem functions (mkdir, rm, rn, ls etc)
MikamiUitOpen 0:3e46577dc273 100 };
MikamiUitOpen 0:3e46577dc273 101
MikamiUitOpen 0:3e46577dc273 102 } // namespace mbed
MikamiUitOpen 0:3e46577dc273 103
MikamiUitOpen 0:3e46577dc273 104 #endif