1 // ========================================================================== 2 // SeqAn - The Library for Sequence Analysis 3 // ========================================================================== 4 // Copyright (c) 2006-2010, Knut Reinert, FU Berlin 5 // All rights reserved. 6 // 7 // Redistribution and use in source and binary forms, with or without 8 // modification, are permitted provided that the following conditions are met: 9 // 10 // * Redistributions of source code must retain the above copyright 11 // notice, this list of conditions and the following disclaimer. 12 // * Redistributions in binary form must reproduce the above copyright 13 // notice, this list of conditions and the following disclaimer in the 14 // documentation and/or other materials provided with the distribution. 15 // * Neither the name of Knut Reinert or the FU Berlin nor the names of 16 // its contributors may be used to endorse or promote products derived 17 // from this software without specific prior written permission. 18 // 19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 // ARE DISCLAIMED. IN NO EVENT SHALL KNUT REINERT OR THE FU BERLIN BE LIABLE 23 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 29 // DAMAGE. 30 // 31 // ========================================================================== 32 33 #ifndef SEQAN_HEADER_GRAPH_EDGESTUMP_H 34 #define SEQAN_HEADER_GRAPH_EDGESTUMP_H 35 36 namespace SEQAN_NAMESPACE_MAIN 37 { 38 ////////////////////////////////////////////////////////////////////////////// 39 // Graph - EdgeStump 40 ////////////////////////////////////////////////////////////////////////////// 41 42 ////////////////////////////////////////////////////////////////////////////// 43 44 /** 45 .Class.EdgeStump: 46 ..cat:Graph 47 ..summary:The EdgeStump class encapsulates a single edge. 48 It represents either a list node in the adjacency list of a graph or an array field if edges are stored in an array. 49 ..signature:EdgeStump<TCargo, bool TList, bool TSource, bool TId, TSpec> 50 ..param.TCargo:The cargo type of an edge. 51 ...metafunction:Metafunction.Cargo 52 ...remarks:The cargo can be used to store arbitrary information with an edge. 53 ...default:$void$ 54 ..param.TList:Boolean value that indicates whether it is a list node or not. 55 ...remarks:If it is a list node it has one or two next pointers. 56 ...default:$true$ 57 ..param.TSource:Boolean value that indicates whether the source is stored in the EdgeStump or not. 58 ...remarks:If this value is true and it is a list node an additional source next pointer is present. 59 ...default:$false$ 60 ..param.TId:Boolean value that indicates whether an id is stored in the EdgeStump or not. 61 Note: Without edge ids external property maps do not work for edges! 62 ...default:$true$ 63 ..param.TSpec:The specializing type. 64 ...metafunction:Metafunction.Spec 65 ...default:$Default$, see @Tag.Default@. 66 ..remarks:The default EdgeStump in all graph types does not consider a cargo. 67 However, in default usage every graph does store an edge id. 68 Edge ids are used to append additional properties to edges with the help of external property maps. 69 ..include:seqan/graph_types.h 70 */ 71 template<typename TCargo, typename TSpec> 72 class EdgeStump<TCargo, true, false, false, TSpec> 73 { 74 public: 75 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 76 TVertexDescriptor_ data_target; 77 TCargo data_cargo; 78 EdgeStump* data_nextT; 79 }; 80 81 ////////////////////////////////////////////////////////////////////////////// 82 83 template<typename TCargo, typename TSpec> 84 class EdgeStump<TCargo, true, false, true, TSpec> 85 { 86 public: 87 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 88 typedef typename Id<EdgeStump>::Type TId_; 89 TVertexDescriptor_ data_target; 90 TId_ data_id; 91 TCargo data_cargo; 92 EdgeStump* data_nextT; 93 }; 94 95 ////////////////////////////////////////////////////////////////////////////// 96 97 template<typename TCargo, typename TSpec> 98 class EdgeStump<TCargo, true, true, false, TSpec> 99 { 100 public: 101 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 102 TVertexDescriptor_ data_target; 103 TVertexDescriptor_ data_source; 104 TCargo data_cargo; 105 EdgeStump* data_nextT; 106 EdgeStump* data_nextS; 107 }; 108 109 ////////////////////////////////////////////////////////////////////////////// 110 111 112 template<typename TCargo, typename TSpec> 113 class EdgeStump<TCargo, true, true, true, TSpec> 114 { 115 public: 116 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 117 typedef typename Id<EdgeStump>::Type TId_; 118 TVertexDescriptor_ data_target; 119 TVertexDescriptor_ data_source; 120 TId_ data_id; 121 TCargo data_cargo; 122 EdgeStump* data_nextT; 123 EdgeStump* data_nextS; 124 }; 125 126 ////////////////////////////////////////////////////////////////////////////// 127 128 template<typename TCargo, typename TSpec> 129 class EdgeStump<TCargo, false, false, false, TSpec> 130 { 131 public: 132 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 133 TVertexDescriptor_ data_target; 134 TCargo data_cargo; 135 }; 136 137 ////////////////////////////////////////////////////////////////////////////// 138 139 template<typename TCargo, typename TSpec> 140 class EdgeStump<TCargo, false, false, true, TSpec> 141 { 142 public: 143 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 144 typedef typename Id<EdgeStump>::Type TId_; 145 TVertexDescriptor_ data_target; 146 TId_ data_id; 147 TCargo data_cargo; 148 }; 149 150 ////////////////////////////////////////////////////////////////////////////// 151 152 template<typename TCargo, typename TSpec> 153 class EdgeStump<TCargo, false, true, false, TSpec> 154 { 155 public: 156 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 157 TVertexDescriptor_ data_target; 158 TVertexDescriptor_ data_source; 159 TCargo data_cargo; 160 }; 161 162 ////////////////////////////////////////////////////////////////////////////// 163 164 template<typename TCargo, typename TSpec> 165 class EdgeStump<TCargo, false, true, true, TSpec> 166 { 167 public: 168 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 169 typedef typename Id<EdgeStump>::Type TId_; 170 TVertexDescriptor_ data_target; 171 TVertexDescriptor_ data_source; 172 TId_ data_id; 173 TCargo data_cargo; 174 }; 175 176 ////////////////////////////////////////////////////////////////////////////// 177 // Graph - Cargoless EdgeStump 178 ////////////////////////////////////////////////////////////////////////////// 179 180 ////////////////////////////////////////////////////////////////////////////// 181 182 template<typename TSpec> 183 class EdgeStump<void, true, false, false, TSpec> 184 { 185 public: 186 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 187 TVertexDescriptor_ data_target; 188 EdgeStump* data_nextT; 189 }; 190 191 ////////////////////////////////////////////////////////////////////////////// 192 193 template<typename TSpec> 194 class EdgeStump<void, true, false, true, TSpec> 195 { 196 public: 197 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 198 typedef typename Id<EdgeStump>::Type TId_; 199 TVertexDescriptor_ data_target; 200 TId_ data_id; 201 EdgeStump* data_nextT; 202 }; 203 204 ////////////////////////////////////////////////////////////////////////////// 205 206 template<typename TSpec> 207 class EdgeStump<void, true, true, false, TSpec> 208 { 209 public: 210 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 211 TVertexDescriptor_ data_target; 212 TVertexDescriptor_ data_source; 213 EdgeStump* data_nextT; 214 EdgeStump* data_nextS; 215 }; 216 217 ////////////////////////////////////////////////////////////////////////////// 218 219 220 template<typename TSpec> 221 class EdgeStump<void, true, true, true, TSpec> 222 { 223 public: 224 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 225 typedef typename Id<EdgeStump>::Type TId_; 226 TVertexDescriptor_ data_target; 227 TVertexDescriptor_ data_source; 228 TId_ data_id; 229 EdgeStump* data_nextT; 230 EdgeStump* data_nextS; 231 }; 232 233 ////////////////////////////////////////////////////////////////////////////// 234 235 template<typename TSpec> 236 class EdgeStump<void, false, false, false, TSpec> 237 { 238 public: 239 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 240 TVertexDescriptor_ data_target; 241 }; 242 243 ////////////////////////////////////////////////////////////////////////////// 244 245 template<typename TSpec> 246 class EdgeStump<void, false, false, true, TSpec> 247 { 248 public: 249 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 250 typedef typename Id<EdgeStump>::Type TId_; 251 TVertexDescriptor_ data_target; 252 TId_ data_id; 253 }; 254 255 ////////////////////////////////////////////////////////////////////////////// 256 257 template<typename TSpec> 258 class EdgeStump<void, false, true, false, TSpec> 259 { 260 public: 261 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 262 TVertexDescriptor_ data_target; 263 TVertexDescriptor_ data_source; 264 }; 265 266 ////////////////////////////////////////////////////////////////////////////// 267 268 template<typename TSpec> 269 class EdgeStump<void, false, true, true, TSpec> 270 { 271 public: 272 typedef typename VertexDescriptor<EdgeStump>::Type TVertexDescriptor_; 273 typedef typename Id<EdgeStump>::Type TId_; 274 TVertexDescriptor_ data_target; 275 TVertexDescriptor_ data_source; 276 TId_ data_id; 277 }; 278 279 ////////////////////////////////////////////////////////////////////////////// 280 // EdgeStump - Metafunctions 281 ////////////////////////////////////////////////////////////////////////////// 282 283 ////////////////////////////////////////////////////////////////////////////// 284 285 ///.Metafunction.Cargo.param.T.type:Class.EdgeStump 286 287 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 288 struct Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> > { 289 typedef TCargo Type; 290 }; 291 292 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 293 struct Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> const> { 294 typedef TCargo const Type; 295 }; 296 297 298 template<bool TList, bool TSource, bool TId, typename TSpec> 299 struct Cargo<EdgeStump<void, TList, TSource, TId, TSpec> > { 300 typedef void* Type; 301 }; 302 303 template<bool TList, bool TSource, bool TId, typename TSpec> 304 struct Cargo<EdgeStump<void, TList, TSource, TId, TSpec> const> { 305 typedef void* Type; 306 }; 307 308 309 ////////////////////////////////////////////////////////////////////////////// 310 311 ///.Metafunction.Spec.param.T.type:Class.EdgeStump 312 313 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 314 struct Spec<EdgeStump<TCargo, TList, TSource, TId, TSpec> > 315 { 316 typedef TSpec Type; 317 }; 318 319 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 320 struct Spec<EdgeStump<TCargo, TList, TSource, TId, TSpec> const> 321 { 322 typedef TSpec Type; 323 }; 324 325 ////////////////////////////////////////////////////////////////////////////// 326 // FUNCTIONS 327 ////////////////////////////////////////////////////////////////////////////// 328 329 330 ////////////////////////////////////////////////////////////////////////////// 331 332 /** 333 .Function.getCargo: 334 ..cat:Graph 335 ..summary:Get method for the edge cargo. 336 ..signature:getCargo(es) 337 ..param.es:Pointer to the EdgeStump. 338 ...type:Class.EdgeStump 339 ..returns:Returns the cargo. 340 ..remarks:If cargo is not present the return value is (void*) 0. 341 ..see:Function.cargo 342 ..see:Function.assignCargo 343 ..include:seqan/graph_types.h 344 */ 345 346 347 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 348 inline typename Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> const>::Type& 349 getCargo(EdgeStump<TCargo, TList, TSource, TId, TSpec> const* es) 350 { 351 SEQAN_CHECKPOINT 352 return es->data_cargo; 353 } 354 355 ////////////////////////////////////////////////////////////////////////////// 356 357 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 358 inline typename Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> >::Type& 359 getCargo(EdgeStump<TCargo, TList, TSource, TId, TSpec>* es) 360 { 361 SEQAN_CHECKPOINT 362 return es->data_cargo; 363 } 364 365 ////////////////////////////////////////////////////////////////////////////// 366 367 template<bool TList, bool TSource, bool TId, typename TSpec> 368 inline typename Cargo<EdgeStump<void, TList, TSource, TId, TSpec> const>::Type 369 getCargo(EdgeStump<void, TList, TSource, TId, TSpec> const*) 370 { 371 SEQAN_CHECKPOINT 372 // No real cargo 373 return 0; 374 } 375 376 ////////////////////////////////////////////////////////////////////////////// 377 378 template<bool TList, bool TSource, bool TId, typename TSpec> 379 inline typename Cargo<EdgeStump<void, TList, TSource, TId, TSpec> >::Type 380 getCargo(EdgeStump<void, TList, TSource, TId, TSpec>*) 381 { 382 SEQAN_CHECKPOINT 383 // No real cargo 384 return 0; 385 } 386 387 ////////////////////////////////////////////////////////////////////////////// 388 389 /** 390 .Function.cargo: 391 ..cat:Graph 392 ..summary:Access to the cargo. 393 ..signature:cargo(es) 394 ..param.es:Pointer to the EdgeStump. 395 ...type:Class.EdgeStump 396 ..returns:Returns a reference to the cargo. 397 ..remarks:If cargo is not present the return value is (void*) 0. 398 ..see:Function.getCargo 399 ..see:Function.assignCargo 400 ..include:seqan/graph_types.h 401 */ 402 403 404 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 405 inline typename Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> const>::Type& 406 cargo(EdgeStump<TCargo, TList, TSource, TId, TSpec> const* es) 407 { 408 SEQAN_CHECKPOINT 409 return es->data_cargo; 410 } 411 412 ////////////////////////////////////////////////////////////////////////////// 413 414 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 415 inline typename Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> >::Type& 416 cargo(EdgeStump<TCargo, TList, TSource, TId, TSpec>* es) 417 { 418 SEQAN_CHECKPOINT 419 return es->data_cargo; 420 } 421 422 423 ////////////////////////////////////////////////////////////////////////////// 424 425 template<bool TList, bool TSource, bool TId, typename TSpec> 426 inline typename Cargo<EdgeStump<void, TList, TSource, TId, TSpec> >::Type 427 cargo(EdgeStump<void, TList, TSource, TId, TSpec>*) 428 { 429 SEQAN_CHECKPOINT 430 // No real cargo 431 return 0; 432 } 433 434 ////////////////////////////////////////////////////////////////////////////// 435 436 template<bool TList, bool TSource, bool TId, typename TSpec> 437 inline typename Cargo<EdgeStump<void, TList, TSource, TId, TSpec> const>::Type 438 cargo(EdgeStump<void, TList, TSource, TId, TSpec> const*) 439 { 440 SEQAN_CHECKPOINT 441 // No real cargo 442 return 0; 443 } 444 445 ////////////////////////////////////////////////////////////////////////////// 446 447 /** 448 .Function.assignCargo: 449 ..cat:Graph 450 ..summary:Assigns a new cargo to the edge. 451 ..signature:assignCargo(es, cargo) 452 ..param.es:Pointer to the EdgeStump. 453 ...type:Class.EdgeStump 454 ..param.cargo:New cargo object. 455 ...remarks:Type of the new cargo object must match Cargo<EdgeStump<TCargo, TList, TSource, TId, TSpec> >::Type. 456 ..returns:void 457 ..remarks:In cargoless EdgeStumps this operation is a NOP. 458 ..see:Function.cargo 459 ..see:Function.getCargo 460 ..include:seqan/graph_types.h 461 */ 462 463 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec, typename TCargo2> 464 inline void 465 assignCargo(EdgeStump<TCargo, TList, TSource, TId, TSpec>* es, 466 TCargo2 const& t) 467 { 468 SEQAN_CHECKPOINT 469 es->data_cargo = (TCargo) t; 470 } 471 472 ////////////////////////////////////////////////////////////////////////////// 473 474 template<bool TList, bool TSource, bool TId, typename TSpec, typename TCargo2> 475 inline void 476 assignCargo(EdgeStump<void, TList, TSource, TId, TSpec>*, 477 TCargo2 const&) 478 { 479 SEQAN_CHECKPOINT 480 // No real cargo 481 } 482 483 ////////////////////////////////////////////////////////////////////////////// 484 485 /** 486 .Function.assignTarget: 487 ..cat:Graph 488 ..summary:Assigns a target vertex to an edge. 489 ..signature:assignTarget(es, t) 490 ..param.es:Pointer to the EdgeStump. 491 ...type:Class.EdgeStump 492 ..param.t:Target vertex. 493 ..returns:void 494 ..see:Function.target 495 ..see:Function.getTarget 496 ..include:seqan/graph_types.h 497 */ 498 499 500 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec, typename TVertexDescriptor> 501 inline void 502 assignTarget(EdgeStump<TCargo, TList, TSource, TId, TSpec>* es, 503 TVertexDescriptor const t) 504 { 505 SEQAN_CHECKPOINT 506 es->data_target = t; 507 } 508 509 ////////////////////////////////////////////////////////////////////////////// 510 511 /** 512 .Function.target: 513 ..cat:Graph 514 ..summary:Accesses the target of an EdgeStump. 515 ..signature:target(es) 516 ..param.es:Pointer to the EdgeStump. 517 ...type:Class.EdgeStump 518 ..returns:Reference to the target vertex. 519 ..see:Function.assignTarget 520 ..see:Function.getTarget 521 ..include:seqan/graph_types.h 522 */ 523 524 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 525 inline typename VertexDescriptor<EdgeStump<TCargo, TList, TSource, TId, TSpec> >::Type& 526 target(EdgeStump<TCargo, TList, TSource, TId, TSpec>* es) 527 { 528 SEQAN_CHECKPOINT 529 return es->data_target; 530 } 531 532 ////////////////////////////////////////////////////////////////////////////// 533 534 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 535 inline typename VertexDescriptor<EdgeStump<TCargo, TList, TSource, TId, TSpec> >::Type 536 target(EdgeStump<TCargo, TList, TSource, TId, TSpec> const* es) 537 { 538 SEQAN_CHECKPOINT 539 return es->data_target; 540 } 541 542 ////////////////////////////////////////////////////////////////////////////// 543 544 /** 545 .Function.getTarget: 546 ..cat:Graph 547 ..summary:Get method for the target. 548 ..signature:getTarget(es) 549 ..param.es:Pointer to the EdgeStump. 550 ...type:Class.EdgeStump 551 ..returns:Target vertex. 552 ..see:Function.assignTarget 553 ..see:Function.target 554 ..include:seqan/graph_types.h 555 */ 556 557 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 558 inline typename VertexDescriptor<EdgeStump<TCargo, TList, TSource, TId, TSpec> const>::Type 559 getTarget(EdgeStump<TCargo, TList, TSource, TId, TSpec> const* es) 560 { 561 SEQAN_CHECKPOINT 562 return es->data_target; 563 } 564 565 ////////////////////////////////////////////////////////////////////////////// 566 567 template<typename TCargo, bool TList, bool TSource, bool TId, typename TSpec> 568 inline typename VertexDescriptor<EdgeStump<TCargo, TList, TSource, TId, TSpec> >::Type 569 getTarget(EdgeStump<TCargo, TList, TSource, TId, TSpec>* es) 570 { 571 SEQAN_CHECKPOINT 572 return es->data_target; 573 } 574 575 576 ////////////////////////////////////////////////////////////////////////////// 577 578 /** 579 .Function.Graph#assignSource: 580 ..cat:Graph 581 ..summary:Assigns a source vertex to an edge. 582 ..remarks:A source vertex is not required in an edge stump. 583 However, EdgeStumps can be configured to contain a source vertex, e.g., in undirected graphs. 584 ..signature:assignSource(es, s) 585 ..param.es:Pointer to the EdgeStump. 586 ...type:Class.EdgeStump 587 ..param.s:Source vertex. 588 ..returns:void 589 ..see:Function.source 590 ..see:Function.getSource 591 ..include:seqan/graph_types.h 592 */ 593 594 template<typename TCargo, bool TList, bool TId, typename TSpec, typename TVertexDescriptor> 595 inline void 596 assignSource(EdgeStump<TCargo, TList, true, TId, TSpec>* es, 597 TVertexDescriptor const s) 598 { 599 SEQAN_CHECKPOINT 600 es->data_source = s; 601 } 602 603 ////////////////////////////////////////////////////////////////////////////// 604 605 template<typename TCargo, bool TList, bool TId, typename TSpec, typename TVertexDescriptor> 606 inline void 607 assignSource(EdgeStump<TCargo, TList, false, TId, TSpec>*, 608 TVertexDescriptor const) 609 { 610 SEQAN_CHECKPOINT 611 // NOP 612 } 613 614 ////////////////////////////////////////////////////////////////////////////// 615 616 template<typename TCargo, bool TList, bool TId, typename TSpec> 617 inline typename VertexDescriptor<EdgeStump<TCargo, TList, true, TId, TSpec> >::Type& 618 source(EdgeStump<TCargo, TList, true, TId, TSpec>* es) 619 { 620 SEQAN_CHECKPOINT 621 return es->data_source; 622 } 623 624 ////////////////////////////////////////////////////////////////////////////// 625 626 template<typename TCargo, bool TList, bool TId, typename TSpec> 627 inline typename VertexDescriptor<EdgeStump<TCargo, TList, true, TId, TSpec> >::Type 628 source(EdgeStump<TCargo, TList, true, TId, TSpec> const* es) 629 { 630 SEQAN_CHECKPOINT 631 return es->data_source; 632 } 633 634 ////////////////////////////////////////////////////////////////////////////// 635 636 637 template<typename TCargo, bool TList, bool TId, typename TSpec> 638 inline typename VertexDescriptor<EdgeStump<TCargo, TList, false, TId, TSpec> >::Type 639 source(EdgeStump<TCargo, TList, false, TId, TSpec>*) 640 { 641 SEQAN_CHECKPOINT 642 // No source available 643 return 0; 644 } 645 646 ////////////////////////////////////////////////////////////////////////////// 647 648 649 template<typename TCargo, bool TList, bool TId, typename TSpec> 650 inline typename VertexDescriptor<EdgeStump<TCargo, TList, false, TId, TSpec> >::Type 651 source(EdgeStump<TCargo, TList, false, TId, TSpec> const*) 652 { 653 SEQAN_CHECKPOINT 654 // No source available 655 return 0; 656 } 657 658 ////////////////////////////////////////////////////////////////////////////// 659 660 /** 661 .Function.getSource: 662 ..cat:Graph 663 ..summary:Get method for the source. 664 ..remarks:A source vertex is not required in an edge stump. 665 However, EdgeStumps can be configured to contain a source vertex, e.g., in undirected graphs. 666 ..signature:getSource(es) 667 ..param.es:Pointer to the EdgeStump. 668 ...type:Class.EdgeStump 669 ..returns:Source vertex. 670 ..see:Function.Graph#assignSource 671 ..see:Function.source 672 ..include:seqan/graph_types.h 673 */ 674 675 template<typename TCargo, bool TList, bool TId, typename TSpec> 676 inline typename VertexDescriptor<EdgeStump<TCargo, TList, true, TId, TSpec> const>::Type 677 getSource(EdgeStump<TCargo, TList, true, TId, TSpec> const* es) 678 { 679 SEQAN_CHECKPOINT 680 return es->data_source; 681 } 682 683 ////////////////////////////////////////////////////////////////////////////// 684 685 template<typename TCargo, bool TList, bool TId, typename TSpec> 686 inline typename VertexDescriptor<EdgeStump<TCargo, TList, true, TId, TSpec> >::Type 687 getSource(EdgeStump<TCargo, TList, true, TId, TSpec>* es) 688 { 689 SEQAN_CHECKPOINT 690 return es->data_source; 691 } 692 693 ////////////////////////////////////////////////////////////////////////////// 694 695 template<typename TCargo, bool TList, bool TId, typename TSpec> 696 inline typename VertexDescriptor<EdgeStump<TCargo, TList, false, TId, TSpec> const>::Type 697 getSource(EdgeStump<TCargo, TList, false, TId, TSpec> const*) 698 { 699 SEQAN_CHECKPOINT 700 // Nop 701 return 0; 702 } 703 704 ////////////////////////////////////////////////////////////////////////////// 705 706 template<typename TCargo, bool TList, bool TId, typename TSpec> 707 inline typename VertexDescriptor<EdgeStump<TCargo, TList, false, TId, TSpec> >::Type 708 getSource(EdgeStump<TCargo, TList, false, TId, TSpec>*) 709 { 710 SEQAN_CHECKPOINT 711 // Nop 712 return 0; 713 } 714 715 716 717 718 ////////////////////////////////////////////////////////////////////////////// 719 720 /** 721 .Function.assignNextT: 722 ..cat:Graph 723 ..summary:Assigns another EdgeStump to the next target pointer. 724 ..signature:assignNextT(es, es2) 725 ..param.es:Pointer to the EdgeStump. 726 ...type:Class.EdgeStump 727 ..param.es2:Pointer to the following EdgeStump. 728 ...type:Class.EdgeStump 729 ..returns:void 730 ..see:Function.nextT 731 ..see:Function.getNextT 732 ..include:seqan/graph_types.h 733 */ 734 735 template<typename TCargo, bool TSource, bool TId, typename TSpec> 736 inline void 737 assignNextT(EdgeStump<TCargo, true, TSource, TId, TSpec>* es, 738 EdgeStump<TCargo, true, TSource, TId, TSpec>* es2) 739 { 740 SEQAN_CHECKPOINT 741 es->data_nextT = es2; 742 } 743 744 ////////////////////////////////////////////////////////////////////////////// 745 746 /** 747 .Function.nextT: 748 ..cat:Graph 749 ..summary:Accesses the next target pointer. 750 ..signature:nextT(es) 751 ..param.es:Pointer to the EdgeStump. 752 ...type:Class.EdgeStump 753 ..returns:Reference to the next target pointer. 754 ..see:Function.assignNextT 755 ..see:Function.getNextT 756 ..include:seqan/graph_types.h 757 */ 758 759 template<typename TCargo, bool TSource, bool TId, typename TSpec> 760 inline EdgeStump<TCargo, true, TSource, TId, TSpec>* & 761 nextT(EdgeStump<TCargo, true, TSource, TId, TSpec>* es) 762 { 763 SEQAN_CHECKPOINT 764 return es->data_nextT; 765 } 766 767 ////////////////////////////////////////////////////////////////////////////// 768 769 template<typename TCargo, bool TSource, bool TId, typename TSpec> 770 inline EdgeStump<TCargo, true, TSource, TId, TSpec>* & 771 nextT(EdgeStump<TCargo, true, TSource, TId, TSpec> const* es) 772 { 773 return es->data_nextT; 774 } 775 776 ////////////////////////////////////////////////////////////////////////////// 777 778 779 /** 780 .Function.getNextT: 781 ..cat:Graph 782 ..summary:Get method for the next target pointer. 783 ..signature:getNextT(es) 784 ..param.es:Pointer to the EdgeStump. 785 ...type:Class.EdgeStump 786 ..returns:Pointer to the next edge stump in target list. 787 ..see:Function.assignNextT 788 ..see:Function.nextT 789 ..include:seqan/graph_types.h 790 */ 791 792 template<typename TCargo, bool TSource, bool TId, typename TSpec> 793 inline EdgeStump<TCargo, true, TSource, TId, TSpec>* 794 getNextT(EdgeStump<TCargo, true, TSource, TId, TSpec>* es) 795 { 796 SEQAN_CHECKPOINT 797 return es->data_nextT; 798 } 799 800 801 ////////////////////////////////////////////////////////////////////////////// 802 803 template<typename TCargo, bool TSource, bool TId, typename TSpec> 804 inline EdgeStump<TCargo, true, TSource, TId, TSpec>* 805 getNextT(EdgeStump<TCargo, true, TSource, TId, TSpec> const* es) 806 { 807 return es->data_nextT; 808 } 809 810 ////////////////////////////////////////////////////////////////////////////// 811 812 /** 813 .Function.assignNextS: 814 ..cat:Graph 815 ..summary:Assigns another EdgeStump to the next source pointer. 816 ..signature:assignNextS(es, es2) 817 ..remarks:EdgeStumps can be configured to have no source. Then there is no next source pointer. 818 ..param.es:Pointer to the EdgeStump. 819 ...type:Class.EdgeStump 820 ..param.es2:Pointer to the following EdgeStump. 821 ...type:Class.EdgeStump 822 ..returns:void 823 ..see:Function.nextS 824 ..see:Function.getNextS 825 ..include:seqan/graph_types.h 826 */ 827 828 template<typename TCargo, bool TId, typename TSpec> 829 inline void 830 assignNextS(EdgeStump<TCargo, true, true, TId, TSpec>* es, 831 EdgeStump<TCargo, true, true, TId, TSpec>* es2) 832 { 833 SEQAN_CHECKPOINT 834 es->data_nextS = es2; 835 } 836 837 838 ////////////////////////////////////////////////////////////////////////////// 839 840 template<typename TCargo, bool TId, typename TSpec> 841 inline void 842 assignNextS(EdgeStump<TCargo, true, false, TId, TSpec>*, 843 EdgeStump<TCargo, true, false, TId, TSpec>*) 844 { 845 SEQAN_CHECKPOINT 846 // Nop 847 } 848 849 ////////////////////////////////////////////////////////////////////////////// 850 851 /** 852 .Function.nextS: 853 ..cat:Graph 854 ..summary:Accesses the next source pointer. 855 ..signature:nextS(es) 856 ..remarks:EdgeStumps can be configured to have no source. Then there is no next source pointer. 857 ..param.es:Pointer to the EdgeStump. 858 ...type:Class.EdgeStump 859 ..returns:Reference to the next source pointer. 860 ..see:Function.assignNextS 861 ..see:Function.getNextS 862 ..include:seqan/graph_types.h 863 */ 864 865 template<typename TCargo, bool TId, typename TSpec> 866 inline EdgeStump<TCargo, true, true, TId, TSpec>* & 867 nextS(EdgeStump<TCargo, true, true, TId, TSpec>* es) 868 { 869 SEQAN_CHECKPOINT 870 return es->data_nextS; 871 } 872 873 ////////////////////////////////////////////////////////////////////////////// 874 875 template<typename TCargo, bool TId, typename TSpec> 876 inline EdgeStump<TCargo, true, true, TId, TSpec>* & 877 nextS(EdgeStump<TCargo, true, true, TId, TSpec> const* es) 878 { 879 return es->data_nextS; 880 } 881 882 ////////////////////////////////////////////////////////////////////////////// 883 884 template<typename TCargo, bool TId, typename TSpec> 885 inline EdgeStump<TCargo, true, false, TId, TSpec>* 886 nextS(EdgeStump<TCargo, true, false, TId, TSpec>*) 887 { 888 SEQAN_CHECKPOINT 889 // Nop 890 return 0; 891 } 892 893 ////////////////////////////////////////////////////////////////////////////// 894 895 template<typename TCargo, bool TId, typename TSpec> 896 inline EdgeStump<TCargo, true, false, TId, TSpec>* 897 nextS(EdgeStump<TCargo, true, false, TId, TSpec> const*) 898 { 899 // Nop 900 return 0; 901 } 902 903 ////////////////////////////////////////////////////////////////////////////// 904 905 /** 906 .Function.getNextS: 907 ..cat:Graph 908 ..summary:Get method for the next source pointer. 909 ..remarks:EdgeStumps can be configured to have no source. Then there is no next source pointer. 910 ..signature:getNextS(es) 911 ..param.es:Pointer to the EdgeStump. 912 ...type:Class.EdgeStump 913 ..returns:Pointer to the next edge stump in source list. 914 ..see:Function.assignNextS 915 ..see:Function.nextS 916 ..include:seqan/graph_types.h 917 */ 918 919 template<typename TCargo, bool TId, typename TSpec> 920 inline EdgeStump<TCargo, true, true, TId, TSpec>* 921 getNextS(EdgeStump<TCargo, true, true, TId, TSpec> const* es) 922 { 923 SEQAN_CHECKPOINT 924 return es->data_nextS; 925 } 926 927 ////////////////////////////////////////////////////////////////////////////// 928 929 template<typename TCargo, bool TId, typename TSpec> 930 inline EdgeStump<TCargo, true, false, TId, TSpec>* 931 getNextS(EdgeStump<TCargo, true, false, TId, TSpec> const*) 932 { 933 SEQAN_CHECKPOINT 934 // No source pointer 935 return 0; 936 } 937 938 939 940 941 ////////////////////////////////////////////////////////////////////////////// 942 943 ////////////////////////////////////////////////////////////////////////////// 944 // INTERNAL FUNCTIONS 945 ////////////////////////////////////////////////////////////////////////////// 946 947 ////////////////////////////////////////////////////////////////////////////// 948 949 template<typename TCargo, bool TList, bool TSource, typename TSpec, typename TId2> 950 void 951 _assignId(EdgeStump<TCargo, TList, TSource, true, TSpec>* es, 952 TId2 const id) 953 { 954 SEQAN_CHECKPOINT 955 es->data_id = id; 956 } 957 958 ////////////////////////////////////////////////////////////////////////////// 959 960 template<typename TCargo, bool TList, bool TSource, typename TSpec, typename TId2> 961 void 962 _assignId(EdgeStump<TCargo, TList, TSource, false, TSpec>*, 963 TId2 const) 964 { 965 // No id -> does nothing 966 } 967 968 ////////////////////////////////////////////////////////////////////////////// 969 970 template<typename TCargo, bool TList, bool TSource, typename TId2> 971 void 972 _assignId(EdgeStump<TCargo, TList, TSource, false, TreeTag>*, 973 TId2 const) 974 { 975 // For a tree do nothing, child id = tree id 976 } 977 978 ////////////////////////////////////////////////////////////////////////////// 979 980 template<typename TCargo, bool TList, bool TSource, typename TSpec> 981 inline typename Id<EdgeStump<TCargo, TList, TSource, true, TSpec> const>::Type 982 _getId(EdgeStump<TCargo, TList, TSource, true, TSpec> const* es) 983 { 984 SEQAN_CHECKPOINT 985 return es->data_id; 986 } 987 988 ////////////////////////////////////////////////////////////////////////////// 989 990 template<typename TCargo, bool TList, bool TSource, typename TSpec> 991 inline typename Id<EdgeStump<TCargo, TList, TSource, true, TSpec> >::Type 992 _getId(EdgeStump<TCargo, TList, TSource, true, TSpec>* es) 993 { 994 SEQAN_CHECKPOINT 995 return es->data_id; 996 } 997 998 ////////////////////////////////////////////////////////////////////////////// 999 1000 template<typename TCargo, bool TList, bool TSource> 1001 inline typename Id<EdgeStump<TCargo, TList, TSource, false, TreeTag> const>::Type 1002 _getId(EdgeStump<TCargo, TList, TSource, false, TreeTag> const* es) 1003 { 1004 SEQAN_CHECKPOINT 1005 // Child id = edge id in a tree 1006 return es->data_target; 1007 } 1008 1009 ////////////////////////////////////////////////////////////////////////////// 1010 1011 template<typename TCargo, bool TList, bool TSource> 1012 inline typename Id<EdgeStump<TCargo, TList, TSource, false, TreeTag> >::Type 1013 _getId(EdgeStump<TCargo, TList, TSource, false, TreeTag>* es) 1014 { 1015 SEQAN_CHECKPOINT 1016 // Child id = edge id in a tree 1017 return es->data_target; 1018 } 1019 1020 ////////////////////////////////////////////////////////////////////////////// 1021 1022 template<typename TCargo, bool TList, bool TSource, typename TSpec> 1023 inline typename Id<EdgeStump<TCargo, TList, TSource, false, TSpec> >::Type 1024 _getId(EdgeStump<TCargo, TList, TSource, false, TSpec> const*) 1025 { 1026 SEQAN_CHECKPOINT 1027 // No real id 1028 return 0; 1029 } 1030 1031 ////////////////////////////////////////////////////////////////////////////// 1032 1033 template<typename TCargo, bool TList, bool TSource, typename TSpec> 1034 inline typename Id<EdgeStump<TCargo, TList, TSource, false, TSpec> >::Type 1035 _getId(EdgeStump<TCargo, TList, TSource, false, TSpec>*) 1036 { 1037 SEQAN_CHECKPOINT 1038 // No real id 1039 return 0; 1040 } 1041 1042 1043 1044 }// namespace SEQAN_NAMESPACE_MAIN 1045 1046 #endif //#ifndef SEQAN_HEADER_... 1047