t

Fork of mbed-dev by mbed official

Committer:
AnnaBridge
Date:
Wed Jun 21 17:46:44 2017 +0100
Revision:
168:e84263d55307
Child:
169:9672193075cf
This updates the lib to the mbed lib v 145

Who changed what in which revision?

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