visualnode.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 namespace Gecode { namespace Gist {
00039
00040 forceinline
00041 Extent::Extent(void) : l(-1), r(-1) {}
00042
00043 forceinline
00044 Extent::Extent(int l0, int r0) : l(l0), r(r0) {}
00045
00046 inline
00047 Extent::Extent(int width) {
00048 int halfWidth = width / 2;
00049 l = 0 - halfWidth;
00050 r = 0 + halfWidth;
00051 }
00052
00053 inline void
00054 Extent::extend(int deltaL, int deltaR) {
00055 l += deltaL; r += deltaR;
00056 }
00057
00058 inline void
00059 Extent::move(int delta) {
00060 l += delta; r += delta;
00061 }
00062
00063 forceinline const Extent&
00064 Shape::operator [](int i) const {
00065 assert(i < _depth);
00066 return shape[i];
00067 }
00068
00069 forceinline Extent&
00070 Shape::operator [](int i) {
00071 assert(i < _depth);
00072 return shape[i];
00073 }
00074
00075 inline Shape*
00076 Shape::allocate(int d) {
00077 Shape* ret =
00078 static_cast<Shape*>(heap.ralloc(sizeof(Shape) +
00079 (d-1)*sizeof(Extent)));
00080 ret->_depth = d;
00081 return ret;
00082 }
00083
00084 inline Shape*
00085 Shape::allocate(Extent e) {
00086 Shape* ret = Shape::allocate(1);
00087 (*ret)[0] = e;
00088 return ret;
00089 }
00090
00091 forceinline void
00092 Shape::deallocate(Shape* shape) {
00093 if (shape != hidden && shape != leaf)
00094 heap.rfree(shape);
00095 }
00096
00097 forceinline int
00098 Shape::depth(void) const { return _depth; }
00099
00100 forceinline
00101 BoundingBox::BoundingBox(int l, int r)
00102 : left(l), right(r) {}
00103
00104 forceinline bool
00105 VisualNode::isHidden(void) {
00106 return getFlag(HIDDEN);
00107 }
00108
00109 forceinline void
00110 VisualNode::setHidden(bool h) {
00111 setFlag(HIDDEN, h);
00112 }
00113
00114 forceinline void
00115 VisualNode::setStop(bool h) {
00116 if (getStatus() == BRANCH && h)
00117 setStatus(STOP);
00118 else if (getStatus() == STOP && !h)
00119 setStatus(UNSTOP);
00120 }
00121
00122 forceinline int
00123 VisualNode::getOffset(void) { return offset; }
00124
00125 forceinline void
00126 VisualNode::setOffset(int n) { offset = n; }
00127
00128 forceinline bool
00129 VisualNode::isDirty(void) {
00130 return getFlag(DIRTY);
00131 }
00132
00133 forceinline void
00134 VisualNode::setDirty(bool d) {
00135 setFlag(DIRTY, d);
00136 }
00137
00138 forceinline bool
00139 VisualNode::childrenLayoutIsDone(void) {
00140 return getFlag(CHILDRENLAYOUTDONE);
00141 }
00142
00143 forceinline void
00144 VisualNode::setChildrenLayoutDone(bool d) {
00145 setFlag(CHILDRENLAYOUTDONE, d);
00146 }
00147
00148 forceinline bool
00149 VisualNode::isMarked(void) {
00150 return getFlag(MARKED);
00151 }
00152
00153 forceinline void
00154 VisualNode::setMarked(bool m) {
00155 setFlag(MARKED, m);
00156 }
00157
00158 forceinline bool
00159 VisualNode::isBookmarked(void) {
00160 return getFlag(BOOKMARKED);
00161 }
00162
00163 forceinline void
00164 VisualNode::setBookmarked(bool m) {
00165 setFlag(BOOKMARKED, m);
00166 }
00167
00168 forceinline bool
00169 VisualNode::isOnPath(void) {
00170 return getFlag(ONPATH);
00171 }
00172
00173 forceinline void
00174 VisualNode::setOnPath(bool b) {
00175 setFlag(ONPATH, b);
00176 }
00177
00178 forceinline Shape*
00179 VisualNode::getShape(void) { return shape; }
00180
00181 forceinline void
00182 VisualNode::setBoundingBox(BoundingBox b) { box = b; }
00183
00184 forceinline BoundingBox
00185 VisualNode::getBoundingBox(void) { return box; }
00186
00187 forceinline VisualNode*
00188 VisualNode::getParent() {
00189 return static_cast<VisualNode*>(SpaceNode::getParent());
00190 }
00191
00192 forceinline VisualNode*
00193 VisualNode::getChild(int i) {
00194 return static_cast<VisualNode*>(SpaceNode::getChild(i));
00195 }
00196
00197 }}
00198
00199