News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Collection Object

Started by mabdelouahab, November 17, 2013, 07:22:21 PM

Previous topic - Next topic

mabdelouahab

hi
I've creation of this object, and I want to be well done.
Please,
 Tortured him, kill him, then sent back, with his errors

simple Object collecton, like ObservableCollection In .NET

   CLASS BaseCollection, Base
      CMETHOD Basedestructor     <=== for destroy
      CMETHOD Clear                     <=== clear all item
      CMETHOD ClearItem              <=== clear item   but not remove
      CMETHOD ClearItemAt           <=== by index
      CMETHOD FindItem                 
      CMETHOD FindObject               <=== find by object =  item   in collection   
      CMETHOD FirstItem     
      CMETHOD ForEath     <==    invoke Proc  all item
      CMETHOD ForEathWCildren       <==    invoke Proc  all item and children
      CMETHOD GetChild       <==    ret hinst=BaseCollection children of item
      CMETHOD GetCount     
      CMETHOD GetItemObject     <==ret hObject of item
      CMETHOD GetType     <=== reserved for inherist OBJECT
      CMETHOD IndexOf     
      CMETHOD InsertItem     
      CMETHOD InsertItemAt     
      CMETHOD InvForEath     <= inverse for eath started by lastitem
      CMETHOD InvForEathWCildren     
      CMETHOD LastItem     
      CMETHOD MoveItem     
      CMETHOD Notifhandler    <== add ptr proc for invoke on Insert/Romove/mov OR OnItemChanged
      CMETHOD RemoveItem     
      CMETHOD RemoveItemAt     
      CMETHOD RemoveNotif     <== romove Handel Notif
      CMETHOD SelectedItem     
      CMETHOD SelectItem     
      CMETHOD SendNotif                <== (Auto Used  By Object)
      CMETHOD SetChild
      CMETHOD SetItemObject     
      CMETHOD ToString      <=== reserved for inherist OBJECT     
      Items        dd    ?        <== Collection of Items
      ColNotif        dd    ?        <== Collection of Notif Handl
      Base_Type       dd    ?
      Base_String     dd    ?
   BaseCollection ENDS


TY

dedndave

the result text is displayed in a GUI window with no File/Save and no Copy/Paste
how do you expect to see the results ?   :P

jj2007

Cut, Copy & Paste works here (Win XP).

dedndave

ahhh - Ctrl-C worked - but no drop-down context menu

windows xp mce2005 sp3
=====================    =
Create New  BaseCollection  =
=====================    =
Insert  New   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 1

* 1 I am First 001
=====================    =
Insert  New   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 2

* 1 I am First 001
* 2 I am  002 Item
=====================    =
Insert  New   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 3

* 1 I am First 001
* 2 I am  002 Item
* 3 I am  3
=====================    =
Insert  At Index 02   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 4

* 1 I am First 001
* 2 I am 004 Item But Insert In 2 ---
* 3 I am  002 Item
* 4 I am  3
=====================    =
Insert  At Index 02   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 5

* 1 I am First 001
* 2 I am 5 Item But Insert In 2 ---
* 3 I am 004 Item But Insert In 2 ---
* 4 I am  002 Item
* 5 I am  3
=====================    =
Test Find Item .........................    =====> I am hire **    =====> I am Introuvale   
=====================    =
Test Find Object .........................    =====> I am hire **    =====> I am hire **   
=====================    =
Test GetItemObject .........................   ( Found )
=====================    =
Create New Child BaseCollection  =
=====================    =
Test ForEathWCildren Enum All Item Whith Children

* 1 I am First 001
* 1 ===============>>>Children 01
* 2 ===============>>>Children 02
* 2 I am 5 Item But Insert In 2 ---
* 3 I am 004 Item But Insert In 2 ---
* 4 I am  002 Item
* 5 I am  3
=====================    =
Test Invert ForEath   

* 5 I am  3
* 4 I am  002 Item
* 3 I am 004 Item But Insert In 2 ---
* 2 I am 5 Item But Insert In 2 ---
* 1 I am First 001
=====================    =
Test IndexOf in: Index ==> Get outp: Item   
Test IndexOf :  =======> found   
=====================    =
LastItem / FirstItem ...   I am  3 /// I am First 001
=====================    =
Test Move Item .........................   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 5

* 1 I am First 001
* 2 I am 5 Item But Insert In 2 ---
* 3 I am 004 Item But Insert In 2 ---
* 4 I am  002 Item
* 5 I am  3
--------------------
Listing By FOREATH    =
----------------------- = Count    = 5

* 1 I am First 001
* 2 I am 5 Item But Insert In 2 ---
* 3 I am  002 Item
* 4 I am 004 Item But Insert In 2 ---
* 5 I am  3
=====================    =
Test Clear Item / ClearItemAt (Not Romove) // Clear 01 / ClearAt 4 /.........................   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 5

* 1
* 2 I am 5 Item But Insert In 2 ---
* 3 I am  002 Item
* 4
* 5 I am  3
=====================    =
Test set object Item .........................   
=====================    =
Test Romove / RemoveAt  .........................   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 4

