Code

update
[inkscape.git] / src / removeoverlap / blocks.h
1 /**
2  * \brief A block structure defined over the variables
3  *
4  * A block structure defined over the variables such that each block contains
5  * 1 or more variables, with the invariant that all constraints inside a block
6  * are satisfied by keeping the variables fixed relative to one another
7  *
8  * Authors:
9  *   Tim Dwyer <tgdwyer@gmail.com>
10  *
11  * Copyright (C) 2005 Authors
12  *
13  * Released under GNU LGPL.  Read the file 'COPYING' for more information.
14  */
16 #ifndef SEEN_REMOVEOVERLAP_BLOCKS_H
17 #define SEEN_REMOVEOVERLAP_BLOCKS_H
19 #ifdef RECTANGLE_OVERLAP_LOGGING
20 #define LOGFILE "cRectangleOverlap.log"
21 #endif
23 #include <set>
24 #include <list>
26 class Block;
27 class Variable;
28 class Constraint;
29 /**
30  * A block structure defined over the variables such that each block contains
31  * 1 or more variables, with the invariant that all constraints inside a block
32  * are satisfied by keeping the variables fixed relative to one another
33  */
34 class Blocks : public std::set<Block*>
35 {
36 public:
37         Blocks(const int n, Variable *vs[]);
38         ~Blocks(void);
39         void mergeLeft(Block *r);
40         void mergeRight(Block *l);
41         void split(Block *b, Block *&l, Block *&r, Constraint *c);
42         std::list<Variable*> *totalOrder();
43         void cleanup();
44         double cost();
45 private:
46         void dfsVisit(Variable *v, std::list<Variable*> *order);
47         void removeBlock(Block *doomed);
48         Variable **vs;
49         int nvs;
50 };
52 extern long blockTimeCtr;
53 #endif // SEEN_REMOVEOVERLAP_BLOCKS_H