3 This document is automatically processed by Doxygen (http://www.doxygen.org/).
4 Don't remove special formatting tags.
5 This section won't be processed unless enabled.
7 See STATUS for further information and tips about Doxygen tags.
9 \page oop Object Oriented Programming
11 BeRTOS uses object oriented programming concepts for the base interfaces.
12 If used in the right way, OOP elegantly solves a broad range of problems
13 linked with the creation of common and reusable interfaces that allow
14 you to save development time and precious memory space.
15 Have a look at <a href="">KFile tutorial</a> on BeRTOS web site for
16 a more complete introduction to object oriented programming.
19 Object oriented programming in C requires a context struct and a few interface
20 functions that operate on that context.
21 The base class is implemented with a struct with a few function pointers
22 that point to the implementation specific for the context.
24 Inherited classes are created by defining a struct with the following
26 \li a base class member
27 \li context specific members
29 Then you can call interface functions by simply using the base class member
30 as the context of the function.
31 Note that base classes usually don't have an init function, because they are
32 not meant to be used directly and it wouldn't make sense anyway, since they
33 provide no functionality, only the interface.
34 The usage pattern requires you to declare a context (eg. Flash), initialize
35 the context with a specific function call (eg. flash_init()) then use the
36 interface funtions to access the context.
38 To make an example, in BeRTOS the Serial driver is a derived class of the
40 The KFile interface defines a few interface functions, which can be used to
41 extract data from the Serial context.
43 // declare the serial context
50 // initialize the serial driver
51 ser_init(&ser, SER_UART0);
52 ser_setbaudrate(115200);
53 // now access using the interface functions
55 kfile_read(&ser.fd, buf, 20);
57 kfile_printf(&ser.fd, "Writing to serial using KFile interface...\n");
67 * \defgroup drivers BeRTOS peripherals drivers
69 * This section includes all BeRTOS drivers. They may be internal CPU drivers
70 * or CPU independent drivers
75 * \defgroup core BeRTOS core functionality
77 * This section includes BeRTOS core functionalities and interfaces.
82 * \defgroup kern Kernel facilities
84 * This section describes the kernel facilities and the synchronization
85 * primitives available in BeRTOS.