From 406758342ee046707e5426f804c7b381a0728335 Mon Sep 17 00:00:00 2001 From: Georg Holzmann Date: Thu, 3 Nov 2005 20:40:40 +0000 Subject: additional methods: [getall(, [keys(, [values( svn path=/trunk/externals/grh/; revision=3832 --- PDContainer/CHANGELOG | 4 ++ PDContainer/help/help-h_deque.pd | 50 +++++++------ PDContainer/help/help-h_list.pd | 60 ++++++++-------- PDContainer/help/help-h_map.pd | 136 +++++++++++++++++++----------------- PDContainer/help/help-h_multimap.pd | 132 ++++++++++++++++++---------------- PDContainer/help/help-h_multiset.pd | 40 ++++++----- PDContainer/help/help-h_set.pd | 40 ++++++----- PDContainer/help/help-h_vector.pd | 50 +++++++------ PDContainer/include/ContainerBase.h | 6 ++ PDContainer/include/GlobalStuff.h | 54 +------------- PDContainer/src/h_deque.cpp | 26 +++++++ PDContainer/src/h_list.cpp | 26 +++++++ PDContainer/src/h_map.cpp | 52 ++++++++++++++ PDContainer/src/h_multimap.cpp | 52 ++++++++++++++ PDContainer/src/h_multiset.cpp | 26 +++++++ PDContainer/src/h_set.cpp | 26 +++++++ PDContainer/src/h_vector.cpp | 26 +++++++ 17 files changed, 517 insertions(+), 289 deletions(-) diff --git a/PDContainer/CHANGELOG b/PDContainer/CHANGELOG index 41212e5..babedd9 100755 --- a/PDContainer/CHANGELOG +++ b/PDContainer/CHANGELOG @@ -1,4 +1,8 @@ +new: + - [getall( message to dump out all data sequentially + - [keys( + [values( to dump out all keys, values of map, multimap + version 0.2 - possible to store pointers now as keys, values, ... (for pd graphical datastructures) - h_map: IMPORTANT: [add ( has changed !!! now it resets the value, diff --git a/PDContainer/help/help-h_deque.pd b/PDContainer/help/help-h_deque.pd index eda26ba..c28052e 100755 --- a/PDContainer/help/help-h_deque.pd +++ b/PDContainer/help/help-h_deque.pd @@ -159,23 +159,23 @@ is much more stable.; #X text 295 36 help file of; #X text 36 98 init arg: namespace; #X msg 480 293 print; -#X msg 480 337 clear; -#X msg 480 637 help; -#X obj 559 688 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#X msg 480 379 clear; +#X msg 480 664 help; +#X obj 559 715 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 480 234 getnamespace; -#X msg 480 375 clearall; -#X obj 480 736 print BBB; +#X msg 480 417 clearall; +#X obj 480 763 print BBB; #X obj 68 380 print AAA; #X text 591 259 <- change namespace; #X msg 480 258 namespace grix; #X text 527 294 <- print all the data of the; #X text 546 309 current namespace; -#X text 528 337 <- clear all the data of the; -#X text 549 352 current namespace; -#X text 548 377 <- clear all the data in all; -#X text 569 392 same containers (maybe; -#X text 571 407 you shouldn't use this); +#X text 528 379 <- clear all the data of the; +#X text 549 394 current namespace; +#X text 548 419 <- clear all the data in all; +#X text 569 434 same containers (maybe; +#X text 571 449 you shouldn't use this); #X text 580 236 <- get current namespace; #X text 512 193 general operations:; #X msg 294 341 list damm 4345 it; @@ -252,12 +252,12 @@ the element at the top of a stack is the one that was most recently added (push). Top outputs the elements from the top without removing it \, pop outputs and removes it.; #X restore 516 89 pd Container_Explanation; -#X msg 480 574 resize \$1; -#X msg 480 608 getsize; -#X floatatom 488 546 5 0 0 0 - - -; -#X floatatom 519 707 5 0 0 0 - - -; -#X text 545 607 <- get the size (at 2nd; -#X text 567 621 outlet); +#X msg 480 601 resize \$1; +#X msg 480 635 getsize; +#X floatatom 488 573 5 0 0 0 - - -; +#X floatatom 519 734 5 0 0 0 - - -; +#X text 545 634 <- get the size (at 2nd; +#X text 567 648 outlet); #X msg 68 290 get \$1; #X floatatom 74 269 5 0 0 0 - - -; #X floatatom 74 226 5 0 0 0 - - -; @@ -290,9 +290,9 @@ at the beginning _and_ the end.; #X obj 68 358 h_deque havi; #X obj 70 776 h_deque havi; #X obj 69 619 h_deque havi; -#X obj 480 664 h_deque havi; -#X text 560 708 <- size of deque; -#X text 556 575 <- resizes the deque; +#X obj 480 691 h_deque havi; +#X text 560 735 <- size of deque; +#X text 556 602 <- resizes the deque; #X text 187 702 Thats not very fast with a deque!; #X msg 69 489 pushfront \$1; #X floatatom 79 470 5 0 0 0 - - -; @@ -407,13 +407,16 @@ it at the back (so the size will increase); #X connect 10 0 0 0; #X connect 11 0 0 0; #X connect 12 0 0 0; -#X restore 480 456 pd read_save_possibilities; -#X text 520 480 different possiblities to read; -#X text 520 494 and write from and to files; -#X text 519 509 (XML and textfiles); +#X restore 480 491 pd read_save_possibilities; +#X text 520 515 different possiblities to read; +#X text 520 529 and write from and to files; +#X text 519 544 (XML and textfiles); #X text 216 844 htttp://grh.mur.at/software/pdcontainer.html; #X text 180 827 =%)!(%= PDContainer \, by Georg Holzmann \, 2005; +#X msg 480 334 getall; +#X text 535 335 <- dumps out all data sequentially; +#X text 556 349 at the first outlet; #X connect 8 0 68 0; #X connect 9 0 68 0; #X connect 10 0 68 0; @@ -454,3 +457,4 @@ it at the back (so the size will increase); #X connect 76 0 67 0; #X connect 77 0 67 0; #X connect 86 0 68 0; +#X connect 92 0 14 0; diff --git a/PDContainer/help/help-h_list.pd b/PDContainer/help/help-h_list.pd index 86bf16d..9e0f6ab 100755 --- a/PDContainer/help/help-h_list.pd +++ b/PDContainer/help/help-h_list.pd @@ -1,4 +1,4 @@ -#N canvas 535 40 834 864 10; +#N canvas 535 40 834 856 10; #X obj 36 29 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 38 31 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 @@ -6,33 +6,33 @@ #X text 298 41 help file of; #X text 39 103 init arg: namespace; #X msg 483 298 print; -#X msg 483 342 clear; -#X msg 483 653 help; -#X obj 604 712 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#X msg 483 372 clear; +#X msg 483 643 help; +#X obj 604 702 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 483 239 getnamespace; -#X msg 483 380 clearall; -#X obj 483 769 print BBB; +#X msg 483 410 clearall; +#X obj 483 759 print BBB; #X text 594 264 <- change namespace; #X msg 483 263 namespace grix; #X text 530 299 <- print all the data of the; #X text 549 314 current namespace; -#X text 531 342 <- clear all the data of the; -#X text 552 357 current namespace; -#X text 551 382 <- clear all the data in all; -#X text 572 397 same containers (maybe; -#X text 574 412 you shouldn't use this); +#X text 531 372 <- clear all the data of the; +#X text 552 387 current namespace; +#X text 551 412 <- clear all the data in all; +#X text 572 427 same containers (maybe; +#X text 574 442 you shouldn't use this); #X text 583 241 <- get current namespace; #X text 514 198 general operations:; -#X msg 483 561 getsize; -#X floatatom 523 749 5 0 0 0 - - -; -#X text 570 574 outlet); +#X msg 483 568 getsize; +#X floatatom 523 739 5 0 0 0 - - -; +#X text 570 581 outlet); #X text 290 58 ::: h_list :::; #X text 40 133 Fast insertion and removal anywhere \, all the other elements move up. But a list provides only sequential access (not via index !). A list is a doubly linked list.; -#X obj 483 691 h_list simonatbase; -#X text 604 730 <- size of the list; +#X obj 483 681 h_list simonatbase; +#X text 604 720 <- size of the list; #X obj 192 721 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 71 700 h_list simonatbase; @@ -176,14 +176,14 @@ removed is unchanged.; #X connect 8 0 3 0; #X restore 134 578 pd special_operations; #X text 217 720 <- bang if not found; -#X floatatom 563 730 5 0 0 0 - - -; -#X text 565 750 <- current iterator position; +#X floatatom 563 720 5 0 0 0 - - -; +#X text 565 740 <- current iterator position; #X floatatom 151 721 5 0 0 0 - - -; #X floatatom 111 721 5 0 0 0 - - -; -#X msg 483 604 getiter; -#X text 548 560 <- get the size (at 3nd; -#X text 574 620 (2nd outlet); -#X text 553 605 <- get current iterator pos; +#X msg 483 600 getiter; +#X text 548 567 <- get the size (at 3nd; +#X text 574 616 (2nd outlet); +#X text 553 601 <- get current iterator pos; #X obj 500 28 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 0; #X obj 502 30 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 @@ -495,13 +495,16 @@ it at the back (so the size will increase); #X connect 2 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; -#X restore 483 459 pd read_save_possibilities; -#X text 523 483 different possiblities to read; -#X text 523 497 and write from and to files; -#X text 522 512 (XML and textfiles); -#X text 234 821 htttp://grh.mur.at/software/pdcontainer.html; -#X text 194 805 =%)!(%= PDContainer \, by Georg Holzmann +#X restore 483 477 pd read_save_possibilities; +#X text 523 501 different possiblities to read; +#X text 523 515 and write from and to files; +#X text 522 530 (XML and textfiles); +#X text 229 822 htttp://grh.mur.at/software/pdcontainer.html; +#X text 189 806 =%)!(%= PDContainer \, by Georg Holzmann \, 2004; +#X msg 483 335 getall; +#X text 535 335 <- dumps out all data sequentially; +#X text 556 349 at the first outlet; #X connect 4 0 27 0; #X connect 5 0 27 0; #X connect 6 0 27 0; @@ -520,3 +523,4 @@ it at the back (so the size will increase); #X connect 31 0 30 0; #X connect 49 0 27 0; #X connect 58 0 27 0; +#X connect 64 0 27 0; diff --git a/PDContainer/help/help-h_map.pd b/PDContainer/help/help-h_map.pd index 1d4df0e..8789b08 100755 --- a/PDContainer/help/help-h_map.pd +++ b/PDContainer/help/help-h_map.pd @@ -1,6 +1,6 @@ -#N canvas 0 0 818 882 10; -#X msg 82 407 add ge; -#X obj 175 494 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#N canvas 551 0 818 885 10; +#X msg 82 392 add ge; +#X obj 175 479 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 33 24 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; @@ -9,69 +9,69 @@ #X text 295 36 help file of; #X text 292 53 ::: h_map :::; #X text 40 98 init arg: namespace; -#X msg 474 379 print; -#X msg 474 423 clear; -#X msg 474 643 help; -#X obj 567 704 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#X msg 474 364 print; +#X msg 474 478 clear; +#X msg 474 698 help; +#X obj 567 750 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X msg 474 320 getnamespace; -#X msg 474 461 clearall; -#X obj 474 681 h_map druschka; -#X obj 474 757 print BBB; -#X obj 82 495 print AAA; -#X text 585 345 <- change namespace; -#X msg 474 344 namespace grix; -#X text 521 380 <- print all the data of the; -#X text 540 395 current namespace; -#X text 522 423 <- clear all the data of the; -#X text 543 438 current namespace; -#X text 542 463 <- clear all the data in all; -#X text 563 478 same containers (maybe; -#X text 565 493 you shouldn't use this); -#X text 574 322 <- get current namespace; -#X text 473 268 general operations:; -#X msg 82 381 add bla bal tuff; -#X msg 82 431 add 4 f 3; -#X msg 82 356 add \$1; -#X floatatom 82 318 5 0 0 0 - - -; -#X symbolatom 129 320 10 0 0 0 - - -; -#X obj 82 472 h_map druschka; -#X msg 244 433 list damm 4345 it; -#X floatatom 244 339 5 0 0 0 - - -; -#X symbolatom 244 357 10 0 0 0 - - -; -#X msg 244 409 hacka 45; -#X msg 244 386 3 4 krschi; +#X msg 474 305 getnamespace; +#X msg 474 516 clearall; +#X obj 474 727 h_map druschka; +#X obj 474 803 print BBB; +#X obj 82 480 print AAA; +#X text 585 330 <- change namespace; +#X msg 474 329 namespace grix; +#X text 521 365 <- print all the data of the; +#X text 540 380 current namespace; +#X text 522 478 <- clear all the data of the; +#X text 543 493 current namespace; +#X text 542 518 <- clear all the data in all; +#X text 563 533 same containers (maybe; +#X text 565 548 you shouldn't use this); +#X text 574 307 <- get current namespace; +#X text 473 253 general operations:; +#X msg 82 366 add bla bal tuff; +#X msg 82 416 add 4 f 3; +#X msg 82 341 add \$1; +#X floatatom 82 303 5 0 0 0 - - -; +#X symbolatom 129 305 10 0 0 0 - - -; +#X obj 82 457 h_map druschka; +#X msg 244 418 list damm 4345 it; +#X floatatom 244 324 5 0 0 0 - - -; +#X symbolatom 244 342 10 0 0 0 - - -; +#X msg 244 394 hacka 45; +#X msg 244 371 3 4 krschi; #X text 37 130 Maps represent a mapping from one type (the key type) to another type (the value type). You can associate a value with a key \, or find the value associated with a key \, very efficiently. Map is a Sorted Associative Container and it is also a Unique Associative Container \, meaning that no two elements have the same key. (see Multimap for more elements with the same key); -#X text 110 293 key:; -#X text 254 308 value:; -#X text 127 269 add data to the map:; -#X obj 172 748 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#X text 110 278 key:; +#X text 254 293 value:; +#X text 127 254 add data to the map:; +#X obj 172 733 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; -#X obj 79 749 print AAA; -#X floatatom 79 572 5 0 0 0 - - -; -#X symbolatom 126 574 10 0 0 0 - - -; -#X obj 79 726 h_map druschka; -#X text 136 541 get \, remove data:; -#X msg 79 610 get \$1; -#X msg 79 635 get bla bal tuff; -#X msg 79 661 get ge; -#X msg 79 685 get 4 f 3; -#X floatatom 222 576 5 0 0 0 - - -; -#X symbolatom 269 578 10 0 0 0 - - -; -#X msg 222 614 remove \$1; -#X msg 222 639 remove bla bal tuff; -#X msg 222 665 remove ge; -#X msg 222 689 remove 4 f 3; -#X text 195 748 <- bang if the key isn't found; -#X msg 474 609 getsize; -#X text 539 608 <- get the size (at 2nd; -#X text 561 622 outlet); -#X obj 520 730 print size; +#X obj 79 734 print AAA; +#X floatatom 79 557 5 0 0 0 - - -; +#X symbolatom 126 559 10 0 0 0 - - -; +#X obj 79 711 h_map druschka; +#X text 136 526 get \, remove data:; +#X msg 79 595 get \$1; +#X msg 79 620 get bla bal tuff; +#X msg 79 646 get ge; +#X msg 79 670 get 4 f 3; +#X floatatom 222 561 5 0 0 0 - - -; +#X symbolatom 269 563 10 0 0 0 - - -; +#X msg 222 599 remove \$1; +#X msg 222 624 remove bla bal tuff; +#X msg 222 650 remove ge; +#X msg 222 674 remove 4 f 3; +#X text 195 733 <- bang if the key isn't found; +#X msg 474 664 getsize; +#X text 539 663 <- get the size (at 2nd; +#X text 561 677 outlet); +#X obj 520 776 print size; #X obj 504 26 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 0; #X obj 506 28 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 @@ -383,13 +383,19 @@ it at the back (so the size will increase); #X connect 2 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; -#X restore 474 522 pd read_save_possibilities; -#X text 512 543 different possiblities to read; -#X text 512 557 and write from and to files; -#X text 511 571 (XML and textfiles); -#X text 248 827 htttp://grh.mur.at/software/pdcontainer.html; -#X text 208 811 =%)!(%= PDContainer \, by Georg Holzmann +#X restore 474 577 pd read_save_possibilities; +#X text 512 598 different possiblities to read; +#X text 512 612 and write from and to files; +#X text 511 626 (XML and textfiles); +#X text 242 857 htttp://grh.mur.at/software/pdcontainer.html; +#X text 202 841 =%)!(%= PDContainer \, by Georg Holzmann \, 2004; +#X text 535 415 at the first outlet; +#X msg 474 401 keys; +#X text 514 401 <- dumps out all keys sequentially; +#X text 549 451 at the first outlet; +#X msg 474 437 values; +#X text 528 437 <- dumps out all values sequentially; #X connect 0 0 32 0; #X connect 7 0 13 0; #X connect 8 0 13 0; @@ -428,3 +434,5 @@ it at the back (so the size will increase); #X connect 57 0 46 0; #X connect 59 0 13 0; #X connect 68 0 13 0; +#X connect 75 0 13 0; +#X connect 78 0 13 0; diff --git a/PDContainer/help/help-h_multimap.pd b/PDContainer/help/help-h_multimap.pd index 4895db8..fecfff3 100755 --- a/PDContainer/help/help-h_multimap.pd +++ b/PDContainer/help/help-h_multimap.pd @@ -1,71 +1,71 @@ -#N canvas 556 0 813 872 10; -#X msg 82 407 add ge; +#N canvas 556 0 813 845 10; +#X msg 82 375 add ge; #X obj 33 24 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 35 26 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 295 36 help file of; #X text 40 98 init arg: namespace; -#X msg 479 373 print; -#X msg 479 417 clear; -#X msg 479 655 help; -#X msg 479 314 getnamespace; -#X msg 479 455 clearall; -#X obj 479 708 print BBB; -#X obj 82 495 print AAA; -#X text 590 339 <- change namespace; -#X msg 479 338 namespace grix; -#X text 526 374 <- print all the data of the; -#X text 545 389 current namespace; -#X text 527 417 <- clear all the data of the; -#X text 548 432 current namespace; -#X text 547 457 <- clear all the data in all; -#X text 568 472 same containers (maybe; -#X text 570 487 you shouldn't use this); -#X text 579 316 <- get current namespace; -#X text 478 262 general operations:; -#X msg 82 381 add bla bal tuff; -#X msg 82 431 add 4 f 3; -#X msg 82 356 add \$1; -#X floatatom 82 318 5 0 0 0 - - -; -#X symbolatom 129 320 10 0 0 0 - - -; -#X msg 232 429 list damm 4345 it; -#X floatatom 232 335 5 0 0 0 - - -; -#X symbolatom 232 353 10 0 0 0 - - -; -#X msg 232 405 hacka 45; -#X msg 232 382 3 4 krschi; -#X text 110 293 key:; -#X text 242 304 value:; -#X obj 79 749 print AAA; -#X floatatom 79 572 5 0 0 0 - - -; -#X symbolatom 126 574 10 0 0 0 - - -; -#X text 136 541 get \, remove data:; -#X msg 79 610 get \$1; -#X msg 79 635 get bla bal tuff; -#X msg 79 661 get ge; -#X msg 79 685 get 4 f 3; -#X floatatom 222 576 5 0 0 0 - - -; -#X symbolatom 269 578 10 0 0 0 - - -; -#X msg 222 614 remove \$1; -#X msg 222 639 remove bla bal tuff; -#X msg 222 665 remove ge; -#X msg 222 689 remove 4 f 3; +#X msg 479 341 print; +#X msg 479 455 clear; +#X msg 479 693 help; +#X msg 479 282 getnamespace; +#X msg 479 493 clearall; +#X obj 479 747 print BBB; +#X obj 82 463 print AAA; +#X text 590 307 <- change namespace; +#X msg 479 306 namespace grix; +#X text 526 342 <- print all the data of the; +#X text 545 357 current namespace; +#X text 527 455 <- clear all the data of the; +#X text 548 470 current namespace; +#X text 547 495 <- clear all the data in all; +#X text 568 510 same containers (maybe; +#X text 570 525 you shouldn't use this); +#X text 579 284 <- get current namespace; +#X text 478 230 general operations:; +#X msg 82 349 add bla bal tuff; +#X msg 82 399 add 4 f 3; +#X msg 82 324 add \$1; +#X floatatom 82 286 5 0 0 0 - - -; +#X symbolatom 129 288 10 0 0 0 - - -; +#X msg 232 397 list damm 4345 it; +#X floatatom 232 303 5 0 0 0 - - -; +#X symbolatom 232 321 10 0 0 0 - - -; +#X msg 232 373 hacka 45; +#X msg 232 350 3 4 krschi; +#X text 110 261 key:; +#X text 242 272 value:; +#X obj 79 717 print AAA; +#X floatatom 79 540 5 0 0 0 - - -; +#X symbolatom 126 542 10 0 0 0 - - -; +#X text 136 509 get \, remove data:; +#X msg 79 578 get \$1; +#X msg 79 603 get bla bal tuff; +#X msg 79 629 get ge; +#X msg 79 653 get 4 f 3; +#X floatatom 222 544 5 0 0 0 - - -; +#X symbolatom 269 546 10 0 0 0 - - -; +#X msg 222 582 remove \$1; +#X msg 222 607 remove bla bal tuff; +#X msg 222 633 remove ge; +#X msg 222 657 remove 4 f 3; #X text 40 131 Multimaps are just like maps except that a key can be associated with several values. Multimap is a Sorted Associative Container and also a Multiple Associative Container \, meaning that there is no limit on the number of elements with the same key. (see also Map) ; #X text 275 53 ::: h_multimap :::; -#X obj 82 472 h_multimap dampta; -#X obj 79 726 h_multimap dampta; -#X obj 479 686 h_multimap dampta; -#X floatatom 136 782 5 0 0 0 - - -; -#X text 111 263 add data to the multimap:; -#X text 180 783 <- nr of values at the specific key; -#X msg 479 600 getsize; -#X text 566 613 outlet); -#X text 544 599 <- get the size (at 3rd; -#X obj 593 709 print size; +#X obj 82 440 h_multimap dampta; +#X obj 79 694 h_multimap dampta; +#X obj 479 724 h_multimap dampta; +#X floatatom 136 750 5 0 0 0 - - -; +#X text 111 231 add data to the multimap:; +#X text 180 751 <- nr of values at the specific key; +#X msg 479 638 getsize; +#X text 566 651 outlet); +#X text 544 637 <- get the size (at 3rd; +#X obj 593 747 print size; #X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 0; #X obj 502 26 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 @@ -377,13 +377,19 @@ it at the back (so the size will increase); #X connect 2 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; -#X restore 479 515 pd read_save_possibilities; -#X text 517 536 different possiblities to read; -#X text 517 550 and write from and to files; -#X text 516 564 (XML and textfiles); -#X text 260 835 htttp://grh.mur.at/software/pdcontainer.html; -#X text 220 819 =%)!(%= PDContainer \, by Georg Holzmann +#X restore 479 553 pd read_save_possibilities; +#X text 517 574 different possiblities to read; +#X text 517 588 and write from and to files; +#X text 516 602 (XML and textfiles); +#X text 241 815 htttp://grh.mur.at/software/pdcontainer.html; +#X text 201 799 =%)!(%= PDContainer \, by Georg Holzmann \, 2004; +#X text 540 392 at the first outlet; +#X msg 479 378 keys; +#X text 519 378 <- dumps out all keys sequentially; +#X text 554 428 at the first outlet; +#X msg 479 414 values; +#X text 533 414 <- dumps out all values sequentially; #X connect 0 0 51 0; #X connect 5 0 53 0; #X connect 6 0 53 0; @@ -420,3 +426,5 @@ it at the back (so the size will increase); #X connect 53 2 60 0; #X connect 57 0 53 0; #X connect 66 0 53 0; +#X connect 73 0 53 0; +#X connect 76 0 53 0; diff --git a/PDContainer/help/help-h_multiset.pd b/PDContainer/help/help-h_multiset.pd index b97dd8a..7ad90a7 100755 --- a/PDContainer/help/help-h_multiset.pd +++ b/PDContainer/help/help-h_multiset.pd @@ -7,19 +7,19 @@ #X text 295 36 help file of; #X text 37 100 init arg: namespace; #X msg 470 377 print; -#X msg 470 421 clear; -#X msg 470 642 help; +#X msg 470 456 clear; +#X msg 470 677 help; #X msg 470 318 getnamespace; -#X msg 470 459 clearall; +#X msg 470 494 clearall; #X text 581 343 <- change namespace; #X msg 470 342 namespace grix; #X text 517 378 <- print all the data of the; #X text 536 393 current namespace; -#X text 518 421 <- clear all the data of the; -#X text 539 436 current namespace; -#X text 538 461 <- clear all the data in all; -#X text 559 476 same containers (maybe; -#X text 561 491 you shouldn't use this); +#X text 518 456 <- clear all the data of the; +#X text 539 471 current namespace; +#X text 538 496 <- clear all the data in all; +#X text 559 511 same containers (maybe; +#X text 561 526 you shouldn't use this); #X text 570 320 <- get current namespace; #X text 469 266 general operations:; #X msg 154 362 add bla bal tuff; @@ -41,22 +41,22 @@ #X msg 227 671 remove ge; #X msg 227 695 remove 4 f 3; #X floatatom 84 757 5 0 0 0 - - -; -#X floatatom 470 696 5 0 0 0 - - -; +#X floatatom 470 731 5 0 0 0 - - -; #X floatatom 154 477 5 0 0 0 - - -; #X text 275 52 ::: h_multiset :::; #X obj 154 453 h_multiset \$0-pscht; #X obj 84 731 h_multiset \$0-pscht; -#X obj 470 673 h_multiset \$0-pscht; +#X obj 470 708 h_multiset \$0-pscht; #X text 131 757 <- the number how often the data is set; #X text 37 137 Multisets are just like sets \, except that you can have several copies of the same element. Multiset is a Sorted Associative Container and a Multiple Associative Container \, meaning that two or more elements may be identical. (see also Set); #X text 140 268 add data to the multiset:; -#X msg 470 605 getsize; -#X text 535 604 <- get the size (at 2nd; -#X text 557 618 outlet); -#X obj 598 695 print size; +#X msg 470 640 getsize; +#X text 535 639 <- get the size (at 2nd; +#X text 557 653 outlet); +#X obj 598 730 print size; #X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 0; #X obj 502 26 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 @@ -368,13 +368,16 @@ it at the back (so the size will increase); #X connect 2 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; -#X restore 470 524 pd read_save_possibilities; -#X text 508 545 different possiblities to read; -#X text 508 559 and write from and to files; -#X text 507 573 (XML and textfiles); +#X restore 470 559 pd read_save_possibilities; +#X text 508 580 different possiblities to read; +#X text 508 594 and write from and to files; +#X text 507 608 (XML and textfiles); #X text 244 827 htttp://grh.mur.at/software/pdcontainer.html; #X text 204 811 =%)!(%= PDContainer \, by Georg Holzmann \, 2004; +#X msg 470 416 getall; +#X text 522 416 <- dumps out all data sequentially; +#X text 543 430 at the first outlet; #X connect 0 0 43 0; #X connect 5 0 45 0; #X connect 6 0 45 0; @@ -405,3 +408,4 @@ it at the back (so the size will increase); #X connect 45 1 52 0; #X connect 49 0 45 0; #X connect 58 0 45 0; +#X connect 64 0 45 0; diff --git a/PDContainer/help/help-h_set.pd b/PDContainer/help/help-h_set.pd index aadf628..26932e9 100755 --- a/PDContainer/help/help-h_set.pd +++ b/PDContainer/help/help-h_set.pd @@ -7,19 +7,19 @@ #X text 295 36 help file of; #X text 37 100 init arg: namespace; #X msg 477 380 print; -#X msg 477 424 clear; -#X msg 477 644 help; +#X msg 477 454 clear; +#X msg 477 674 help; #X msg 477 321 getnamespace; -#X msg 477 462 clearall; +#X msg 477 492 clearall; #X text 588 346 <- change namespace; #X msg 477 345 namespace grix; #X text 524 381 <- print all the data of the; #X text 543 396 current namespace; -#X text 525 424 <- clear all the data of the; -#X text 546 439 current namespace; -#X text 545 464 <- clear all the data in all; -#X text 566 479 same containers (maybe; -#X text 568 494 you shouldn't use this); +#X text 525 454 <- clear all the data of the; +#X text 546 469 current namespace; +#X text 545 494 <- clear all the data in all; +#X text 566 509 same containers (maybe; +#X text 568 524 you shouldn't use this); #X text 577 323 <- get current namespace; #X text 476 269 general operations:; #X msg 154 362 add bla bal tuff; @@ -41,7 +41,7 @@ #X msg 227 671 remove ge; #X msg 227 695 remove 4 f 3; #X floatatom 84 757 5 0 0 0 - - -; -#X floatatom 477 698 5 0 0 0 - - -; +#X floatatom 477 728 5 0 0 0 - - -; #X text 291 51 ::: h_set :::; #X text 37 129 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container @@ -53,11 +53,11 @@ are the same. (see Multiset to have several copies of the same element) #X floatatom 154 477 5 0 0 0 - - -; #X obj 84 732 h_set krx; #X text 131 757 <- 1 if the data is set (otherwise 0); -#X obj 477 675 h_set krx; -#X obj 535 698 print size; -#X msg 477 609 getsize; -#X text 542 608 <- get the size (at 2nd; -#X text 564 622 outlet); +#X obj 477 705 h_set krx; +#X obj 535 728 print size; +#X msg 477 639 getsize; +#X text 542 638 <- get the size (at 2nd; +#X text 564 652 outlet); #X obj 500 24 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 0; #X obj 502 26 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 @@ -369,13 +369,16 @@ it at the back (so the size will increase); #X connect 2 0 0 0; #X connect 7 0 0 0; #X connect 8 0 0 0; -#X restore 477 525 pd read_save_possibilities; -#X text 515 546 different possiblities to read; -#X text 515 560 and write from and to files; -#X text 514 574 (XML and textfiles); +#X restore 477 555 pd read_save_possibilities; +#X text 515 576 different possiblities to read; +#X text 515 590 and write from and to files; +#X text 514 604 (XML and textfiles); #X text 283 824 htttp://grh.mur.at/software/pdcontainer.html; #X text 243 808 =%)!(%= PDContainer \, by Georg Holzmann \, 2004; +#X msg 477 418 getall; +#X text 529 418 <- dumps out all data sequentially; +#X text 550 432 at the first outlet; #X connect 0 0 44 0; #X connect 5 0 48 0; #X connect 6 0 48 0; @@ -406,3 +409,4 @@ it at the back (so the size will increase); #X connect 48 1 49 0; #X connect 50 0 7 0; #X connect 58 0 48 0; +#X connect 64 0 48 0; diff --git a/PDContainer/help/help-h_vector.pd b/PDContainer/help/help-h_vector.pd index 618af69..802316c 100755 --- a/PDContainer/help/help-h_vector.pd +++ b/PDContainer/help/help-h_vector.pd @@ -8,23 +8,23 @@ #X text 295 36 help file of; #X text 40 98 init arg: namespace; #X msg 480 313 print; -#X msg 480 357 clear; -#X msg 480 671 help; -#X obj 566 721 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 +#X msg 480 395 clear; +#X msg 480 676 help; +#X obj 566 726 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 480 254 getnamespace; -#X msg 480 395 clearall; -#X obj 480 770 print BBB; +#X msg 480 433 clearall; +#X obj 480 775 print BBB; #X obj 71 443 print AAA; #X text 591 279 <- change namespace; #X msg 480 278 namespace grix; #X text 527 314 <- print all the data of the; #X text 546 329 current namespace; -#X text 528 357 <- clear all the data of the; -#X text 549 372 current namespace; -#X text 548 397 <- clear all the data in all; -#X text 569 412 same containers (maybe; -#X text 571 427 you shouldn't use this); +#X text 528 395 <- clear all the data of the; +#X text 549 410 current namespace; +#X text 548 435 <- clear all the data in all; +#X text 569 450 same containers (maybe; +#X text 571 465 you shouldn't use this); #X text 580 256 <- get current namespace; #X text 512 213 general operations:; #X msg 297 366 list damm 4345 it; @@ -38,15 +38,15 @@ via index (like an array) and fast insertion and removal of elements at the end. The number of elements in a vector may vary dynamically. ; -#X msg 480 608 resize \$1; -#X msg 480 642 getsize; -#X floatatom 488 580 5 0 0 0 - - -; -#X text 556 609 <- resizes the vector; -#X obj 480 698 h_vector klax; -#X floatatom 523 741 5 0 0 0 - - -; -#X text 545 641 <- get the size (at 2nd; -#X text 567 655 outlet); -#X text 567 740 <- size of vector; +#X msg 480 613 resize \$1; +#X msg 480 647 getsize; +#X floatatom 488 585 5 0 0 0 - - -; +#X text 556 614 <- resizes the vector; +#X obj 480 703 h_vector klax; +#X floatatom 523 746 5 0 0 0 - - -; +#X text 545 646 <- get the size (at 2nd; +#X text 567 660 outlet); +#X text 567 745 <- size of vector; #X obj 71 383 h_vector klax; #X floatatom 114 422 5 0 0 0 - - -; #X msg 71 290 get \$1; @@ -403,10 +403,13 @@ it at the back (so the size will increase); #X connect 10 0 0 0; #X connect 11 0 0 0; #X connect 12 0 0 0; -#X restore 480 476 pd read_save_possibilities; -#X text 520 500 different possiblities to read; -#X text 520 514 and write from and to files; -#X text 519 529 (XML and textfiles); +#X restore 480 501 pd read_save_possibilities; +#X text 520 525 different possiblities to read; +#X text 520 539 and write from and to files; +#X text 519 554 (XML and textfiles); +#X msg 480 352 getall; +#X text 532 352 <- dumps out all data sequentially; +#X text 553 366 at the first outlet; #X connect 5 0 36 0; #X connect 6 0 36 0; #X connect 7 0 36 0; @@ -442,3 +445,4 @@ it at the back (so the size will increase); #X connect 67 0 73 1; #X connect 74 0 60 0; #X connect 82 0 36 0; +#X connect 86 0 36 0; diff --git a/PDContainer/include/ContainerBase.h b/PDContainer/include/ContainerBase.h index c32a22a..7cc54b9 100755 --- a/PDContainer/include/ContainerBase.h +++ b/PDContainer/include/ContainerBase.h @@ -94,6 +94,12 @@ class ContainerBase virtual void clearNamespace() { data_.erase(h_namespace_); } + /* returns a reference to the whole Container + * of the current namespace + */ + virtual ContainerType &getAll() + { return data_[h_namespace_]; } + /* clears all the data of the current container * ( in all namespaces !!!!! ) * so be carefull !!! diff --git a/PDContainer/include/GlobalStuff.h b/PDContainer/include/GlobalStuff.h index 6cb96cc..6424a99 100755 --- a/PDContainer/include/GlobalStuff.h +++ b/PDContainer/include/GlobalStuff.h @@ -32,7 +32,7 @@ using std::endl; // current version -#define PDC_VERSION "0.2" +#define PDC_VERSION "0.2.1" // TinyXML @@ -78,19 +78,6 @@ class Element if(atom_ && size_) { length = size_; - - // !!!! FIXME !!!! - // hack to avoid lockating too much memory - // (somewhere I read an uninitialized value ... - // ... but where !?) - if(length>999) - { - post("Element, constr1: invalid construction !!! should be fixed !!!"); - length=0; - atom=NULL; - return; - } - atom = (t_atom*)copybytes(atom_, length*sizeof(t_atom)); } } @@ -101,19 +88,6 @@ class Element if(src.atom) { length = src.length; - - // !!!! FIXME !!!! - // hack to avoid lockating too much memory - // (somewhere I read an uninitialized value ... - // ... but where !?) - if(length>999) - { - post("Element, constr2: invalid construction !!! should be fixed !!!"); - length=0; - atom=NULL; - return; - } - atom = (t_atom*)copybytes(src.atom, length*sizeof(t_atom)); } } @@ -138,19 +112,6 @@ class Element if(atom_) { length = size_; - - // !!!! FIXME !!!! - // hack to avoid lockating too much memory - // (somewhere I read an uninitialized value ... - // ... but where !?) - if(length>999) - { - post("Element, setAtoms: invalid construction !!! should be fixed !!!"); - length=0; - atom=NULL; - return; - } - atom = (t_atom*)copybytes(atom_, length*sizeof(t_atom)); } } @@ -175,19 +136,6 @@ class Element if(src.atom) { length = src.length; - - // !!!! FIXME !!!! - // hack to avoid lockating too much memory - // (somewhere I read an uninitialized value ... - // ... but where !?) - if(length>999) - { - post("Element, assignment: invalid construction !!! should be fixed !!!"); - length=0; - atom=NULL; - return (*this); - } - atom = (t_atom*)copybytes(src.atom, length*sizeof(t_atom)); } diff --git a/PDContainer/src/h_deque.cpp b/PDContainer/src/h_deque.cpp index 6246a51..989ca51 100755 --- a/PDContainer/src/h_deque.cpp +++ b/PDContainer/src/h_deque.cpp @@ -343,6 +343,30 @@ static void h_deque_get_namespace(t_h_deque *x) post("h_deque current namespace: %s",x->hdeque->getNamespace().c_str()); } +static void h_deque_getall(t_h_deque *x) +{ + deque::iterator iter = x->hdeque->getAll().begin(); + + while(iter != x->hdeque->getAll().end()) + { + Element output = *iter; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_deque_print(t_h_deque *x) { x->hdeque->printAllIndex(); @@ -554,6 +578,8 @@ void h_deque_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_deque_class, (t_method)h_deque_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_deque_class, (t_method)h_deque_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_deque_class, (t_method)h_deque_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_deque_class, (t_method)h_deque_clear, diff --git a/PDContainer/src/h_list.cpp b/PDContainer/src/h_list.cpp index bbe9b68..e44e2a5 100755 --- a/PDContainer/src/h_list.cpp +++ b/PDContainer/src/h_list.cpp @@ -279,6 +279,30 @@ static void h_list_clear_all(t_h_list *x) x->hlist->clearAll(); } +static void h_list_getall(t_h_list *x) +{ + list::iterator iter = x->hlist->getAll().begin(); + + while(iter != x->hlist->getAll().end()) + { + Element output = *iter; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_list_print(t_h_list *x) { x->hlist->printAllIndex(); @@ -426,6 +450,8 @@ void h_list_setup(void) gensym("clear"), A_DEFFLOAT, 0); class_addmethod(h_list_class, (t_method)h_list_clear_all, gensym("clearall"), A_DEFFLOAT, 0); + class_addmethod(h_list_class, (t_method)h_list_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_list_class, (t_method)h_list_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_list_class, (t_method)h_list_save, diff --git a/PDContainer/src/h_map.cpp b/PDContainer/src/h_map.cpp index 11ce59e..4e5beeb 100755 --- a/PDContainer/src/h_map.cpp +++ b/PDContainer/src/h_map.cpp @@ -182,6 +182,54 @@ static void h_map_get_namespace(t_h_map *x) post("h_map current namespace: %s",x->hmap->getNamespace().c_str()); } +static void h_map_keys(t_h_map *x) +{ + map::iterator iter = x->hmap->getAll().begin(); + + while(iter != x->hmap->getAll().end()) + { + Element output = (*iter).first; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + +static void h_map_values(t_h_map *x) +{ + map::iterator iter = x->hmap->getAll().begin(); + + while(iter != x->hmap->getAll().end()) + { + Element output = (*iter).second; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_map_print(t_h_map *x) { x->hmap->printAll(); @@ -314,6 +362,10 @@ void h_map_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_map_class, (t_method)h_map_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_map_class, (t_method)h_map_keys, + gensym("keys"), A_DEFFLOAT, 0); + class_addmethod(h_map_class, (t_method)h_map_values, + gensym("values"), A_DEFFLOAT, 0); class_addmethod(h_map_class, (t_method)h_map_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_map_class, (t_method)h_map_clear, diff --git a/PDContainer/src/h_multimap.cpp b/PDContainer/src/h_multimap.cpp index 8449fd9..9f5de2e 100755 --- a/PDContainer/src/h_multimap.cpp +++ b/PDContainer/src/h_multimap.cpp @@ -179,6 +179,54 @@ static void h_multimap_get_namespace(t_h_multimap *x) post("h_multimap current namespace: %s",x->hmultimap->getNamespace().c_str()); } +static void h_multimap_keys(t_h_multimap *x) +{ + multimap::iterator iter = x->hmultimap->getAll().begin(); + + while(iter != x->hmultimap->getAll().end()) + { + Element output = (*iter).first; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + +static void h_multimap_values(t_h_multimap *x) +{ + multimap::iterator iter = x->hmultimap->getAll().begin(); + + while(iter != x->hmultimap->getAll().end()) + { + Element output = (*iter).second; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_multimap_print(t_h_multimap *x) { x->hmultimap->printAll(); @@ -310,6 +358,10 @@ void h_multimap_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_multimap_class, (t_method)h_multimap_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_multimap_class, (t_method)h_multimap_keys, + gensym("keys"), A_DEFFLOAT, 0); + class_addmethod(h_multimap_class, (t_method)h_multimap_values, + gensym("values"), A_DEFFLOAT, 0); class_addmethod(h_multimap_class, (t_method)h_multimap_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_multimap_class, (t_method)h_multimap_clear, diff --git a/PDContainer/src/h_multiset.cpp b/PDContainer/src/h_multiset.cpp index 0886a8b..f6c1ea3 100755 --- a/PDContainer/src/h_multiset.cpp +++ b/PDContainer/src/h_multiset.cpp @@ -82,6 +82,30 @@ static void h_multiset_get_namespace(t_h_multiset *x) post("h_multiset current namespace: %s",x->hmultiset->getNamespace().c_str()); } +static void h_multiset_getall(t_h_multiset *x) +{ + multiset::iterator iter = x->hmultiset->getAll().begin(); + + while(iter != x->hmultiset->getAll().end()) + { + Element output = *iter; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_multiset_print(t_h_multiset *x) { x->hmultiset->printAll(); @@ -200,6 +224,8 @@ void h_multiset_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_multiset_class, (t_method)h_multiset_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_multiset_class, (t_method)h_multiset_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_multiset_class, (t_method)h_multiset_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_multiset_class, (t_method)h_multiset_clear, diff --git a/PDContainer/src/h_set.cpp b/PDContainer/src/h_set.cpp index 2e97cef..712817b 100755 --- a/PDContainer/src/h_set.cpp +++ b/PDContainer/src/h_set.cpp @@ -82,6 +82,30 @@ static void h_set_get_namespace(t_h_set *x) post("h_set current namespace: %s",x->hset->getNamespace().c_str()); } +static void h_set_getall(t_h_set *x) +{ + set::iterator iter = x->hset->getAll().begin(); + + while(iter != x->hset->getAll().end()) + { + Element output = *iter; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_set_print(t_h_set *x) { x->hset->printAll(); @@ -200,6 +224,8 @@ void h_set_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_set_class, (t_method)h_set_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_set_class, (t_method)h_set_getall, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_set_class, (t_method)h_set_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_set_class, (t_method)h_set_clear, diff --git a/PDContainer/src/h_vector.cpp b/PDContainer/src/h_vector.cpp index d3f76a3..df29ccf 100755 --- a/PDContainer/src/h_vector.cpp +++ b/PDContainer/src/h_vector.cpp @@ -261,6 +261,30 @@ static void h_vector_get_namespace(t_h_vector *x) post("h_vector current namespace: %s",x->hvector->getNamespace().c_str()); } +static void h_vector_getall(t_h_vector *x) +{ + vector::iterator iter = x->hvector->getAll().begin(); + + while(iter != x->hvector->getAll().end()) + { + Element output = *iter; + + if(output.getLength() == 1) // symbol or float + { + if (output.getAtom()[0].a_type == A_FLOAT) + outlet_float(x->out0, output.getAtom()[0].a_w.w_float); + if (output.getAtom()[0].a_type == A_SYMBOL) + outlet_symbol(x->out0, output.getAtom()[0].a_w.w_symbol); + if (output.getAtom()[0].a_type == A_POINTER) + outlet_pointer(x->out0, output.getAtom()[0].a_w.w_gpointer); + } + if(output.getLength() > 1) // list + outlet_list(x->out0,&s_list,output.getLength(),output.getAtom()); + + iter++; + } +} + static void h_vector_print(t_h_vector *x) { x->hvector->printAllIndex(); @@ -464,6 +488,8 @@ void h_vector_setup(void) gensym("namespace"), A_DEFSYMBOL , 0); class_addmethod(h_vector_class, (t_method)h_vector_get_namespace, gensym("getnamespace"), A_DEFFLOAT, 0); + class_addmethod(h_vector_class, (t_method)h_vector_print, + gensym("getall"), A_DEFFLOAT, 0); class_addmethod(h_vector_class, (t_method)h_vector_print, gensym("print"), A_DEFFLOAT, 0); class_addmethod(h_vector_class, (t_method)h_vector_clear, -- cgit v1.2.1