Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
platform/FileSystemLike.h@166:3a9487d57a5c, 2017-06-29 (annotated)
- Committer:
- thedo
- Date:
- Thu Jun 29 11:00:41 2017 +0000
- Revision:
- 166:3a9487d57a5c
This is Opencv 3.1 project on GR-PEACH board
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thedo | 166:3a9487d57a5c | 1 | /* mbed Microcontroller Library |
thedo | 166:3a9487d57a5c | 2 | * Copyright (c) 2006-2013 ARM Limited |
thedo | 166:3a9487d57a5c | 3 | * |
thedo | 166:3a9487d57a5c | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
thedo | 166:3a9487d57a5c | 5 | * you may not use this file except in compliance with the License. |
thedo | 166:3a9487d57a5c | 6 | * You may obtain a copy of the License at |
thedo | 166:3a9487d57a5c | 7 | * |
thedo | 166:3a9487d57a5c | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
thedo | 166:3a9487d57a5c | 9 | * |
thedo | 166:3a9487d57a5c | 10 | * Unless required by applicable law or agreed to in writing, software |
thedo | 166:3a9487d57a5c | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
thedo | 166:3a9487d57a5c | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
thedo | 166:3a9487d57a5c | 13 | * See the License for the specific language governing permissions and |
thedo | 166:3a9487d57a5c | 14 | * limitations under the License. |
thedo | 166:3a9487d57a5c | 15 | */ |
thedo | 166:3a9487d57a5c | 16 | #ifndef MBED_FILESYSTEMLIKE_H |
thedo | 166:3a9487d57a5c | 17 | #define MBED_FILESYSTEMLIKE_H |
thedo | 166:3a9487d57a5c | 18 | |
thedo | 166:3a9487d57a5c | 19 | #include "platform/platform.h" |
thedo | 166:3a9487d57a5c | 20 | |
thedo | 166:3a9487d57a5c | 21 | #include "platform/FileSystemHandle.h" |
thedo | 166:3a9487d57a5c | 22 | #include "platform/FileHandle.h" |
thedo | 166:3a9487d57a5c | 23 | #include "platform/DirHandle.h" |
thedo | 166:3a9487d57a5c | 24 | |
thedo | 166:3a9487d57a5c | 25 | namespace mbed { |
thedo | 166:3a9487d57a5c | 26 | /** \addtogroup platform */ |
thedo | 166:3a9487d57a5c | 27 | |
thedo | 166:3a9487d57a5c | 28 | |
thedo | 166:3a9487d57a5c | 29 | /** A filesystem-like object is one that can be used to open file-like |
thedo | 166:3a9487d57a5c | 30 | * objects though it by fopen("/name/filename", mode) |
thedo | 166:3a9487d57a5c | 31 | * |
thedo | 166:3a9487d57a5c | 32 | * Implementations must define at least open (the default definitions |
thedo | 166:3a9487d57a5c | 33 | * of the rest of the functions just return error values). |
thedo | 166:3a9487d57a5c | 34 | * |
thedo | 166:3a9487d57a5c | 35 | * @note Synchronization level: Set by subclass |
thedo | 166:3a9487d57a5c | 36 | * @ingroup platform |
thedo | 166:3a9487d57a5c | 37 | */ |
thedo | 166:3a9487d57a5c | 38 | class FileSystemLike : public FileSystemHandle, public FileBase { |
thedo | 166:3a9487d57a5c | 39 | public: |
thedo | 166:3a9487d57a5c | 40 | /** FileSystemLike lifetime |
thedo | 166:3a9487d57a5c | 41 | */ |
thedo | 166:3a9487d57a5c | 42 | FileSystemLike(const char *name = NULL) : FileBase(name, FileSystemPathType) {} |
thedo | 166:3a9487d57a5c | 43 | virtual ~FileSystemLike() {} |
thedo | 166:3a9487d57a5c | 44 | |
thedo | 166:3a9487d57a5c | 45 | // Inherited functions with name conflicts |
thedo | 166:3a9487d57a5c | 46 | using FileSystemHandle::open; |
thedo | 166:3a9487d57a5c | 47 | |
thedo | 166:3a9487d57a5c | 48 | /** Open a file on the filesystem |
thedo | 166:3a9487d57a5c | 49 | * |
thedo | 166:3a9487d57a5c | 50 | * @param path The name of the file to open |
thedo | 166:3a9487d57a5c | 51 | * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, |
thedo | 166:3a9487d57a5c | 52 | * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND |
thedo | 166:3a9487d57a5c | 53 | * @return A file handle on success, NULL on failure |
thedo | 166:3a9487d57a5c | 54 | * @deprecated Replaced by `int open(FileHandle **, ...)` for propagating error codes |
thedo | 166:3a9487d57a5c | 55 | */ |
thedo | 166:3a9487d57a5c | 56 | MBED_DEPRECATED_SINCE("mbed-os-5.5", |
thedo | 166:3a9487d57a5c | 57 | "Replaced by `int open(FileHandle **, ...)` for propagating error codes") |
thedo | 166:3a9487d57a5c | 58 | FileHandle *open(const char *path, int flags) |
thedo | 166:3a9487d57a5c | 59 | { |
thedo | 166:3a9487d57a5c | 60 | FileHandle *file; |
thedo | 166:3a9487d57a5c | 61 | int err = open(&file, path, flags); |
thedo | 166:3a9487d57a5c | 62 | return err ? NULL : file; |
thedo | 166:3a9487d57a5c | 63 | } |
thedo | 166:3a9487d57a5c | 64 | |
thedo | 166:3a9487d57a5c | 65 | /** Open a directory on the filesystem |
thedo | 166:3a9487d57a5c | 66 | * |
thedo | 166:3a9487d57a5c | 67 | * @param path Name of the directory to open |
thedo | 166:3a9487d57a5c | 68 | * @return A directory handle on success, NULL on failure |
thedo | 166:3a9487d57a5c | 69 | * @deprecated Replaced by `int open(DirHandle **, ...)` for propagating error codes |
thedo | 166:3a9487d57a5c | 70 | */ |
thedo | 166:3a9487d57a5c | 71 | MBED_DEPRECATED_SINCE("mbed-os-5.5", |
thedo | 166:3a9487d57a5c | 72 | "Replaced by `int open(DirHandle **, ...)` for propagating error codes") |
thedo | 166:3a9487d57a5c | 73 | DirHandle *opendir(const char *path) |
thedo | 166:3a9487d57a5c | 74 | { |
thedo | 166:3a9487d57a5c | 75 | DirHandle *dir; |
thedo | 166:3a9487d57a5c | 76 | int err = open(&dir, path); |
thedo | 166:3a9487d57a5c | 77 | return err ? NULL : dir; |
thedo | 166:3a9487d57a5c | 78 | } |
thedo | 166:3a9487d57a5c | 79 | }; |
thedo | 166:3a9487d57a5c | 80 | |
thedo | 166:3a9487d57a5c | 81 | |
thedo | 166:3a9487d57a5c | 82 | } // namespace mbed |
thedo | 166:3a9487d57a5c | 83 | |
thedo | 166:3a9487d57a5c | 84 | #endif |
thedo | 166:3a9487d57a5c | 85 |