matrix.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 _SIGNALTYPES_MATRIX_H
00011 #define _SIGNALTYPES_MATRIX_H
00012 
00013 #ifdef __GEDDEI_BUILD
00014 #include "signaltype.h"
00015 #else
00016 #include <geddei/signaltype.h>
00017 #endif
00018 using namespace Geddei;
00019 
00020 namespace SignalTypes
00021 {
00022 
00027 class Matrix: public SignalType
00028 {
00029  virtual void serialise(QSocketSession &sink) const;
00030  virtual void deserialise(QSocketSession &source);
00031  virtual const uint id() const { return 3; }
00032  virtual SignalType *copyBE() const { return new Matrix(theWidth, theHeight, theFrequency); }
00033  virtual const bool sameAsBE(const SignalType *cmp) const;
00034 
00035 protected:
00036  uint theWidth; 
00037  uint theHeight; 
00038  float thePitchWidth; 
00039  float thePitchHeight; 
00040 
00041 public:
00047  const uint width() const { return theWidth; }
00048 
00054  const uint height() const { return theHeight; }
00055 
00061  const float pitchWidth() const { return thePitchWidth; }
00062 
00069  const float pitchHeight() const { return thePitchHeight; }
00070 
00085  Matrix(const uint width = 1, const uint height = 1, const float frequency = 0, const float pitchWidth = 0, const float pitchHeight = 0) : SignalType(width * height, frequency), theWidth(width), theHeight(height), thePitchWidth(pitchWidth), thePitchHeight(pitchHeight) {}
00086 };
00087 
00096 class SquareMatrix: public Matrix
00097 {
00098  virtual const uint id() const { return 4; }
00099  virtual SignalType *copyBE() const { return new SquareMatrix(theWidth, theFrequency); }
00100 
00101 public:
00109  const uint size() const { return theWidth; }
00110 
00117  const float pitch() const { return thePitchWidth; }
00118 
00129  SquareMatrix(const uint size = 1, const float frequency = 0., const float pitch = 0.) : Matrix(size, size, frequency, pitch, pitch) {}
00130 };
00131 
00132 };
00133 
00134 #endif

Generated on Fri Nov 10 21:58:26 2006 for Exscalibar by  doxygen 1.5.1