Exemplo n.º 1
0
def writeSetCode(attrib, output, element):
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  cleanName = strFunctions.cleanStr(attName)
  capAttName = att[1]
  attType = att[2]
  if attType == 'string':
    attTypeCode = 'const std::string&'
  else:
    attTypeCode = att[3]
  num = att[4]
  if attType == 'lo_element' or attType == 'inline_lo_element':
    return
  if attrib['type'] == 'array':
    output.write('/*\n')
    output.write(' * Sets the \"{0}\"'.format(attName))
    output.write(' element of this {0}.\n'.format(element))
    output.write(' *\n')
    output.write(' * @param inArray; {1} array to be set (it will be copied).\n'.format(attName, attTypeCode))
    output.write(' * @param arrayLength; the length of the array.\n')
    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{0}::set{1}('.format(element, capAttName))
    output.write('{0} inArray, int arrayLength)\n'.format(attTypeCode))
    output.write('{\n')
    output.write('  if (inArray == NULL) return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n')
    output.write('\n')
    output.write('  if (m{0} != NULL) delete[] m{0};\n'.format(capAttName))
    output.write('  m{0} = new {1}[arrayLength];\n'.format(capAttName, attrib['element']))
    output.write('  memcpy(m{0}, inArray, sizeof({1})*arrayLength);\n'.format(capAttName, attrib['element']))
    output.write('  mIsSet{0}Length = true;\n'.format(capAttName))
    output.write('  m{0}Length = arrayLength;\n'.format(capAttName))
    output.write('\n')
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
    output.write('}\n')
    return
  output.write('/*\n')
  output.write(' * Sets {0} and returns value indicating success.\n'.format(attName))
  output.write(' */\n')
  output.write('int\n')
  output.write('{0}::set{1}({2} {3})\n'.format(element, capAttName, attTypeCode, cleanName))
  output.write('{\n')
  if attType == 'string':
    if attName == 'id':
      output.write('  return SyntaxChecker::checkAndSetSId({0}, m{1});\n'.format(attName, capAttName))
    else:
      output.write('  if (&({0}) == NULL)\n'.format(cleanName))
      output.write('  {\n    return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n  }\n')
      if attrib['type'] == 'SIdRef':
        output.write('  else if (!(SyntaxChecker::isValidInternalSId({0})))\n'.format(cleanName))
        output.write('  {\n    return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n  }\n')
      output.write('  else\n  {\n')
      output.write('    m{0} = {1};\n'.format(capAttName, cleanName))
      output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
  elif num == True:
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  mIsSet{0} = true;\n'.format(capAttName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attrib['type'] == 'enum':
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attrib['type'] == 'array':
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attType == 'boolean':
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  mIsSet{0} = true;\n'.format(capAttName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attType == 'XMLNode*':
      output.write('  if (m{0} == {1})\n'.format(capAttName, cleanName))
      output.write('  {\n    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
      output.write('  else if ({0} == NULL)\n'.format(cleanName))
      output.write('  {\n')
      output.write('    delete m{0};\n'.format(capAttName))
      output.write('    m{0} = NULL;\n'.format(capAttName))
      output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
      output.write('  delete m{0};\n'.format(capAttName))
      output.write('  m{0} = ({1} != NULL) ?\n'.format(capAttName, cleanName))
      output.write('    {0}->clone() : NULL;\n'.format(cleanName))
      output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attType == 'element':
    output.write('  if (m{0} == {1})\n'.format(capAttName, cleanName))
    output.write('  {\n    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
    output.write('  else if ({0} == NULL)\n'.format(cleanName))
    output.write('  {\n')
    output.write('    delete m{0};\n'.format(capAttName))
    output.write('    m{0} = NULL;\n'.format(capAttName))
    output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
    if attTypeCode == 'const ASTNode*':
      output.write('  else if (!({0}->isWellFormedASTNode()))\n'.format(cleanName))
      output.write('  {\n    return LIBSBML_INVALID_OBJECT;\n  }\n')
    output.write('  else\n  {\n')
    output.write('    delete m{0};\n'.format(capAttName))
    output.write('    m{0} = ({1} != NULL) ?\n'.format(capAttName, cleanName))
    if attTypeCode == 'const ASTNode*':
      output.write('      {0}->deepCopy() : NULL;\n'.format(cleanName))
    else:
      output.write('      static_cast<{0}>({1}->clone()) : NULL;\n'.format(attTypeCode, cleanName))
    output.write('    if (m{0} != NULL)\n'.format(capAttName))
    output.write('    {\n')
    if attTypeCode == 'const ASTNode*':
      output.write('      m{0}->setParentSBMLObject(this);\n'.format(capAttName, cleanName))
    else:
      if generalFunctions.overridesElementName(attrib):
        output.write('      m{0}->setElementName("{1}");\n'.format(capAttName, cleanName))
      output.write('      m{0}->connectToParent(this);\n'.format(capAttName, cleanName))
    output.write('    }\n')
    output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
  output.write('}\n\n\n')

  if attrib['type'] == 'enum':
    output.write('/*\n')
    output.write(' * Sets {0} and returns value indicating success.\n'.format(attName))
    output.write(' */\n')
    output.write('int\n')
    output.write('{0}::set{1}(const std::string& {2})\n'.format(element, capAttName, cleanName))
    output.write('{\n')
    output.write('  {0}_t parsed = {0}_parse({1}.c_str());\n'.format(attrib['element'], cleanName))
    output.write('  if (parsed == {0}_UNKNOWN) return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n'.format(attrib['element'].upper(), cleanName))
    output.write('  m{0} = parsed;\n'.format(capAttName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
    output.write('}\n\n\n')
Exemplo n.º 2
0
def writeSetCode(attrib, output, element):
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  cleanName = strFunctions.cleanStr(attName)
  capAttName = att[1]
  attType = att[2]
  if attType == 'string':
    attTypeCode = 'const std::string&'
  else:
    attTypeCode = att[3]
  num = att[4]
  if attType == 'lo_element' or attType == 'inline_lo_element':
    return
  if attrib['type'] == 'array':
    output.write('/*\n')
    output.write(' * Sets the \"{0}\"'.format(attName))
    output.write(' element of this {0}.\n'.format(element))
    output.write(' *\n')
    output.write(' * @param inArray; {1} array to be set (it will be copied).\n'.format(attName, attTypeCode))
    output.write(' * @param arrayLength; the length of the array.\n')
    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{0}::set{1}('.format(element, capAttName))
    output.write('{0} inArray, int arrayLength)\n'.format(attTypeCode))
    output.write('{\n')
    output.write('  if (inArray == NULL) return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n')
    output.write('\n')
    output.write('  if (m{0} != NULL) delete[] m{0};\n'.format(capAttName))
    output.write('  m{0} = new {1}[arrayLength];\n'.format(capAttName, attrib['element']))
    output.write('  memcpy(m{0}, inArray, sizeof({1})*arrayLength);\n'.format(capAttName, attrib['element']))
    output.write('  mIsSet{0}Length = true;\n'.format(capAttName))
    output.write('  m{0}Length = arrayLength;\n'.format(capAttName))
    output.write('\n')
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
    output.write('}\n')
    return
  output.write('/*\n')
  output.write(' * Sets {0} and returns value indicating success.\n'.format(attName))
  output.write(' */\n')
  output.write('int\n')
  output.write('{0}::set{1}({2} {3})\n'.format(element, capAttName, attTypeCode, cleanName))
  output.write('{\n')
  if attType == 'string':
    if attName == 'id':
      output.write('  return SyntaxChecker::checkAndSetSId({0}, m{1});\n'.format(attName, capAttName))
    else:
      if attrib['type'] == 'SIdRef':
        output.write('  if (!(SyntaxChecker::isValidInternalSId({0})))\n'.format(cleanName))
        output.write('  {\n    return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n  }\n')
        output.write('  else\n')
      output.write('  {\n')
      output.write('    m{0} = {1};\n'.format(capAttName, cleanName))
      output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
  elif num == True:
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  mIsSet{0} = true;\n'.format(capAttName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attrib['type'] == 'enum':
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attrib['type'] == 'array':
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attType == 'boolean':
    output.write('  m{0} = {1};\n'.format(capAttName, cleanName))
    output.write('  mIsSet{0} = true;\n'.format(capAttName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attType == 'XMLNode*':
      output.write('  if (m{0} == {1})\n'.format(capAttName, cleanName))
      output.write('  {\n    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
      output.write('  else if ({0} == NULL)\n'.format(cleanName))
      output.write('  {\n')
      output.write('    delete m{0};\n'.format(capAttName))
      output.write('    m{0} = NULL;\n'.format(capAttName))
      output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
      output.write('  delete m{0};\n'.format(capAttName))
      output.write('  m{0} = ({1} != NULL) ?\n'.format(capAttName, cleanName))
      output.write('    {0}->clone() : NULL;\n'.format(cleanName))
      output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
  elif attType == 'element':
    output.write('  if (m{0} == {1})\n'.format(capAttName, cleanName))
    output.write('  {\n    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
    output.write('  else if ({0} == NULL)\n'.format(cleanName))
    output.write('  {\n')
    output.write('    delete m{0};\n'.format(capAttName))
    output.write('    m{0} = NULL;\n'.format(capAttName))
    output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
    if attTypeCode == 'const ASTNode*':
      output.write('  else if (!({0}->isWellFormedASTNode()))\n'.format(cleanName))
      output.write('  {\n    return LIBSBML_INVALID_OBJECT;\n  }\n')
    output.write('  else\n  {\n')
    output.write('    delete m{0};\n'.format(capAttName))
    output.write('    m{0} = ({1} != NULL) ?\n'.format(capAttName, cleanName))
    if attTypeCode == 'const ASTNode*':
      output.write('      {0}->deepCopy() : NULL;\n'.format(cleanName))
    else:
      output.write('      static_cast<{0}>({1}->clone()) : NULL;\n'.format(attTypeCode, cleanName))
    output.write('    if (m{0} != NULL)\n'.format(capAttName))
    output.write('    {\n')
    if attTypeCode == 'const ASTNode*':
      output.write('      m{0}->setParentSBMLObject(this);\n'.format(capAttName, cleanName))
    else:
      if generalFunctions.overridesElementName(attrib):
        output.write('      m{0}->setElementName("{1}");\n'.format(capAttName, cleanName))
      output.write('      m{0}->connectToParent(this);\n'.format(capAttName, cleanName))
    output.write('    }\n')
    output.write('    return LIBSBML_OPERATION_SUCCESS;\n  }\n')
  output.write('}\n\n\n')

  if attrib['type'] == 'enum':
    output.write('/*\n')
    output.write(' * Sets {0} and returns value indicating success.\n'.format(attName))
    output.write(' */\n')
    output.write('int\n')
    output.write('{0}::set{1}(const std::string& {2})\n'.format(element, capAttName, cleanName))
    output.write('{\n')
    output.write('  {0}_t parsed = {0}_parse({1}.c_str());\n'.format(attrib['element'], cleanName))
    output.write('  if (parsed == {0}_UNKNOWN) return LIBSBML_INVALID_ATTRIBUTE_VALUE;\n'.format(attrib['element'].upper(), cleanName))
    output.write('  m{0} = parsed;\n'.format(capAttName))
    output.write('  return LIBSBML_OPERATION_SUCCESS;\n')
    output.write('}\n\n\n')
Exemplo n.º 3
0
def writeGetCode(attrib, output, element):
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  if attType == 'lo_element' or attType == 'inline_lo_element':
    return

  if attrib['type'] == 'array':
    output.write('/*\n');
    output.write(' * The "{0}" attribute of this {1} is returned in an {2} array (pointer)\n'.format(attName, element, attTypeCode));
    output.write(' * that is passed as argument to the method (this is needed while using SWIG to\n');
    output.write(' * convert int[] from C++ to Java). The method itself has a return type void.\n');
    output.write(' *\n');
    output.write(' * NOTE: you have to pre-allocate the array with the correct length!'); 
    output.write(' *\n');
    output.write(' * @return void.\n');
    output.write(' */\n');
    output.write('void\n{0}::get{1}({2} outArray) const\n'.format(element,capAttName, attTypeCode));
    output.write('{\n');
    output.write('   if (outArray == NULL || m{0} == NULL) return;\n\n'.format(capAttName))
    output.write('   memcpy(outArray , m{0}, sizeof({1})*m{0}Length);\n'.format(capAttName, attrib['element']));
    output.write('}\n\n\n');
    return

  output.write('/*\n')
  output.write(' * Returns the value of the \"{0}\"'.format(attName))
  output.write(' attribute of this {0}.\n'.format(element))
  output.write(' */\n')
  if attType == 'element' and attTypeCode != 'const ASTNode*':
    output.write('const {0}\n'.format(attTypeCode))
  else:
    output.write('{0}\n'.format(attTypeCode))
  output.write('{0}::get{1}() const\n'.format(element, capAttName))
  output.write('{\n')
  output.write('  return m{0};\n'.format(capAttName))
  output.write('}\n\n\n')

  if attType == 'element' and attName != 'math':
    # return non-const elements as well
    output.write('/*\n')
    output.write(' * Returns the value of the \"{0}\"'.format(attName))
    output.write(' attribute of this {0}.\n'.format(element))
    output.write(' */\n')
    output.write('{0}\n'.format(attTypeCode))
    output.write('{0}::get{1}()\n'.format(element, capAttName))
    output.write('{\n')
    output.write('  return m{0};\n'.format(capAttName))
    output.write('}\n\n\n')

    pkgName = attrib['root']['name']

    if attrib['abstract'] == False:
      output.write('/*\n')
      output.write(' * Creates a new \"{0}\"'.format(attName))
      output.write(' element of this {0} and returns it.\n'.format(element))
      output.write(' */\n')
      output.write('{0}\n'.format(attTypeCode))
      output.write('{0}::create{1}()\n'.format(element, capAttName))
      output.write('{\n')
      if attName == 'math' or attName == 'Math' or attType == 'XMLNode*':
        output.write('  if (m{0} != NULL) delete m{0};\n'.format(capAttName))
        output.write('  m{0} = new {1}();\n'.format(capAttName, attrib['element']))
        output.write('  return m{0};\n'.format(capAttName))
      else:
        output.write('  if (m{0} != NULL) delete m{0};\n'.format(capAttName))
        output.write('  {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
        output.write('  m{0} = new {1}({2}ns);\n'.format(capAttName, attrib['element'], pkgName.lower()))
        if generalFunctions.overridesElementName(attrib):
          output.write('  m{0}->setElementName("{1}");\n'.format(capAttName, attrib['name']));
        output.write('  delete {0}ns;\n'.format(pkgName.lower()))
        output.write('  connectToChild();\n'.format(pkgName.lower()))          
        output.write('  return m{0};\n'.format(capAttName))
      output.write('}\n\n\n')
    else:
      for concrete in generalFunctions.getConcretes(attrib['root'], attrib['concrete']):
        output.write('/*\n')
        output.write(' * Creates a new \"{0}\"'.format(attName))
        output.write(' element of this {0} and returns it.\n'.format(element))
        output.write(' */\n')
        output.write('{0}*\n'.format(concrete['element']))
        output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(concrete['name'])))
        output.write('{\n')
        output.write('  if (m{0} != NULL) delete m{0};\n'.format(capAttName))
        output.write('  {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
        output.write('  m{0} = new {1}({2}ns);\n'.format(capAttName, concrete['element'], pkgName.lower()))
        if generalFunctions.overridesElementName(concrete):
          output.write('  m{0}->setElementName("{1}");\n'.format(capAttName, attrib['name']));
        output.write('  delete {0}ns;\n'.format(pkgName.lower()))
        output.write('  connectToChild();\n'.format(pkgName.lower()))          
        output.write('  return static_cast<{0}*>(m{1});\n'.format(concrete['element'], capAttName))
        output.write('}\n\n\n')
Exemplo n.º 4
0
def writeGetCode(attrib, output, element):
  att = generalFunctions.parseAttribute(attrib)
  attName = att[0]
  capAttName = att[1]
  attType = att[2]
  attTypeCode = att[3]
  if attType == 'lo_element' or attType == 'inline_lo_element':
    return

  if attrib['type'] == 'array':
    output.write('/*\n');
    output.write(' * The "{0}" attribute of this {1} is returned in an {2} array (pointer)\n'.format(attName, element, attTypeCode));
    output.write(' * that is passed as argument to the method (this is needed while using SWIG to\n');
    output.write(' * convert int[] from C++ to Java). The method itself has a return type void.\n');
    output.write(' *\n');
    output.write(' * NOTE: you have to pre-allocate the array with the correct length!'); 
    output.write(' *\n');
    output.write(' * @return void.\n');
    output.write(' */\n');
    output.write('void\n{0}::get{1}({2} outArray) const\n'.format(element,capAttName, attTypeCode));
    output.write('{\n');
    output.write('   if (outArray == NULL || m{0} == NULL) return;\n\n'.format(capAttName))
    output.write('   memcpy(outArray , m{0}, sizeof({1})*m{0}Length);\n'.format(capAttName, attrib['element']));
    output.write('}\n\n\n');
    return

  output.write('/*\n')
  output.write(' * Returns the value of the \"{0}\"'.format(attName))
  output.write(' attribute of this {0}.\n'.format(element))
  output.write(' */\n')
  if attType == 'element' and attTypeCode != 'const ASTNode*':
    output.write('const {0}\n'.format(attTypeCode))
  else:
    output.write('{0}\n'.format(attTypeCode))
  output.write('{0}::get{1}() const\n'.format(element, capAttName))
  output.write('{\n')
  output.write('  return m{0};\n'.format(capAttName))
  output.write('}\n\n\n')

  if attType == 'element' and attName != 'math':
    # return non-const elements as well
    output.write('/*\n')
    output.write(' * Returns the value of the \"{0}\"'.format(attName))
    output.write(' attribute of this {0}.\n'.format(element))
    output.write(' */\n')
    output.write('{0}\n'.format(attTypeCode))
    output.write('{0}::get{1}()\n'.format(element, capAttName))
    output.write('{\n')
    output.write('  return m{0};\n'.format(capAttName))
    output.write('}\n\n\n')

    pkgName = attrib['root']['name']

    if attrib['abstract'] == False:
      output.write('/*\n')
      output.write(' * Creates a new \"{0}\"'.format(attName))
      output.write(' element of this {0} and returns it.\n'.format(element))
      output.write(' */\n')
      output.write('{0}\n'.format(attTypeCode))
      output.write('{0}::create{1}()\n'.format(element, capAttName))
      output.write('{\n')
      if attName == 'math' or attName == 'Math' or attType == 'XMLNode*':
        output.write('  if (m{0} != NULL) delete m{0};\n'.format(capAttName))
        output.write('  m{0} = new {1}();\n'.format(capAttName, attrib['element']))
        output.write('  return m{0};\n'.format(capAttName))
      else:
        output.write('  if (m{0} != NULL) delete m{0};\n'.format(capAttName))
        output.write('  {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
        output.write('  m{0} = new {1}({2}ns);\n'.format(capAttName, attrib['element'], pkgName.lower()))
        if generalFunctions.overridesElementName(attrib):
          output.write('  m{0}->setElementName("{1}");\n'.format(capAttName, attrib['name']));
        output.write('  delete {0}ns;\n'.format(pkgName.lower()))
        output.write('  connectToChild();\n'.format(pkgName.lower()))          
        output.write('  return m{0};\n'.format(capAttName))
      output.write('}\n\n\n')
    else:
      for concrete in generalFunctions.getConcretes(attrib['root'], attrib['concrete']):
        output.write('/*\n')
        output.write(' * Creates a new \"{0}\"'.format(attName))
        output.write(' element of this {0} and returns it.\n'.format(element))
        output.write(' */\n')
        output.write('{0}*\n'.format(concrete['element']))
        output.write('{0}::create{1}()\n'.format(element, strFunctions.cap(concrete['name'])))
        output.write('{\n')
        output.write('  if (m{0} != NULL) delete m{0};\n'.format(capAttName))
        output.write('  {0}_CREATE_NS({1}ns, getSBMLNamespaces());\n'.format(pkgName.upper(), pkgName.lower()))
        output.write('  m{0} = new {1}({2}ns);\n'.format(capAttName, concrete['element'], pkgName.lower()))
        if generalFunctions.overridesElementName(concrete):
          output.write('  m{0}->setElementName("{1}");\n'.format(capAttName, attrib['name']));
        output.write('  delete {0}ns;\n'.format(pkgName.lower()))
        output.write('  connectToChild();\n'.format(pkgName.lower()))          
        output.write('  return static_cast<{0}*>(m{1});\n'.format(concrete['element'], capAttName))
        output.write('}\n\n\n')