#include "pip.h"
//! [main]
class ElementA: public PIObject {
	PIOBJECT(ElementA)
	// ...
};
ADD_NEW_TO_COLLECTION(ab_group, ElementA)

class ElementB: public PIObject {
	PIOBJECT(ElementB)
	// ...
};
ADD_NEW_TO_COLLECTION(ab_group, ElementB)

class ElementC: public PIObject {
	PIOBJECT(ElementC)
	// ...
};
ADD_NEW_TO_COLLECTION(c_group, ElementC)

class ElementD: public PIObject {
	PIOBJECT(ElementD)
	// ...
};

int main() {
	ElementD * el_d = new ElementD();
	ADD_TO_COLLECTION(ab_group, el_d)
	
	PIStringList gl = PICollection::groups();
	piCout << gl; // {"ab_group", "c_group"}
	piForeachC (PIString g, gl) {
		PIVector<const PIObject * > go = PICollection::groupElements(g);
		piCout << "group" << g << ":";
		piForeachC (PIObject * o, go)
			piCout << Tab << o->className();
	}
	
	/*
	group ab_group :
		ElementA
		ElementB
		ElementD
	group c_group :
		ElementC
	*/
};
//! [main]