* 1 ===============>>> retourned Object
* 2 I am 5 Item But Insert In 2 ---
* 3 I am  002 Item
* 4 I am  3
=====================    =
Test Clear Collection .........................   
--------------------
Listing By FOREATH    =
----------------------- = Count    = 1

* 1 For Test re-index
=====================    =
Test Timer  #################################### 
== Insert 100.000 Item == 375 // Count = 1000001

== Enume 1000.000 Item == 16 // Count = 1000001
(val01 = 0 inc in proc ForEath )= 1000001

= re-Index 1000.000 Item = 16 // Count= 1000000

mabdelouahab


dedndave

console version
windows xp mce2005 sp3
===Create New  BaseCollection 
===Insert  New   
------- Listing By FOREATH -------------
====> Count = 1

*  1 I am First 001
---------------------------------------
===Insert  New   
------- Listing By FOREATH -------------
====> Count = 2

*  1 I am First 001
*  2 I am  002 Item
---------------------------------------
===Insert  New   
------- Listing By FOREATH -------------
====> Count = 3

*  1 I am First 001
*  2 I am  002 Item
*  3 I am  3
---------------------------------------
Press any key to continue ...

===Insert  At Index 02   
------- Listing By FOREATH -------------
====> Count = 4

*  1 I am First 001
*  2 I am 004 Item But Insert In 2
*  3 I am  002 Item
*  4 I am  3
---------------------------------------
===Insert  At Index 02   
------- Listing By FOREATH -------------
====> Count = 5

*  1 I am First 001
*  2 I am 5 Item But Insert In 2
*  3 I am 004 Item But Insert In 2
*  4 I am  002 Item
*  5 I am  3
---------------------------------------
Press any key to continue ...

===Test Find Item   ..........> I am hire **   .........> I am Introuvale   
===Test Find Object    ..........> I am hire **   .......> I am hire **   
Press any key to continue ...

===Test GetItemObject ( Found )
Press any key to continue ...

===Create New Child BaseCollection  =
Press any key to continue ...

===Test ForEathWCildren Enum All Item Whith Children

*  1 I am First 001
*  1 ...........>>>Children 01
*  2 ............>>>Children 02
*  2 I am 5 Item But Insert In 2
*  3 I am 004 Item But Insert In 2
*  4 I am  002 Item
*  5 I am  3
===Test Invert ForEath   

*  5 I am  3
*  4 I am  002 Item
*  3 I am 004 Item But Insert In 2
*  2 I am 5 Item But Insert In 2
*  1 I am First 001
Press any key to continue ...

===Test IndexOf in: Index > Get outp: Item   
Test IndexOf :  > found   
===LastItem / FirstItem     I am  3 /// I am First 001
Press any key to continue ...

===Test Move Item   
------- Listing By FOREATH -------------
====> Count = 5

*  1 I am First 001
*  2 I am 5 Item But Insert In 2
*  3 I am 004 Item But Insert In 2
*  4 I am  002 Item
*  5 I am  3
---------------------------------------
------- Listing By FOREATH -------------
====> Count = 5

*  1 I am First 001
*  2 I am 5 Item But Insert In 2
*  3 I am  002 Item
*  4 I am 004 Item But Insert In 2
*  5 I am  3
---------------------------------------
===Test Clear Item / ClearItemAt (Not Romove) // Clear 01 / ClearAt 4 /   
------- Listing By FOREATH -------------
====> Count = 5

*  1
*  2 I am 5 Item But Insert In 2
*  3 I am  002 Item
*  4
*  5 I am  3
---------------------------------------
===Test set object Item     
===Test Romove / RemoveAt     
------- Listing By FOREATH -------------
====> Count = 4

*  1 ===============>>> retourned Object
*  2 I am 5 Item But Insert In 2
*  3 I am  002 Item
*  4 I am  3
---------------------------------------
===Test Clear Collection   
------- Listing By FOREATH -------------
====> Count = 1

*  1 For Test re-index
---------------------------------------
=== Test Timer   
Press any key to continue ...

Insert 1000.000 Item : 375 ms // Count = 1000001

Enume 1000.000 Item : 31  ms// Count = 1000001
(val01 = 0 inc in proc ForEath )= 1000001

re-Index 1000.000 Item : 16 ms // Count= 1000000
Press any key to continue ...
Press any key to continue ...

qWord

are all methods needed to be virtual? You could enormously reduce the structure size by calling methods through labels.
MREAL macros - when you need floating point arithmetic while assembling!

mabdelouahab

Hi
I thank you for help
qWord:
Quote from: qWord on November 18, 2013, 05:47:17 AM
are all methods needed to be virtual? You could enormously reduce the structure size by calling methods through labels.
virtual/Static/Private/ ...  methods
In fact, I do not know the difference between them in the MASM, (not in .NET)
How do I define each of them, what's the difference between them in use
If you listed an example, he is the best
thank you

qWord

It is that you (AFAICS) use function pointers to call the methods. Commonly this is used to implement virtual functions, which are resolved at runtime. None-virtual methods could be called by the label (= by name):
e.g.
invoke MyMethod@ClassName,this,...
MREAL macros - when you need floating point arithmetic while assembling!