Mbed OS Reference
Loading...
Searching...
No Matches
FileBase.h
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2019 ARM Limited
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17#ifndef MBED_FILEBASE_H
18#define MBED_FILEBASE_H
19
20typedef int FILEHANDLE;
21
22#include "platform/platform.h"
23#include "platform/SingletonPtr.h"
24#include "rtos/Mutex.h"
25#include "platform/NonCopyable.h"
26
27namespace mbed {
28
29typedef enum {
30 FilePathType,
31 FileSystemPathType
32} PathType;
33
34/** \defgroup platform-public-api-file File
35 * \ingroup platform-public-api
36 */
37
38/**
39 * \defgroup platform_FileBase FileBase class
40 * \ingroup platform-public-api-file
41 * @{
42 */
43
44/** Class FileBase
45 *
46 */
47
48class FileBase : private NonCopyable<FileBase> {
49public:
50 FileBase(const char *name, PathType t);
51 virtual ~FileBase();
52
53 const char *getName(void);
54 PathType getPathType(void);
55
56 static FileBase *lookup(const char *name, unsigned int len);
57
58 static FileBase *get(int n);
59
60 void set_as_default();
61
62private:
63 static FileBase *_head;
64 static FileBase *_default;
65 static SingletonPtr<rtos::Mutex> _mutex;
66
67 FileBase *_next;
68 const char *const _name;
69 const PathType _path_type;
70};
71
72/**@}*/
73
74} // namespace mbed
75
76#endif
Class FileBase.
Definition: FileBase.h:48
Prevents generation of copy constructor and copy assignment operator in derived classes.
Definition: NonCopyable.h:162
Utility class for creating and using a singleton.
Definition: SingletonPtr.h:88