BA / SerialCom

Fork of OmniWheels by Gustav Atmel

Committer:
gustavatmel
Date:
Tue May 01 15:47:08 2018 +0000
Revision:
1:9c5af431a1f1
sdf

Who changed what in which revision?

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