00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _RGEDDEI_NODESESSION_H
00011 #define _RGEDDEI_NODESESSION_H
00012
00013 #include <qmutex.h>
00014 #include <qthread.h>
00015 #include <qstring.h>
00016 #include <qstringlist.h>
00017 #include <qcstring.h>
00018
00019 #ifdef __GEDDEI_BUILD
00020 #include "properties.h"
00021 #include "commcodes.h"
00022 #else
00023 #include <geddei/properties.h>
00024 #include <rgeddei/commcodes.h>
00025 #endif
00026 using namespace Geddei;
00027
00028 class QSocketSession;
00029
00030 namespace rGeddei
00031 {
00032
00048 class RemoteSession
00049 {
00050 class Keeper: public QThread
00051 { RemoteSession *theOwner;
00052 virtual void run();
00053 public:
00054 Keeper(RemoteSession *owner): theOwner(owner) {}
00055 } theKeeper;
00056 friend class Keeper;
00057
00058 QMutex theCalling;
00059 uint theKey, theProcessorCount;
00060 int theLastError;
00061 QString theHost;
00062 bool theTerminating;
00063 QStringList theCompatibleProcessors;
00064
00065 QSocketSession *theSession;
00066
00067 public:
00068 friend class RemoteProcessor;
00069 friend class LocalProcessor;
00070 friend class RemoteDomProcessor;
00071 friend class LocalDomProcessor;
00072 const bool newProcessor(const QString &type, const QString &name);
00073 void deleteProcessor(const QString &name);
00074 const bool newDomProcessor(const QString &subType, const QString &name);
00075 void deleteDomProcessor(const QString &name);
00076 void processorInit(const QString &name, const Properties &p, const QString &newName);
00077 const bool processorGo(const QString &name);
00078 const int processorWaitUntilGoing(const QString &name, int &errorData);
00079 void processorWaitUntilDone(const QString &name);
00080 void processorStop(const QString &name);
00081 void processorReset(const QString &name);
00082 const bool processorConnect(const QString &name, const uint bufferSize, const uint output, const QString &destName, const uint destInput);
00083 const bool processorConnect(const QString &name, const uint bufferSize, const uint output, const QString &destHost, const uint destKey, const QString &destName, const uint destInput);
00084 void processorDisconnect(const QString &name, const uint output);
00085 void processorDisconnectAll(const QString &name);
00086 void processorSplit(const QString &name, const uint output);
00087 void processorShare(const QString &name, const uint output);
00088 const bool domProcessorCreateAndAdd(const QString &name);
00089 const bool domProcessorCreateAndAdd(const QString &name, const QString &host, const uint hostKey);
00090 const bool typeAvailable(const QString &type);
00091 const int typeVersion(const QString &type);
00092 const bool typeSubAvailable(const QString &type);
00093 const int typeSubVersion(const QString &type);
00094 void keepAlive();
00095
00096 const QString makeUniqueProcessorName() { return "!_" + QString().setNum(++theProcessorCount); }
00097
00098 public:
00107 const bool available(const QString &type);
00108
00117 const bool subAvailable(const QString &type);
00118
00127 const int version(const QString &type);
00128
00137 const int subVersion(const QString &type);
00138
00145 const bool isValid();
00146
00157 RemoteSession(const QString &host, const uint port = RGEDDEI_PORT);
00158
00162 ~RemoteSession();
00163 };
00164
00165 };
00166
00167 #endif