casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DBusSession.h
Go to the documentation of this file.
1 //# DBusSession.h: connection to the DBus session
2 //# Copyright (C) 2009
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef DBUS_SESSION_H_
29 #define DBUS_SESSION_H_
30 
31 #include <vector>
32 #include <string>
33 #include <casadbus/session/DBusSession.proxy.h>
35 
36 namespace casa {
37 
38  class DBusSession :
39  private org::freedesktop::DBus_proxy,
40  public DBus::IntrospectableProxy,
41  public DBus::ObjectProxy {
42  public:
43 
44  static DBusSession &instance( );
45  std::vector<std::string> listNames( ) { return ListNames( ); }
46  DBus::Connection &connection( ) { return conn; }
48 
49  private:
50 
51  DBus::Connection conn;
52  DBusSession( DBus::Connection & );
53  DBusSession( );
54 
56 
57  // pure virtual functions (i.e. dbus signals)
58  void NameOwnerChanged(const std::string&, const std::string&, const std::string&);
59  void NameLost(const std::string&);
60  void NameAcquired(const std::string&);
61 
62  friend class init_dispatcher;
63  };
64 
65  static class init_dispatcher {
66  public:
68  if ( ! initalized ) {
69  initalized = true;
71  DBus::default_dispatcher = DBusSession::dispatcher_;
72  }
73  }
74  private:
75  static bool initalized;
77 
78 }
79 #endif
std::vector< std::string > listNames()
Definition: DBusSession.h:45
static dbus::Dispatcher * dispatcher_
Definition: DBusSession.h:55
static DBusSession & instance()
void NameAcquired(const std::string &)
dbus::Dispatcher & dispatcher()
Definition: DBusSession.h:47
void NameOwnerChanged(const std::string &, const std::string &, const std::string &)
pure virtual functions (i.e.
DBus::Connection & connection()
Definition: DBusSession.h:46
void NameLost(const std::string &)
DBus::Connection conn
Definition: DBusSession.h:51
static class casa::init_dispatcher init_dispatcher_
static bool initalized
Definition: DBusSession.h:75