Lab 1 Program C
Fork of mbed by
Base.h@0:82220227f4fa, 2008-04-08 (annotated)
- Committer:
- simon.ford@mbed.co.uk
- Date:
- Tue Apr 08 14:12:21 2008 +0000
- Revision:
- 0:82220227f4fa
- Child:
- 1:6b7f447ca868
A first develoment release of the mbed libraries
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon.ford@mbed.co.uk | 0:82220227f4fa | 1 | /* mbed Microcontroller Library - Base |
simon.ford@mbed.co.uk | 0:82220227f4fa | 2 | * Copyright (c) 2007-2008, sford |
simon.ford@mbed.co.uk | 0:82220227f4fa | 3 | */ |
simon.ford@mbed.co.uk | 0:82220227f4fa | 4 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 5 | #ifndef MBED_BASE_H |
simon.ford@mbed.co.uk | 0:82220227f4fa | 6 | #define MBED_BASE_H |
simon.ford@mbed.co.uk | 0:82220227f4fa | 7 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 8 | #define MBED_BASE_NUM_OBJECTS 128 // max # base objects |
simon.ford@mbed.co.uk | 0:82220227f4fa | 9 | #define MBED_BASE_SIZE_NAME 16 // max size of object name, including the null-termination |
simon.ford@mbed.co.uk | 0:82220227f4fa | 10 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 11 | #include "rt_sys.h" |
simon.ford@mbed.co.uk | 0:82220227f4fa | 12 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 13 | namespace mbed { |
simon.ford@mbed.co.uk | 0:82220227f4fa | 14 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 15 | class Base { |
simon.ford@mbed.co.uk | 0:82220227f4fa | 16 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 17 | public: |
simon.ford@mbed.co.uk | 0:82220227f4fa | 18 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 19 | Base(); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 20 | virtual ~Base(); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 21 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 22 | void name(const char* name); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 23 | const char* name(); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 24 | const char* type(); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 25 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 26 | static Base* lookup(const char* name); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 27 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 28 | virtual FILEHANDLE sys_open(const char* name, int openmode); |
simon.ford@mbed.co.uk | 0:82220227f4fa | 29 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 30 | protected: |
simon.ford@mbed.co.uk | 0:82220227f4fa | 31 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 32 | const char* _type; // The class type |
simon.ford@mbed.co.uk | 0:82220227f4fa | 33 | char _name[MBED_BASE_SIZE_NAME]; // The class instance name |
simon.ford@mbed.co.uk | 0:82220227f4fa | 34 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 35 | static int _uid; // The counter used to generate the uid's |
simon.ford@mbed.co.uk | 0:82220227f4fa | 36 | static Base* _objects[MBED_BASE_NUM_OBJECTS]; // Pointers to all the objects to enable things like rpc |
simon.ford@mbed.co.uk | 0:82220227f4fa | 37 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 38 | }; |
simon.ford@mbed.co.uk | 0:82220227f4fa | 39 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 40 | } // namespace mbed |
simon.ford@mbed.co.uk | 0:82220227f4fa | 41 | |
simon.ford@mbed.co.uk | 0:82220227f4fa | 42 | #endif |