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