| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
#ifndef DLCOMPLETIONTREE_H |
| 21 |
#define DLCOMPLETIONTREE_H |
| 22 |
|
| 23 |
#include <vector> |
| 24 |
|
| 25 |
#include "globaldef.h" |
| 26 |
#include "dlCompletionTreeArc.h" |
| 27 |
#include "tSaveList.h" |
| 28 |
#include "tRestorer.h" |
| 29 |
#include "CGLabel.h" |
| 30 |
#include "logging.h" |
| 31 |
|
| 32 |
class DLDag; |
| 33 |
class DlCompletionGraph; |
| 34 |
|
| 35 |
|
| 36 |
#define RKG_CHECK_BACKJUMPING |
| 37 |
|
| 38 |
#if USE_LOGGING |
| 39 |
# define USE_BLOCKING_STATISTICS |
| 40 |
#endif |
| 41 |
|
| 42 |
#ifdef USE_BLOCKING_STATISTICS |
| 43 |
extern void printBlockingStat1 ( std::ostream& o ); |
| 44 |
extern void clearBlockingStat1 ( void ); |
| 45 |
# define printBlockingStat(O) printBlockingStat1(O) |
| 46 |
# define clearBlockingStat() clearBlockingStat1() |
| 47 |
#else |
| 48 |
# define printBlockingStat(O) (void)NULL |
| 49 |
# define clearBlockingStat() (void)NULL |
| 50 |
#endif |
| 51 |
|
| 52 |
|
| 53 |
typedef unsigned short CTNominalLevel; |
| 54 |
|
| 55 |
const CTNominalLevel BlockableLevel = static_cast<CTNominalLevel>(-1); |
| 56 |
|
| 57 |
class DlCompletionTree |
| 58 |
{ |
| 59 |
friend class DlCompletionGraph; |
| 60 |
|
| 61 |
protected: |
| 62 |
|
| 63 |
class SaveState |
| 64 |
{ |
| 65 |
public: |
| 66 |
|
| 67 |
CGLabel::SaveState lab; |
| 68 |
|
| 69 |
unsigned int curLevel = 0; |
| 70 |
|
| 71 |
size_t nNeighbours = 0; |
| 72 |
|
| 73 |
public: |
| 74 |
|
| 75 |
unsigned int level ( void ) const { return curLevel; } |
| 76 |
}; |
| 77 |
|
| 78 |
|
| 79 |
class UnBlock: public TRestorer |
| 80 |
{ |
| 81 |
protected: |
| 82 |
DlCompletionTree* p; |
| 83 |
const DlCompletionTree* Blocker; |
| 84 |
DepSet dep; |
| 85 |
bool pBlocked, dBlocked; |
| 86 |
public: |
| 87 |
explicit UnBlock ( DlCompletionTree* q ) : p(q), Blocker(q->Blocker), dep(q->pDep), pBlocked(q->pBlocked), dBlocked(q->dBlocked) {} |
| 88 |
void restore ( void ) override { p->Blocker = Blocker; p->pDep = dep; p->pBlocked = pBlocked; p->dBlocked = dBlocked; } |
| 89 |
}; |
| 90 |
|
| 91 |
|
| 92 |
class CacheRestorer: public TRestorer |
| 93 |
{ |
| 94 |
protected: |
| 95 |
DlCompletionTree* p; |
| 96 |
bool cached; |
| 97 |
public: |
| 98 |
explicit CacheRestorer ( DlCompletionTree* q ) : p(q), cached(q->cached) {} |
| 99 |
void restore ( void ) override { p->cached = cached; } |
| 100 |
}; |
| 101 |
|
| 102 |
#ifdef RKG_IR_IN_NODE_LABEL |
| 103 |
|
| 104 |
class IRRestorer: public TRestorer |
| 105 |
{ |
| 106 |
protected: |
| 107 |
DlCompletionTree* p; |
| 108 |
size_t n; |
| 109 |
public: |
| 110 |
explicit IRRestorer ( DlCompletionTree* q ) : p(q), n(q->IR.size()) {} |
| 111 |
void restore ( void ) override { p->IR.resize(n); } |
| 112 |
}; |
| 113 |
#endif |
| 114 |
|
| 115 |
public: |
| 116 |
|
| 117 |
typedef std::vector<DlCompletionTreeArc*> ArcCollection; |
| 118 |
|
| 119 |
|
| 120 |
typedef ArcCollection::iterator edge_iterator; |
| 121 |
|
| 122 |
typedef ArcCollection::const_iterator const_edge_iterator; |
| 123 |
|
| 124 |
|
| 125 |
typedef CGLabel::const_iterator const_label_iterator; |
| 126 |
|
| 127 |
#ifdef RKG_IR_IN_NODE_LABEL |
| 128 |
|
| 129 |
typedef std::vector<ConceptWDep> IRInfo; |
| 130 |
#endif |
| 131 |
|
| 132 |
protected: |
| 133 |
|
| 134 |
CGLabel Label; |
| 135 |
#ifdef RKG_IR_IN_NODE_LABEL |
| 136 |
|
| 137 |
IRInfo IR; |
| 138 |
#endif |
| 139 |
|
| 140 |
ArcCollection Neighbour; |
| 141 |
|
| 142 |
TSaveList<SaveState> saves; |
| 143 |
|
| 144 |
unsigned int id = 0; |
| 145 |
|
| 146 |
BipolarPointer Init = bpINVALID; |
| 147 |
|
| 148 |
|
| 149 |
const DlCompletionTree* Blocker = nullptr; |
| 150 |
|
| 151 |
DepSet pDep; |
| 152 |
|
| 153 |
|
| 154 |
unsigned int curLevel = 0; |
| 155 |
|
| 156 |
CTNominalLevel nominalLevel; |
| 157 |
|
| 158 |
|
| 159 |
bool flagDataNode : 1; |
| 160 |
|
| 161 |
bool cached : 1; |
| 162 |
|
| 163 |
bool pBlocked : 1; |
| 164 |
|
| 165 |
bool dBlocked : 1; |
| 166 |
|
| 167 |
|
| 168 |
|
| 169 |
bool affected : 1; |
| 170 |
|
| 171 |
protected: |
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
bool isCommonlyBlockedBy ( const DLDag& dag, const DlCompletionTree* p ) const; |
| 181 |
|
| 182 |
bool isABlockedBy ( const DLDag& dag, const DlCompletionTree* p ) const; |
| 183 |
|
| 184 |
bool isCBlockedBy ( const DLDag& dag, const DlCompletionTree* p ) const; |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
bool B1 ( const DlCompletionTree* p ) const; |
| 190 |
|
| 191 |
bool B2Simple ( const RAStateTransitions& RST, BipolarPointer C ) const; |
| 192 |
|
| 193 |
bool B2Complex ( const RAStateTransitions& RST, BipolarPointer C ) const; |
| 194 |
|
| 195 |
bool B2 ( const DLVertex& v, BipolarPointer C ) const |
| 196 |
{ |
| 197 |
# ifdef ENABLE_CHECKING |
| 198 |
fpp_assert ( hasParent() ); |
| 199 |
# endif |
| 200 |
const RAStateTransitions& RST = v.getRole()->getAutomaton()[v.getState()]; |
| 201 |
if ( v.getRole()->isSimple() ) |
| 202 |
return B2Simple ( RST, v.getC() ); |
| 203 |
else |
| 204 |
{ |
| 205 |
if ( RST.empty() ) |
| 206 |
return true; |
| 207 |
|
| 208 |
BipolarPointer bp = C - (BipolarPointer)v.getState(); |
| 209 |
if ( RST.isSingleton() ) |
| 210 |
return B2Simple ( RST, bp + (BipolarPointer)RST.getTransitionEnd() ); |
| 211 |
return B2Complex ( RST, bp ); |
| 212 |
} |
| 213 |
} |
| 214 |
|
| 215 |
bool B3 ( const DlCompletionTree* p, unsigned int n, const TRole* S, BipolarPointer C ) const; |
| 216 |
|
| 217 |
bool B4 ( const DlCompletionTree* p, unsigned int m, const TRole* T, BipolarPointer E ) const; |
| 218 |
|
| 219 |
bool B5 ( const TRole* T, BipolarPointer E ) const; |
| 220 |
|
| 221 |
bool B6 ( const TRole* U, BipolarPointer F ) const; |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
bool canBlockInit ( BipolarPointer C ) const { return C == bpTOP || label().contains(C); } |
| 229 |
|
| 230 |
bool isParentArcIBlocked ( void ) const |
| 231 |
{ |
| 232 |
for ( const DlCompletionTreeArc* edge : *this ) |
| 233 |
if ( edge->isPredEdge() && !edge->isIBlocked() ) |
| 234 |
return false; |
| 235 |
return true; |
| 236 |
} |
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
const DlCompletionTree* isTSomeApplicable ( const TRole* R, BipolarPointer C ) const; |
| 244 |
|
| 245 |
const DlCompletionTree* isNSomeApplicable ( const TRole* R, BipolarPointer C ) const; |
| 246 |
|
| 247 |
const DlCompletionTree* isTSuccLabelled ( const TRole* R, BipolarPointer C ) const; |
| 248 |
|
| 249 |
const DlCompletionTree* isTPredLabelled ( const TRole* R, BipolarPointer C, const DlCompletionTree* from ) const; |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
bool inIRwithC ( const ConceptWDep& C, DepSet& dep ) const; |
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
unsigned int getCurLevel ( void ) const { return curLevel; } |
| 264 |
|
| 265 |
void save ( SaveState* nss ) const; |
| 266 |
|
| 267 |
void restore ( SaveState* nss ); |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
void logSRNode ( const char* action ATTR_UNUSED ) const |
| 275 |
{ |
| 276 |
# if defined(RKG_CHECK_BACKJUMPING) |
| 277 |
if ( LLM.isWritable(llSRInfo) ) |
| 278 |
LL << " " << action << "(" << id << "[" << Neighbour.size() << "]," << getCurLevel() << ")"; |
| 279 |
# undef RKG_CHECK_BACKJUMPING // it is the only user |
| 280 |
# endif |
| 281 |
} |
| 282 |
|
| 283 |
const char* getBlockingStatusName ( void ) const { return isPBlocked() ? "p" : isDBlocked() ? "d" : isIBlocked() ? "i" : "u"; } |
| 284 |
|
| 285 |
void logNodeBStatus ( std::ostream& o ) const |
| 286 |
{ |
| 287 |
|
| 288 |
if ( Blocker ) |
| 289 |
o << getBlockingStatusName() << Blocker->getId(); |
| 290 |
if ( isCached() ) |
| 291 |
o << "c"; |
| 292 |
} |
| 293 |
|
| 294 |
void logNodeBlocked ( void ) const |
| 295 |
{ |
| 296 |
if ( LLM.isWritable(llGTA) ) |
| 297 |
{ |
| 298 |
LL << " " << getBlockingStatusName() << "b(" << id; |
| 299 |
if ( Blocker ) |
| 300 |
LL << "," << Blocker->id; |
| 301 |
LL << ")"; |
| 302 |
} |
| 303 |
} |
| 304 |
|
| 305 |
public: |
| 306 |
|
| 307 |
void init ( unsigned int level ); |
| 308 |
|
| 309 |
explicit DlCompletionTree ( unsigned int newId ) : id(newId) {} |
| 310 |
|
| 311 |
DlCompletionTree ( const DlCompletionTree& ) = delete; |
| 312 |
|
| 313 |
DlCompletionTree& operator = ( const DlCompletionTree& ) = delete; |
| 314 |
|
| 315 |
~DlCompletionTree() { saves.clear(); } |
| 316 |
|
| 317 |
|
| 318 |
void addNeighbour ( DlCompletionTreeArc* p ) { Neighbour.push_back(p); } |
| 319 |
|
| 320 |
|
| 321 |
unsigned int getId ( void ) const { return id; } |
| 322 |
|
| 323 |
bool isCached ( void ) const { return cached; } |
| 324 |
|
| 325 |
TRestorer* setCached ( bool val ) |
| 326 |
{ |
| 327 |
if ( cached == val ) |
| 328 |
return nullptr; |
| 329 |
TRestorer* ret = new CacheRestorer(this); |
| 330 |
cached = val; |
| 331 |
return ret; |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
bool isDataNode ( void ) const { return flagDataNode; } |
| 337 |
void setDataNode ( void ) { flagDataNode = true; } |
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
bool isBlockableNode ( void ) const { return nominalLevel == BlockableLevel; } |
| 342 |
bool isNominalNode ( void ) const { return nominalLevel != BlockableLevel; } |
| 343 |
bool isNominalNode ( CTNominalLevel level ) const { return nominalLevel == level; } |
| 344 |
void setNominalLevel ( void ) { nominalLevel = 0; } |
| 345 |
void setNominalLevel ( CTNominalLevel newLevel ) { nominalLevel = newLevel; } |
| 346 |
CTNominalLevel getNominalLevel ( void ) const { return nominalLevel; } |
| 347 |
|
| 348 |
|
| 349 |
bool operator < ( const DlCompletionTree& node ) const |
| 350 |
{ |
| 351 |
return ( getNominalLevel() < node.getNominalLevel() ) || |
| 352 |
( ( getNominalLevel() == node.getNominalLevel() ) && |
| 353 |
( getId() < node.getId() ) ); |
| 354 |
} |
| 355 |
|
| 356 |
|
| 357 |
void addConcept ( const ConceptWDep& p, bool isComplex ) { Label.getLabel(isComplex).add(p); } |
| 358 |
|
| 359 |
void setInit ( BipolarPointer p ) { Init = p; } |
| 360 |
BipolarPointer getInit() { return Init; } |
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
const_edge_iterator begin ( void ) const { return Neighbour.begin(); } |
| 368 |
const_edge_iterator end ( void ) const { return Neighbour.end(); } |
| 369 |
edge_iterator begin ( void ) { return Neighbour.begin(); } |
| 370 |
edge_iterator end ( void ) { return Neighbour.end(); } |
| 371 |
|
| 372 |
|
| 373 |
bool hasParent ( void ) const |
| 374 |
{ |
| 375 |
if ( Neighbour.empty() ) |
| 376 |
return false; |
| 377 |
return (*begin())->isPredEdge(); |
| 378 |
} |
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
const DlCompletionTree* isSomeApplicable ( const TRole* R, BipolarPointer C ) const |
| 386 |
{ return R->isTransitive() ? isTSomeApplicable(R,C) : isNSomeApplicable(R,C); } |
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
const CGLabel& label ( void ) const { return Label; } |
| 394 |
|
| 395 |
CGLabel& label ( void ) { return Label; } |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
const_label_iterator beginl_sc ( void ) const { return Label.begin_sc(); } |
| 401 |
|
| 402 |
const_label_iterator endl_sc ( void ) const { return Label.end_sc(); } |
| 403 |
|
| 404 |
const_label_iterator beginl_cc ( void ) const { return Label.begin_cc(); } |
| 405 |
|
| 406 |
const_label_iterator endl_cc ( void ) const { return Label.end_cc(); } |
| 407 |
|
| 408 |
|
| 409 |
bool isLabelledBy ( BipolarPointer p ) const { return Label.contains(p); } |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
bool isBlockedBy_SH ( const DlCompletionTree* p ) const { return B1(p); } |
| 419 |
|
| 420 |
bool isBlockedBy_SHI ( const DLDag& dag, const DlCompletionTree* p ) const { return isCommonlyBlockedBy ( dag, p ); } |
| 421 |
|
| 422 |
bool isBlockedBy_SHIQ ( const DLDag& dag, const DlCompletionTree* p ) const |
| 423 |
{ return isCommonlyBlockedBy ( dag, p ) && ( isCBlockedBy ( dag, p ) || isABlockedBy ( dag, p ) ); } |
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
const DlCompletionTree* getParentNode ( void ) const { return (*begin())->getArcEnd(); } |
| 430 |
|
| 431 |
DlCompletionTree* getParentNode ( void ) { return (*begin())->getArcEnd(); } |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
bool isAffected ( void ) const { return affected; } |
| 439 |
|
| 440 |
void setAffected ( void ) |
| 441 |
{ |
| 442 |
|
| 443 |
if ( isAffected() || isNominalNode() || isPBlocked() ) |
| 444 |
return; |
| 445 |
affected = true; |
| 446 |
for ( const_edge_iterator q = begin(), q_end = end(); q < q_end; ++q ) |
| 447 |
if ( (*q)->isSuccEdge() ) |
| 448 |
(*q)->getArcEnd()->setAffected(); |
| 449 |
} |
| 450 |
|
| 451 |
void clearAffected ( void ) { affected = false; } |
| 452 |
|
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
bool isDBlocked ( void ) const { return Blocker != nullptr && !pBlocked && dBlocked; } |
| 457 |
|
| 458 |
bool isIBlocked ( void ) const { return Blocker != nullptr && !pBlocked && !dBlocked; } |
| 459 |
|
| 460 |
bool isPBlocked ( void ) const { return Blocker != nullptr && pBlocked && !dBlocked; } |
| 461 |
|
| 462 |
bool isBlocked ( void ) const { return Blocker != nullptr && !pBlocked; } |
| 463 |
|
| 464 |
bool isIllegallyDBlocked ( void ) const { return isDBlocked() && Blocker->isBlocked(); } |
| 465 |
|
| 466 |
|
| 467 |
const DlCompletionTree* getBlocker ( void ) const { return Blocker; } |
| 468 |
|
| 469 |
DlCompletionTree* resolvePBlocker ( void ) |
| 470 |
{ |
| 471 |
if ( unlikely(isPBlocked()) ) |
| 472 |
return const_cast<DlCompletionTree*>(Blocker)->resolvePBlocker(); |
| 473 |
else |
| 474 |
return this; |
| 475 |
} |
| 476 |
|
| 477 |
const DlCompletionTree* resolvePBlocker ( void ) const |
| 478 |
{ |
| 479 |
if ( unlikely(isPBlocked()) ) |
| 480 |
return Blocker->resolvePBlocker(); |
| 481 |
else |
| 482 |
return this; |
| 483 |
} |
| 484 |
|
| 485 |
DlCompletionTree* resolvePBlocker ( DepSet& dep ) |
| 486 |
{ |
| 487 |
if ( likely(!isPBlocked()) ) |
| 488 |
return this; |
| 489 |
dep += pDep; |
| 490 |
return const_cast<DlCompletionTree*>(Blocker)->resolvePBlocker(dep); |
| 491 |
} |
| 492 |
|
| 493 |
const DepSet& getPurgeDep ( void ) const { return pDep; } |
| 494 |
|
| 495 |
bool canBlockInit ( const DlCompletionTree* p ) const { return canBlockInit(p->Init); } |
| 496 |
|
| 497 |
|
| 498 |
bool isLoopLabelled ( BipolarPointer c ) |
| 499 |
{ |
| 500 |
fpp_assert ( isDBlocked() ); |
| 501 |
if ( Blocker->isLabelledBy(c) ) |
| 502 |
return true; |
| 503 |
int n = 1; |
| 504 |
for ( DlCompletionTree* p = getParentNode(); p->hasParent() && p != Blocker; p = p->getParentNode() ) |
| 505 |
if ( p->isLabelledBy(c) ) |
| 506 |
return true; |
| 507 |
else |
| 508 |
++n; |
| 509 |
if ( LLM.isWritable(llGTA) ) |
| 510 |
LL << " loop(" << n << ")"; |
| 511 |
return false; |
| 512 |
} |
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
TRestorer* setBlocked ( const DlCompletionTree* blocker, bool permanently, bool directly ) |
| 520 |
{ |
| 521 |
TRestorer* ret = new UnBlock(this); |
| 522 |
Blocker = blocker; |
| 523 |
pBlocked = permanently; |
| 524 |
dBlocked = directly; |
| 525 |
logNodeBlocked(); |
| 526 |
return ret; |
| 527 |
} |
| 528 |
|
| 529 |
TRestorer* setDBlocked ( const DlCompletionTree* blocker ) { return setBlocked ( blocker, false, true ); } |
| 530 |
|
| 531 |
TRestorer* setIBlocked ( const DlCompletionTree* blocker ) { return setBlocked ( blocker, false, false ); } |
| 532 |
|
| 533 |
TRestorer* setUBlocked ( void ) { return setBlocked ( nullptr, true, true ); } |
| 534 |
|
| 535 |
TRestorer* setPBlocked ( const DlCompletionTree* blocker, const DepSet& dep ) |
| 536 |
{ |
| 537 |
TRestorer* ret = new UnBlock(this); |
| 538 |
Blocker = blocker; |
| 539 |
if ( isNominalNode() ) |
| 540 |
pDep = dep; |
| 541 |
pBlocked = true; |
| 542 |
dBlocked = false; |
| 543 |
logNodeBlocked(); |
| 544 |
return ret; |
| 545 |
} |
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
DlCompletionTreeArc* getEdgeLabelled ( const TRole* R, const DlCompletionTree* node ) const |
| 553 |
{ |
| 554 |
for ( const_edge_iterator p = begin(), p_end = end(); p < p_end; ++p ) |
| 555 |
if ( (*p)->getArcEnd() == node && (*p)->isNeighbour(R) ) |
| 556 |
return *p; |
| 557 |
return nullptr; |
| 558 |
} |
| 559 |
|
| 560 |
bool isParentArcLabelled ( const TRole* R ) const { return getEdgeLabelled ( R, getParentNode() ) != nullptr; } |
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
#ifdef RKG_IR_IN_NODE_LABEL |
| 567 |
|
| 568 |
bool initIR ( BipolarPointer level, const DepSet& ds ) |
| 569 |
{ |
| 570 |
ConceptWDep C(level,ds); |
| 571 |
DepSet dummy; |
| 572 |
if ( inIRwithC ( C, dummy ) ) |
| 573 |
return true; |
| 574 |
IR.push_back(std::move(C)); |
| 575 |
return false; |
| 576 |
} |
| 577 |
|
| 578 |
bool nonMergeable ( const DlCompletionTree* node, DepSet& dep ) const; |
| 579 |
|
| 580 |
TRestorer* updateIR ( const DlCompletionTree* node, const DepSet& toAdd ); |
| 581 |
#endif |
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
bool needSave ( unsigned int newLevel ) const { return getCurLevel() < newLevel; } |
| 589 |
|
| 590 |
void save ( unsigned int level ) |
| 591 |
{ |
| 592 |
save(saves.push()); |
| 593 |
curLevel = level; |
| 594 |
} |
| 595 |
|
| 596 |
void restore ( void ) |
| 597 |
{ |
| 598 |
fpp_assert ( !saves.empty() ); |
| 599 |
restore (saves.pop()); |
| 600 |
} |
| 601 |
|
| 602 |
bool needRestore ( unsigned int restLevel ) const { return getCurLevel() > restLevel; } |
| 603 |
|
| 604 |
void restore ( unsigned int level ) { restore(saves.pop(level)); } |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
void logNode ( void ) const { LL << getId(); logNodeBStatus(LL); } |
| 610 |
|
| 611 |
void PrintBody ( std::ostream& o ) const; |
| 612 |
}; |
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
inline void DlCompletionTree :: init ( unsigned int level ) |
| 619 |
{ |
| 620 |
flagDataNode = false; |
| 621 |
nominalLevel = BlockableLevel; |
| 622 |
curLevel = level; |
| 623 |
cached = false; |
| 624 |
affected = true; |
| 625 |
dBlocked = true; |
| 626 |
pBlocked = true; |
| 627 |
|
| 628 |
Label.init(); |
| 629 |
Init = bpTOP; |
| 630 |
|
| 631 |
|
| 632 |
saves.clear(); |
| 633 |
#ifdef RKG_IR_IN_NODE_LABEL |
| 634 |
IR.clear(); |
| 635 |
#endif |
| 636 |
Neighbour.clear(); |
| 637 |
Blocker = nullptr; |
| 638 |
pDep.clear(); |
| 639 |
} |
| 640 |
|
| 641 |
#endif |