signaltype.h

00001 #ifndef _GEDDEI_SIGNALTYPE_H
00002 #define _GEDDEI_SIGNALTYPE_H
00003 
00004 #include <iostream>
00005 using namespace std;
00006 
00007 class QSocketSession;
00008 
00009 namespace Geddei
00010 {
00011 
00035 class SignalType
00036 {
00037  friend class LRConnection;
00038  friend class RLConnection;
00039  friend class DRCoupling;
00040  friend class RSCoupling;
00041  friend class SignalTypeRefs;
00042  friend class SignalTypeRef;
00043  friend class Buffer;
00044  friend class Splitter;
00045  friend class MLConnection;
00046  friend class LMConnection;
00047  friend class LxConnection;
00048  friend class LLConnection;
00049  friend class Processor;
00050  friend class SubProcessor;
00051  friend class LxConnectionNull;
00052  
00058  void send(QSocketSession &sink) const;
00059 
00070  static SignalType *receive(QSocketSession &source);
00071 
00077  SignalType *copy() const { return copyBE(); }
00078 
00085  const bool sameAs(const SignalType *comp) const { return sameAsBE(comp); }
00086 
00097  static SignalType *create(const uint id);
00098 
00099 protected:
00103  uint theScope;
00104 
00108  float theFrequency;
00109 
00117 
00137  virtual void serialise(QSocketSession &sink) const;
00138 
00161  virtual void deserialise(QSocketSession &source);
00162 
00173  virtual const uint id() const = 0;
00174 
00188  virtual SignalType *copyBE() const = 0;
00189 
00208  virtual const bool sameAsBE(const SignalType *comp) const { return id() == comp->id() && theScope == comp->theScope && theFrequency == comp->theFrequency; }
00209 
00211 
00224  SignalType(const uint scope = 1, const float frequency = 0);
00225 
00226 public:
00231  const uint scope() const { return theScope; }
00232 
00237  const float frequency() const { return theFrequency; }
00238 
00244  void setScope(const uint scope) { theScope = scope; }
00245 
00251  void setFrequency(const float frequency) { theFrequency = frequency; }
00252 
00260  const uint samples(const uint elements) const { return elements / theScope; }
00261 
00268  const float seconds(const uint elements) const { return float(elements / theScope) / theFrequency; }
00269 
00277  const uint elementsFromSamples(const uint samples) const { return samples * theScope; }
00278 
00285  const uint elementsFromSeconds(const float seconds) const { return (uint)(seconds * theFrequency) * theScope; }
00286  
00290  virtual ~SignalType() {}
00291 };
00292 
00293 }
00294 
00295 #endif
00296 

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