/*#io
docCopyright("Steve Dekorte", 2002)
docLicense("BSD revised")
docDescription("Holds references to first and last Objects in a group of linked Objects.")
*/

#ifndef IOOBJECTGROUP_DEFINED 
#define IOOBJECTGROUP_DEFINED 1

#include "Common.h"
#include "IoObject_struct.h"
//#include "IoWeakLink.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef struct
{
    IoObject *first;
    //IoObject *last; // we need the last to make the appendGroup operation efficient
    IoMark mark;
    void *state;
} IoObjectGroup;

IoObjectGroup *IoObjectGroup_newWithColor_(void *state, unsigned char color);
void IoObjectGroup_free(IoObjectGroup *self);
size_t IoObjectGroup_count(IoObjectGroup *self);

//void IoObjectGroup_colorValues(IoObjectGroup *self);
void IoObjectGroup_markValues(IoObjectGroup *self);
size_t IoObjectGroup_freeValues(IoObjectGroup *self);
unsigned char IoObjectGroup_isEmpty(IoObjectGroup *self);

void IoObjectGroup_findLoops(IoObjectGroup *self);
size_t IoObjectGroup_occurencesOf_(IoObjectGroup *self, IoObject *value);

int IoObjectGroup_sharesWithGroup_(IoObjectGroup *self, IoObjectGroup *other);
int IoObjectGroup_hasValue_(IoObjectGroup *self, IoObject *value);

void IoObjectGroup_show(IoObjectGroup *self);

#include "IoObjectGroup_inline.h"

#ifdef __cplusplus
}
#endif
#endif
