Vector List
Posted: Sat Sep 11, 2004 6:49 pm
I've created a vector list (array) for PB in C called VList, (except for 3 functions, here are the functions I have completed. BUT I have a question(see below):
VListPush (vlistPtr VList, void* Data)
VListPop (vlistPtr VList)
VListOverwrite (vlistPtr VList, void* Data)
VListSelect (vlistPtr VList, int Index)
VListNext (vlistPtr VList)
VListPrevious (vlistPtr VList)
VListCreate (int Size)
VListDelete (vlistPtr VList)
VListAutoSize (vlistPtr VList)
VListResize (vlistPtr VList, int NewSize)
VListGetArray (vlistPtr VList)
VListGetData (vlistPtr VList, int Index)
VListGetIndex (vlistPtr VList)
VListGetSize (vlistPtr VList)
VListGetCount (vlistPtr VList)
Now I was just wandering if I should create a function called VListSet() that will actually set the current VList to be used effectively eliminating passing the vlistPtr. I see this as being a pain for having to make a quick call, but for say doing a tight loop this would save speed, no ? is this worth it or will it be annoying for the programmer ? would you rather just set the VList you currently want to use instead of passing it continually ? (If you are curious the functions I'm missing are VListSort, VListInsert, VListRemove)
example pseudo code:
MyList = VListCreate(100)
VListSet(MyList)
VListPush(10)
VListPush(34)
VListPush(76)
VListPop()
this example is stupid but i'm just showing what it would look like without passing a VList each time ? is this better or not, I need serious feedback
VListPush (vlistPtr VList, void* Data)
VListPop (vlistPtr VList)
VListOverwrite (vlistPtr VList, void* Data)
VListSelect (vlistPtr VList, int Index)
VListNext (vlistPtr VList)
VListPrevious (vlistPtr VList)
VListCreate (int Size)
VListDelete (vlistPtr VList)
VListAutoSize (vlistPtr VList)
VListResize (vlistPtr VList, int NewSize)
VListGetArray (vlistPtr VList)
VListGetData (vlistPtr VList, int Index)
VListGetIndex (vlistPtr VList)
VListGetSize (vlistPtr VList)
VListGetCount (vlistPtr VList)
Now I was just wandering if I should create a function called VListSet() that will actually set the current VList to be used effectively eliminating passing the vlistPtr. I see this as being a pain for having to make a quick call, but for say doing a tight loop this would save speed, no ? is this worth it or will it be annoying for the programmer ? would you rather just set the VList you currently want to use instead of passing it continually ? (If you are curious the functions I'm missing are VListSort, VListInsert, VListRemove)
example pseudo code:
MyList = VListCreate(100)
VListSet(MyList)
VListPush(10)
VListPush(34)
VListPush(76)
VListPop()
this example is stupid but i'm just showing what it would look like without passing a VList each time ? is this better or not, I need serious feedback