1
2 /* Web Polygraph http://www.web-polygraph.org/
3 * Copyright 2003-2011 The Measurement Factory
4 * Licensed under the Apache License, Version 2.0 */
5
6 #ifndef POLYGRAPH__PGL_PGLBWIDTHSYM_H
7 #define POLYGRAPH__PGL_PGLBWIDTHSYM_H
8
9 #include "xstd/Time.h"
10 #include "xstd/BigSize.h"
11 #include "pgl/PglExprSym.h"
12
13 class TimeSym;
14 class SizeSym;
15 class NumSym;
16
17 typedef double Bwidth; // for now
18 extern Bwidth Bandwidth(BigSize sz, Time tm);
BytesPerSec(Bwidth bw)19 inline double BytesPerSec(Bwidth bw) { return bw; }
BitsPerSec(Bwidth bw)20 inline double BitsPerSec(Bwidth bw) { return 8*BytesPerSec(bw); }
21
22
23 // bandwidth [size/time]
24
25 class BwidthSym: public ExpressionSym {
26 public:
27 static String TheType;
28
29 public:
30 BwidthSym(BigSize aSize, Time anInterval);
31 BwidthSym(Bwidth aVal);
32
33 Bwidth val() const;
34 void val(Bwidth aVal);
35
36 virtual bool isA(const String &type) const;
37
38 virtual ExpressionSym *unOper(const Oper &op) const;
39 virtual ExpressionSym *bnOper(const Oper &op, const SynSym &exp) const;
40
41 virtual ostream &print(ostream &os, const String &pfx) const;
42
43 protected:
44 virtual SynSym *dupe(const String &dType) const;
45
46 ExpressionSym *operBB(const Oper &op, BwidthSym *rs, const SynSym &s) const;
47 ExpressionSym *operBT(const Oper &op, TimeSym *ts, const SynSym &s) const;
48 ExpressionSym *operBN(const Oper &op, NumSym *ns, const SynSym &s) const;
49
50 protected:
51 Bwidth theVal;
52 };
53
54
55
56
57 #endif
58