mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

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-2013 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 /** \addtogroup platform */
00035 /** @{*/
00036 /**
00037  * \defgroup platform_FileBase FileBase class
00038  * @{
00039  */
00040 /** Class FileBase
00041  *
00042  */
00043 
00044 class FileBase : private NonCopyable<FileBase> {
00045 public:
00046     FileBase(const char *name, PathType t);
00047     virtual ~FileBase();
00048 
00049     const char *getName(void);
00050     PathType    getPathType(void);
00051 
00052     static FileBase *lookup(const char *name, unsigned int len);
00053 
00054     static FileBase *get(int n);
00055 
00056     void set_as_default();
00057 
00058 private:
00059     static FileBase *_head;
00060     static FileBase *_default;
00061     static SingletonPtr<PlatformMutex>  _mutex;
00062 
00063     FileBase   *_next;
00064     const char *const _name;
00065     const PathType _path_type;
00066 };
00067 
00068 /**@}*/
00069 
00070 /**@}*/
00071 
00072 } // namespace mbed
00073 
00074 #endif
00075