processorforwarder.h

00001 /***************************************************************************
00002  *   Copyright (C) 2003 by Gav Wood                                        *
00003  *   gav@cs.york.ac.uk                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU Library General Public License as       *
00007  *   published by the Free Software Foundation; either version 2 of the    *
00008  *   License, or (at your option) any later version.                       *
00009  ***************************************************************************/
00010 #ifndef _RGEDDEI_PROCESSORFORWARDER_H
00011 #define _RGEDDEI_PROCESSORFORWARDER_H
00012 
00013 #include <qptrlist.h>
00014 #include <qmutex.h>
00015 #include <qstring.h>
00016 #include <qserversocket.h>
00017 
00018 #ifdef __GEDDEI_BUILD
00019 #include "processor.h"
00020 #else
00021 #include <geddei/processor.h>
00022 #endif
00023 using namespace Geddei;
00024 
00025 #define GEDDEI_PORT 16661
00026 
00027 namespace Geddei
00028 {
00029 
00030 class DRCoupling;
00031 
00039 class ProcessorForwarder: public QServerSocket
00040 {
00041  // Orderly (out of thread) remote connection deletion subsystem.
00042  // Needed because a connection cannot delete itself from its own thread.
00043  static QMutex *theReaper;
00044  static QPtrList<RLConnection> theGraveyard;
00045  static QMutex *reaper();
00046  void clearGraveyard();
00047 
00048  friend class ProcessorForwarderLink;
00049 
00050  //* Reimplementation from QServerSocket.
00051  virtual void newConnection(int socket);
00052 
00057  virtual Processor *lookup(uint key, const QString &name) = 0;
00058 
00066  static QSocketDevice *login(const QString &host, const uint key);
00067 
00068 public:
00075  static LRConnection *createConnection(Source *source, const uint sourceIndex, const uint bufferSize, const QString &sinkHost, const uint sinkKey, const QString &sinkProcessorName, const uint sinkIndex);
00076 
00082  static const bool deleteConnection(const QString &sinkHost, const uint sinkKey, const QString &sinkProcessorName, const uint sinkIndex);
00083 
00088  static void deleteMeLater(RLConnection *me);
00089 
00095  static DRCoupling *createCoupling(DomProcessor *dom, const QString &host, const uint key, const QString &type);
00096 
00104  static const bool deleteCoupling(const QString &host, const uint key, const uint subProcessorKey);
00105 
00109  ProcessorForwarder(const uint port = 0);
00110 };
00111 
00112 };
00113 
00114 #endif

Generated on Thu Jul 13 06:56:33 2006 for Exscalibar by  doxygen 1.4.7