diff options
Diffstat (limited to 'dnn/Loop.h')
-rw-r--r-- | dnn/Loop.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/dnn/Loop.h b/dnn/Loop.h new file mode 100644 index 0000000..9009c39 --- /dev/null +++ b/dnn/Loop.h @@ -0,0 +1,82 @@ +/* + * DNN - Data News Network + * + * by Stephane Chatty and Stephane Sire + * + * Copyright 1993-1996 + * Centre d'Etudes de la Navigation Aerienne (CENA) + * + * Multiplexer. + * + * $Id$ + * $CurLog$ + */ + +#ifndef DnnMultiplexer_H_ +#define DnnMultiplexer_H_ + +#include "ccu/Initializer.h" +#include "ccu/List.h" + +enum MPX_RES { isMpxEmpty, isMpxTerminated, isMpxError, isMpxAborted }; + +typedef void (DnnMpxHook) (); + +class DnnBaseMultiplexer { +friend void DnnOpen (DnnBaseMultiplexer*); +friend MPX_RES DnnLoop (); +friend void DnnClose (); + +public: +static bool ClassInitialized; +static void ClassInit (); +static CcuInitializerFor <DnnBaseMultiplexer> Initializer; + +protected: +static CcuList* GlobalHooks; +static CcuList* GlobalFinalHooks; +virtual MPX_RES Loop () = 0; + +public: + DnnBaseMultiplexer (); +virtual ~DnnBaseMultiplexer (); + + MPX_RES Run (); +virtual void Stop () = 0; + +static void AddGlobalHook (DnnMpxHook*, bool = false); +static void RemoveGlobalHook (DnnMpxHook*, bool = false); +virtual void AddHook (DnnMpxHook*, bool = false) = 0; +virtual void RemoveHook (DnnMpxHook*, bool = false) = 0; +virtual void AddFinalHook (DnnMpxHook*) = 0; +virtual void RemoveFinalHook (DnnMpxHook*) = 0; +}; + +class DnnMultiplexer : public DnnBaseMultiplexer { +protected: + CcuList Hooks; + CcuList FinalHooks; + bool Looping; + + void ExecHooks (bool = false); + MPX_RES Loop (); + +public: + DnnMultiplexer (); + ~DnnMultiplexer (); + void Stop (); + void AddHook (DnnMpxHook*, bool = false); + void RemoveHook (DnnMpxHook*, bool = false); + void AddFinalHook (DnnMpxHook*); + void RemoveFinalHook (DnnMpxHook*); +}; + + +extern DnnBaseMultiplexer* DnnMpx; +extern void DnnOpen (DnnBaseMultiplexer* = 0); +extern MPX_RES DnnLoop (); +extern void DnnStop (); +extern void DnnClose (); + + +#endif /* DnnMultiplexer_H_ */ |