def writeListOfCode(output, element, elementDict = None): loelement = generalFunctions.writeListOf(element) loelementClass = generalFunctions.getListOfClassName(elementDict, element) hasId = generalFunctions.hasIdAttribute (elementDict, element) if hasId: output.write('/*\n') output.write(' *\n') output.write(' */\n') output.write('LIBSBML_EXTERN\n') output.write('{0}_t *\n'.format(element)) output.write('{0}_getById'.format(loelementClass)) output.write('(ListOf_t * lo, const char * sid)\n') output.write('{\n') output.write(' if (lo == NULL)\n') output.write(' return NULL;\n\n') output.write(' return (sid != NULL) ? static_cast <{0} *>(lo)->get(sid) : NULL;\n'.format(loelementClass)) output.write('}\n\n\n') output.write('/*\n') output.write(' *\n') output.write(' */\n') output.write('LIBSBML_EXTERN\n') output.write('{0}_t *\n'.format(element)) output.write('{0}_removeById'.format(loelement)) output.write('(ListOf_t * lo, const char * sid)\n') output.write('{\n') output.write(' if (lo == NULL)\n') output.write(' return NULL;\n\n') output.write(' return (sid != NULL) ? static_cast <{0} *>(lo)->remove(sid) : NULL;\n'.format(loelementClass)) output.write('}\n\n\n')
def writeListOfHeaders(output, element, type, elementDict=None): loelement = generalFunctions.writeListOf(element) loelementClass = generalFunctions.getListOfClassName(elementDict, type) hasId = generalFunctions.hasIdAttribute(elementDict, element) if hasId: output.write("LIBSBML_EXTERN\n") output.write("{0}_t *\n".format(type)) output.write("{0}_getById".format(loelementClass)) output.write("(ListOf_t * lo, const char * sid);\n\n\n") output.write("LIBSBML_EXTERN\n") output.write("{0}_t *\n".format(type)) output.write("{0}_removeById".format(loelementClass)) output.write("(ListOf_t * lo, const char * sid);\n\n\n")
def writeListOfHeaders(output, element, type, elementDict=None): loelement = generalFunctions.writeListOf(element) loelementClass = generalFunctions.getListOfClassName(elementDict, type) hasId = generalFunctions.hasIdAttribute(elementDict, element) if hasId: output.write('LIBSBML_EXTERN\n') output.write('{0}_t *\n'.format(type)) output.write('{0}_getById'.format(loelementClass)) output.write('(ListOf_t * lo, const char * sid);\n\n\n') output.write('LIBSBML_EXTERN\n') output.write('{0}_t *\n'.format(type)) output.write('{0}_removeById'.format(loelementClass)) output.write('(ListOf_t * lo, const char * sid);\n\n\n')