Пример #1
0
void FilterData::SavePolyToFile( const QString & filename )
{
    QFile workingFile( filename );
    if( workingFile.open( QFile::WriteOnly | QFile::Text ) )
    {
        QTextStream textBuffer( & workingFile );

        for( auto pair : aproxPoly )
        {
            textBuffer << pair.second << "\n";
        }

        workingFile.flush();
        workingFile.close();
    }
}
Пример #2
0
void FileTestContext::workingFileFromTemplate(
   const char* templateName,     ///< testInputDir file
   TemplateConverter* converter, ///< conversion function
   const char* filename          ///< testWorkingDir file
                                               )
{
   /*
    * The template in the testInputDir and the filename in testWorkingDir are opened,
    * and then both files are passed to the converter.
    *
    * The converter is responsible for reading the template and writing the filename.
    *
    * If no filename is supplied, its name is the same as the templateName.
    */
   CPPUNIT_ASSERT(templateName != NULL);
   CPPUNIT_ASSERT(converter != NULL);

   // Open the template file
   UtlString templatePath;
   inputFilePath(templateName, templatePath);
   OsPath input(templatePath);
   OsFile inputFile(input);

   CPPUNIT_ASSERT_EQUAL(OS_SUCCESS, inputFile.open(OsFile::READ_ONLY));

   // Create/open the registration DB file.
   UtlString workingPath;
   workingFilePath(filename ? filename : templateName, workingPath);
   OsPath working(workingPath);
   OsFile workingFile(working);
   CPPUNIT_ASSERT_EQUAL(OS_SUCCESS, workingFile.open(OsFile::CREATE));

   // Let the converter convert the files
   converter(&inputFile, &workingFile);

   CPPUNIT_ASSERT_EQUAL(OS_SUCCESS, workingFile.flush());

   Os::Logger::instance().log(FAC_UNIT_TEST, PRI_NOTICE, "FileTestContext::workingFileFromTemplate '%s' -> '%s'",
                 templateName, workingPath.data());

   inputFile.close();
   workingFile.close();
}
Пример #3
0
void RobotHexa::write_contact(std::string const name)
{


  std::ofstream workingFile(name.c_str());

  if (workingFile)
  {
    for (int i =0;i<_behavior_contact_0.size();i++)
    {
      workingFile<<_behavior_contact_0[i]<<" "<<_behavior_contact_1[i]<<" "<<_behavior_contact_2[i]<<" "<<_behavior_contact_3[i]<<" "<<_behavior_contact_4[i]<<" "<<_behavior_contact_5[i]<<std::endl;
    }
  }
  else
  {
    ROS_ERROR_STREAM("Impossible to open the file.");
  }


}