Update of /cvsroot/pure-data/externals/grh/PDContainer/help In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15862/help
Added Files: help-h_deque.pd help-h_list.pd help-h_map.pd help-h_multimap.pd help-h_multiset.pd help-h_priority_queue.pd help-h_queue.pd help-h_set.pd help-h_stack.pd help-h_vector.pd Log Message: only moving to a new directory
--- NEW FILE: help-h_deque.pd --- #N canvas 344 22 799 883 10; #X obj 147 379 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 498 23 cnv 15 204 120 empty empty empty 20 12 0 14 -66577 -66577 0; #X obj 500 25 cnv 15 200 116 empty empty ReadMe: 65 15 0 14 -262131 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 534 61 pd General_Concept; #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 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 -1; #X msg 480 234 getnamespace; #X msg 480 375 clearall; #X obj 480 736 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 580 236 <- get current namespace; #X text 512 193 general operations:; #X msg 294 341 list damm 4345 it; #X floatatom 294 247 5 0 0 0 - - -; #X symbolatom 294 265 10 0 0 0 - - -; #X msg 294 317 hacka 45; #X msg 294 294 3 4 krschi; #X text 304 216 value:; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 68 290 get $1; #X floatatom 74 269 5 0 0 0 - - -; #X floatatom 74 226 5 0 0 0 - - -; #X msg 68 247 set $1; #X msg 71 706 insert $1; #X floatatom 80 687 5 0 0 0 - - -; #X floatatom 79 731 5 0 0 0 - - -; #X msg 70 752 remove $1; #X text 124 246 <- changes the value; #X text 145 260 at that index; #X text 142 304 at that index; #X text 121 290 <- get the value; #X text 167 379 <- bang if not found; #X msg 69 519 popback; #X floatatom 79 429 5 0 0 0 - - -; #X msg 69 449 pushback $1; #X text 209 456 <- inserts the data at the; #X msg 178 776 some data; #X text 152 679 remove and insert at index:; #X text 188 716 If you need this very often you; #X text 188 730 should better use a list or a map; #X text 188 743 (or something else) !; #X symbolatom 124 429 10 0 0 0 - - -; #X text 283 54 ::: h_deque :::; #X text 37 126 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible 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 text 187 702 Thats not very fast with a deque!; #X msg 69 489 pushfront $1; #X floatatom 79 470 5 0 0 0 - - -; #X symbolatom 122 470 10 0 0 0 - - -; #X msg 69 542 popfront; #X msg 69 572 back; #X msg 69 594 front; #X text 229 471 front/back of the deque; #X text 208 485 (so the size will increase); #X text 143 521 <- removes the element from the; #X text 143 539 back/front (so the size will decrease); #X text 124 571 <- gives out the element from the; #X text 146 586 back/front; #X obj 69 641 print CCC; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 548 115 pd Fileformats; #N canvas 174 18 646 402 read_save_possibilities 0; #X obj 44 336 outlet; #X msg 44 208 save data.dat; #X msg 44 244 read data.dat; #X msg 44 288 readat data.dat 0; #X text 149 208 <- save all the data of the current namespace as textfile ; #X text 143 244 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 177 287 <- read the textfile and insert it at the given index (so the size won't increase !); #X text 166 94 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 169 61 <- save all the data of the current namespace as XML-file ; #X text 196 139 <- read the XML-file and insert it at the given index (so the size won't increase !); #X msg 44 61 saveXML data.xml; #X msg 44 93 readXML data.xml; #X msg 44 139 readatXML data.xml 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #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 text 216 844 htttp://grh.mur.at/software/pdcontainer.html; #X text 180 827 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2005; #X connect 8 0 68 0; #X connect 9 0 68 0; #X connect 10 0 68 0; #X connect 12 0 68 0; #X connect 13 0 68 0; #X connect 17 0 68 0; #X connect 27 0 65 1; #X connect 28 0 65 1; #X connect 29 0 65 1; #X connect 30 0 65 1; #X connect 31 0 65 1; #X connect 34 0 68 0; #X connect 35 0 68 0; #X connect 36 0 34 0; #X connect 40 0 65 0; #X connect 41 0 40 0; #X connect 42 0 43 0; #X connect 43 0 65 0; #X connect 44 0 66 0; #X connect 45 0 44 0; #X connect 46 0 47 0; #X connect 47 0 66 0; #X connect 53 0 67 0; #X connect 54 0 55 0; #X connect 55 0 67 0; #X connect 57 0 66 1; #X connect 62 0 55 0; #X connect 65 0 15 0; #X connect 65 2 0 0; #X connect 67 0 84 0; #X connect 68 0 14 0; #X connect 68 1 37 0; #X connect 68 2 11 0; #X connect 72 0 67 0; #X connect 73 0 72 0; #X connect 74 0 72 0; #X connect 75 0 67 0; #X connect 76 0 67 0; #X connect 77 0 67 0; #X connect 86 0 68 0;
--- NEW FILE: help-h_priority_queue.pd --- #N canvas 354 37 801 853 10; #X obj 261 702 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 ; #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 430 438 clear; #X msg 430 532 help; #X obj 607 586 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 430 335 getnamespace; #X msg 430 476 clearall; #X obj 430 630 print BBB; #X text 541 360 <- change namespace; #X msg 430 359 namespace grix; #X text 478 438 <- clear all the data of the; #X text 499 453 current namespace; #X text 498 478 <- clear all the data in all; #X text 519 493 same containers (maybe; #X text 521 508 you shouldn't use this); #X text 530 337 <- get current namespace; #X text 429 283 general operations:; #X floatatom 518 606 5 0 0 0 - - -; #X floatatom 172 717 5 0 0 0 - - -; #X msg 430 391 getsize; #X text 493 391 <- puts out the size of the; #X text 514 407 stack at the 2nd outlet; #X text 153 600 removing it; #X msg 84 626 pop; #X text 285 53 ::: h_queue :::; #X text 562 606 <- nr of elements; #X text 119 627 <- removes the data fom the front; #X text 40 128 A priority queue is also a "first in first out" (FIFO) data structure like a queue , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X msg 84 571 top; #X text 132 572 <- get the data from the top; #X text 153 587 of the container without; #X text 140 642 of the container; #X text 287 702 <- bang if container is empty; #X obj 79 486 print AAA; #X msg 256 431 list damm 4345 it; #X floatatom 256 337 5 0 0 0 - - -; #X symbolatom 256 355 10 0 0 0 - - -; #X msg 256 407 hacka 45; #X msg 256 384 3 4 krschi; #X text 253 309 value:; #X msg 79 358 push $1; #X floatatom 79 336 5 0 0 0 - - -; #X text 77 308 priority:; #X text 81 263 add data to the priority_queue:; #X obj 79 463 h_priority_queue $0-aetsch; #X obj 84 743 print CCC; #X obj 84 678 h_priority_queue $0-aetsch; #X obj 430 563 h_priority_queue $0-aetsch; #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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #X text 224 810 htttp://grh.mur.at/software/pdcontainer.html; #X text 184 794 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2004; #X connect 5 0 50 0; #X connect 6 0 50 0; #X connect 8 0 50 0; #X connect 9 0 50 0; #X connect 12 0 50 0; #X connect 22 0 50 0; #X connect 26 0 49 0; #X connect 31 0 49 0; #X connect 37 0 47 1; #X connect 38 0 47 1; #X connect 39 0 47 1; #X connect 40 0 47 1; #X connect 41 0 47 1; #X connect 43 0 47 0; #X connect 44 0 43 0; #X connect 47 0 36 0; #X connect 49 0 48 0; #X connect 49 1 21 0; #X connect 49 2 0 0; #X connect 50 0 10 0; #X connect 50 1 20 0; #X connect 50 2 7 0;
--- NEW FILE: help-h_map.pd --- #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 -1; #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 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 -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 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 -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 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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 540 64 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 522 92 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 554 118 pd Fileformats; #N canvas 174 18 646 317 read_save_possibilities 0; #X obj 50 258 outlet; #X msg 50 158 save data.dat; #X msg 50 194 read data.dat; #X text 155 158 <- save all the data of the current namespace as textfile ; #X text 149 194 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 173 83 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 176 50 <- save all the data of the current namespace as XML-file ; #X msg 51 50 saveXML data.xml; #X msg 51 82 readXML data.xml; #X connect 1 0 0 0; #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 grh@mur.at , 2004; #X connect 0 0 32 0; #X connect 7 0 13 0; #X connect 8 0 13 0; #X connect 9 0 13 0; #X connect 11 0 13 0; #X connect 12 0 13 0; #X connect 13 0 14 0; #X connect 13 1 62 0; #X connect 13 2 10 0; #X connect 17 0 13 0; #X connect 27 0 32 0; #X connect 28 0 32 0; #X connect 29 0 32 0; #X connect 30 0 29 0; #X connect 31 0 29 0; #X connect 32 0 15 0; #X connect 32 2 1 0; #X connect 33 0 32 1; #X connect 34 0 32 1; #X connect 35 0 32 1; #X connect 36 0 32 1; #X connect 37 0 32 1; #X connect 44 0 48 0; #X connect 45 0 48 0; #X connect 46 0 43 0; #X connect 46 2 42 0; #X connect 48 0 46 0; #X connect 49 0 46 0; #X connect 50 0 46 0; #X connect 51 0 46 0; #X connect 52 0 54 0; #X connect 53 0 54 0; #X connect 54 0 46 0; #X connect 55 0 46 0; #X connect 56 0 46 0; #X connect 57 0 46 0; #X connect 59 0 13 0; #X connect 68 0 13 0;
--- NEW FILE: help-h_queue.pd --- #N canvas 529 37 794 742 10; #X obj 154 536 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 ; #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 430 438 clear; #X msg 430 532 help; #X obj 502 587 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 430 335 getnamespace; #X msg 430 476 clearall; #X obj 430 630 print BBB; #X obj 82 579 print AAA; #X text 541 360 <- change namespace; #X msg 430 359 namespace grix; #X text 478 438 <- clear all the data of the; #X text 499 453 current namespace; #X text 498 478 <- clear all the data in all; #X text 519 493 same containers (maybe; #X text 521 508 you shouldn't use this); #X text 530 337 <- get current namespace; #X text 429 283 general operations:; #X floatatom 466 606 5 0 0 0 - - -; #X floatatom 118 556 5 0 0 0 - - -; #X msg 430 391 getsize; #X text 493 391 <- puts out the size of the; #X text 514 407 stack at the 2nd outlet; #X msg 82 358 push $1; #X floatatom 82 332 5 0 0 0 - - -; #X symbolatom 130 332 10 0 0 0 - - -; #X text 151 436 removing it; #X msg 82 462 pop; #X text 285 53 ::: h_queue :::; #X obj 82 514 h_queue xlt; #X obj 430 563 h_queue xlt; #X text 39 136 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X text 510 606 <- nr of elements; #X text 180 536 <- bang if queue is empty; #X text 148 359 <- push some data in the queue; #X msg 82 407 front; #X text 130 408 <- get the data from the front; #X text 151 423 of the queue without; #X text 138 478 of the queue; #X text 117 463 <- removes the data fom the front; #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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #X text 211 703 htttp://grh.mur.at/software/pdcontainer.html; #X text 171 687 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2004; #X connect 5 0 33 0; #X connect 6 0 33 0; #X connect 8 0 33 0; #X connect 9 0 33 0; #X connect 13 0 33 0; #X connect 23 0 33 0; #X connect 26 0 32 0; #X connect 27 0 26 0; #X connect 28 0 26 0; #X connect 30 0 32 0; #X connect 32 0 11 0; #X connect 32 1 22 0; #X connect 32 2 0 0; #X connect 33 0 10 0; #X connect 33 1 21 0; #X connect 33 2 7 0; #X connect 38 0 32 0;
--- NEW FILE: help-h_stack.pd --- #N canvas 0 0 796 754 10; #X obj 161 579 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 ; #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 430 438 clear; #X msg 430 532 help; #X obj 509 588 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 430 335 getnamespace; #X msg 430 476 clearall; #X obj 430 630 print BBB; #X obj 82 622 print AAA; #X text 541 360 <- change namespace; #X msg 430 359 namespace grix; #X text 478 438 <- clear all the data of the; #X text 499 453 current namespace; #X text 498 478 <- clear all the data in all; #X text 519 493 same containers (maybe; #X text 521 508 you shouldn't use this); #X text 530 337 <- get current namespace; #X text 429 283 general operations:; #X text 287 53 ::: h_stack :::; #X obj 430 563 h_stack data; #X floatatom 469 606 5 0 0 0 - - -; #X obj 82 557 h_stack data; #X floatatom 121 599 5 0 0 0 - - -; #X msg 430 391 getsize; #X text 493 391 <- puts out the size of the; #X text 514 407 stack at the 2nd outlet; #X msg 82 358 push $1; #X floatatom 82 332 5 0 0 0 - - -; #X symbolatom 130 332 10 0 0 0 - - -; #X text 148 359 <- push some data to the; #X text 169 374 top of the stack; #X msg 82 407 top; #X text 117 408 <- get the data from the top; #X text 138 423 of the stack without; #X text 138 436 removing it; #X msg 82 462 pop; #X text 513 606 <- nr of elements; #X text 187 579 <- bang if stack is empty; #X text 117 463 <- removes the data from the; #X text 138 478 top of the stack; #X text 137 494 (but without putting it; #X text 146 508 out !!!); #X text 38 133 Stack is a "last in first out" (LIFO) data structure: 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 removes it without putting it out.; #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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #X text 218 709 htttp://grh.mur.at/software/pdcontainer.html; #X text 178 693 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2004; #X connect 5 0 22 0; #X connect 6 0 22 0; #X connect 8 0 22 0; #X connect 9 0 22 0; #X connect 13 0 22 0; #X connect 22 0 10 0; #X connect 22 1 23 0; #X connect 22 2 7 0; #X connect 24 0 11 0; #X connect 24 1 25 0; #X connect 24 2 0 0; #X connect 26 0 22 0; #X connect 29 0 24 0; #X connect 30 0 29 0; #X connect 31 0 29 0; #X connect 34 0 24 0; #X connect 38 0 24 0;
--- NEW FILE: help-h_vector.pd --- #N canvas 0 54 830 880 10; #X obj 157 404 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 ; #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 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 -1; #X msg 480 254 getnamespace; #X msg 480 395 clearall; #X obj 480 770 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 580 256 <- get current namespace; #X text 512 213 general operations:; #X msg 297 366 list damm 4345 it; #X floatatom 297 272 5 0 0 0 - - -; #X symbolatom 297 290 10 0 0 0 - - -; #X msg 297 342 hacka 45; #X msg 297 319 3 4 krschi; #X text 307 241 value:; #X text 279 54 ::: h_vector :::; #X text 31 143 A vector is a sequence that supports access to all elements 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 obj 71 383 h_vector klax; #X floatatom 114 422 5 0 0 0 - - -; #X msg 71 290 get $1; #X floatatom 77 269 5 0 0 0 - - -; #X floatatom 77 226 5 0 0 0 - - -; #X msg 71 247 set $1; #X msg 71 698 insert $1; #X floatatom 78 671 5 0 0 0 - - -; #X floatatom 79 721 5 0 0 0 - - -; #X msg 70 744 remove $1; #X text 127 246 <- changes the value; #X text 148 260 at that index; #X text 145 304 at that index; #X text 124 290 <- get the value; #X text 177 404 <- bang if not found; #X msg 70 526 pushback gsdfg 34; #X msg 70 572 popback; #X obj 70 622 h_vector klax; #X floatatom 70 481 5 0 0 0 - - -; #X msg 70 503 pushback $1; #X text 166 503 <- inserts the data at the; #X text 223 518 back of the vector; #X text 230 532 (so the size will; #X text 230 545 increase); #X text 131 571 <- removes the element from the; #X text 154 586 back (so the size will decrease); #X msg 178 768 some data; #X text 152 671 remove and insert at index:; #X text 188 708 If you need this very often you; #X text 188 722 should better use a list or a map; #X text 187 694 Thats not very fast with a vector!; #X text 188 735 (or something else) !; #X obj 70 768 h_vector klax; #X symbolatom 115 481 10 0 0 0 - - -; #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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #X text 238 841 htttp://grh.mur.at/software/pdcontainer.html; #X text 198 825 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2004; #N canvas 174 18 646 402 read_save_possibilities 0; #X obj 44 336 outlet; #X msg 44 208 save data.dat; #X msg 44 244 read data.dat; #X msg 44 288 readat data.dat 0; #X text 149 208 <- save all the data of the current namespace as textfile ; #X text 143 244 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 177 287 <- read the textfile and insert it at the given index (so the size won't increase !); #X text 166 94 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 169 61 <- save all the data of the current namespace as XML-file ; #X text 196 139 <- read the XML-file and insert it at the given index (so the size won't increase !); #X msg 44 61 saveXML data.xml; #X msg 44 93 readXML data.xml; #X msg 44 139 readatXML data.xml 0; #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 0 0; #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 connect 5 0 36 0; #X connect 6 0 36 0; #X connect 7 0 36 0; #X connect 9 0 36 0; #X connect 10 0 36 0; #X connect 14 0 36 0; #X connect 24 0 41 1; #X connect 25 0 41 1; #X connect 26 0 41 1; #X connect 27 0 41 1; #X connect 28 0 41 1; #X connect 32 0 36 0; #X connect 33 0 36 0; #X connect 34 0 32 0; #X connect 36 0 11 0; #X connect 36 1 37 0; #X connect 36 2 8 0; #X connect 41 0 12 0; #X connect 41 1 42 0; #X connect 41 2 0 0; #X connect 43 0 41 0; #X connect 44 0 43 0; #X connect 45 0 46 0; #X connect 46 0 41 0; #X connect 47 0 73 0; #X connect 48 0 47 0; #X connect 49 0 50 0; #X connect 50 0 73 0; #X connect 56 0 58 0; #X connect 57 0 58 0; #X connect 59 0 60 0; #X connect 60 0 58 0; #X connect 67 0 73 1; #X connect 74 0 60 0; #X connect 82 0 36 0;
--- NEW FILE: help-h_set.pd --- #N canvas 0 0 800 865 10; #X msg 154 388 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 37 100 init arg: namespace; #X msg 477 380 print; #X msg 477 424 clear; #X msg 477 644 help; #X msg 477 321 getnamespace; #X msg 477 462 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 577 323 <- get current namespace; #X text 476 269 general operations:; #X msg 154 362 add bla bal tuff; #X msg 154 412 add 4 f 3; #X msg 154 337 add $1; #X floatatom 154 299 5 0 0 0 - - -; #X symbolatom 201 301 10 0 0 0 - - -; #X floatatom 84 578 5 0 0 0 - - -; #X symbolatom 131 580 10 0 0 0 - - -; #X text 139 544 get , remove data:; #X msg 84 616 get $1; #X msg 84 641 get bla bal tuff; #X msg 84 667 get ge; #X msg 84 691 get 4 f 3; #X floatatom 227 582 5 0 0 0 - - -; #X symbolatom 274 584 10 0 0 0 - - -; #X msg 227 620 remove $1; #X msg 227 645 remove bla bal tuff; #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 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 and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X text 140 268 add data to the set:; #X obj 154 453 h_set krx; #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 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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #N canvas 174 18 646 317 read_save_possibilities 0; #X obj 50 258 outlet; #X msg 50 158 save data.dat; #X msg 50 194 read data.dat; #X text 155 158 <- save all the data of the current namespace as textfile ; #X text 149 194 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 173 83 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 176 50 <- save all the data of the current namespace as XML-file ; #X msg 51 50 saveXML data.xml; #X msg 51 82 readXML data.xml; #X connect 1 0 0 0; #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 text 283 824 htttp://grh.mur.at/software/pdcontainer.html; #X text 243 808 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2004; #X connect 0 0 44 0; #X connect 5 0 48 0; #X connect 6 0 48 0; #X connect 7 0 48 0; #X connect 8 0 48 0; #X connect 9 0 48 0; #X connect 11 0 48 0; #X connect 21 0 44 0; #X connect 22 0 44 0; #X connect 23 0 44 0; #X connect 24 0 23 0; #X connect 25 0 23 0; #X connect 26 0 29 0; #X connect 27 0 29 0; #X connect 29 0 46 0; #X connect 30 0 46 0; #X connect 31 0 46 0; #X connect 32 0 46 0; #X connect 33 0 35 0; #X connect 34 0 35 0; #X connect 35 0 46 0; #X connect 36 0 46 0; #X connect 37 0 46 0; #X connect 38 0 46 0; #X connect 44 0 45 0; #X connect 46 0 39 0; #X connect 48 0 40 0; #X connect 48 1 49 0; #X connect 50 0 7 0; #X connect 58 0 48 0;
--- NEW FILE: help-h_multimap.pd --- #N canvas 556 0 813 872 10; #X msg 82 407 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 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 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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #N canvas 174 18 646 317 read_save_possibilities 0; #X obj 50 258 outlet; #X msg 50 158 save data.dat; #X msg 50 194 read data.dat; #X text 155 158 <- save all the data of the current namespace as textfile ; #X text 149 194 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 173 83 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 176 50 <- save all the data of the current namespace as XML-file ; #X msg 51 50 saveXML data.xml; #X msg 51 82 readXML data.xml; #X connect 1 0 0 0; #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 grh@mur.at , 2004; #X connect 0 0 51 0; #X connect 5 0 53 0; #X connect 6 0 53 0; #X connect 7 0 53 0; #X connect 8 0 53 0; #X connect 9 0 53 0; #X connect 13 0 53 0; #X connect 23 0 51 0; #X connect 24 0 51 0; #X connect 25 0 51 0; #X connect 26 0 25 0; #X connect 27 0 25 0; #X connect 28 0 51 1; #X connect 29 0 51 1; #X connect 30 0 51 1; #X connect 31 0 51 1; #X connect 32 0 51 1; #X connect 36 0 39 0; #X connect 37 0 39 0; #X connect 39 0 52 0; #X connect 40 0 52 0; #X connect 41 0 52 0; #X connect 42 0 52 0; #X connect 43 0 45 0; #X connect 44 0 45 0; #X connect 45 0 52 0; #X connect 46 0 52 0; #X connect 47 0 52 0; #X connect 48 0 52 0; #X connect 51 0 11 0; #X connect 52 0 35 0; #X connect 52 1 54 0; #X connect 53 0 10 0; #X connect 53 2 60 0; #X connect 57 0 53 0; #X connect 66 0 53 0;
--- NEW FILE: help-h_list.pd --- #N canvas 535 40 834 864 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 -66577 0; #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 -1; #X msg 483 239 getnamespace; #X msg 483 380 clearall; #X obj 483 769 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 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 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 192 721 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 71 700 h_list simonatbase; #X obj 71 674 r $0-list; #X obj 71 739 print AAA; #N canvas 523 246 495 416 pusch_pop_back_front 0; #X msg 66 229 popback; #X floatatom 76 120 5 0 0 0 - - -; #X msg 66 140 pushback $1; #X text 180 140 <- inserts the data at the; #X symbolatom 121 120 10 0 0 0 - - -; #X msg 66 180 pushfront $1; #X floatatom 76 161 5 0 0 0 - - -; #X symbolatom 119 161 10 0 0 0 - - -; #X msg 66 252 popfront; #X msg 66 302 back; #X msg 66 324 front; #X obj 66 367 s $0-list; #X text 200 155 front/back of the list; #X text 152 244 the back/front; #X text 130 231 <- removes the element from; #X text 143 316 the back/front; #X text 121 301 <- gives out the element from; #X text 27 28 insert/remove/get data at the back/front of the list. ; #X text 27 44 These methods won't change the current iterator position !!!; #X connect 0 0 11 0; #X connect 1 0 2 0; #X connect 2 0 11 0; #X connect 4 0 2 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 7 0 5 0; #X connect 8 0 11 0; #X connect 9 0 11 0; #X connect 10 0 11 0; #X restore 136 494 pd pusch_pop_back_front; #X text 40 452 insert/remove/get data at the back/front of the list ,; #X text 43 247 You can use so called "iterators" to navigate through ; #X text 40 468 _without_ changing the current iterator position:; #N canvas 843 44 493 562 iterator_navigation 0; #X text 39 73 Iterators are a generalization of pointers: they are objects that point to other objects. Via an iterator you can navigate through the container. You can ask a list for an iterator that points to the first element with the message begin. You can get a past-the-end iterator with the message end.; #X text 182 35 ::: ITERATORS :::; #X msg 43 216 begin; #X msg 43 321 next; #X text 40 179 iterator navigation:; #X obj 43 505 s $0-list; #X text 91 217 <- points to the first element fo the h_list; #X text 87 244 <- points _after_ the last element of the h_list; #X text 94 259 (so that you can insert data there for example ,; #X text 99 274 but attention: you can't remove an element at; #X text 98 289 that position !!!); #X text 85 321 <- increment the iterator - so it will point to; #X text 107 335 the next element of h_list; #X msg 43 244 end; #X msg 43 357 last; #X text 84 358 <- decrement the iterator - so it will point to; #X text 106 372 the previous element of h_list; #X msg 43 400 getiter; #X text 113 401 <- puts out the current iterator position; #X text 134 416 at second outlet; #X msg 57 467 setiter $1; #X floatatom 57 448 5 0 0 0 - - -; #X text 147 467 <- set specific iterator position; #X connect 2 0 5 0; #X connect 3 0 5 0; #X connect 13 0 5 0; #X connect 14 0 5 0; #X connect 17 0 5 0; #X connect 20 0 5 0; #X connect 21 0 20 0; #X restore 137 303 pd iterator_navigation; #X text 43 261 the h_list. Here is a short explanation of iterators ; #X text 43 275 and how you can use it in with h_list:; #X text 45 364 operations at a specific iterator position:; #N canvas 0 469 468 430 iterator_operations 0; #X obj 54 389 s $0-list; #X msg 54 283 delete; #X msg 54 113 insert $1; #X floatatom 54 92 5 0 0 0 - - -; #X msg 54 338 get; #X symbolatom 100 92 10 0 0 0 - - -; #X text 48 33 Operations at a specific iterator position :; #X msg 54 137 insert bla sdflj 34 fd; #X text 235 126 current iterator position; #X text 212 111 <- inserts the data at the; #X text 139 299 current iterator position; #X text 116 284 <- deletes the data at the; #X text 138 355 current iterator position; #X text 115 340 <- get the data at the; #X msg 54 230 modify hallo da du; #X floatatom 68 171 5 0 0 0 - - -; #X symbolatom 68 189 10 0 0 0 - - -; #X msg 54 208 modify $1; #X text 211 188 <- modifies the data at the; #X text 232 203 current iterator position; #X text 231 219 (it overrides the data); #X connect 1 0 0 0; #X connect 2 0 0 0; #X connect 3 0 2 0; #X connect 4 0 0 0; #X connect 5 0 2 0; #X connect 7 0 0 0; #X connect 14 0 0 0; #X connect 15 0 17 0; #X connect 16 0 17 0; #X connect 17 0 0 0; #X restore 138 388 pd iterator_operations; #X text 39 550 special operations with h_list:; #N canvas 705 269 550 449 special_operations 0; #X msg 54 289 unique; #X msg 54 237 reverse; #X msg 54 189 sort; #X obj 54 369 s $0-list; #X text 30 28 special operations with h_list:; #X floatatom 54 92 5 0 0 0 - - -; #X symbolatom 100 92 10 0 0 0 - - -; #X msg 54 113 remove $1; #X msg 54 137 remove bla sdflj 34 fd; #X text 212 111 <- removes the element with; #X text 235 126 the given data; #X text 124 237 <- reverses the h_list; #X text 102 190 <- sorts the h_list; #X text 113 289 <- Removes all but the first element in every consecutive group of equal elements. The relative order of elements that are not removed is unchanged.; #X connect 0 0 3 0; #X connect 1 0 3 0; #X connect 2 0 3 0; #X connect 5 0 7 0; #X connect 6 0 7 0; #X connect 7 0 3 0; #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 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 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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 66 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 94 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 120 pd Fileformats; #N canvas 174 18 646 317 read_save_possibilities 0; #X obj 50 258 outlet; #X msg 50 158 save data.dat; #X msg 50 194 read data.dat; #X text 155 158 <- save all the data of the current namespace as textfile ; #X text 149 194 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 173 83 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 176 50 <- save all the data of the current namespace as XML-file ; #X msg 51 50 saveXML data.xml; #X msg 51 82 readXML data.xml; #X connect 1 0 0 0; #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 grh@mur.at , 2004; #X connect 4 0 27 0; #X connect 5 0 27 0; #X connect 6 0 27 0; #X connect 8 0 27 0; #X connect 9 0 27 0; #X connect 12 0 27 0; #X connect 22 0 27 0; #X connect 27 0 10 0; #X connect 27 1 23 0; #X connect 27 2 45 0; #X connect 27 3 7 0; #X connect 30 0 32 0; #X connect 30 1 48 0; #X connect 30 2 47 0; #X connect 30 3 29 0; #X connect 31 0 30 0; #X connect 49 0 27 0; #X connect 58 0 27 0;
--- NEW FILE: help-h_multiset.pd --- #N canvas 0 0 817 875 10; #X msg 154 388 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 37 100 init arg: namespace; #X msg 470 377 print; #X msg 470 421 clear; #X msg 470 642 help; #X msg 470 318 getnamespace; #X msg 470 459 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 570 320 <- get current namespace; #X text 469 266 general operations:; #X msg 154 362 add bla bal tuff; #X msg 154 412 add 4 f 3; #X msg 154 337 add $1; #X floatatom 154 299 5 0 0 0 - - -; #X symbolatom 201 301 10 0 0 0 - - -; #X floatatom 84 578 5 0 0 0 - - -; #X symbolatom 131 580 10 0 0 0 - - -; #X text 139 544 get , remove data:; #X msg 84 616 get $1; #X msg 84 641 get bla bal tuff; #X msg 84 667 get ge; #X msg 84 691 get 4 f 3; #X floatatom 227 582 5 0 0 0 - - -; #X symbolatom 274 584 10 0 0 0 - - -; #X msg 227 620 remove $1; #X msg 227 645 remove bla bal tuff; #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 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 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 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 -143491 0; #N canvas 674 0 511 843 General_Concept 0; #X text 37 165 This library was made for algorithmic composition and of course for all other algorithms. I came into troubles with making bigger musical structures in PD with send-receive pairs , arrays , etc. So I tried to make it possible , to have access to some storage in a whole patch.; #X text 131 131 ::: GOAL OF THE LIBRARY :::; #X text 39 428 For communication I use namespaces. Every Container with the same namespace (and the same container type) has access to the same data. So you can modify and get this data everywhere in the patch. For local namespaces use names with $0.; #X text 140 266 ::: DATASTRUCTURES :::; #X text 156 397 ::: NAMESPACES :::; #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; #N canvas 434 247 671 362 namespace_example 0; #X obj 43 176 h_stack hallawum; #X msg 43 151 push some data; #X text 34 25 ::: NAMESPACE EXAMPLE :::; #X text 166 150 <- add the list "some data" to the stack; #X text 187 167 (namespace "hallawum"); #X obj 41 254 h_stack hallawum; #X msg 41 231 top; #X text 76 231 <- get the data (same namespace); #X msg 341 235 top; #X obj 341 258 h_stack kaletom; #X obj 341 281 print BBB; #X obj 41 277 print AAA; #X text 376 235 <- get the data (different namespace); #X text 475 271 not possible !!!; #X text 35 65 In different namespaces you have access to different data. Here with the datastructure "stack". The two objects with the same namespace (here "hallawum") are sharing their data!; #X connect 1 0 0 0; #X connect 5 0 11 0; #X connect 6 0 5 0; #X connect 8 0 9 0; #X connect 9 0 10 0; #X restore 39 503 pd namespace_example; #X text 161 554 ::: DATATYPES :::; #X text 38 296 As storage datastructures I implemented the C++ STL (Standard Template Library) Containers in PD. Currently following datastructures are available (prefixed with h_): h_map , h_multimap , h_set , h_multiset , h_vector , h_list , h_deque , h_queue , h_priority_queue and h_stack.; #N canvas 438 21 583 739 map_example 0; #X obj 45 297 h_map $0-data; #X msg 45 256 add data1; #X msg 131 273 1 4 3 5 6; #X obj 45 220 t b b; #X obj 45 194 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 321 303 h_map $0-data; #X obj 321 226 t b b; #X obj 321 200 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X msg 321 262 add data2; #X msg 407 279 6 4 5 1 2; #X obj 118 402 h_map $0-data; #X msg 118 376 print; #X text 170 375 <- see whats in the container; #X obj 118 556 h_map $0-data; #X msg 118 485 get data1; #X msg 142 519 get data2; #X obj 118 578 print AAA; #X text 202 485 <- get data1; #X text 229 520 <- get data2; #X text 345 199 <- add to key data2 a list; #X text 69 193 <- add to key data1 a list; #X text 32 32 ::: MAP_EXAMPLE :::; #X text 34 72 With the datastructure "map" it's for example possible to make send-receive pairs , you don't have to update the send-receive pairs all the time (like [value]) , you can use send-receive "namespaces" , ...; #X text 111 659 ( If you use lists as key you can also make a multidimensional matrix ... ); #X connect 1 0 0 0; #X connect 2 0 0 1; #X connect 3 0 1 0; #X connect 3 1 2 0; #X connect 4 0 3 0; #X connect 6 0 8 0; #X connect 6 1 9 0; #X connect 7 0 6 0; #X connect 8 0 5 0; #X connect 9 0 5 1; #X connect 11 0 10 0; #X connect 13 0 16 0; #X connect 14 0 13 0; #X connect 15 0 13 0; #X restore 41 615 pd map_example; #X text 273 34 general concept of; #X text 274 52 PDContainer; #X text 41 579 In the containers you can save all of the PD build-in datatypes: lists , floats , and symbol.; #N canvas 215 140 716 600 save_load_example 0; #X text 27 23 ::: SAVE/LOAD EXAMPLE :::; #X msg 68 229 pushback one word; #X msg 90 260 pushback an other word; #X msg 114 290 pushback something else; #X obj 68 198 t b b b; #X obj 68 168 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1 -1; #X obj 68 324 h_list $0-local; #X text 93 168 <- add these three lists to h_list; #X obj 333 321 h_list $0-local; #X msg 358 285 print; #X obj 140 477 h_set blablu; #X msg 140 413 read example.dat; #X text 274 413 <- read the same data now into a h_set; #X text 26 67 You can save and load data from and to disk. So you can also exchange data through different datastructures with the same data-format (here from a h_list to a h_set).; #X msg 178 441 print; #X msg 333 207 saveXML example.xml; #X text 457 238 <- save data as file; #X msg 333 238 save example.dat; #X text 477 208 <- save data as XML file; #X msg 140 378 readXML example.xml; #X text 283 379 <- read the same XML data now into a h_set; #X text 22 529 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable !; #X connect 1 0 6 0; #X connect 2 0 6 0; #X connect 3 0 6 0; #X connect 4 0 1 0; #X connect 4 1 2 0; #X connect 4 2 3 0; #X connect 5 0 4 0; #X connect 9 0 8 0; #X connect 11 0 10 0; #X connect 14 0 10 0; #X connect 15 0 8 0; #X connect 17 0 8 0; #X connect 19 0 10 0; #X restore 40 797 pd save_load_example; #X text 41 696 All the data of all containers can be saved to disk. So you can also manually edit the file with an editor (which is sometimes much faster) and then load it in PD into a container. You can also load data from other containers. Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable.; #X text 164 671 ::: SAVE/LOAD :::; #X restore 536 62 pd General_Concept; #N canvas 205 0 993 742 Container_Explanation 0; #X obj 14 13 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 16 15 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 254 23 general explation of; #X text 254 40 the datastructures; #X text 23 655 A vector is a sequence that supports access to all elements 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 obj 189 627 h_vector; #X text 500 654 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 680 628 h_list; #X obj 189 773 h_deque; #X text 498 801 A queue is a "first in first out" (FIFO) data structure. That is , elements are added to the back of the queue (push) and may be removed from the front (pop).; #X obj 679 774 h_queue; #X text 22 951 A priority queue is also a "first in first out" (FIFO) data structure , but you can give the elements a priority. So the elements with a higher priority are automatically inserted before all other elements with a lower priority.; #X obj 154 924 h_priority_queue; #X text 20 800 A deque (double ended queue , pronounced "deck") is very much like a vector: like vector , it is a sequence that supports access to all elements via index. The main way in which deque differs from vector is that fast insertion and removal of elements is possible at the beginning _and_ the end.; #X text 22 232 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 obj 188 203 h_map; #X text 492 231 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 obj 643 201 h_multimap; #X text 24 419 Sets allow you to add and delete elements. Afterwards you can look if an element is set. Set is a Sorted Associative Container and a Unique Associative Container , meaning that no two elements are the same. (see Multiset to have several copies of the same element) ; #X obj 187 392 h_set; #X text 493 419 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 obj 642 391 h_multiset; #X text 339 167 :::: ASSOCIATIVE CONTAINERS ::::; #X text 393 592 :::: SEQUENCES ::::; #X text 289 1099 (look for help at all the objects for more information) ; #X text 35 87 PDContainer contains the following datastructures:; #X text 399 86 map , nultimap , set , multiset , vector , list , deque , queue , stack , priority queue; #X obj 679 916 h_stack; #X text 495 950 Stack is a "last in first out" (LIFO) data structure: 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 518 90 pd Container_Explanation; #N canvas 254 0 927 786 Fileformats 0; #X obj 38 27 cnv 15 404 54 empty empty empty 22 25 0 18 -1 -66577 0 ; #X obj 40 29 cnv 15 400 50 empty empty PDContainer 22 25 0 18 -228992 -66577 0; #X text 259 56 PDContainer; #X text 257 38 different fileformats of; #X text 472 116 Please use the XML fileformat if possible , because it's easier to edit in an external editor and the XML parser is much more stable!; #X text 40 582 s go; #X text 40 569 f 2 s wow f 2; #X text 40 599 f 23; #X text 38 634 (f=float , s=symbol); #X text 37 171 a) single elements: are the containers h_vector , h_list , h_deque , h_set , h_multiset; #X text 471 172 b) key-value pairs: are the containers h_map and h_multimap ; #X text 469 276 2.element: symbol go; #X text 476 698 f 2 s wow - f 2; #X text 476 712 s go - s not f 34; #X text 476 729 f 23 - s op; #X text 488 244 key: list 2 wow; #X text 470 229 1.element:; #X text 488 258 value: float 2; #X text 490 291 key: symbol go; #X text 490 305 value: list symbol not float 34; #X text 39 243 1.element: list 2 wow 2; #X text 39 257 2.element: symbol go; #X text 38 272 3.element: float 23; #X text 37 223 a) example1:; #X text 470 212 b) example2:; #X text 37 312 a) example1 , XML:; #X text 37 339 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 37 353 <PDContainer type="h_list">; #X text 54 366 <element>; #X text 70 379 <f> 2 </f>; #X text 70 405 <f> 2 </f>; #X text 56 418 </element>; #X text 70 391 <s> wow </s>; #X text 56 431 <element>; #X text 57 455 </element>; #X text 72 443 <s> go </s>; #X text 56 468 <element>; #X text 57 492 </element>; #X text 72 480 <f> 23 </f>; #X text 41 506 </PDContainer>; #X text 41 542 a) example1 , textfile:; #X text 39 115 You can save the data of the containers to XML files and normal textfiles (see General_Concept).; #X text 469 375 <?xml version="1.0" encoding="ISO-8859-1" ?>; #X text 469 389 <PDContainer type="h_list">; #X text 486 402 <element>; #X text 519 430 <f> 2 </f>; #X text 520 482 <f> 2 </f>; #X text 488 506 </element>; #X text 519 442 <s> wow </s>; #X text 475 634 </PDContainer>; #X text 469 348 b) example2 , XML:; #X text 503 415 <key>; #X text 504 456 </key>; #X text 503 468 <value>; #X text 504 494 </value>; #X text 487 519 <element>; #X text 489 621 </element>; #X text 504 532 <key>; #X text 505 559 </key>; #X text 504 571 <value>; #X text 505 609 </value>; #X text 520 545 <s> go </s>; #X text 521 584 <s> not </s>; #X text 521 597 <f> 34 </f>; #X text 476 668 b) example2 , textfile:; #X restore 550 116 pd Fileformats; #N canvas 174 18 646 317 read_save_possibilities 0; #X obj 50 258 outlet; #X msg 50 158 save data.dat; #X msg 50 194 read data.dat; #X text 155 158 <- save all the data of the current namespace as textfile ; #X text 149 194 <- read this textfile to the current namespace and insert it at the back (so the size will increase); #X text 173 83 <- read this XML-file to the current namespace and insert it at the back (so the size will increase); #X text 176 50 <- save all the data of the current namespace as XML-file ; #X msg 51 50 saveXML data.xml; #X msg 51 82 readXML data.xml; #X connect 1 0 0 0; #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 text 244 827 htttp://grh.mur.at/software/pdcontainer.html; #X text 204 811 =%)!(%= PDContainer , by Georg Holzmann grh@mur.at , 2004; #X connect 0 0 43 0; #X connect 5 0 45 0; #X connect 6 0 45 0; #X connect 7 0 45 0; #X connect 8 0 45 0; #X connect 9 0 45 0; #X connect 11 0 45 0; #X connect 21 0 43 0; #X connect 22 0 43 0; #X connect 23 0 43 0; #X connect 24 0 23 0; #X connect 25 0 23 0; #X connect 26 0 29 0; #X connect 27 0 29 0; #X connect 29 0 44 0; #X connect 30 0 44 0; #X connect 31 0 44 0; #X connect 32 0 44 0; #X connect 33 0 35 0; #X connect 34 0 35 0; #X connect 35 0 44 0; #X connect 36 0 44 0; #X connect 37 0 44 0; #X connect 38 0 44 0; #X connect 43 0 41 0; #X connect 44 0 39 0; #X connect 45 0 40 0; #X connect 45 1 52 0; #X connect 49 0 45 0; #X connect 58 0 45 0;