Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

...

Blok kódu
languagecpp
titlePríklad implementácie externej funkcieExample of implementation of external function
int DemoRedim(SyncRoutedFunctionParams& params) {
	// Parameter check: the first parameter must be the structure, the second simple integer 
	if (params.getCount() != 2
		|| !params[0].isStructured()
		|| !params[1].isSimple() || params[1].getType() != Integer)
		return CallError; // Wrong number or types of parameters - generates runtime exception in ESL

	// If the parameter specifying the new dimension of the structure is valid, 
	if (params[1].isValid()) {
		// then it will change the structure dimension
		params[0].setRowsCount(params[1].getValueInteger());
		for (int i = 1; i < params[0].getRowsCount(); ++i) {
			// and copy the values from the first row into the other ones
			for (int j = 0; j < params[0].getColumnsCount(); ++j) {
				params[0].copyValue(params[0], 0, j, i, j);
			}
		}
	}
	// Calling of the external function was successful 
	return CallSuccess;
}

...