code petit robot pour homologation

Fork of CRAC-Strat_2017_V2 by CRAC Team

Committer:
antbig
Date:
Wed Apr 13 22:04:54 2016 +0000
Revision:
0:ad97421fb1fb
Ajout interruption fin de match

Who changed what in which revision?

UserRevisionLine numberNew contents of line
antbig 0:ad97421fb1fb 1 /* mbed Microcontroller Library - DirHandler
antbig 0:ad97421fb1fb 2 * Copyright (c) 2008-2009 ARM Limited. All rights reserved.
antbig 0:ad97421fb1fb 3 */
antbig 0:ad97421fb1fb 4
antbig 0:ad97421fb1fb 5 #ifndef MBED_DIRHANDLE_H
antbig 0:ad97421fb1fb 6 #define MBED_DIRHANDLE_H
antbig 0:ad97421fb1fb 7
antbig 0:ad97421fb1fb 8 #ifdef __ARMCC_VERSION
antbig 0:ad97421fb1fb 9 # define NAME_MAX 255
antbig 0:ad97421fb1fb 10 typedef int mode_t;
antbig 0:ad97421fb1fb 11 #else
antbig 0:ad97421fb1fb 12 # include <sys/syslimits.h>
antbig 0:ad97421fb1fb 13 #endif
antbig 0:ad97421fb1fb 14 #include "FileHandle.h"
antbig 0:ad97421fb1fb 15
antbig 0:ad97421fb1fb 16 struct dirent {
antbig 0:ad97421fb1fb 17 char d_name[NAME_MAX+1];
antbig 0:ad97421fb1fb 18 };
antbig 0:ad97421fb1fb 19
antbig 0:ad97421fb1fb 20 namespace mbed {
antbig 0:ad97421fb1fb 21
antbig 0:ad97421fb1fb 22 /* Class DirHandle
antbig 0:ad97421fb1fb 23 * Represents a directory stream. Objects of this type are returned
antbig 0:ad97421fb1fb 24 * by a FileSystemLike's opendir method. Implementations must define
antbig 0:ad97421fb1fb 25 * at least closedir, readdir and rewinddir.
antbig 0:ad97421fb1fb 26 *
antbig 0:ad97421fb1fb 27 * If a FileSystemLike class defines the opendir method, then the
antbig 0:ad97421fb1fb 28 * directories of an object of that type can be accessed by
antbig 0:ad97421fb1fb 29 * DIR *d = opendir("/example/directory") (or opendir("/example")
antbig 0:ad97421fb1fb 30 * to open the root of the filesystem), and then using readdir(d) etc.
antbig 0:ad97421fb1fb 31 *
antbig 0:ad97421fb1fb 32 * The root directory is considered to contain all FileLike and
antbig 0:ad97421fb1fb 33 * FileSystemLike objects, so the DIR* returned by opendir("/") will
antbig 0:ad97421fb1fb 34 * reflect this.
antbig 0:ad97421fb1fb 35 */
antbig 0:ad97421fb1fb 36 class DirHandle {
antbig 0:ad97421fb1fb 37
antbig 0:ad97421fb1fb 38 public:
antbig 0:ad97421fb1fb 39 /* Function closedir
antbig 0:ad97421fb1fb 40 * Closes the directory.
antbig 0:ad97421fb1fb 41 *
antbig 0:ad97421fb1fb 42 * Variables
antbig 0:ad97421fb1fb 43 * returns - 0 on success, or -1 on error.
antbig 0:ad97421fb1fb 44 */
antbig 0:ad97421fb1fb 45 virtual int closedir()=0;
antbig 0:ad97421fb1fb 46
antbig 0:ad97421fb1fb 47 /* Function readdir
antbig 0:ad97421fb1fb 48 * Return the directory entry at the current position, and
antbig 0:ad97421fb1fb 49 * advances the position to the next entry.
antbig 0:ad97421fb1fb 50 *
antbig 0:ad97421fb1fb 51 * Returns
antbig 0:ad97421fb1fb 52 * A pointer to a dirent structure representing the
antbig 0:ad97421fb1fb 53 * directory entry at the current position, or NULL on reaching
antbig 0:ad97421fb1fb 54 * end of directory or error.
antbig 0:ad97421fb1fb 55 */
antbig 0:ad97421fb1fb 56 virtual struct dirent *readdir()=0;
antbig 0:ad97421fb1fb 57
antbig 0:ad97421fb1fb 58 /* Function rewinddir
antbig 0:ad97421fb1fb 59 * Resets the position to the beginning of the directory.
antbig 0:ad97421fb1fb 60 */
antbig 0:ad97421fb1fb 61 virtual void rewinddir()=0;
antbig 0:ad97421fb1fb 62
antbig 0:ad97421fb1fb 63 /* Function telldir
antbig 0:ad97421fb1fb 64 * Returns the current position of the DirHandle.
antbig 0:ad97421fb1fb 65 *
antbig 0:ad97421fb1fb 66 * Returns
antbig 0:ad97421fb1fb 67 * The current position, or -1 on error.
antbig 0:ad97421fb1fb 68 */
antbig 0:ad97421fb1fb 69 virtual off_t telldir() { return -1; }
antbig 0:ad97421fb1fb 70
antbig 0:ad97421fb1fb 71 /* Function seekdir
antbig 0:ad97421fb1fb 72 * Sets the position of the DirHandle.
antbig 0:ad97421fb1fb 73 *
antbig 0:ad97421fb1fb 74 * Variables
antbig 0:ad97421fb1fb 75 * location - The location to seek to. Must be a value returned
antbig 0:ad97421fb1fb 76 * by telldir.
antbig 0:ad97421fb1fb 77 */
antbig 0:ad97421fb1fb 78 virtual void seekdir(off_t location) { }
antbig 0:ad97421fb1fb 79
antbig 0:ad97421fb1fb 80 };
antbig 0:ad97421fb1fb 81
antbig 0:ad97421fb1fb 82 } // namespace mbed
antbig 0:ad97421fb1fb 83
antbig 0:ad97421fb1fb 84 typedef mbed::DirHandle DIR;
antbig 0:ad97421fb1fb 85
antbig 0:ad97421fb1fb 86 extern "C" {
antbig 0:ad97421fb1fb 87 DIR *opendir(const char*);
antbig 0:ad97421fb1fb 88 struct dirent *readdir(DIR *);
antbig 0:ad97421fb1fb 89 int closedir(DIR*);
antbig 0:ad97421fb1fb 90 void rewinddir(DIR*);
antbig 0:ad97421fb1fb 91 long telldir(DIR*);
antbig 0:ad97421fb1fb 92 void seekdir(DIR*, long);
antbig 0:ad97421fb1fb 93 int mkdir(const char *name, mode_t n);
antbig 0:ad97421fb1fb 94 };
antbig 0:ad97421fb1fb 95
antbig 0:ad97421fb1fb 96 #endif /* MBED_DIRHANDLE_H */