Code

GSoC C++-ificiation merge and cleanup.
[inkscape.git] / src / libvpsc / 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 namespace vpsc {
27 class Block;
28 class Variable;
29 class Constraint;
30 /**
31  * A block structure defined over the variables such that each block contains
32  * 1 or more variables, with the invariant that all constraints inside a block
33  * are satisfied by keeping the variables fixed relative to one another
34  */
35 class Blocks : public std::set<Block*>
36 {
37 public:
38         Blocks(const int n, Variable* const vs[]);
39     virtual ~Blocks(void);
40         void mergeLeft(Block *r);
41         void mergeRight(Block *l);
42         void split(Block *b, Block *&l, Block *&r, Constraint *c);
43         std::list<Variable*> *totalOrder();
44         void cleanup();
45         double cost();
46 private:
47         void dfsVisit(Variable *v, std::list<Variable*> *order);
48         void removeBlock(Block *doomed);
49         Variable* const *vs;
50         int nvs;
51 };
53 extern long blockTimeCtr;
54 }
55 #endif // SEEN_REMOVEOVERLAP_BLOCKS_H