lrconnection.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 
00011 #ifndef _GEDDEI_LRCONNECTION_H
00012 #define _GEDDEI_LRCONNECTION_H
00013 
00014 #include <qmutex.h>
00015 
00016 #ifdef __GEDDEI_BUILD
00017 #include "qsocketsession.h"
00018 #include "lxconnectionreal.h"
00019 #else
00020 #include <qtextra/qsocketsession.h>
00021 #include <geddei/lxconnectionreal.h>
00022 #endif
00023 using namespace Geddei;
00024 
00025 class QSocketDevice;
00026 
00027 namespace Geddei
00028 {
00029 
00030 class ProcessorForwarder;
00031 
00040 class LRConnection: public LxConnectionReal
00041 {
00042  //* Reimplementations from Connection
00043  virtual const SignalTypeRef type();
00044 
00045  //* Reimplementations from LxConnection
00046  virtual const bool waitUntilReady();
00047  virtual void setType(const SignalType *type);
00048  virtual void resetType();
00049  virtual void sourceStopping();
00050  virtual void sourceStopped();
00051  virtual void reset() {}
00052  virtual void pushPlunger();
00053  virtual void startPlungers();
00054  virtual void plungerSent();
00055  virtual void noMorePlungers();
00056  virtual const uint maximumScratchElements(const uint) { return Undefined; }
00057  virtual const uint maximumScratchElementsEver() { return Undefined; }
00058  virtual void enforceMinimum(const uint elements);
00059 
00060  //* Reimplementations from LxConnectionReal
00061  virtual void transport(const BufferData &data);
00062  virtual void bufferWaitForFree();
00063  virtual const uint bufferElementsFree();
00064 
00065  QString theRemoteHost, theRemoteProcessorName;
00066  uint theRemoteKey, theRemoteIndex;
00067 
00068  QSocketSession theSink;
00069  QMutex theTrapdoor;
00070  void openTrapdoor() { theTrapdoor.lock(); }
00071  void closeTrapdoor() { theTrapdoor.unlock(); }
00072  const bool trapdoor() { bool ret = theTrapdoor.tryLock(); if(ret) theTrapdoor.unlock(); return !ret; }
00073 
00078  friend class ProcessorForwarder;
00079  LRConnection(Source *newSource, const uint newSourceIndex, QSocketDevice *newSink);
00080 
00084  ~LRConnection();
00085 
00086 public:
00087  void setCredentials(const QString &remoteHost, const uint remoteKey, const QString &remoteProcessorName, const uint remoteIndex);
00088 };
00089 
00090 };
00091 
00092 #endif

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