static boost::python::list values( GraphComponent &c ) { const GraphComponent::ChildContainer &ch = c.children(); boost::python::list l; for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ ) { l.append( *it ); } return l; }
static boost::python::list keys( GraphComponent &c ) { const GraphComponent::ChildContainer &ch = c.children(); boost::python::list l; for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ ) { l.append( (*it)->getName().c_str() ); } return l; }
static boost::python::tuple children( GraphComponent &c, IECore::TypeId typeId ) { const GraphComponent::ChildContainer &ch = c.children(); boost::python::list l; for( GraphComponent::ChildContainer::const_iterator it=ch.begin(); it!=ch.end(); it++ ) { if( (*it)->isInstanceOf( typeId ) ) { l.append( *it ); } } return boost::python::tuple( l ); }
static GraphComponentPtr getItem( GraphComponent &g, long index ) { long s = g.children().size(); if( index < 0 ) { index += s; } if( index >= s || index < 0 ) { PyErr_SetString( PyExc_IndexError, "GraphComponent index out of range" ); throw_error_already_set(); } return g.getChild<GraphComponent>( index ); }
static int length( GraphComponent &g ) { return g.children().size(); }