🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.ms-windows.programmer.tools.mfc
6 messages
6 total messages Started by John Lutz Fri, 05 Apr 1996 08:14
Linked Lists
#68
Author: John Lutz
Date: Fri, 05 Apr 1996 08:14
33 lines
1195 bytes
Hello everyone!

	I have a somewhat interesting problem. I am taking over an existing 
project that is a propretary graphic object based engine. Essentially the 
product is a game. The existing product wasen't complete in design or 
implementation.
 
 There are several objects...
	

	Graphic Object-----V
		Animation Sprite__V
			Prop Sprite
		TextSprite
		
		Indicator (fuel gauge)
		Button

	Etc..

  I would like to store all the objects in a linked list for a given window. I 
would like for the linked list to handle the dynamic allocation of these 
object and return the pointer to the subclass that is allocating the objects 
on the linked list. I would like for the linked list class to delete all 
objects dynamically.

Any help is appreciated in this area.


John

tsk@cts.com
Re: Linked Lists
#69
Author: Blake Kadatz
Date: Sat, 06 Apr 1996 14:08
18 lines
1366 bytes
John Lutz wrote:
> 
>   I would like to store all the objects in a linked list for a given window. I
> would like for the linked list to handle the dynamic allocation of these
> object and return the pointer to the subclass that is allocating the objects
> on the linked list. I would like for the linked list class to delete all
> objects dynamically.

Have you tried CObList or CPtrList?  These classes don't automatically 
delete the object for you, but when you remove the object from the list, 
it returns you a pointer.  Easy -- just delete that pointer.

--
--------------------------------------------------------------------
Blake Kadatz                    phone: 604-420-3931
BitMotion Software Inc.         fax:   604-420-3921
304 - 7321 Halifax Street       mailto:blake_kadatz@mindlink.bc.ca
Burnaby, B.C., Canada V5A 4R5
Re: Linked Lists
#76
Author: Tom Vilot
Date: Wed, 10 Apr 1996 00:20
42 lines
2013 bytes
Blake Kadatz wrote:

>>   I would like to store all the objects in a linked list for a given window. 

>Have you tried CObList or CPtrList?  

These are some of the really nice parts of VC++/MFC. 

John, I'd recommend that you read up on these, and all their
permutations (CMapStringToOb, CMapWordToOb, CMapWordToPtr, or whatever
else there is...). They essentially implement linked lists and hash
tables for you. Very sleek. Very easy to use. Very nice.

These list-based objects, as Blake indicated, do not do all kinds of
"automatic" memory allocation/deallocation for you - but you *could*
subclass one of them, or you could write your own object which
utilizes one of these lists within itself, and does all the list
access and memory management for you.

>> ...and return the pointer to the subclass that is allocating the objects
>> on the linked list. 

I'm not entirely clear on what you mean here. Do you mean something
like this?:

void CSomeObject::MakeNewListMember(CLinkedList *list)
{
 CMyObject	*object = new CMyObject;
 CNewObject	*newObject = object->MakeANewGuy();

 list->AddToTail(newObject);
}

??


+---------------------------------------------------------------+
|  Thomas J. Vilot	        ||               Digital Artist |
|  Boulder, Colorado            ||         Multimedia Developer |
|                                                  Photographer |
|  <href="http://www.indra.com/~tjv/">                          |
+---------------------------------------------------------------+
Re: Linked Lists
#83
Author: Alexander Stigsen
Date: Wed, 10 Apr 1996 19:49
13 lines
1088 bytes
John Lutz wrote:
> 
>   I would like to store all the objects in a linked list for a given window. I
> would like for the linked list to handle the dynamic allocation of these
> object and return the pointer to the subclass that is allocating the objects
> on the linked list. I would like for the linked list class to delete all
> objects dynamically.

Ken Griggs have made an optimized CList object which he gives out
as freeware. You can check out his description of it on his site:
http://ulc194.residence.gatech.edu/MSVC.html
I don't think that the code is online right now, but I guess that you
could write to him and ask for it.
Re: Linked Lists
#81
Author: John Lutz
Date: Thu, 11 Apr 1996 02:42
26 lines
1354 bytes
In article <31667AC8.4EE2@mindlink.bc.ca>,
   Blake Kadatz <blake_kadatz@mindlink.bc.ca> wrote:
>John Lutz wrote:
>> 
>>   I would like to store all the objects in a linked list for a given 
window. I
>> would like for the linked list to handle the dynamic allocation of these
>> object and return the pointer to the subclass that is allocating the 
objects
>> on the linked list. I would like for the linked list class to delete all
>> objects dynamically.
>
>Have you tried CObList or CPtrList?  These classes don't automatically 
>delete the object for you, but when you remove the object from the list, 
>it returns you a pointer.  Easy -- just delete that pointer.
>


Opps, I forgot to mention it's under Visual C++ 4.0 but not using
MFC.

John

PS- Also, this project doesn't include MFC, how difficult would it be to 
implemente MFC (linking in a .LIB file)? I'm somewhat new to MFC/VC++ but not 
to C++.
Re: Linked Lists
#84
Author: William E. Kempf
Date: Fri, 12 Apr 1996 16:28
39 lines
1962 bytes
tsk@cts.com (John Lutz) wrote:

:In article <31667AC8.4EE2@mindlink.bc.ca>,
:   Blake Kadatz <blake_kadatz@mindlink.bc.ca> wrote:
:>John Lutz wrote:
:>> 
:>>   I would like to store all the objects in a linked list for a given 
:window. I
:>> would like for the linked list to handle the dynamic allocation of these
:>> object and return the pointer to the subclass that is allocating the 
:objects
:>> on the linked list. I would like for the linked list class to delete all
:>> objects dynamically.
:>
:>Have you tried CObList or CPtrList?  These classes don't automatically 
:>delete the object for you, but when you remove the object from the list, 
:>it returns you a pointer.  Easy -- just delete that pointer.
:>
:
:
:Opps, I forgot to mention it's under Visual C++ 4.0 but not using
:MFC.
:
:John
:
:PS- Also, this project doesn't include MFC, how difficult would it be to 
:implemente MFC (linking in a .LIB file)? I'm somewhat new to MFC/VC++ but not 
:to C++.
:
Linked lists are actually quite easy to implement, if you are looking
to do it yourself.  Most C++ programming books will discuss how.

If you are looking for other libraries that will do it for you, check
out either STL (included with VC++ 4.0) or RogueWave.

-----
William E. Kempf          : http://www.novia.net/~srwillrd
"Sir Willard"             : mailto:srwillrd@novia.net (home)
Knight of the Ascii Table : mailto:wekempf@marlton.1dc.com (work)
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads