Changeset 320 for Generics/NativeGenerics/Demo
- Timestamp:
- Feb 7, 2012, 2:03:20 PM (13 years ago)
- Location:
- Generics/NativeGenerics/Demo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Generics/NativeGenerics/Demo
- Property svn:ignore
-
old new 1 1 lib 2 backup 3 Demo.exe 4 heaptrclog.trc
-
- Property svn:ignore
-
Generics/NativeGenerics/Demo/Demo.lpi
r313 r320 38 38 </Item2> 39 39 </RequiredPackages> 40 <Units Count="5 3">40 <Units Count="59"> 41 41 <Unit0> 42 42 <Filename Value="Demo.lpr"/> … … 57 57 <EditorIndex Value="0"/> 58 58 <WindowIndex Value="0"/> 59 <TopLine Value=" 694"/>60 <CursorPos X=" 36" Y="719"/>59 <TopLine Value="127"/> 60 <CursorPos X="15" Y="47"/> 61 61 <UsageCount Value="233"/> 62 62 <Bookmarks Count="1"> 63 <Item0 X="65" Y="23 5" ID="2"/>63 <Item0 X="65" Y="234" ID="2"/> 64 64 </Bookmarks> 65 65 <Loaded Value="True"/> … … 437 437 <Filename Value="../Units/GenericList.pas"/> 438 438 <UnitName Value="GenericList"/> 439 <EditorIndex Value=" 6"/>440 <WindowIndex Value="0"/> 441 <TopLine Value=" 361"/>442 <CursorPos X="7" Y=" 374"/>443 <UsageCount Value="3 2"/>439 <EditorIndex Value="11"/> 440 <WindowIndex Value="0"/> 441 <TopLine Value="66"/> 442 <CursorPos X="7" Y="21"/> 443 <UsageCount Value="34"/> 444 444 <Loaded Value="True"/> 445 445 </Unit46> … … 447 447 <Filename Value="../Units/GenericMatrix.pas"/> 448 448 <UnitName Value="GenericMatrix"/> 449 <EditorIndex Value="4"/> 450 <WindowIndex Value="0"/> 451 <TopLine Value="352"/> 452 <CursorPos X="44" Y="365"/> 453 <UsageCount Value="12"/> 454 <Loaded Value="True"/> 449 <WindowIndex Value="0"/> 450 <TopLine Value="4"/> 451 <CursorPos X="12" Y="11"/> 452 <UsageCount Value="12"/> 455 453 </Unit47> 456 454 <Unit48> 457 455 <Filename Value="../Units/GenericStream.pas"/> 458 456 <UnitName Value="GenericStream"/> 459 <EditorIndex Value="5"/> 460 <WindowIndex Value="0"/> 461 <TopLine Value="1"/> 462 <CursorPos X="5" Y="12"/> 463 <UsageCount Value="12"/> 457 <IsVisibleTab Value="True"/> 458 <EditorIndex Value="9"/> 459 <WindowIndex Value="0"/> 460 <TopLine Value="59"/> 461 <CursorPos X="29" Y="67"/> 462 <UsageCount Value="14"/> 464 463 <Loaded Value="True"/> 465 464 </Unit48> … … 467 466 <Filename Value="../Units/GenericQueue.pas"/> 468 467 <UnitName Value="GenericQueue"/> 469 <EditorIndex Value=" 3"/>470 <WindowIndex Value="0"/> 471 <TopLine Value="1 "/>472 <CursorPos X=" 3" Y="11"/>473 <UsageCount Value="1 0"/>468 <EditorIndex Value="6"/> 469 <WindowIndex Value="0"/> 470 <TopLine Value="18"/> 471 <CursorPos X="24" Y="28"/> 472 <UsageCount Value="12"/> 474 473 <Loaded Value="True"/> 475 474 </Unit49> … … 477 476 <Filename Value="../Units/GenericDictionary.pas"/> 478 477 <UnitName Value="GenericDictionary"/> 479 <EditorIndex Value=" 2"/>480 <WindowIndex Value="0"/> 481 <TopLine Value="1"/> 482 <CursorPos X="1 7" Y="16"/>483 <UsageCount Value="1 0"/>478 <EditorIndex Value="4"/> 479 <WindowIndex Value="0"/> 480 <TopLine Value="1"/> 481 <CursorPos X="1" Y="1"/> 482 <UsageCount Value="12"/> 484 483 <Loaded Value="True"/> 485 484 </Unit50> 486 485 <Unit51> 487 486 <Filename Value="../../../../../Lazarus/0.9.31_2.6.0/fpc/2.6.0/source/rtl/objpas/sysutils/sysunih.inc"/> 488 <EditorIndex Value=" 1"/>487 <EditorIndex Value="3"/> 489 488 <WindowIndex Value="0"/> 490 489 <TopLine Value="9"/> 491 490 <CursorPos X="10" Y="22"/> 492 <UsageCount Value="10"/> 493 <Loaded Value="True"/> 491 <UsageCount Value="12"/> 492 <Loaded Value="True"/> 493 <DefaultSyntaxHighlighter Value="Delphi"/> 494 494 </Unit51> 495 495 <Unit52> 496 496 <Filename Value="../Units/SpecializedList.pas"/> 497 497 <UnitName Value="SpecializedList"/> 498 <IsVisibleTab Value="True"/> 498 <EditorIndex Value="12"/> 499 <WindowIndex Value="0"/> 500 <TopLine Value="1"/> 501 <CursorPos X="23" Y="11"/> 502 <UsageCount Value="12"/> 503 <Loaded Value="True"/> 504 </Unit52> 505 <Unit53> 506 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/classesh.inc"/> 507 <EditorIndex Value="5"/> 508 <WindowIndex Value="0"/> 509 <TopLine Value="52"/> 510 <CursorPos X="49" Y="65"/> 511 <UsageCount Value="12"/> 512 <Loaded Value="True"/> 513 </Unit53> 514 <Unit54> 515 <Filename Value="../Units/GenericSet.pas"/> 516 <UnitName Value="GenericSet"/> 499 517 <EditorIndex Value="7"/> 500 518 <WindowIndex Value="0"/> 501 <TopLine Value="45"/> 502 <CursorPos X="7" Y="60"/> 503 <UsageCount Value="10"/> 504 <Loaded Value="True"/> 505 </Unit52> 519 <TopLine Value="17"/> 520 <CursorPos X="14" Y="33"/> 521 <UsageCount Value="12"/> 522 <Loaded Value="True"/> 523 </Unit54> 524 <Unit55> 525 <Filename Value="../Units/GenericStack.pas"/> 526 <UnitName Value="GenericStack"/> 527 <EditorIndex Value="8"/> 528 <WindowIndex Value="0"/> 529 <TopLine Value="22"/> 530 <CursorPos X="14" Y="38"/> 531 <UsageCount Value="12"/> 532 <Loaded Value="True"/> 533 </Unit55> 534 <Unit56> 535 <Filename Value="../Units/GenericRange.pas"/> 536 <UnitName Value="GenericRange"/> 537 <EditorIndex Value="1"/> 538 <WindowIndex Value="0"/> 539 <TopLine Value="4"/> 540 <CursorPos X="33" Y="8"/> 541 <UsageCount Value="12"/> 542 <Loaded Value="True"/> 543 </Unit56> 544 <Unit57> 545 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/rtl/inc/systemh.inc"/> 546 <EditorIndex Value="10"/> 547 <WindowIndex Value="0"/> 548 <TopLine Value="958"/> 549 <CursorPos X="11" Y="971"/> 550 <UsageCount Value="12"/> 551 <Loaded Value="True"/> 552 </Unit57> 553 <Unit58> 554 <Filename Value="../Units/GenericTree.pas"/> 555 <UnitName Value="GenericTree"/> 556 <EditorIndex Value="2"/> 557 <WindowIndex Value="0"/> 558 <TopLine Value="1"/> 559 <CursorPos X="33" Y="8"/> 560 <UsageCount Value="12"/> 561 <Loaded Value="True"/> 562 </Unit58> 506 563 </Units> 507 <JumpHistory Count="30" HistoryIndex="2 9">564 <JumpHistory Count="30" HistoryIndex="28"> 508 565 <Position1> 509 <Filename Value="../Units/Generic List.pas"/>510 <Caret Line=" 423" Column="16" TopLine="402"/>566 <Filename Value="../Units/GenericStream.pas"/> 567 <Caret Line="29" Column="42" TopLine="11"/> 511 568 </Position1> 512 569 <Position2> 513 <Filename Value="../Units/Generic List.pas"/>514 <Caret Line=" 425" Column="7" TopLine="404"/>570 <Filename Value="../Units/GenericStream.pas"/> 571 <Caret Line="39" Column="57" TopLine="26"/> 515 572 </Position2> 516 573 <Position3> 517 <Filename Value="../Units/Generic List.pas"/>518 <Caret Line=" 437" Column="17" TopLine="416"/>574 <Filename Value="../Units/GenericStream.pas"/> 575 <Caret Line="29" Column="19" TopLine="16"/> 519 576 </Position3> 520 577 <Position4> 521 <Filename Value="../Units/Generic List.pas"/>522 <Caret Line=" 448" Column="43" TopLine="427"/>578 <Filename Value="../Units/GenericStream.pas"/> 579 <Caret Line="16" Column="53" TopLine="7"/> 523 580 </Position4> 524 581 <Position5> 525 <Filename Value="../Units/Generic List.pas"/>526 <Caret Line="4 55" Column="45" TopLine="434"/>582 <Filename Value="../Units/GenericStream.pas"/> 583 <Caret Line="46" Column="19" TopLine="33"/> 527 584 </Position5> 528 585 <Position6> 529 <Filename Value="../Units/Generic List.pas"/>530 <Caret Line=" 457" Column="7" TopLine="436"/>586 <Filename Value="../Units/GenericStream.pas"/> 587 <Caret Line="34" Column="8" TopLine="24"/> 531 588 </Position6> 532 589 <Position7> 533 <Filename Value="../Units/Generic List.pas"/>534 <Caret Line=" 466" Column="17" TopLine="445"/>590 <Filename Value="../Units/GenericStream.pas"/> 591 <Caret Line="30" Column="19" TopLine="20"/> 535 592 </Position7> 536 593 <Position8> 537 <Filename Value="../Units/Generic List.pas"/>538 <Caret Line="4 72" Column="40" TopLine="451"/>594 <Filename Value="../Units/GenericStream.pas"/> 595 <Caret Line="41" Column="1" TopLine="33"/> 539 596 </Position8> 540 597 <Position9> 541 <Filename Value="../Units/Generic List.pas"/>542 <Caret Line=" 481" Column="52" TopLine="460"/>598 <Filename Value="../Units/GenericStream.pas"/> 599 <Caret Line="8" Column="13" TopLine="1"/> 543 600 </Position9> 544 601 <Position10> 545 <Filename Value="../Units/Generic List.pas"/>546 <Caret Line=" 483" Column="7" TopLine="462"/>602 <Filename Value="../Units/GenericStream.pas"/> 603 <Caret Line="29" Column="58" TopLine="14"/> 547 604 </Position10> 548 605 <Position11> 549 <Filename Value="../Units/Generic List.pas"/>550 <Caret Line=" 492" Column="45" TopLine="471"/>606 <Filename Value="../Units/GenericStream.pas"/> 607 <Caret Line="39" Column="1" TopLine="27"/> 551 608 </Position11> 552 609 <Position12> 553 <Filename Value="../Units/Generic List.pas"/>554 <Caret Line=" 494" Column="7" TopLine="473"/>610 <Filename Value="../Units/GenericStream.pas"/> 611 <Caret Line="29" Column="18" TopLine="6"/> 555 612 </Position12> 556 613 <Position13> 557 <Filename Value="../Units/Generic List.pas"/>558 <Caret Line=" 503" Column="51" TopLine="482"/>614 <Filename Value="../Units/GenericStream.pas"/> 615 <Caret Line="46" Column="23" TopLine="33"/> 559 616 </Position13> 560 617 <Position14> 561 <Filename Value="../Units/Generic List.pas"/>562 <Caret Line=" 516" Column="9" TopLine="495"/>618 <Filename Value="../Units/GenericStream.pas"/> 619 <Caret Line="66" Column="25" TopLine="53"/> 563 620 </Position14> 564 621 <Position15> 565 <Filename Value="../Units/Generic List.pas"/>566 <Caret Line=" 518" Column="52" TopLine="504"/>622 <Filename Value="../Units/GenericStream.pas"/> 623 <Caret Line="62" Column="29" TopLine="49"/> 567 624 </Position15> 568 625 <Position16> 569 <Filename Value="../Units/Generic List.pas"/>570 <Caret Line=" 525" Column="17" TopLine="504"/>626 <Filename Value="../Units/GenericRange.pas"/> 627 <Caret Line="1" Column="1" TopLine="1"/> 571 628 </Position16> 572 629 <Position17> 573 <Filename Value="../Units/Generic List.pas"/>574 <Caret Line=" 531" Column="17" TopLine="510"/>630 <Filename Value="../Units/GenericTree.pas"/> 631 <Caret Line="1" Column="1" TopLine="1"/> 575 632 </Position17> 576 633 <Position18> 577 <Filename Value="../Units/Generic List.pas"/>578 <Caret Line=" 537" Column="17" TopLine="516"/>634 <Filename Value="../Units/GenericTree.pas"/> 635 <Caret Line="8" Column="33" TopLine="1"/> 579 636 </Position18> 580 637 <Position19> 581 <Filename Value="../Units/Generic List.pas"/>582 <Caret Line=" 551" Column="19" TopLine="530"/>638 <Filename Value="../Units/GenericRange.pas"/> 639 <Caret Line="8" Column="33" TopLine="1"/> 583 640 </Position19> 584 641 <Position20> 585 <Filename Value="../Units/Generic List.pas"/>586 <Caret Line=" 557" Column="18" TopLine="536"/>642 <Filename Value="../Units/GenericTree.pas"/> 643 <Caret Line="8" Column="33" TopLine="1"/> 587 644 </Position20> 588 645 <Position21> 589 <Filename Value="../Units/Generic List.pas"/>590 <Caret Line=" 563" Column="9" TopLine="542"/>646 <Filename Value="../Units/GenericStream.pas"/> 647 <Caret Line="46" Column="23" TopLine="33"/> 591 648 </Position21> 592 649 <Position22> 593 <Filename Value="../Units/Generic List.pas"/>594 <Caret Line=" 565" Column="52" TopLine="544"/>650 <Filename Value="../Units/GenericStream.pas"/> 651 <Caret Line="86" Column="1" TopLine="61"/> 595 652 </Position22> 596 653 <Position23> 597 <Filename Value="../Units/Generic List.pas"/>598 <Caret Line=" 571" Column="17" TopLine="550"/>654 <Filename Value="../Units/GenericStream.pas"/> 655 <Caret Line="66" Column="18" TopLine="42"/> 599 656 </Position23> 600 657 <Position24> 601 <Filename Value="../Units/Generic List.pas"/>602 <Caret Line=" 211" Column="7" TopLine="198"/>658 <Filename Value="../Units/GenericStream.pas"/> 659 <Caret Line="46" Column="19" TopLine="33"/> 603 660 </Position24> 604 661 <Position25> 605 <Filename Value="../Units/Generic List.pas"/>606 <Caret Line=" 221" Column="62" TopLine="200"/>662 <Filename Value="../Units/GenericStream.pas"/> 663 <Caret Line="16" Column="53" TopLine="5"/> 607 664 </Position25> 608 665 <Position26> 609 <Filename Value="../Units/Generic List.pas"/>610 <Caret Line=" 357" Column="7" TopLine="344"/>666 <Filename Value="../Units/GenericStream.pas"/> 667 <Caret Line="45" Column="15" TopLine="34"/> 611 668 </Position26> 612 669 <Position27> 613 <Filename Value="../Units/ SpecializedList.pas"/>614 <Caret Line=" 1" Column="1" TopLine="1"/>670 <Filename Value="../Units/GenericStream.pas"/> 671 <Caret Line="47" Column="18" TopLine="34"/> 615 672 </Position27> 616 673 <Position28> 617 <Filename Value="../Units/ SpecializedList.pas"/>618 <Caret Line="2 5" Column="7" TopLine="12"/>674 <Filename Value="../Units/GenericStream.pas"/> 675 <Caret Line="20" Column="15" TopLine="7"/> 619 676 </Position28> 620 677 <Position29> 621 <Filename Value="../Units/ SpecializedList.pas"/>622 <Caret Line=" 34" Column="7" TopLine="21"/>678 <Filename Value="../Units/GenericStream.pas"/> 679 <Caret Line="48" Column="18" TopLine="35"/> 623 680 </Position29> 624 681 <Position30> 625 <Filename Value="../ Units/SpecializedList.pas"/>626 <Caret Line=" 49" Column="7" TopLine="36"/>682 <Filename Value="../../../../../Lazarus/0.9.31_2.7.1/fpc/2.7.1/source/rtl/objpas/classes/classesh.inc"/> 683 <Caret Line="65" Column="49" TopLine="52"/> 627 684 </Position30> 628 685 </JumpHistory> -
Generics/NativeGenerics/Demo/UMainForm.pas
r313 r320 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, GenericList, GenericDictionary, GenericQueue, GenericMatrix,9 ComCtrls, GenericList, GenericDictionary, GenericQueue, 10 10 DateUtils, SpecializedList; 11 11 … … 101 101 102 102 procedure TMainForm.ButtonMatrixIntegerClick(Sender: TObject); 103 var 104 Matrix: TGMatrix<Integer, Integer, Integer>; 105 I: Integer; 106 begin 107 ListViewOutput.Clear; 103 //var 104 // Matrix: TGMatrix<Integer, Integer, Integer>; 105 begin 106 (* ListViewOutput.Clear; 108 107 LabelTestName.Caption := 'TMatrixInteger test'; 109 108 Matrix := TGMatrix<Integer, Integer, Integer>.Create; … … 121 120 finally 122 121 Free; 123 end; 122 end; *) 124 123 end; 125 124 … … 130 129 131 130 procedure TMainForm.ButtonListObjectClick(Sender: TObject); 132 var133 List: TGListObject<TObject>;134 I: Integer;131 //var 132 //List: TListObject<TObject>; 133 //I: Integer; 135 134 begin 136 135 (*ListViewOutput.Clear; … … 182 181 183 182 procedure TMainForm.ButtonDictionaryStringClick(Sender: TObject); 184 type185 TPairStringString = TGPair<String, String>;186 var 187 Dictionary: TGDictionary< TPairStringString>;183 //type 184 // TPairStringString = TGPair<string, string>; 185 var 186 Dictionary: TGDictionary<string, string>; 188 187 begin 189 188 ListViewOutput.Clear; 190 189 LabelTestName.Caption := 'TDictionaryString test'; 191 Dictionary := TGDictionary< TPairStringString>.Create;190 Dictionary := TGDictionary<string, string>.Create; 192 191 with Dictionary do try 193 192 Add('Key1', 'Value1'); 194 193 Add('Key2', 'Value2'); 195 194 Add('Key3', 'Value3'); 196 WriteOutput('Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1'')', Implode(',', StringPairToStr));195 WriteOutput('Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1''),Add(''Key1'', ''Value1'')', List.Implode(',', StringPairToStr)); 197 196 WriteOutput('Values[Key2]', Values['Key2']); 198 197 WriteOutput('Values[Key2] = None'); … … 392 391 393 392 procedure TMainForm.ButtonBenchmarkDictionaryClick(Sender: TObject); 394 type395 TPairStringString = TGPair<String, String>;396 var 397 Dictionary: TGDictionary< TPairStringString>;393 //type 394 // TPairStringString = TGPair<String, String>; 395 var 396 Dictionary: TGDictionary<string, string>; 398 397 Dictionary2: TStringList; 399 398 StartTime: TDateTime; … … 405 404 try 406 405 UpdateButtonState(False); 407 Dictionary := TGDictionary< TPairStringString>.Create;406 Dictionary := TGDictionary<string, string>.Create; 408 407 Dictionary2 := TStringList.Create; 409 408 Dictionary2.NameValueSeparator := '|'; … … 415 414 I := I + 1; 416 415 until (Now - StartTime) > MeasureDuration; 417 WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary. Count) + ' ops');416 WriteOutput('TDictionaryStringString.Add', IntToStr(Dictionary.List.Count) + ' ops'); 418 417 Application.ProcessMessages; 419 418 … … 430 429 StartTime := Now; 431 430 repeat 432 R := Dictionary.Values[IntToStr(I mod Dictionary. Count)];431 R := Dictionary.Values[IntToStr(I mod Dictionary.List.Count)]; 433 432 I := I + 1; 434 433 until (Now - StartTime) > MeasureDuration; … … 448 447 StartTime := Now; 449 448 repeat 450 R := Dictionary.Keys[I mod Dictionary. Count];449 R := Dictionary.Keys[I mod Dictionary.List.Count]; 451 450 I := I + 1; 452 451 until (Now - StartTime) > MeasureDuration; … … 466 465 StartTime := Now; 467 466 repeat 468 R := Dictionary. Items[I mod Dictionary.Count].Value;467 R := Dictionary.List.Items[I mod Dictionary.List.Count].Value; 469 468 I := I + 1; 470 469 until (Now - StartTime) > MeasureDuration;
Note:
See TracChangeset
for help on using the changeset viewer.