00001 #ifndef CLASSLIB_HOOK_LIST_H
00002 # define CLASSLIB_HOOK_LIST_H
00003
00004
00005
00006 # include "classlib/utils/Hook.h"
00007 # include <list>
00008
00009 namespace lat {
00010
00011
00012
00013
00014
00015
00016
00017 class HookList : public std::list< Hook<bool> >
00018 {
00019 public:
00020 bool call (void);
00021 };
00022
00023 template <class T1>
00024 class HookList1 : public std::list< Hook1<bool,T1> >
00025 {
00026 public:
00027 bool call (const T1 &arg_1);
00028 };
00029
00030
00031
00032
00033 inline bool HookList::call (void)
00034 {
00035 bool stopped = false;
00036 iterator first;
00037 for (first = begin (); first != end () && ! stopped; ++first)
00038 stopped = (*first) ();
00039
00040 return stopped;
00041 }
00042
00044
00045 template <class T1>
00046 inline bool HookList1<T1>::call (const T1 &arg1)
00047 {
00048 typedef typename std::list< Hook1<bool,T1> >::iterator iterator;
00049
00050 bool stopped = false;
00051 iterator first;
00052 for (first = this->begin (); first != this->end () && ! stopped; ++first)
00053 stopped = (*first) (arg1);
00054
00055 return stopped;
00056 }
00057
00058 }
00059 #endif // CLASSLIB_HOOK_LIST_H