Ignore:
Timestamp:
Dec 10, 2008, 7:31:39 PM (15 years ago)
Author:
rosiere
Message:

Almost complete design
with Test and test platform

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/IPs/systemC/processor/Morpheo/Behavioural/src/XML_generate_file.cpp

    r81 r88  
    77
    88#include "Behavioural/include/XML.h"
     9#include "Common/include/ErrorMorpheo.h"
    910#include <fstream>
    1011
     
    1415#undef  FUNCTION
    1516#define FUNCTION "XML::generate_file"
    16   void XML::generate_file (std::string encoding)
     17  void XML::generate_file (std::string dirname, std::string encoding)
    1718  {
    1819    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
     
    2021    header (encoding);
    2122
    22     std::string filename =  _name + "." + _filename_extension;
     23    std::string filename = dirname + "/" + _name + _filename_extension;
    2324
    24     std::cout << "Generate file \""<< filename << "\"" << std::endl;
     25    msg_printf(INFORMATION,_("Generate file \"%s\"."),filename.c_str());
    2526
    2627    std::ofstream file;
    27     file.open(filename.c_str(),std::ios::out | std::ios::trunc);
     28    file.open(filename.c_str() ,std::ios::out | std::ios::trunc);
     29
     30    if (!file)
     31      throw ERRORMORPHEO(FUNCTION,toString(_("Error opening \"%s\" file.\n"),filename.c_str()));
    2832
    2933    file << get_body();
     
    3438  };
    3539
    36   void XML::generate_file (void)
     40  void XML::generate_file (std::string dirname)
    3741  {
    3842    log_printf(FUNC,Behavioural,FUNCTION,"Begin");
    39     generate_file("UTF-8");
     43    generate_file(dirname,"UTF-8");
    4044    log_printf(FUNC,Behavioural,FUNCTION,"End");
    4145  };
Note: See TracChangeset for help on using the changeset viewer.