mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
22 lines
1.2 KiB
Text
22 lines
1.2 KiB
Text
The tt(monitor) program uses a tt(Monitor) object doing most of the
|
|
work. The class tt(Monitor)'s public interface only offers a default
|
|
constructor and one member, tt(run), to perform its tasks. All other member
|
|
functions are located in the class's tt(private) section.
|
|
|
|
tt(Monitor) defines the tt(private) enum tt(Commands), symbolically
|
|
listing the various commands its input language supports, as well as several
|
|
data members. Among the data members are a tt(Selector) object and a tt(map)
|
|
using child order numbers as its keys and pointer to tt(Child) objects (see
|
|
section ref(CHILD)) as its values. Furthermore, tt(Monitor) has a static array
|
|
member tt(s_handler[]), storing pointers to member functions handling user
|
|
commands.
|
|
|
|
A destructor should be implemented as well, but its implementation is left
|
|
as an exercise to the reader. Here is tt(Monitor)'s interface, including the
|
|
interface of the nested class tt(Find) that is used to create a function
|
|
object:
|
|
verbinclude(//CLASS examples/monitor/monitor.h)
|
|
|
|
Since there's only one non-class type data member, the class's constructor
|
|
is a very simple function which could be implemented inline:
|
|
verbinclude(//CONS examples/monitor/monitor.h)
|