/**
 * Writes the given NUML document to filename.  This convenience function
 * is functionally equivalent to:
 *
 *   NUMLWriter_writeNUML(NUMLWriter_create(), d, filename);
 *
 * @return non-zero on success and zero if the filename could not be opened
 * for writing.
 */
LIBNUML_EXTERN
int
writeNUML (const NUMLDocument_t *d, const char *filename)
{
  NUMLWriter sw;
  return static_cast<int>( sw.writeNUML(d, filename) );
}
/**
 *
 * Writes the given NUMLDocument to the given file.
 *
 */ 
bool writeExampleNUML(const NUMLDocument* numlDoc, const string& filename)
{
  NUMLWriter numlWriter;

  bool result = numlWriter.writeNUML(numlDoc, filename);

  if (result)
  {
    cout << "Wrote file \"" << filename << "\"" << endl;
    return true;
  }
  else
  {
    cerr << "Failed to write \"" << filename << "\"" << endl;
    return false;
  }
}