dbus-cxx logo

utility.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2007,2008,2009,2010 by Rick L. Vinyard, Jr.             *
00003  *   rvinyard@cs.nmsu.edu                                                  *
00004  *                                                                         *
00005  *   This file is part of the dbus-cxx library.                            *
00006  *                                                                         *
00007  *   The dbus-cxx library is free software; you can redistribute it and/or *
00008  *   modify it under the terms of the GNU General Public License           *
00009  *   version 3 as published by the Free Software Foundation.               *
00010  *                                                                         *
00011  *   The dbus-cxx library is distributed in the hope that it will be       *
00012  *   useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
00013  *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
00014  *   General Public License for more details.                              *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU General Public License     *
00017  *   along with this software. If not see <http://www.gnu.org/licenses/>.  *
00018  ***************************************************************************/
00019 
00020 #include <dbus/dbus.h>
00021 #include <dbus-cxx/pointer.h>
00022 
00023 #ifndef DBUSCXX_UTILITY_H
00024 #define DBUSCXX_UTILITY_H
00025 
00026 #define DBUS_CXX_PARAM_LIMIT 7
00027 
00028 #ifdef DBUS_CXX_DEBUG_ENABLED
00029   #include <iostream>
00030 
00031  #define DEBUG_OUT(x,y) if (DEBUG) std::cout << x << " " << pthread_self() << ": " << y << std::endl
00032  #define DBUS_CXX_DEBUG(x) std::cout << pthread_self() << ": " << x << std::endl
00033 //   #define DEBUG_OUT(x,y) ;
00034 //   #define DBUS_CXX_DEBUG(x) ;
00035 #else
00036   #define DEBUG_OUT(x,y) ;
00037   #define DBUS_CXX_DEBUG(x) ;
00038 #endif
00039 
00040 #define DBUS_CXX_INTROSPECTABLE_INTERFACE "org.freedesktop.DBus.Introspectable"
00041 
00061 #define DBUS_CXX_ITERATOR_SUPPORT( CppType, DBusType )                                                \
00062   inline                                                                                              \
00063   DBus::MessageIterator& operator>>(DBus::MessageIterator& __msgiter, CppType& __cpptype)             \
00064   {                                                                                                   \
00065     DBusType __dbustype;                                                                              \
00066     __msgiter >> __dbustype;                                                                          \
00067     __cpptype = static_cast< CppType >( __dbustype );                                                 \
00068     return __msgiter;                                                                                 \
00069   }                                                                                                   \
00070                                                                                                       \
00071   inline                                                                                              \
00072   DBus::MessageAppendIterator& operator<<(DBus::MessageAppendIterator& __msgiter, CppType& __cpptype) \
00073   {                                                                                                   \
00074     __msgiter << static_cast< DBusType >( __cpptype );                                                \
00075     return __msgiter;                                                                                 \
00076   }                                                                                                   \
00077                                                                                                       \
00078   namespace DBus {                                                                                    \
00079     template<> inline std::string signature< CppType >() { return signature< DBusType >(); }          \
00080   }
00081 
00082 
00083 namespace DBus
00084 {
00085 
00091   void init(bool threadsafe=true);
00092 
00098   bool initialized();
00099 
00100 }
00101 
00102 #endif

Generated on Thu Mar 18 09:30:55 2010 for dbus-cxx by doxygen 1.6.1