---
name: "ACE_QtReactor"
section: "3"
platform: "linux"
package: "libace-doc"
version: "5.0.7-4"
release: "Debian 2.2 (Potato)"
platforms: ["linux"]
url: "https://new.carta.tech/ACE_QtReactor"
---

# ACE\_QtReactor(3)

An object-oriented event demultiplexor and event handler dispatcher that uses the Qt Library. This class declaration also uses the extnsion facilities provided by the Qt. So, readers of the class declaration should not be upset with the appearence of the Keywords like Q\_OBJECT, private slots etc. They are specific to Qt which uses these as a call back methods implementation mechanism.

## NAME

ACE\_QtReactor -  An object-oriented event demultiplexor and event handler dispatcher that uses the Qt Library. This class declaration also uses the extnsion facilities  provided by the Qt. So, readers  of the class declaration should not be upset with the appearence of the Keywords like Q\_OBJECT, private slots etc. They are specific to Qt which uses these as a call back methods implementation mechanism.

## SYNOPSIS

```
#include <ace/QtReactor.h>
class ACE_QtReactor : public QObject, public ACE_Select_Reactor
{
  protected:
    virtual int register_handler_i (
        ACE_HANDLE handle,
        ACE_Event_Handler *handler,
        ACE_Reactor_Mask mask
        );
    virtual int register_handler_i (
        const ACE_Handle_Set &handles,
        ACE_Event_Handler *handler,
        ACE_Reactor_Mask mask
        );
    virtual int remove_handler_i (
        ACE_HANDLE handle,
        ACE_Reactor_Mask mask
        );
    virtual int remove_handler_i (
        const ACE_Handle_Set &handles,
        ACE_Reactor_Mask mask
        );
    virtual int wait_for_multiple_events (
        ACE_Select_Reactor_Handle_Set &handle_set,
        ACE_Time_Value *max_wait_time
        );
    virtual int QtWaitForMultipleEvents (
        int width,
        ACE_Select_Reactor_Handle_Set &wait_set,
        ACE_Time_Value *max_wait_time
        );
    QApplication *qapp_;
        typedef ACE_Map_Manager<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> MAP;

    MAP read_notifier_;
    MAP write_notifier_;
    MAP exception_notifier_;
    QTimer *qtime_;
  private:
    Q_OBJECT public: ACE_QtReactor (
        QApplication *qapp = NULL,
        size_t size = DEFAULT_SIZE,
        int restart = 0,
        ACE_Sig_Handler *handler = 0
        );
    virtual ~ACE_QtReactor (void);
    void qapplication (QApplication *qapp);
    virtual long schedule_timer (
        ACE_Event_Handler *handler,
        const void *arg,
        const ACE_Time_Value &delta_time,
        const ACE_Time_Value &interval
        );
    virtual int cancel_timer (
        ACE_Event_Handler *handler,
        int dont_call_handle_close = 1
        );
    virtual int cancel_timer (
        long timer_id,
        const void **arg = 0,
        int dont_call_handle_close = 1
        );
    void reset_timeout (void);
    ACE_QtReactor (const ACE_QtReactor &);
    ACE_QtReactor &operator= (const ACE_QtReactor &);
    void read_event (int FD);
    void write_event (int FD);
    void exception_event (int FD);
    void timeout_event (void);
};
```

## Register timers/handles with Qt

```
virtual int register_handler_i (
    ACE_HANDLE handle,
    ACE_Event_Handler *handler,
    ACE_Reactor_Mask mask
    );
```

Register a single handler.

```
virtual int register_handler_i (
    const ACE_Handle_Set &handles,
    ACE_Event_Handler *handler,
    ACE_Reactor_Mask mask
    );
```

Register a set of handlers with Qt.

```
virtual int remove_handler_i (
    ACE_HANDLE handle,
    ACE_Reactor_Mask mask
    );
```

Remove the handler associated with this handle.

```
virtual int remove_handler_i (
    const ACE_Handle_Set &handles,
    ACE_Reactor_Mask mask
    );
```

Remove a set of handles.

```
virtual int wait_for_multiple_events (
    ACE_Select_Reactor_Handle_Set &handle_set,
    ACE_Time_Value *max_wait_time
    );
```

Wait for events to occur.

```
virtual int QtWaitForMultipleEvents (
    int width,
    ACE_Select_Reactor_Handle_Set &wait_set,
    ACE_Time_Value *max_wait_time
    );
```

Wait for Qt events to occur

```
QApplication *qapp_;
```

Some Qt stuff that we need to have

```
    typedef ACE_Map_Manager<ACE_HANDLE, QSocketNotifier *, ACE_Null_Mutex> MAP;

```

Typedef of a map.

```
MAP read_notifier_;
```

A notifier for a read

```
MAP write_notifier_;
```

A write notifier

```
MAP exception_notifier_;
```

An exception notifier

```
QTimer *qtime_;
```

The timer class that would provide timer-sgnals & single-shot timers

## AUTHOR

Hamish Friedlander ullexco@wave.co.nz integrated in to ACE by Balachandran Natarajan bala@cs.wustl.edu

## Timer operations.

## LIBRARY

ace
