Hi George,
George A. Heintzelman writes:
...
> TModule::Process() {
> StartProcessing();
> for ( /* each track in a container */ ) {
> if ((*fPtrToCutFunction)(track)) {
> /* Process */
> }
> }
> }
> But if we wanted to write these modules out, we would have to be able
> to stream somehow pointers-to-function.
...
Instead of pointers-to-function, what about using Functional Objects
(Functors) as described in Chapter 18 of Stroustrup's C++ P.L. Special
Ed.? Basically, instead of using a function you use a class with a
method like:
bool operator()(TTrack*);
Since it is just an object, it should be able to be sent through ROOT
I/O.
This would also gain you the ability to make use of the binder
functions (bind1st, bind2nd) which would allow people to pass closures
(function + parameters) to the module.
I am myself just starting to learn about functors, so I am not sure
they will work here, but you might want to take a look.
-Brett.
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET