Top Content Up
Prec

5.2 Implementation

Next

A component is simply a function or class. The function receives as its first parameter a reference to an _F_component object. A class receives at the first parameter of its constructor a refenrece as well. Here is an example.
void foo (_F_foo &c)
{
	c.start();
	for (int i=0; i<10; i++){
		c.loop(i);
	}
	c.end();
}

A small component

There is nothing magic with the component implementation. It use the _F_foo object to dispatch call to the various "f" tags of the caller.

For a class, things are about the same. The class will generally keep a copy of the _F_foo object so it can be used in other member functions. For example:

class FOO {
	_F_FOO *c;
public:
	FOO(_F_FOO &_c){
		c = &_c;
	}
	void exec(){
		c->start();
		c->loop(1);
		c->end();
	}
}

A small object component

Top Content Up
Prec

Next
Table of content
One big HTML document