00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _RGEDDEI_HOSTSESSION_H
00012 #define _RGEDDEI_HOSTSESSION_H
00013
00014 #include <qmutex.h>
00015 #include <qmap.h>
00016 #include <qstring.h>
00017
00018 #ifdef __GEDDEI_BUILD
00019 #include "processorgroup.h"
00020 #include "processor.h"
00021 #include "properties.h"
00022 #include "buffer.h"
00023 #else
00024 #include <geddei/processorgroup.h>
00025 #include <geddei/processor.h>
00026 #include <geddei/properties.h>
00027 #include <geddei/buffer.h>
00028 #endif
00029 using namespace Geddei;
00030
00031 namespace rGeddei
00032 {
00033
00052 class SessionServer
00053 {
00054 static QMap<uint, SessionServer *> theSessionKeyMap;
00055 static QMutex mutSessionKeyMap;
00056 class SessionServerReaper: public QThread { virtual void run(); };
00057
00058 static SessionServerReaper *theReaper;
00059 static void reap();
00060
00061 uint theSessionKey;
00062 QMap<QString, Processor *> theProcessors;
00063 bool theAlive, theReaping;
00064 mutable QMutex theCalling;
00065
00066 void setAlive();
00067 void resetAlive();
00068 const bool alive() const;
00069
00070 public:
00071
00072 bool newProcessor(const QString &type, const QString &name, bool &ret);
00073 bool deleteProcessor(const QString &name);
00074 bool newDomProcessor(const QString &subType, const QString &name, bool &ret);
00075 bool deleteDomProcessor(const QString &name);
00076 bool processorInit(const QString &name, const Properties &p, const QString &newName);
00077 bool processorGo(const QString &name, bool &ret);
00078 bool processorWaitUntilGoing(const QString &name, int &errorData, int &ret);
00079 bool processorWaitUntilDone(const QString &name);
00080 bool processorStop(const QString &name);
00081 bool processorReset(const QString &name);
00082 bool processorConnectNetwork(const QString &name, const uint bufferSize, const uint output, const QString &desthost, const uint destkey, const QString &destname, const uint destinput, bool &ret);
00083
00084 bool processorConnectSocket(const QString &name, const uint bufferSize, const uint output, const uint destkey, const QString &destname, const uint destinput, bool &ret);
00085 bool processorConnectLocal(const QString &name, const uint bufferSize, const uint output, const QString &destname, const uint destinput, bool &ret);
00086 bool processorDisconnect(const QString &name, const uint output);
00087 bool processorDisconnectAll(const QString &name);
00088 bool processorSplit(const QString &name, const uint output);
00089 bool processorShare(const QString &name, const uint output);
00090 bool domProcessorCreateAndAddLocal(const QString &name, bool &ret);
00091 bool domProcessorCreateAndAddNetwork(const QString &name, const QString &host, const uint key, bool &ret);
00092 bool typeAvailable(const QString &id, bool &ret);
00093 bool typeVersion(const QString &id, int &ret);
00094 bool typeSubAvailable(const QString &id, bool &ret);
00095 bool typeSubVersion(const QString &id, int &ret);
00096 void keepAlive() { setAlive(); }
00097
00098 inline Processor *getProcessor(const QString &name) { return theProcessors.contains(name) ? theProcessors[name] : 0; }
00099 inline uint sessionKey() { return theSessionKey; }
00100 static SessionServer *session(uint sessionKey);
00101
00108 static void safeDelete(uint sessionKey);
00109
00110 SessionServer();
00111 ~SessionServer();
00112 };
00113
00114 };
00115
00116 #endif