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 int
00115 VisualNode::getOffset(void) { return offset; }
00116
00117 forceinline void
00118 VisualNode::setOffset(int n) { offset = n; }
00119
00120 forceinline bool
00121 VisualNode::isDirty(void) {
00122 return getFlag(DIRTY);
00123 }
00124
00125 forceinline void
00126 VisualNode::setDirty(bool d) {
00127 setFlag(DIRTY, d);
00128 }
00129
00130 forceinline bool
00131 VisualNode::childrenLayoutIsDone(void) {
00132 return getFlag(CHILDRENLAYOUTDONE);
00133 }
00134
00135 forceinline void
00136 VisualNode::setChildrenLayoutDone(bool d) {
00137 setFlag(CHILDRENLAYOUTDONE, d);
00138 }
00139
00140 forceinline bool
00141 VisualNode::isMarked(void) {
00142 return getFlag(MARKED);
00143 }
00144
00145 forceinline void
00146 VisualNode::setMarked(bool m) {
00147 setFlag(MARKED, m);
00148 }
00149
00150 forceinline bool
00151 VisualNode::isOnPath(void) {
00152 return getFlag(ONPATH);
00153 }
00154
00155 forceinline void
00156 VisualNode::setOnPath(bool b) {
00157 setFlag(ONPATH, b);
00158 }
00159
00160 forceinline Shape*
00161 VisualNode::getShape(void) { return shape; }
00162
00163 forceinline void
00164 VisualNode::setBoundingBox(BoundingBox b) { box = b; }
00165
00166 forceinline BoundingBox
00167 VisualNode::getBoundingBox(void) { return box; }
00168
00169 forceinline VisualNode*
00170 VisualNode::getParent() {
00171 return static_cast<VisualNode*>(SpaceNode::getParent());
00172 }
00173
00174 forceinline VisualNode*
00175 VisualNode::getChild(int i) {
00176 return static_cast<VisualNode*>(SpaceNode::getChild(i));
00177 }
00178
00179 }}
00180
00181