1/*
2* Copyright 2006 Sony Computer Entertainment Inc.
3*
4* Licensed under the MIT Open Source License, for details please see license.txt or the website
5* http://www.opensource.org/licenses/mit-license.php
6*
7*/
8
9#include <dae.h>
10#include <dae/daeDom.h>
11#include <dom/domVertices.h>
12#include <dae/daeMetaCMPolicy.h>
13#include <dae/daeMetaSequence.h>
14#include <dae/daeMetaChoice.h>
15#include <dae/daeMetaGroup.h>
16#include <dae/daeMetaAny.h>
17#include <dae/daeMetaElementAttribute.h>
18
19daeElementRef
20domVertices::create(DAE& dae)
21{
22	domVerticesRef ref = new domVertices(dae);
23	return ref;
24}
25
26
27daeMetaElement *
28domVertices::registerElement(DAE& dae)
29{
30	daeMetaElement* meta = dae.getMeta(ID());
31	if ( meta != NULL ) return meta;
32
33	meta = new daeMetaElement(dae);
34	dae.setMeta(ID(), *meta);
35	meta->setName( "vertices" );
36	meta->registerClass(domVertices::create);
37
38	daeMetaCMPolicy *cm = NULL;
39	daeMetaElementAttribute *mea = NULL;
40	cm = new daeMetaSequence( meta, cm, 0, 1, 1 );
41
42	mea = new daeMetaElementArrayAttribute( meta, cm, 0, 1, -1 );
43	mea->setName( "input" );
44	mea->setOffset( daeOffsetOf(domVertices,elemInput_array) );
45	mea->setElementType( domInputLocal::registerElement(dae) );
46	cm->appendChild( mea );
47
48	mea = new daeMetaElementArrayAttribute( meta, cm, 1, 0, -1 );
49	mea->setName( "extra" );
50	mea->setOffset( daeOffsetOf(domVertices,elemExtra_array) );
51	mea->setElementType( domExtra::registerElement(dae) );
52	cm->appendChild( mea );
53
54	cm->setMaxOrdinal( 1 );
55	meta->setCMRoot( cm );
56
57	//	Add attribute: id
58	{
59		daeMetaAttribute *ma = new daeMetaAttribute;
60		ma->setName( "id" );
61		ma->setType( dae.getAtomicTypes().get("xsID"));
62		ma->setOffset( daeOffsetOf( domVertices , attrId ));
63		ma->setContainer( meta );
64		ma->setIsRequired( true );
65
66		meta->appendAttribute(ma);
67	}
68
69	//	Add attribute: name
70	{
71		daeMetaAttribute *ma = new daeMetaAttribute;
72		ma->setName( "name" );
73		ma->setType( dae.getAtomicTypes().get("xsNCName"));
74		ma->setOffset( daeOffsetOf( domVertices , attrName ));
75		ma->setContainer( meta );
76
77		meta->appendAttribute(ma);
78	}
79
80	meta->setElementSize(sizeof(domVertices));
81	meta->validate();
82
83	return meta;
84}
85
86