Example #1
0
def writeListOfSubFunctions(attrib, output, element):
  loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  output.write('/*\n')
  output.write(' * Returns the  \"{0}\"'.format(loname))
  output.write(' in this {0} object.\n'.format(element))
  output.write(' */\n')
  output.write('const {0}*\n'.format(loname))
  output.write('{0}::getListOf{1}s() const\n'.format(element, strFunctions.cap(attrib['name'])))
  output.write('{\n')
  output.write('\treturn &m{0};\n'.format(strFunctions.capp(attName)))
  output.write('}\n\n\n')
  writeListOfCode.writeRemoveFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName)
  writeListOfCode.writeGetFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName)
  output.write('/**\n')
  output.write(' * Adds a copy the given \"{0}\" to this {1}.\n'.format(attrib['element'], element))
  output.write(' *\n')
  output.write(' * @param {0}; the {1} object to add\n'.format(strFunctions.objAbbrev(attrib['element']), attrib['element']))
  output.write(' *\n')
  output.write(' * @return integer value indicating success/failure of the\n')
  output.write(' * function.  @if clike The value is drawn from the\n')
  output.write(' * enumeration #OperationReturnValues_t. @endif The possible values\n')
  output.write(' * returned by this function are:\n')
  output.write(' * @li LIBSEDML_OPERATION_SUCCESS\n')
  output.write(' * @li LIBSEDML_INVALID_ATTRIBUTE_VALUE\n')
  output.write(' */\n')
  output.write('int\n')
  output.write('{0}::add{1}(const {2}* {3})\n'.format(element, strFunctions.cap(attrib['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
  output.write('{\n')
  output.write('\tif({0} == NULL) return LIBSEDML_INVALID_ATTRIBUTE_VALUE;\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('\tm{0}.append({1});\n'.format(strFunctions.capp(attrib['name']),strFunctions.objAbbrev(attrib['element'])))
  output.write('\treturn LIBSEDML_OPERATION_SUCCESS;\n')
  output.write('}\n\n\n')
  output.write('/**\n')
  output.write(' * Get the number of {0} objects in this {1}.\n'.format(attrib['element'], element))
  output.write(' *\n')
  output.write(' * @return the number of {0} objects in this {1}\n'.format(attrib['element'], element))
  output.write(' */\n')
  output.write('unsigned int \n')
  output.write('{0}::getNum{1}s() const\n'.format(element, strFunctions.cap(attrib['name'])))
  output.write('{\n')
  output.write('\treturn m{0}.size();\n'.format(strFunctions.capp(attrib['name'])))
  output.write('}\n\n')
  if attrib.has_key('abstract') == False or (attrib.has_key('abstract') and attrib['abstract'] == False):
    output.write('/**\n')
    output.write(' * Creates a new {0} object, adds it to this {1}s\n'.format(attrib['element'], element))
    output.write(' * {0} and returns the {1} object created. \n'.format(element, attrib['element']))
    output.write(' *\n')
    output.write(' * @return a new {0} object instance\n'.format(attrib['element']))
    output.write(' *\n')
    output.write(' * @see add{0}(const {0}* {1})\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
    output.write(' */\n')
    output.write('{0}* \n'.format(attrib['element']))
    output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(attrib['name'])))
    output.write('{\n')
    output.write('\t{0} *temp = new {0}();\n'.format(attrib['element']))
    output.write('\tif (temp != NULL) m{0}.appendAndOwn(temp);\n'.format(strFunctions.capp(attrib['name'])))
    output.write('\treturn temp;\n')
    output.write('}\n\n')
  elif attrib.has_key('concrete'):
    for elem in attrib['concrete']:
      output.write('/**\n')
      output.write(' * Creates a new {0} object, adds it to this {1}s\n'.format(elem['element'], element))
      output.write(' * {0} and returns the {1} object created. \n'.format(element, elem['element']))
      output.write(' *\n')
      output.write(' * @return a new {0} object instance\n'.format(elem['element']))
      output.write(' *\n')
      output.write(' * @see add{0}(const {1}* {2})\n'.format(strFunctions.cap(elem['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write(' */\n')
      output.write('{0}* \n'.format(elem['element']))
      output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(elem['name'])))
      output.write('{\n')
      output.write('\t{0} *temp = new {0}();\n'.format(elem['element']))
      output.write('\tif (temp != NULL) m{0}.appendAndOwn(temp);\n'.format(strFunctions.capp(attrib['name'])))
      output.write('\treturn temp;\n')
      output.write('}\n\n')
Example #2
0
def writeListOfSubFunctions(attrib, output, element, pkgName):
  lotype = generalFunctions.getListOfClassName(attrib, strFunctions.cap(attrib['element']))
  loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  output.write('/*\n')
  output.write(' * Returns the  \"{0}\"'.format(lotype))
  output.write(' in this {0} object.\n'.format(element))
  output.write(' */\n')
  output.write('const {0}*\n'.format(lotype))
  output.write('{0}::get{1}() const\n'.format(element, loname))
  output.write('{\n')
  output.write('  return &m{0};\n'.format(strFunctions.capp(attName)))
  output.write('}\n\n\n')
  output.write('/*\n')
  output.write(' * Returns the  \"{0}\"'.format(lotype))
  output.write(' in this {0} object.\n'.format(element))
  output.write(' */\n')
  output.write('{0}*\n'.format(lotype))
  output.write('{0}::get{1}()\n'.format(element, loname))
  output.write('{\n')
  output.write('  return &m{0};\n'.format(strFunctions.capp(attName)))
  output.write('}\n\n\n')
  writeListOfCode.writeRemoveFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName, attrib)
  writeListOfCode.writeGetFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName, attrib)
  output.write('/*\n')
  output.write(' * Adds a copy the given \"{0}\" to this {1}.\n'.format(attrib['element'], element))
  output.write(' *\n')
  output.write(' * @param {0}; the {1} object to add\n'.format(strFunctions.objAbbrev(attrib['element']), attrib['element']))
  output.write(' *\n')
  output.write(' * @return integer value indicating success/failure of the\n')
  output.write(' * function.  @if clike The value is drawn from the\n')
  output.write(' * enumeration #OperationReturnValues_t. @endif The possible values\n')
  output.write(' * returned by this function are:\n')
  output.write(' * @li LIBSBML_OPERATION_SUCCESS\n')
  output.write(' * @li LIBSBML_INVALID_ATTRIBUTE_VALUE\n')
  output.write(' */\n')
  output.write('int\n')
  output.write('{0}::add{1}(const {2}* {3})\n'.format(element, strFunctions.cap(attrib['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
  output.write('{\n')
  output.write('  if ({0} == NULL)\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_OPERATION_FAILED;\n')
  output.write('  }\n')
  output.write('  else if ({0}->hasRequiredAttributes() == false)\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_INVALID_OBJECT;\n')
  output.write('  }\n')
  output.write('  else if (getLevel() != {0}->getLevel())\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_LEVEL_MISMATCH;\n')
  output.write('  }\n')
  output.write('  else if (getVersion() != {0}->getVersion())\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_VERSION_MISMATCH;\n')
  output.write('  }\n')
  if not element.endswith('Plugin'):
    output.write(
      '  else if (matchesRequiredSBMLNamespacesForAddition(static_cast<const SBase *>({0})) == false)\n'.format(
        strFunctions.objAbbrev(attrib['element'])))
    output.write('  {\n')
    output.write('    return LIBSBML_NAMESPACES_MISMATCH;\n')
    output.write('  }\n')
  output.write('  else\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    m{0}.append({1});\n'.format(strFunctions.capp(attrib['name']),strFunctions.objAbbrev(attrib['element'])))
  output.write('    return LIBSBML_OPERATION_SUCCESS;\n')
  output.write('  }\n')
  output.write('}\n\n\n')
  output.write('/*\n')
  output.write(' * Get the number of {0} objects in this {1}.\n'.format(attrib['element'], element))
  output.write(' *\n')
  output.write(' * @return the number of {0} objects in this {1}\n'.format(attrib['element'], element))
  output.write(' */\n')
  output.write('unsigned int\n')
  output.write('{0}::getNum{1}() const\n'.format(element, strFunctions.capp(attrib['name'])))
  output.write('{\n')
  output.write('  return m{0}.size();\n'.format(strFunctions.capp(attrib['name'])))
  output.write('}\n\n\n')
  if attrib.has_key('abstract') == False or (attrib.has_key('abstract') and attrib['abstract'] == False):
      output.write('/*\n')
      output.write(' * Creates a new {0} object, adds it to this {1}s\n'.format(attrib['element'], element))
      output.write(' * {0} and returns the {1} object created. \n'.format(element, attrib['element']))
      output.write(' *\n')
      output.write(' * @return a new {0} object instance\n'.format(attrib['element']))
      output.write(' *\n')
      output.write(' * @see add{0}(const {0}* {1})\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write(' */\n')
      output.write('{0}*\n'.format(attrib['element']))
      output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(attrib['name'])))
      output.write('{\n')
      output.write('  {0}* {1} = NULL;\n\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write('  try\n')
      output.write('  {\n')
      output.write('    {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
      output.write(
        '    {0} = new {1}({2}ns);\n'.format(strFunctions.objAbbrev(attrib['element']), attrib['element'], pkgName.lower()))
      output.write('    delete {0}ns;\n'.format(pkgName.lower()))
      output.write('  }\n')
      output.write('  catch (...)\n')
      output.write('  {\n')
      output.write('    /* here we do not create a default object as the level/version must\n')
      output.write('     * match the parent object\n')
      output.write('     *\n')
      output.write('     * do nothing\n')
      output.write('     */\n')
      output.write('  }\n\n')
      output.write('  if({0} != NULL)\n'.format(strFunctions.objAbbrev(attrib['element'])))
      output.write('  {\n')
      output.write('    m{0}.appendAndOwn({1});\n'.format(strFunctions.capp(attrib['name']), strFunctions.objAbbrev(attrib['element'])))
      output.write('  }\n\n')
      output.write('  return {0};\n'.format(strFunctions.objAbbrev(attrib['element'])))
      output.write('}\n\n\n')
  elif attrib.has_key('concrete'):
    for elem in generalFunctions.getConcretes(attrib['root'], attrib['concrete']):
      output.write('/**\n')
      output.write(' * Creates a new {0} object, adds it to this {1}s\n'.format(elem['element'], element))
      output.write(' * {0} and returns the {1} object created. \n'.format(lotype, elem['element']))
      output.write(' *\n')
      output.write(' * @return a new {0} object instance\n'.format(elem['element']))
      output.write(' *\n')
      output.write(' * @see add{0}(const {0}*)\n'.format(strFunctions.cap(attrib['element'])))
      output.write(' */\n')
      output.write('{0}* \n'.format(elem['element']))
      output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(elem['name'])))
      output.write('{\n')
      output.write('  {0}* {1} = NULL;\n\n'.format(elem['element'], strFunctions.objAbbrev(elem['element'])))
      output.write('  try\n')
      output.write('  {\n')
      output.write('    {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
      output.write(
        '    {0} = new {1}({2}ns);\n'.format(strFunctions.objAbbrev(elem['element']), elem['element'], pkgName.lower()))
      output.write('    delete {0}ns;\n'.format(pkgName.lower()))
      output.write('  }\n')
      output.write('  catch (...)\n')
      output.write('  {\n')
      output.write('    /* here we do not create a default object as the level/version must\n')
      output.write('     * match the parent object\n')
      output.write('     *\n')
      output.write('     * do nothing\n')
      output.write('     */\n')
      output.write('  }\n\n')
      output.write('  if({0} != NULL)\n'.format(strFunctions.objAbbrev(elem['element'])))
      output.write('  {\n')
      output.write('    m{0}.appendAndOwn({1});\n'.format(strFunctions.capp(attrib['name']), strFunctions.objAbbrev(elem['element'])))
      output.write('  }\n\n')
      output.write('  return {0};\n'.format(strFunctions.objAbbrev(elem['element'])))
      output.write('}\n\n\n')
Example #3
0
def writeListOfSubFunctions(attrib, output, element):
    loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
    att = generalFunctions.parseAttribute(attrib)
    attName = att[0]
    capAttName = att[1]
    attType = att[2]
    attTypeCode = att[3]
    num = att[4]
    output.write('/*\n')
    output.write(' * Returns the  \"{0}\"'.format(loname))
    output.write(' in this {0} object.\n'.format(element))
    output.write(' */\n')
    output.write('const {0}*\n'.format(loname))
    output.write('{0}::getListOf{1}s() const\n'.format(
        element, strFunctions.cap(attrib['name'])))
    output.write('{\n')
    output.write('\treturn &m{0};\n'.format(capAttName))
    output.write('}\n\n\n')
    writeListOfCode.writeRemoveFunctions(output,
                                         strFunctions.cap(attrib['name']),
                                         attrib['element'], True, element,
                                         capAttName)
    writeListOfCode.writeGetFunctions(output, strFunctions.cap(attrib['name']),
                                      attrib['element'], True, element,
                                      capAttName)
    output.write('/**\n')
    output.write(' * Adds a copy the given \"{0}\" to this {1}.\n'.format(
        attrib['element'], element))
    output.write(' *\n')
    output.write(' * @param {0}; the {1} object to add\n'.format(
        strFunctions.objAbbrev(attrib['element']), attrib['element']))
    output.write(' *\n')
    output.write(
        ' * @return integer value indicating success/failure of the\n')
    output.write(' * function.  @if clike The value is drawn from the\n')
    output.write(
        ' * enumeration #OperationReturnValues_t. @endif The possible values\n'
    )
    output.write(' * returned by this function are:\n')
    output.write(' * @li LIBSEDML_OPERATION_SUCCESS\n')
    output.write(' * @li LIBSEDML_INVALID_ATTRIBUTE_VALUE\n')
    output.write(' */\n')
    output.write('int\n')
    output.write('{0}::add{1}(const {2}* {3})\n'.format(
        element, strFunctions.cap(attrib['name']), attrib['element'],
        strFunctions.objAbbrev(attrib['element'])))
    output.write('{\n')
    output.write(
        '\tif({0} == NULL) return LIBSEDML_INVALID_ATTRIBUTE_VALUE;\n'.format(
            strFunctions.objAbbrev(attrib['element'])))
    output.write('\tm{0}.append({1});\n'.format(
        strFunctions.cap(attrib['name']),
        strFunctions.objAbbrev(attrib['element'])))
    output.write('\treturn LIBSEDML_OPERATION_SUCCESS;\n')
    output.write('}\n\n\n')
    output.write('/**\n')
    output.write(' * Get the number of {0} objects in this {1}.\n'.format(
        attrib['element'], element))
    output.write(' *\n')
    output.write(' * @return the number of {0} objects in this {1}\n'.format(
        attrib['element'], element))
    output.write(' */\n')
    output.write('unsigned int \n')
    output.write('{0}::getNum{1}s() const\n'.format(
        element, strFunctions.cap(attrib['name'])))
    output.write('{\n')
    output.write('\treturn m{0}.size();\n'.format(
        strFunctions.cap(attrib['name'])))
    output.write('}\n\n')
    if attrib.has_key('abstract') == False or (attrib.has_key('abstract') and
                                               attrib['abstract'] == False):
        output.write('/**\n')
        output.write(
            ' * Creates a new {0} object, adds it to this {1}s\n'.format(
                attrib['element'], element))
        output.write(' * {0} and returns the {1} object created. \n'.format(
            element, attrib['element']))
        output.write(' *\n')
        output.write(' * @return a new {0} object instance\n'.format(
            attrib['element']))
        output.write(' *\n')
        output.write(' * @see add{0}(const {0}* {1})\n'.format(
            attrib['element'], strFunctions.objAbbrev(attrib['element'])))
        output.write(' */\n')
        output.write('{0}* \n'.format(attrib['element']))
        output.write('{0}::create{1}()\n'.format(
            element, strFunctions.cap(attrib['name'])))
        output.write('{\n')
        output.write('\t{0} *temp = new {0}();\n'.format(attrib['element']))
        output.write('\tif (temp != NULL) m{0}.appendAndOwn(temp);\n'.format(
            strFunctions.cap(attrib['name'])))
        output.write('\treturn temp;\n')
        output.write('}\n\n')
    elif attrib.has_key('concrete'):
        for elem in attrib['concrete']:
            output.write('/**\n')
            output.write(
                ' * Creates a new {0} object, adds it to this {1}s\n'.format(
                    elem['element'], element))
            output.write(
                ' * {0} and returns the {1} object created. \n'.format(
                    element, elem['element']))
            output.write(' *\n')
            output.write(' * @return a new {0} object instance\n'.format(
                elem['element']))
            output.write(' *\n')
            output.write(' * @see add{0}(const {1}* {2})\n'.format(
                strFunctions.cap(elem['name']), attrib['element'],
                strFunctions.objAbbrev(attrib['element'])))
            output.write(' */\n')
            output.write('{0}* \n'.format(elem['element']))
            output.write('{0}::create{1}()\n'.format(
                element, strFunctions.cap(elem['name'])))
            output.write('{\n')
            output.write('\t{0} *temp = new {0}();\n'.format(elem['element']))
            output.write(
                '\tif (temp != NULL) m{0}.appendAndOwn(temp);\n'.format(
                    strFunctions.cap(attrib['name'])))
            output.write('\treturn temp;\n')
            output.write('}\n\n')
Example #4
0
def writeListOfSubFunctions(attrib, output, element, pkgName):
  lotype = generalFunctions.getListOfClassName(attrib, strFunctions.cap(attrib['element']))
  loname = generalFunctions.writeListOf(strFunctions.cap(attrib['name']))
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  num = att[4]
  output.write('/*\n')
  output.write(' * Returns the  \"{0}\"'.format(lotype))
  output.write(' in this {0} object.\n'.format(element))
  output.write(' */\n')
  output.write('const {0}*\n'.format(lotype))
  output.write('{0}::get{1}() const\n'.format(element, loname))
  output.write('{\n')
  output.write('  return &m{0};\n'.format(strFunctions.capp(attName)))
  output.write('}\n\n\n')
  output.write('/*\n')
  output.write(' * Returns the  \"{0}\"'.format(lotype))
  output.write(' in this {0} object.\n'.format(element))
  output.write(' */\n')
  output.write('{0}*\n'.format(lotype))
  output.write('{0}::get{1}()\n'.format(element, loname))
  output.write('{\n')
  output.write('  return &m{0};\n'.format(strFunctions.capp(attName)))
  output.write('}\n\n\n')
  writeListOfCode.writeRemoveFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName, attrib)
  writeListOfCode.writeGetFunctions(output, strFunctions.cap(attrib['name']), attrib['element'], True, element, capAttName, attrib)
  output.write('/*\n')
  output.write(' * Adds a copy the given \"{0}\" to this {1}.\n'.format(attrib['element'], element))
  output.write(' *\n')
  output.write(' * @param {0}; the {1} object to add\n'.format(strFunctions.objAbbrev(attrib['element']), attrib['element']))
  output.write(' *\n')
  output.write(' * @return integer value indicating success/failure of the\n')
  output.write(' * function.  @if clike The value is drawn from the\n')
  output.write(' * enumeration #OperationReturnValues_t. @endif The possible values\n')
  output.write(' * returned by this function are:\n')
  output.write(' * @li LIBSBML_OPERATION_SUCCESS\n')
  output.write(' * @li LIBSBML_INVALID_ATTRIBUTE_VALUE\n')
  output.write(' */\n')
  output.write('int\n')
  output.write('{0}::add{1}(const {2}* {3})\n'.format(element, strFunctions.cap(attrib['name']), attrib['element'], strFunctions.objAbbrev(attrib['element'])))
  output.write('{\n')
  output.write('  if ({0} == NULL)\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_OPERATION_FAILED;\n')
  output.write('  }\n')
  output.write('  else if ({0}->hasRequiredAttributes() == false)\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_INVALID_OBJECT;\n')
  output.write('  }\n')
  output.write('  else if (getLevel() != {0}->getLevel())\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_LEVEL_MISMATCH;\n')
  output.write('  }\n')
  output.write('  else if (getVersion() != {0}->getVersion())\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    return LIBSBML_VERSION_MISMATCH;\n')
  output.write('  }\n')
  if not element.endswith('Plugin'):
    output.write(
      '  else if (matchesRequiredSBMLNamespacesForAddition(static_cast<const SBase *>({0})) == false)\n'.format(
        strFunctions.objAbbrev(attrib['element'])))
    output.write('  {\n')
    output.write('    return LIBSBML_NAMESPACES_MISMATCH;\n')
    output.write('  }\n')
  output.write('  else\n'.format(strFunctions.objAbbrev(attrib['element'])))
  output.write('  {\n')
  output.write('    m{0}.append({1});\n'.format(strFunctions.capp(attrib['name']),strFunctions.objAbbrev(attrib['element'])))
  output.write('    return LIBSBML_OPERATION_SUCCESS;\n')
  output.write('  }\n')
  output.write('}\n\n\n')
  output.write('/*\n')
  output.write(' * Get the number of {0} objects in this {1}.\n'.format(attrib['element'], element))
  output.write(' *\n')
  output.write(' * @return the number of {0} objects in this {1}\n'.format(attrib['element'], element))
  output.write(' */\n')
  output.write('unsigned int\n')
  output.write('{0}::getNum{1}() const\n'.format(element, strFunctions.capp(attrib['name'])))
  output.write('{\n')
  output.write('  return m{0}.size();\n'.format(strFunctions.capp(attrib['name'])))
  output.write('}\n\n\n')
  if attrib.has_key('abstract') == False or (attrib.has_key('abstract') and attrib['abstract'] == False):
      output.write('/*\n')
      output.write(' * Creates a new {0} object, adds it to this {1}s\n'.format(attrib['element'], element))
      output.write(' * {0} and returns the {1} object created. \n'.format(element, attrib['element']))
      output.write(' *\n')
      output.write(' * @return a new {0} object instance\n'.format(attrib['element']))
      output.write(' *\n')
      output.write(' * @see add{0}(const {0}* {1})\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write(' */\n')
      output.write('{0}*\n'.format(attrib['element']))
      output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(attrib['name'])))
      output.write('{\n')
      output.write('  {0}* {1} = NULL;\n\n'.format(attrib['element'], strFunctions.objAbbrev(attrib['element'])))
      output.write('  try\n')
      output.write('  {\n')
      output.write('    {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
      output.write(
        '    {0} = new {1}({2}ns);\n'.format(strFunctions.objAbbrev(attrib['element']), attrib['element'], pkgName.lower()))
      output.write('    delete {0}ns;\n'.format(pkgName.lower()))
      output.write('  }\n')
      output.write('  catch (...)\n')
      output.write('  {\n')
      output.write('    /* here we do not create a default object as the level/version must\n')
      output.write('     * match the parent object\n')
      output.write('     *\n')
      output.write('     * do nothing\n')
      output.write('     */\n')
      output.write('  }\n\n')
      output.write('  if({0} != NULL)\n'.format(strFunctions.objAbbrev(attrib['element'])))
      output.write('  {\n')
      output.write('    m{0}.appendAndOwn({1});\n'.format(strFunctions.capp(attrib['name']), strFunctions.objAbbrev(attrib['element'])))
      output.write('  }\n\n')
      output.write('  return {0};\n'.format(strFunctions.objAbbrev(attrib['element'])))
      output.write('}\n\n\n')
  elif attrib.has_key('concrete'):
    for elem in generalFunctions.getConcretes(attrib['root'], attrib['concrete']):
      output.write('/**\n')
      output.write(' * Creates a new {0} object, adds it to this {1}s\n'.format(elem['element'], element))
      output.write(' * {0} and returns the {1} object created. \n'.format(lotype, elem['element']))
      output.write(' *\n')
      output.write(' * @return a new {0} object instance\n'.format(elem['element']))
      output.write(' *\n')
      output.write(' * @see add{0}(const {0}*)\n'.format(strFunctions.cap(attrib['element'])))
      output.write(' */\n')
      output.write('{0}* \n'.format(elem['element']))
      output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(elem['name'])))
      output.write('{\n')
      output.write('  {0}* {1} = NULL;\n\n'.format(elem['element'], strFunctions.objAbbrev(elem['element'])))
      output.write('  try\n')
      output.write('  {\n')
      output.write('    {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
      output.write(
        '    {0} = new {1}({2}ns);\n'.format(strFunctions.objAbbrev(elem['element']), elem['element'], pkgName.lower()))
      output.write('    delete {0}ns;\n'.format(pkgName.lower()))
      output.write('  }\n')
      output.write('  catch (...)\n')
      output.write('  {\n')
      output.write('    /* here we do not create a default object as the level/version must\n')
      output.write('     * match the parent object\n')
      output.write('     *\n')
      output.write('     * do nothing\n')
      output.write('     */\n')
      output.write('  }\n\n')
      output.write('  if({0} != NULL)\n'.format(strFunctions.objAbbrev(elem['element'])))
      output.write('  {\n')
      output.write('    m{0}.appendAndOwn({1});\n'.format(strFunctions.capp(attrib['name']), strFunctions.objAbbrev(elem['element'])))
      output.write('  }\n\n')
      output.write('  return {0};\n'.format(strFunctions.objAbbrev(elem['element'])))
      output.write('}\n\n\n')