Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

include/DbusConnection.h

Go to the documentation of this file.
00001 
00017 #define DBUSCONNECTION_H 1
00018 
00019 #ifndef _GLIBCXX_VECTOR
00020 #include <vector>
00021 #endif
00022 
00023 #ifndef _GLIBCXX_STRING
00024 #include <string>
00025 #endif
00026 
00027 #ifndef _GLIBCXX_IOSTREAM
00028 #include <iostream>
00029 #endif
00030 
00031 #ifndef _GLIBCXX_SSTREAM
00032 #include <sstream>
00033 #endif
00034 
00035 #ifndef _GLIBCXX_QUEUE
00036 #include <queue>
00037 #endif
00038 
00039 #ifndef DBUS_GLIB_H
00040 #include <dbus/dbus-glib.h>
00041 #endif
00042 
00043 #ifndef COMM_H
00044 #include "Comm.h"
00045 #endif
00046 
00047 #ifndef GLOBALS_H
00048 #include "Globals.h"
00049 #endif
00050 
00051 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
00052 #include <boost/shared_ptr.hpp>
00053 #endif
00054 
00055 using namespace boost;
00056 using namespace std;
00057 
00058 //forward declarations:
00059 class MessageController;
00063 struct SomeObject
00064 {
00065   GObject parent;
00066   MessageController *mc;
00067 };
00068 
00072 struct SomeObjectClass
00073 {
00074   GObjectClass parent;
00075 };
00076 
00077 typedef struct SomeObject SomeObject;
00078 typedef struct SomeObjectClass SomeObjectClass;
00079 
00080 #define SOME_TYPE_OBJECT              (some_object_get_type ())
00081 #define SOME_OBJECT(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), SOME_TYPE_OBJECT, SomeObject))
00082 #define SOME_OBJECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), SOME_TYPE_OBJECT, SomeObjectClass))
00083 #define SOME_IS_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), SOME_TYPE_OBJECT))
00084 #define SOME_IS_OBJECT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), SOME_TYPE_OBJECT))
00085 #define SOME_OBJECT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), SOME_TYPE_OBJECT, SomeObjectClass))
00086 
00087 
00088 
00093 class DbusConnection:public Comm {
00094         shared_ptr< queue< shared_ptr< vector< shared_ptr< string > > > > > outqueue;   //      Outgoing queue.
00095         pthread_mutex_t mutex;
00096         pthread_cond_t cond;
00097 
00098         pthread_t sendthread;
00099         pthread_t receivethread;
00100         bool sendthread_run;
00101 
00102         string thisapp;
00103         string thatapp;
00104 
00105         //      Dbus
00106         GMainLoop *mainloop;
00107         DBusGProxy *remote_object;
00108 
00112         void dbus_init();
00113 
00114         MessageController* msgcontroller;
00115 
00116         public:
00123         DbusConnection( string nthisapp , string nthatapp , MessageController *ptr );
00124         ~DbusConnection();
00129         bool sendMessage ( shared_ptr< vector< shared_ptr< string > > > messagebody );
00130 
00134         friend void* sendThread( void * );
00138         friend void* receiveThread( void * );
00142         friend gboolean _send_message( SomeObject* , char** , GError** );
00143 };

Generated on Mon Jun 19 10:22:04 2006 for TraplasVisualisation by  doxygen 1.4.4