示例#1
0
/* BeginDocumentation
   Name: cgnext - Call next() on a ConnectionGenerator

   Synopsis:
   cg cgnext -> source target v[0] ... true | false

   Parameters:
   cg - ConnectionGenerator

   Description:
   Call the next() function on a given ConnectionGenerator cg
   to iterate cg's connections on the SLI level. This function
   will return the source and the target of the connection, a
   list containing the values for the connection (if there are
   any), and true, or false, if cg cannot be iterated further.

   Remarks:
   This function is part of the low-level access API for the
   ConnectionGenerator module. It is mainly used for debugging
   purposes. Usually, connections are created from a
   ConnectionGenerator using CGConnect.

   Author: Mikael Djurfeldt
   FirstVersion: December 2012
   SeeAlso: CGParse, CGParseFile, CGConnect, CGSelectImplementation, cgstart, cgsetmask
*/
void
ConnectionGeneratorModule::CGNext_cgFunction::execute( SLIInterpreter* i ) const
{
  i->assert_stack_load( 1 );

  ConnectionGeneratorDatum cgd = getValue< ConnectionGeneratorDatum >( i->OStack.pick( 0 ) );

  int j, k;
  std::vector< double > values;
  i->OStack.pop( 1 );
  i->EStack.pop();
  if ( cg_next( cgd, j, k, values ) )
  {
    i->OStack.push( j );
    i->OStack.push( k );
    for ( size_t m = 0; m < values.size(); ++m )
    {
      i->OStack.push( values[ m ] );
    }
    i->OStack.push( true );
  }
  else
  {
    i->OStack.push( false );
  }
}
示例#2
0
static PyObject *
cc_next (PyObject *self, PyObject *args)
{
	int hid, ret ;

	if (!PyArg_ParseTuple(args, "i", &hid)) {
		return NULL;
	}
	ret = cg_next (hid) ;
	return Py_BuildValue("i", ret);
}