Opencv 3.1 project on GR-PEACH board
Fork of gr-peach-opencv-project by
platform/FileSystemHandle.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_FILESYSTEMHANDLE_H |
thedo | 166:3a9487d57a5c | 17 | #define MBED_FILESYSTEMHANDLE_H |
thedo | 166:3a9487d57a5c | 18 | |
thedo | 166:3a9487d57a5c | 19 | #include "platform/platform.h" |
thedo | 166:3a9487d57a5c | 20 | |
thedo | 166:3a9487d57a5c | 21 | #include "platform/FileBase.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 drivers */ |
thedo | 166:3a9487d57a5c | 27 | /** @{*/ |
thedo | 166:3a9487d57a5c | 28 | |
thedo | 166:3a9487d57a5c | 29 | |
thedo | 166:3a9487d57a5c | 30 | /** A filesystem-like object is one that can be used to open file-like |
thedo | 166:3a9487d57a5c | 31 | * objects though it by fopen("/name/filename", mode) |
thedo | 166:3a9487d57a5c | 32 | * |
thedo | 166:3a9487d57a5c | 33 | * Implementations must define at least open (the default definitions |
thedo | 166:3a9487d57a5c | 34 | * of the rest of the functions just return error values). |
thedo | 166:3a9487d57a5c | 35 | * |
thedo | 166:3a9487d57a5c | 36 | * @note Synchronization level: Set by subclass |
thedo | 166:3a9487d57a5c | 37 | */ |
thedo | 166:3a9487d57a5c | 38 | class FileSystemHandle { |
thedo | 166:3a9487d57a5c | 39 | public: |
thedo | 166:3a9487d57a5c | 40 | /** FileSystemHandle lifetime |
thedo | 166:3a9487d57a5c | 41 | */ |
thedo | 166:3a9487d57a5c | 42 | virtual ~FileSystemHandle() {} |
thedo | 166:3a9487d57a5c | 43 | |
thedo | 166:3a9487d57a5c | 44 | /** Open a file on the filesystem |
thedo | 166:3a9487d57a5c | 45 | * |
thedo | 166:3a9487d57a5c | 46 | * @param file Destination for the handle to a newly created file |
thedo | 166:3a9487d57a5c | 47 | * @param filename The name of the file to open |
thedo | 166:3a9487d57a5c | 48 | * @param flags The flags to open the file in, one of O_RDONLY, O_WRONLY, O_RDWR, |
thedo | 166:3a9487d57a5c | 49 | * bitwise or'd with one of O_CREAT, O_TRUNC, O_APPEND |
thedo | 166:3a9487d57a5c | 50 | * @return 0 on success, negative error code on failure |
thedo | 166:3a9487d57a5c | 51 | */ |
thedo | 166:3a9487d57a5c | 52 | virtual int open(FileHandle **file, const char *filename, int flags) = 0; |
thedo | 166:3a9487d57a5c | 53 | |
thedo | 166:3a9487d57a5c | 54 | /** Open a directory on the filesystem |
thedo | 166:3a9487d57a5c | 55 | * |
thedo | 166:3a9487d57a5c | 56 | * @param dir Destination for the handle to the directory |
thedo | 166:3a9487d57a5c | 57 | * @param path Name of the directory to open |
thedo | 166:3a9487d57a5c | 58 | * @return 0 on success, negative error code on failure |
thedo | 166:3a9487d57a5c | 59 | */ |
thedo | 166:3a9487d57a5c | 60 | virtual int open(DirHandle **dir, const char *path); |
thedo | 166:3a9487d57a5c | 61 | |
thedo | 166:3a9487d57a5c | 62 | /** Remove a file from the filesystem. |
thedo | 166:3a9487d57a5c | 63 | * |
thedo | 166:3a9487d57a5c | 64 | * @param path The name of the file to remove. |
thedo | 166:3a9487d57a5c | 65 | * @return 0 on success, negative error code on failure |
thedo | 166:3a9487d57a5c | 66 | */ |
thedo | 166:3a9487d57a5c | 67 | virtual int remove(const char *path); |
thedo | 166:3a9487d57a5c | 68 | |
thedo | 166:3a9487d57a5c | 69 | /** Rename a file in the filesystem. |
thedo | 166:3a9487d57a5c | 70 | * |
thedo | 166:3a9487d57a5c | 71 | * @param path The name of the file to rename. |
thedo | 166:3a9487d57a5c | 72 | * @param newpath The name to rename it to |
thedo | 166:3a9487d57a5c | 73 | * @return 0 on success, negative error code on failure |
thedo | 166:3a9487d57a5c | 74 | */ |
thedo | 166:3a9487d57a5c | 75 | virtual int rename(const char *path, const char *newpath); |
thedo | 166:3a9487d57a5c | 76 | |
thedo | 166:3a9487d57a5c | 77 | /** Store information about the file in a stat structure |
thedo | 166:3a9487d57a5c | 78 | * |
thedo | 166:3a9487d57a5c | 79 | * @param path The name of the file to find information about |
thedo | 166:3a9487d57a5c | 80 | * @param st The stat buffer to write to |
thedo | 166:3a9487d57a5c | 81 | * @return 0 on success, negative error code on failure |
thedo | 166:3a9487d57a5c | 82 | */ |
thedo | 166:3a9487d57a5c | 83 | virtual int stat(const char *path, struct stat *st); |
thedo | 166:3a9487d57a5c | 84 | |
thedo | 166:3a9487d57a5c | 85 | /** Create a directory in the filesystem. |
thedo | 166:3a9487d57a5c | 86 | * |
thedo | 166:3a9487d57a5c | 87 | * @param path The name of the directory to create. |
thedo | 166:3a9487d57a5c | 88 | * @param mode The permissions with which to create the directory |
thedo | 166:3a9487d57a5c | 89 | * @return 0 on success, negative error code on failure |
thedo | 166:3a9487d57a5c | 90 | */ |
thedo | 166:3a9487d57a5c | 91 | virtual int mkdir(const char *path, mode_t mode); |
thedo | 166:3a9487d57a5c | 92 | }; |
thedo | 166:3a9487d57a5c | 93 | |
thedo | 166:3a9487d57a5c | 94 | |
thedo | 166:3a9487d57a5c | 95 | } // namespace mbed |
thedo | 166:3a9487d57a5c | 96 | |
thedo | 166:3a9487d57a5c | 97 | #endif |
thedo | 166:3a9487d57a5c | 98 | |
thedo | 166:3a9487d57a5c | 99 | /** @}*/ |
thedo | 166:3a9487d57a5c | 100 |