Objgroup Module

This module contains functions for operating on object groups.

Header to include: objgroup.h


IobjGroup *objGroupNew()
void objGroupDelete(IobjGroup *group)
void objGroupClear(IobjGroup *group)
IobjGroup *objGroupDup(IobjGroup *oldGroup)
int objGroupAppend(IobjGroup *group, int ob)
int objGroupLookup(IobjGroup *group, int ob)
IobjGroup *objGroupListExpand(Ilist **grplistp)
Ilist *objGroupListDup(Ilist *grplist)
void objGroupListDelete(Ilist *grplist)
int objGroupListRemove(Ilist *grplist, int item)
int objGroupListBytes(Ilist *grplist)
double objGroupListChecksum(Ilist *grplist)
int objGroupListWrite(Ilist *grplist, FILE *fout)
int objGroupRead(Ilist **grplistp, FILE *fin)
int objGroupListToObjList(Ilist *groupList, int **grpNumList, int *numInList, Ilist *newGroupList, int newObjBase)

IobjGroup *objGroupNew()

Returns a new object group with the object list set to NULL and an empty string for the name.  Returns NULL for memory error

void objGroupDelete(IobjGroup *group)

Frees group and all its data

void objGroupClear(IobjGroup *group)

Clears out the data in group: frees the object list and sets the name to an empty string

IobjGroup *objGroupDup(IobjGroup *oldGroup)

Returns a duplicate of the object group oldGroup

int objGroupAppend(IobjGroup *group, int ob)

Appends one object number o to group. Returns 1 for memory error

int objGroupLookup(IobjGroup *group, int ob)

Returns the index of object ob if it is in group, otherwise -1

IobjGroup *objGroupListExpand(Ilist **grplistp)

Adds a new object group to the list pointed to by grplistp, allocating a new group list if necessary and returning the address in grplistp. Returns a pointer to the new group or NULL for memory error.

Ilist *objGroupListDup(Ilist *grplist)

Returns a duplicate of the object group list grplist including all its data; returns NULL for error.

void objGroupListDelete(Ilist *grplist)

Frees the object group list grplist and all its data

int objGroupListRemove(Ilist *grplist, int item)

Removes one object group at index item from the group list grplist, freeing its data first.  Returns 1 for inappropriate index.

int objGroupListBytes(Ilist *grplist)

Returns a byte count for the object group list in grplist

double objGroupListChecksum(Ilist *grplist)

Returns a checksum value for the object group list in grplist

int objGroupListWrite(Ilist *grplist, FILE *fout)

Writes the group list grplist to the model file with pointer fout. Returns 1 for error

int objGroupRead(Ilist **grplistp, FILE *fin)

Reads one object group from the model file pointed to by fin into the model imod.  Returns 1 for error.

int objGroupListToObjList(Ilist *groupList, int **grpNumList, int *numInList, Ilist *newGroupList, int newObjBase)

Given the full list of object groups in groupList, converts a list grpNumList of numInList object group numbers into a list of unique object numbers, in order.  It frees grpNumList and replaces it with the new object list, and replaces numInList with the new number in the list.  If newGroupList is not NULL, it composes a new list of groups with object numbers corresponding to the sum of the object's index in the new list and newObjBase. Returns 1 for object group number out of range or 2 for memory error.