test

Committer:
elijahsj
Date:
Mon Nov 09 00:33:19 2020 -0500
Revision:
2:4364577b5ad8
Parent:
1:8a094db1347f
copied mbed library

Who changed what in which revision?

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