Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers FileBase.h Source File

FileBase.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2019 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef MBED_FILEBASE_H
00018 #define MBED_FILEBASE_H
00019 
00020 typedef int FILEHANDLE;
00021 
00022 #include "platform/platform.h"
00023 #include "platform/SingletonPtr.h"
00024 #include "platform/PlatformMutex.h"
00025 #include "platform/NonCopyable.h"
00026 
00027 namespace mbed {
00028 
00029 typedef enum {
00030     FilePathType,
00031     FileSystemPathType
00032 } PathType;
00033 
00034 /** \defgroup platform-public-api-file File
00035  * \ingroup platform-public-api
00036  */
00037 
00038 /**
00039  * \defgroup platform_FileBase FileBase class
00040  * \ingroup platform-public-api-file
00041  * @{
00042  */
00043 
00044 /** Class FileBase
00045  *
00046  */
00047 
00048 class FileBase : private NonCopyable<FileBase> {
00049 public:
00050     FileBase(const char *name, PathType t);
00051     virtual ~FileBase();
00052 
00053     const char *getName(void);
00054     PathType    getPathType(void);
00055 
00056     static FileBase *lookup(const char *name, unsigned int len);
00057 
00058     static FileBase *get(int n);
00059 
00060     void set_as_default();
00061 
00062 private:
00063     static FileBase *_head;
00064     static FileBase *_default;
00065     static SingletonPtr<PlatformMutex>  _mutex;
00066 
00067     FileBase   *_next;
00068     const char *const _name;
00069     const PathType _path_type;
00070 };
00071 
00072 /**@}*/
00073 
00074 } // namespace mbed
00075 
00076 #endif