Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-os/platform/FileBase.h@0:fb8047b156bb, 2020-01-15 (annotated)
- Committer:
- rahul_dahiya
- Date:
- Wed Jan 15 15:57:15 2020 +0530
- Revision:
- 0:fb8047b156bb
STM32F7 LWIP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rahul_dahiya |
0:fb8047b156bb | 1 | /* mbed Microcontroller Library |
rahul_dahiya |
0:fb8047b156bb | 2 | * Copyright (c) 2006-2013 ARM Limited |
rahul_dahiya |
0:fb8047b156bb | 3 | * |
rahul_dahiya |
0:fb8047b156bb | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
rahul_dahiya |
0:fb8047b156bb | 5 | * you may not use this file except in compliance with the License. |
rahul_dahiya |
0:fb8047b156bb | 6 | * You may obtain a copy of the License at |
rahul_dahiya |
0:fb8047b156bb | 7 | * |
rahul_dahiya |
0:fb8047b156bb | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
rahul_dahiya |
0:fb8047b156bb | 9 | * |
rahul_dahiya |
0:fb8047b156bb | 10 | * Unless required by applicable law or agreed to in writing, software |
rahul_dahiya |
0:fb8047b156bb | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
rahul_dahiya |
0:fb8047b156bb | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
rahul_dahiya |
0:fb8047b156bb | 13 | * See the License for the specific language governing permissions and |
rahul_dahiya |
0:fb8047b156bb | 14 | * limitations under the License. |
rahul_dahiya |
0:fb8047b156bb | 15 | */ |
rahul_dahiya |
0:fb8047b156bb | 16 | #ifndef MBED_FILEBASE_H |
rahul_dahiya |
0:fb8047b156bb | 17 | #define MBED_FILEBASE_H |
rahul_dahiya |
0:fb8047b156bb | 18 | |
rahul_dahiya |
0:fb8047b156bb | 19 | typedef int FILEHANDLE; |
rahul_dahiya |
0:fb8047b156bb | 20 | |
rahul_dahiya |
0:fb8047b156bb | 21 | #include <cstdio> |
rahul_dahiya |
0:fb8047b156bb | 22 | #include <cstring> |
rahul_dahiya |
0:fb8047b156bb | 23 | |
rahul_dahiya |
0:fb8047b156bb | 24 | #include "platform/platform.h" |
rahul_dahiya |
0:fb8047b156bb | 25 | #include "platform/SingletonPtr.h" |
rahul_dahiya |
0:fb8047b156bb | 26 | #include "platform/PlatformMutex.h" |
rahul_dahiya |
0:fb8047b156bb | 27 | #include "platform/NonCopyable.h" |
rahul_dahiya |
0:fb8047b156bb | 28 | |
rahul_dahiya |
0:fb8047b156bb | 29 | namespace mbed { |
rahul_dahiya |
0:fb8047b156bb | 30 | |
rahul_dahiya |
0:fb8047b156bb | 31 | typedef enum { |
rahul_dahiya |
0:fb8047b156bb | 32 | FilePathType, |
rahul_dahiya |
0:fb8047b156bb | 33 | FileSystemPathType |
rahul_dahiya |
0:fb8047b156bb | 34 | } PathType; |
rahul_dahiya |
0:fb8047b156bb | 35 | |
rahul_dahiya |
0:fb8047b156bb | 36 | /** \addtogroup platform */ |
rahul_dahiya |
0:fb8047b156bb | 37 | /** @{*/ |
rahul_dahiya |
0:fb8047b156bb | 38 | /** |
rahul_dahiya |
0:fb8047b156bb | 39 | * \defgroup platform_FileBase FileBase class |
rahul_dahiya |
0:fb8047b156bb | 40 | * @{ |
rahul_dahiya |
0:fb8047b156bb | 41 | */ |
rahul_dahiya |
0:fb8047b156bb | 42 | /** Class FileBase |
rahul_dahiya |
0:fb8047b156bb | 43 | * |
rahul_dahiya |
0:fb8047b156bb | 44 | */ |
rahul_dahiya |
0:fb8047b156bb | 45 | |
rahul_dahiya |
0:fb8047b156bb | 46 | class FileBase : private NonCopyable<FileBase> { |
rahul_dahiya |
0:fb8047b156bb | 47 | public: |
rahul_dahiya |
0:fb8047b156bb | 48 | FileBase(const char *name, PathType t); |
rahul_dahiya |
0:fb8047b156bb | 49 | virtual ~FileBase(); |
rahul_dahiya |
0:fb8047b156bb | 50 | |
rahul_dahiya |
0:fb8047b156bb | 51 | const char* getName(void); |
rahul_dahiya |
0:fb8047b156bb | 52 | PathType getPathType(void); |
rahul_dahiya |
0:fb8047b156bb | 53 | |
rahul_dahiya |
0:fb8047b156bb | 54 | static FileBase *lookup(const char *name, unsigned int len); |
rahul_dahiya |
0:fb8047b156bb | 55 | |
rahul_dahiya |
0:fb8047b156bb | 56 | static FileBase *get(int n); |
rahul_dahiya |
0:fb8047b156bb | 57 | |
rahul_dahiya |
0:fb8047b156bb | 58 | /* disallow copy constructor and assignment operators */ |
rahul_dahiya |
0:fb8047b156bb | 59 | private: |
rahul_dahiya |
0:fb8047b156bb | 60 | static FileBase *_head; |
rahul_dahiya |
0:fb8047b156bb | 61 | static SingletonPtr<PlatformMutex> _mutex; |
rahul_dahiya |
0:fb8047b156bb | 62 | |
rahul_dahiya |
0:fb8047b156bb | 63 | FileBase *_next; |
rahul_dahiya |
0:fb8047b156bb | 64 | const char * const _name; |
rahul_dahiya |
0:fb8047b156bb | 65 | const PathType _path_type; |
rahul_dahiya |
0:fb8047b156bb | 66 | }; |
rahul_dahiya |
0:fb8047b156bb | 67 | |
rahul_dahiya |
0:fb8047b156bb | 68 | /**@}*/ |
rahul_dahiya |
0:fb8047b156bb | 69 | |
rahul_dahiya |
0:fb8047b156bb | 70 | /**@}*/ |
rahul_dahiya |
0:fb8047b156bb | 71 | |
rahul_dahiya |
0:fb8047b156bb | 72 | } // namespace mbed |
rahul_dahiya |
0:fb8047b156bb | 73 | |
rahul_dahiya |
0:fb8047b156bb | 74 | #endif |
rahul_dahiya |
0:fb8047b156bb | 75 |