Design Pattern Examples
Overview of object-oriented design patterns
Mediator_GroupList.h
Go to the documentation of this file.
1
5
6#pragma once
7#ifndef __MEDIATOR_GROUPLIST_H__
8#define __MEDIATOR_GROUPLIST_H__
9
10#include <stdlib.h>
11
12#include "Mediator_Group.h"
13
18typedef struct
19{
21 size_t groups_count;
23} GroupList;
24
25//-----------------------------------------------------------------------------
26
31void GroupList_Initialize(GroupList* groupList);
32
40void GroupList_Clear(GroupList* groupList);
41
49bool GroupList_AddGroup(GroupList* groupList, Group* group);
50
60int GroupList_FindGroup(GroupList* groupList, const char* groupName);
61
71void GroupList_RemoveGroup(GroupList* groupList, int removeIndex);
72
73
74#endif //__MEDIATOR_GROUPLIST_H__
75
Declaration of the Group structure and the associated support functions as used in the Mediator Patte...
bool GroupList_AddGroup(GroupList *groupList, Group *group)
Add the specified Group object to the specified GroupList object. The list takes ownership of the Gro...
void GroupList_RemoveGroup(GroupList *groupList, int removeIndex)
Remove the group at the specified index in the given GroupList object.
void GroupList_Initialize(GroupList *groupList)
Initialize the given GroupList object for initial use.
void GroupList_Clear(GroupList *groupList)
Clear the given GroupList object to release all associated resources.
int GroupList_FindGroup(GroupList *groupList, const char *groupName)
Search the given GroupList object for the specified group by name and return the index of the group i...
Represents a single group. A group has a name and zero or more users. Users are tracked by name.
Represents a list of groups. Call GroupList_Initialize() to start and GroupList_Clear() to release al...
size_t groups_count
Number of pointers in the groups list.
Group ** groups
Array of pointers to Group objects.
size_t allocated_count
Size of the allocated groups list.