The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
platform/FileBase.h@169:a7c7b631e539, 2018-06-22 (annotated)
- Committer:
- Anna Bridge
- Date:
- Fri Jun 22 15:38:59 2018 +0100
- Revision:
- 169:a7c7b631e539
- Parent:
- 158:1c57384330a6
- Child:
- 170:e95d10626187
mbed library. Release version 162
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AnnaBridge | 156:ff21514d8981 | 1 | /* mbed Microcontroller Library |
AnnaBridge | 156:ff21514d8981 | 2 | * Copyright (c) 2006-2013 ARM Limited |
AnnaBridge | 156:ff21514d8981 | 3 | * |
AnnaBridge | 156:ff21514d8981 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
AnnaBridge | 156:ff21514d8981 | 5 | * you may not use this file except in compliance with the License. |
AnnaBridge | 156:ff21514d8981 | 6 | * You may obtain a copy of the License at |
AnnaBridge | 156:ff21514d8981 | 7 | * |
AnnaBridge | 156:ff21514d8981 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
AnnaBridge | 156:ff21514d8981 | 9 | * |
AnnaBridge | 156:ff21514d8981 | 10 | * Unless required by applicable law or agreed to in writing, software |
AnnaBridge | 156:ff21514d8981 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
AnnaBridge | 156:ff21514d8981 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
AnnaBridge | 156:ff21514d8981 | 13 | * See the License for the specific language governing permissions and |
AnnaBridge | 156:ff21514d8981 | 14 | * limitations under the License. |
AnnaBridge | 156:ff21514d8981 | 15 | */ |
AnnaBridge | 156:ff21514d8981 | 16 | #ifndef MBED_FILEBASE_H |
AnnaBridge | 156:ff21514d8981 | 17 | #define MBED_FILEBASE_H |
AnnaBridge | 156:ff21514d8981 | 18 | |
AnnaBridge | 156:ff21514d8981 | 19 | typedef int FILEHANDLE; |
AnnaBridge | 156:ff21514d8981 | 20 | |
AnnaBridge | 156:ff21514d8981 | 21 | #include <cstdio> |
AnnaBridge | 156:ff21514d8981 | 22 | #include <cstring> |
AnnaBridge | 156:ff21514d8981 | 23 | |
AnnaBridge | 156:ff21514d8981 | 24 | #include "platform/platform.h" |
AnnaBridge | 156:ff21514d8981 | 25 | #include "platform/SingletonPtr.h" |
AnnaBridge | 156:ff21514d8981 | 26 | #include "platform/PlatformMutex.h" |
AnnaBridge | 156:ff21514d8981 | 27 | #include "platform/NonCopyable.h" |
AnnaBridge | 156:ff21514d8981 | 28 | |
AnnaBridge | 156:ff21514d8981 | 29 | namespace mbed { |
AnnaBridge | 158:1c57384330a6 | 30 | |
AnnaBridge | 156:ff21514d8981 | 31 | typedef enum { |
AnnaBridge | 156:ff21514d8981 | 32 | FilePathType, |
AnnaBridge | 156:ff21514d8981 | 33 | FileSystemPathType |
AnnaBridge | 156:ff21514d8981 | 34 | } PathType; |
AnnaBridge | 156:ff21514d8981 | 35 | |
AnnaBridge | 158:1c57384330a6 | 36 | /** \addtogroup platform */ |
AnnaBridge | 158:1c57384330a6 | 37 | /** @{*/ |
AnnaBridge | 156:ff21514d8981 | 38 | /** |
AnnaBridge | 158:1c57384330a6 | 39 | * \defgroup platform_FileBase FileBase class |
AnnaBridge | 158:1c57384330a6 | 40 | * @{ |
AnnaBridge | 156:ff21514d8981 | 41 | */ |
AnnaBridge | 158:1c57384330a6 | 42 | /** Class FileBase |
AnnaBridge | 158:1c57384330a6 | 43 | * |
AnnaBridge | 158:1c57384330a6 | 44 | */ |
AnnaBridge | 158:1c57384330a6 | 45 | |
AnnaBridge | 156:ff21514d8981 | 46 | class FileBase : private NonCopyable<FileBase> { |
AnnaBridge | 156:ff21514d8981 | 47 | public: |
AnnaBridge | 156:ff21514d8981 | 48 | FileBase(const char *name, PathType t); |
AnnaBridge | 156:ff21514d8981 | 49 | virtual ~FileBase(); |
AnnaBridge | 156:ff21514d8981 | 50 | |
AnnaBridge | 156:ff21514d8981 | 51 | const char* getName(void); |
AnnaBridge | 156:ff21514d8981 | 52 | PathType getPathType(void); |
AnnaBridge | 156:ff21514d8981 | 53 | |
AnnaBridge | 156:ff21514d8981 | 54 | static FileBase *lookup(const char *name, unsigned int len); |
AnnaBridge | 156:ff21514d8981 | 55 | |
AnnaBridge | 156:ff21514d8981 | 56 | static FileBase *get(int n); |
AnnaBridge | 156:ff21514d8981 | 57 | |
AnnaBridge | 156:ff21514d8981 | 58 | /* disallow copy constructor and assignment operators */ |
AnnaBridge | 156:ff21514d8981 | 59 | private: |
AnnaBridge | 156:ff21514d8981 | 60 | static FileBase *_head; |
AnnaBridge | 156:ff21514d8981 | 61 | static SingletonPtr<PlatformMutex> _mutex; |
AnnaBridge | 156:ff21514d8981 | 62 | |
AnnaBridge | 156:ff21514d8981 | 63 | FileBase *_next; |
AnnaBridge | 156:ff21514d8981 | 64 | const char * const _name; |
AnnaBridge | 156:ff21514d8981 | 65 | const PathType _path_type; |
AnnaBridge | 156:ff21514d8981 | 66 | }; |
AnnaBridge | 156:ff21514d8981 | 67 | |
AnnaBridge | 158:1c57384330a6 | 68 | /**@}*/ |
AnnaBridge | 158:1c57384330a6 | 69 | |
AnnaBridge | 158:1c57384330a6 | 70 | /**@}*/ |
AnnaBridge | 158:1c57384330a6 | 71 | |
AnnaBridge | 156:ff21514d8981 | 72 | } // namespace mbed |
AnnaBridge | 156:ff21514d8981 | 73 | |
AnnaBridge | 156:ff21514d8981 | 74 | #endif |
AnnaBridge | 156:ff21514d8981 | 75 |