Debian Codegraph @

lib/vpsc/variable.h

raw
1 /**
2 *
3 * Authors:
4 * Tim Dwyer <[email protected]>
5 *
6 * Copyright (C) 2005 Authors
7 *
8 * This version is released under the CPL (Common Public License) with
9 * the Graphviz distribution.
10 * A version is also available under the LGPL as part of the Adaptagrams
11 * project: https://github.com/mjwybrow/adaptagrams.
12 * If you make improvements or bug fixes to this code it would be much
13 * appreciated if you could also contribute those changes back to the
14 * Adaptagrams repository.
15 */
16 #pragma once
17
18 #include <vector>
19 #include <iostream>
20 class Block;
21 struct Constraint;
22 #include <vpsc/block.h>
23
24 typedef std::vector<Constraint*> Constraints;
25 struct Variable
26 {
27 friend std::ostream& operator <<(std::ostream &os, const Variable &v);
28 public:
29 const int id; // useful in log files
30 double desiredPosition;
31 const double weight;
32 double offset;
33 Block *block = nullptr;
34 bool visited;
35 Constraints in;
36 Constraints out;
37 char *toString();
38 Variable(const int id_, const double desiredPos_, const double weight_)
39 : id(id_)
40 , desiredPosition(desiredPos_)
41 , weight(weight_)
42 , offset(0)
43 , visited(false)
44 {
45 }
46 double position() const {
47 return block->posn+offset;
48 }
49 };