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