summaryrefslogtreecommitdiff
path: root/TAO/tao/QtResource_Factory.cpp
blob: dd61a937acff1eecad3ea757076e36f5c84df580 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//$Id$

#include "QtResource_Factory.h"
#include "debug.h"
#include "ace/QtReactor.h"

ACE_RCSID(TAO_QtResource,
          QtResource_Factory,
          "$Id$");

namespace TAO
{

  QtResource_Factory::QtResource_Factory (QApplication *qapp)
    : reactor_impl_ (0)
    , qapp_ (qapp)
  {
  }

  ACE_Reactor_Impl *
  QtResource_Factory::reactor_impl (void)
  {
    if (this->qapp_ == 0)
      {
        ACE_ERROR ((LM_ERROR,
                    "TAO (%P|%t) - QApplication is undefined.",
                    " Cannot create ACE_XtReactor \n"));
        return 0;
      }

    // @@Marek, do we need a lock here??
    if (!this->reactor_impl_)
      {

        ACE_NEW_RETURN (this->reactor_impl_,
                        ACE_QtReactor (qapp_),
                        0);

        if (TAO_debug_level > 0)
          ACE_DEBUG ((LM_DEBUG,
                      "TAO (%P|%t) - ACE_QtReactor created\n"));
      }

    return this->reactor_impl_;
  }
}