Esempio n. 1
3
//
//print() information on screen or in a logfile
//
void HeathRegulationControl::logPrint(string function) {		
	// LET OP: Nummering moet van 0..6 lopen niet van 1..7
	
	double tempory = 0.0;
	int16 number = -1;
	FILE *fp;
	
	if(function == "LogTemperatures")
	{
		fp = fopen("temperaturen.txt", "a");
	} else {
		fp = stderr;
	}
	
		
	for(int16 j=0; j<14; j++)
	{
		tempory = calculate.getTemperatures(j);				// get the values of the sensors out program
		int16 tAmb = tempory * 100;
		switch(j)
		{
			case 0: fprintf(fp, "%s", time.getTimeDate());
					fprintf(fp, "Outdoor Temperature=%5.2f \n", calculate.getTemperatures(0));//itsTempory);
					fprintf(fp, "Setpoint=%5.2f \n", calculate.getSetpoint());
				break;
			case 1: case 4: case 7: case 10:
					fprintf(fp, "Subrack %i: Front:RT%2i=%5.2f  ", number+=1, j, tempory);
					// By temperatures higher than 60 degree, there is a problem
					// By tAmb with a value of 11008 there is no connection
					if(tempory >= 45 && tAmb != 11008 && function == "LogTemperatures")
					{
						logFile( "High temperature, control the fan of the FRONT DOOR of Rack ", number);
					}
				break;
			case 2:	case 5: case 8: case 11:
					fprintf(fp, " Rear:RT%2i=%5.2f  ", j, tempory);
					// By temperatures higher than 60 degree, there is a problem
					// By tAmb with a value of 11008 there is no connection
					if(tempory >= 60 && tAmb != 11008 && function == "LogTemperatures")
					{
						logFile( "High temperature, control the fan of the BACK DOOR of Rack ", number);
					}
				break;
			case 3: case 6: case 9: case 12:
					fprintf(fp, " Control:RT%2i=%5.2f  Fans=%s \n", j, tempory, (calculate.getStateFans((j/3)-1)==1) ? "on" : "off");
				break;
		}
	}
	fprintf(fp, "\n" );

	if(function == "LogTemperatures")
	{
		fclose(fp);
	}
}
Esempio n. 2
1
void ConversionRGB2RGBE::getDataFromOpenCLMemory()
{
	clFinish(core->getCqCommandQueue());
	CStopWatch timer;
	timer.startTimer();
	
	unsigned int size = image->getHeight() * image->getWidth() * sizeof(cl_uint);
	cl_int ciErr1;			// Error code var
	// Synchronous/blocking read of results, and check accumulated errors
	ciErr1 = clEnqueueReadBuffer(core->getCqCommandQueue(), cl_intChannelR, CL_TRUE, 0, 
		size, channelR, 0, NULL, NULL);
	ciErr1 |= clEnqueueReadBuffer(core->getCqCommandQueue(), cl_intChannelG, CL_TRUE, 0, 
		size, channelG, 0, NULL, NULL);
	ciErr1 |= clEnqueueReadBuffer(core->getCqCommandQueue(), cl_intChannelB, CL_TRUE, 0, 
		size, channelB, 0, NULL, NULL);
	ciErr1 |= clEnqueueReadBuffer(core->getCqCommandQueue(), cl_intChannelE, CL_TRUE, 0, 
		size, channelE, 0, NULL, NULL);
	
	clFinish(core->getCqCommandQueue());
	timer.stopTimer();
	logFile("gpuRGB2RGBE,data_out,%d,%d,%f, \n", image->getHeight(), image->getWidth(), timer.getElapsedTime());

    logFile("clEnqueueReadBuffer ...\n\n"); 
    if (ciErr1 != CL_SUCCESS)
    {
		logFile("%d :Error in clEnqueueReadBuffer, Line %u in file %s !!!\n\n", ciErr1, __LINE__, __FILE__);
    }
}
Esempio n. 3
0
Quassel::~Quassel() {
  if(logFile()) {
    logFile()->close();
    logFile()->deleteLater();
  }
  delete _cliParser;
}
Esempio n. 4
0
void
setupLogfile()
{
    if ( QFileInfo( logFile().toLocal8Bit() ).size() > LOGFILE_SIZE )
    {
        QByteArray lc;
        {
            QFile f( logFile().toLocal8Bit() );
            f.open( QIODevice::ReadOnly | QIODevice::Text );
            lc = f.readAll();
            f.close();
        }

        QFile::remove( logFile().toLocal8Bit() );

        {
            QFile f( logFile().toLocal8Bit() );
            f.open( QIODevice::WriteOnly | QIODevice::Text );
            f.write( lc.right( LOGFILE_SIZE - ( LOGFILE_SIZE / 4 ) ) );
            f.close();
        }
    }

    logfile.open( logFile().toLocal8Bit(), ios::app );
    qInstallMsgHandler( TomahawkLogHandler );
}
Esempio n. 5
0
void ConversionRGB2RGBE::allocateOpenCLMemory()
{
	cl_int ciErr1, ciErr2;
	
	// Allocate the OpenCL buffer memory objects for source and result on the device MEM
	unsigned int size = sizeof(cl_float) * image->getHeight() * image->getWidth() * 3;
	cl_floatImage = clCreateBuffer(core->getGPUContext(), CL_MEM_READ_WRITE, 
		size, NULL, &ciErr1);

	unsigned int sizeRGBE = sizeof(cl_uint) * image->getHeight() * image->getWidth();
	cl_intChannelR = clCreateBuffer(core->getGPUContext(), CL_MEM_READ_WRITE, 
		sizeRGBE, NULL, &ciErr2);
    ciErr1 |= ciErr2;
	cl_intChannelG = clCreateBuffer(core->getGPUContext(), CL_MEM_READ_WRITE, 
		sizeRGBE, NULL, &ciErr2);
    ciErr1 |= ciErr2;
	cl_intChannelB = clCreateBuffer(core->getGPUContext(), CL_MEM_READ_WRITE, 
		sizeRGBE, NULL, &ciErr2);
    ciErr1 |= ciErr2;
	cl_intChannelE = clCreateBuffer(core->getGPUContext(), CL_MEM_READ_WRITE, 
		sizeRGBE, NULL, &ciErr2);
    ciErr1 |= ciErr2;
    logFile("clCreateBuffer...\n"); 
    if (ciErr1 != CL_SUCCESS)
    {
		logFile("%d :Error in clCreateBuffer, Line %u in file %s !!!\n\n", ciErr1, __LINE__, __FILE__);
    }
}
Esempio n. 6
0
void ToneMappingDrago03::toneMapping_Drago03(Image<float> *img, float *avLum, float *maxLum, unsigned int *pic, float bias)
{
	image = img;
	picture = pic;

	avLuminance = avLum;
	maxLuminance = maxLum;

	normMaxLum = *maxLum / *avLum; // normalize maximum luminance by average luminance
	const float LOG05 = -0.693147f; // log(0.5)

	divider = log10(normMaxLum + 1.0f);
	biasP = log(bias)/LOG05;
	logFile("divider = %f biasP = %f \n", divider, biasP);

	localWorkSize[0] = BLOCK_SIZE;
	localWorkSize[1] = BLOCK_SIZE;
	
	//round values on upper value
	logFile("%d %d \n", image->getHeight(), image->getWidth());
	globalWorkSize[0] = roundUp(BLOCK_SIZE, image->getHeight());
	globalWorkSize[1] = roundUp(BLOCK_SIZE, image->getWidth());

	//core->runComputeUnit();
	
	
	
	CStopWatch timer;
	timer.startTimer();
	calctoneMapping_Drago03CPU();
	timer.stopTimer();
	logFile("ToneMappingCPU,calc_time, , ,%f, \n", timer.getElapsedTime());
}
Esempio n. 7
0
bool conf_rxn_delphi(SMCCE * mcce_data,float rxn[])
{
   bool bDelPhiReturn = false;
   char FileName[80];

   /*
    * save log and errors in the same file
    */
   sprintf(FileName,"%s%02d.log","rxn",1);
   ofstream logFile(FileName);
   StreamRedirector redirect_cout(cout,logFile.rdbuf());
   StreamRedirector redirect_cerr(cerr,logFile.rdbuf());

   bDelPhiReturn = runDelphi(mcce_data);

   if (false == bDelPhiReturn)
   {
      printf("\n   WARNING: Delphi failed at focusing depth %d of %s, retry\n", 1, mcce_data->uniqID.c_str());
      return false;
   }

   rxn[0] = mcce_data->ergs;

   /*
    * prepare for focusing runs
    */
   mcce_data->bndcon = 3;

   for (int i = 1; i < mcce_data->del_runs; i++)
   {
      /*
       * update mcce_data to prepare for focusing runs
       */
      mcce_data->del_runs -= i;

      /*
       * save log and errors in the same file
       */
      sprintf(FileName,"%s%02d.log","rxn",i+1);
      ofstream logFile(FileName);
      StreamRedirector redirect_cout(cout,logFile.rdbuf());
      StreamRedirector redirect_cerr(cerr,logFile.rdbuf());

      bDelPhiReturn = runDelphi(mcce_data);

      if (false == bDelPhiReturn)
      {
         printf("\n   WARNING: Delphi failed at focusing depth %d of %s, retry\n", 1, mcce_data->uniqID.c_str());
         return false;
      }

      rxn[i] = mcce_data->ergs;
   }


   return true;
}
Esempio n. 8
0
void ToneMappingDrago03::setInputDataToOpenCLMemory()
{
	int height = image->getHeight();
	int width = image->getWidth();
	
	cl_int ciErr1;				
	// Set the Argument values
	ciErr1 = clSetKernelArg(core->getOpenCLKernel(), 0, 
		sizeof(cl_int), (void*)&width);
	ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 1, 
		sizeof(cl_int), (void*)&height);
	ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 2, 
		sizeof(cl_mem), (void*)&cl_floatImage);
    ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 3, 
		sizeof(cl_mem), (void*)&cl_picture);
	ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 4, 
		sizeof(cl_float), (void*)avLuminance);
	ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 5, 
		sizeof(cl_float), (void*)&normMaxLum);
    ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 6, 
		sizeof(cl_float), (void*)&biasP);
	ciErr1 |= clSetKernelArg(core->getOpenCLKernel(), 7, 
		sizeof(cl_float), (void*)&divider);
   
    logFile("clSetKernelArg 0 - 7...\n\n"); 
    if (ciErr1 != CL_SUCCESS)
    {
		logFile("%d :Error in clSetKernelArg, Line %u in file %s !!!\n\n", ciErr1, __LINE__, __FILE__);
    }

    // --------------------------------------------------------
    // Start Core sequence... copy input data to GPU, compute, copy results back

	clFinish(core->getCqCommandQueue());
	CStopWatch timer;
	timer.startTimer();

    // Asynchronous write of data to GPU device
	unsigned int size = sizeof(cl_float) * image->getHeight() * image->getWidth() * RGB_NUM_OF_CHANNELS;
	ciErr1 = clEnqueueWriteBuffer(core->getCqCommandQueue(), cl_floatImage, CL_TRUE, 0, 
		size, image->getImage(), 0, NULL, NULL);

	clFinish(core->getCqCommandQueue());
	timer.stopTimer();
	logFile("gpuDrago,data_in,%d,%d,%f, \n", height, width, timer.getElapsedTime());

    logFile("clEnqueueWriteBuffer ...\n"); 
    if (ciErr1 != CL_SUCCESS)
    {
		logFile("%d :Error in clEnqueueWriteBuffer, Line %u in file %s !!!\n\n", ciErr1, __LINE__, __FILE__);
    }
}
Esempio n. 9
0
/*
 * Thread Safe. Calculates delay and enqueues a packet
 */ 
void enqueuePacket(queued_packet *q, pthread_mutex_t *m, int *index, npp_packet *npp)
{
	while(pthread_mutex_lock(m));
	
	if(index[0] < args.queue_size) {
		q[index[0]].npp = npp;
		q[index[0]].timestamp = 0;
		index[0]++;
		logFile("Packet added to queue", npp);
	}else {
		logFile("Dropped Packet - Queue is full, unable to add packet", npp);
	}
	
	while(pthread_mutex_unlock(m));
}
Esempio n. 10
0
void Database::sysTabDbInsert(SysTableDbData &dbdef) {
  if(!DbFile::exist(SYSTEM_DBDATA_FNAME)) {
    createDbDb();
  }

  LogFile logFile(SYSTEM_DBLOG_FNAME);

  DataFile dataFile( SYSTEM_DBDATA_FNAME, DBFMODE_READWRITE, &logFile);
  KeyFile  indexFile(SYSTEM_DBKEY_FNAME,  DBFMODE_READWRITE, &logFile);

  logFile.begin();
  _tcsupr(dbdef.m_dbName);
  try {
    DbAddr addr = dataFile.insert(&dbdef, sizeof(SysTableDbData));

    KeyFileDefinition keydef(indexFile);
    KeyType key;
    keydef.put(key, 0, String(dbdef.m_dbName));
    keydef.putRecordAddr(key, addr);
    indexFile.insert(key);
  } catch(sqlca) {
    logFile.abort();
    throw;
  }
  logFile.commit();
}
Esempio n. 11
0
void IDdata::showMeAll()
{
	// output everything to a temp file
	ofstream logFile( "logTemp.txt" );
	Identification * pID1;
	vector< MS2Scoring > vMS2Scoring;
	vector< Protein > vProtein;
	list< Identification * >::iterator iter;
	int i;
	logFile << " Totol Identification Number = " << lpIDlist.size () << endl;

	// print out everything in lpIDlist
	for( iter = lpIDlist.begin(); iter != lpIDlist.end(); iter++)
	{
		pID1 = (*iter);
		logFile << "Charge state =  " << pID1->iChargeState << " first MS2 = " << pID1->vMS2Scoring[pID1->iFirstMS2].iMSMSscan << " last MS2 = " << pID1->vMS2Scoring[pID1->iLastMS2].iMSMSscan <<  "	Sequence =  " << pID1->sSequence  << endl;
		vMS2Scoring = pID1->vMS2Scoring;
		vProtein = pID1->vProtein;
		for( i = 0; i < vMS2Scoring.size(); ++i)
			logFile << "	Score =  " << vMS2Scoring[i].fScore << "	iMSMSscan =  " << vMS2Scoring[i].iMSMSscan  << "	fRT = " << vMS2Scoring[i].fRetentionTime << "	sIDfilename =	" <<  vMS2Scoring[i].sIDfilename << endl;
		for( i = 0; i < vProtein.size(); ++i )
			logFile << "		Locus =  " << vProtein[i].sLocus << "	Description =  " << vProtein[i].sDescription << endl;
		
	}

}
Esempio n. 12
0
void ub_message_output(QtMsgType type, const char *msg) {
    // We must temporarily remove the handler to avoid the infinite recursion of
    // ub_message_output -> qt_message_output -> ub_message_output -> qt_message_output ...
    QtMsgHandler previousHandler = qInstallMsgHandler(0);

#if defined(QT_NO_DEBUG)
    // Suppress qDebug output in release builds
    if (type != QtDebugMsg)
    {
        qt_message_output(type, msg);
    }

#else
    // Default output in debug builds
    qt_message_output(type, msg);
#endif

    if (UBApplication::app() && UBApplication::app()->isVerbose()) {
        QString logFileNamePath = UBSettings::userDataDirectory() + "/log/"+ qApp->applicationName() + ".log";
        QFile logFile(logFileNamePath);

        if (logFile.exists() && logFile.size() > 10000000)
            logFile.remove();

        if (logFile.open(QIODevice::Append | QIODevice::Text)) {
            QTextStream out(&logFile);
            out << QDateTime::currentDateTime().toString(Qt::ISODate)
                << "      " << msg << "\n";
            logFile.close();
        }
    }

    qInstallMsgHandler(previousHandler);
}
Esempio n. 13
0
static void MessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
	QByteArray localMsg = msg.toLocal8Bit();
	QFile logFile("log.txt");
	logFile.open(QIODevice::Append);
	if (logFile.size() > 5 * 1024 * 1024)
	{
		logFile.seek(0);
	}

	QString text;
	switch (type) 
	{
	case QtDebugMsg:
		QTextStream(&text) << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " " << "Debug: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")\n";
		break;
	case QtInfoMsg:
		QTextStream(&text) << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " " << "Info: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")\n";
		break;
	case QtWarningMsg:
		QTextStream(&text) << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " " << "Warning: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")\n";
		break;
	case QtCriticalMsg:
		QTextStream(&text) << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " " << "Critical: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")\n";
		break;
	case QtFatalMsg:
		QTextStream(&text) << QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss") << " " << "Fatal: " << localMsg.constData() << " (" << context.file << ":" << context.line << ", " << context.function << ")\n";
		break;
	default:
		qFatal("unknow error type: %d\n", (int)type);
		return;
	}
	logFile.write(text.toUtf8().constData());
	logFile.close();
}
Esempio n. 14
0
void Browser::on_buttonBox_accepted()  
{
   FragmentDirectory(m_preferencesBrowser.fragmentDirectoryLineEdit->text());
   LoggingEnabled(m_preferencesBrowser.loggingEnabledCheckBox->checkState() == Qt::Checked);
   bool logFileHidden(m_preferencesBrowser.logFileHiddenCheckBox->checkState() == Qt::Checked);
   LogFileHidden(logFileHidden);

   QFileInfo logFile(m_preferencesBrowser.logFileLineEdit->text());
#ifdef Q_WS_WIN
   // On Windows the file hidden attribute is set when the log 
   // file is opened in main.C
#else
   QDir dir(logFile.dir());
   QString name(logFile.fileName());
   if (logFileHidden) {
      if (!name.startsWith(".")) name.push_front(".");
   }else {
      while (name.startsWith(".")) { name.remove(0,1); }
   }
   logFile.setFile(dir,name);
#endif

   LogFilePath(logFile.filePath());
   m_preferencesBrowser.logFileLineEdit->setText(logFile.filePath());

   QChemDatabaseFilePath(m_preferencesBrowser.qchemDatabaseFileLineEdit->text());
   DefaultForceField(m_preferencesBrowser.forceFieldCombo->currentText());
   UndoLimit(m_preferencesBrowser.undoLimit->value());
   LabelFontSize(m_preferencesBrowser.labelFontSize->value());
   updated();
   accept();
}
Esempio n. 15
0
void NetcatGUI::ncSaveLog()
{
    if(ui->tabWidget->currentIndex() == -1){
        QMessageBox::warning(this, "No session active", "You have no session currently active, thus you have no log to save.");
        return;
    }
    if(static_cast<NcSessionWidget*>(ui->tabWidget->currentWidget())->getSessionLog().isEmpty()){
        QMessageBox::warning(this, "Session log empty", "The session log is empty, thus you have nothing to save.");
        return;
    }
    QString fileName = QFileDialog::getSaveFileName(this, tr("Save Session Log"), NULL, tr("Text files (*.txt)"));
    if(fileName.isEmpty())
        return;
    QFile logFile(fileName);
    if(!logFile.open(QIODevice::WriteOnly)){
        QMessageBox::critical(this, "File open error", "The selected file could not be opened for writing.\n Log not saved.");
        return;
    }
    QString log = "--\n[" + QTime::currentTime().toString(Qt::SystemLocaleShortDate) + " " + QDate::currentDate().toString(Qt::SystemLocaleShortDate)
                  + "]" + "\nNetcatGUI log session for " + static_cast<NcSessionWidget*>(ui->tabWidget->currentWidget())->getSessionName() + "\n---\n" + static_cast<NcSessionWidget*>(ui->tabWidget->currentWidget())->getSessionLog().toAscii() + "\n-----";
    qint64 bytesWritten = logFile.write(log.toAscii());
    if( bytesWritten ==  -1)
        QMessageBox::critical(this, "File write error", "Could not write to the specified file.\n Log not saved.");
    else
        if( bytesWritten != qstrlen(log.toAscii()))
        QMessageBox::critical(this, "File write error", "Could not write the entire log session.\n Log saved partially.");
    else
        QMessageBox::information(this, "Log saved successfully", "The session log has been saved successfully.");

    logFile.close();
}
Esempio n. 16
0
int main()
{ AddStreamRetain as(std::cerr); // ***
  LOG("start");

  std::string logFileName="tmp/messages.log";
  std::ofstream logFile(logFileName.c_str());
  bool logFileOk = !!logFile;

  { AddStreamRetain as_if(logFile,logFileOk); // ***
    LOG("open log file '" << logFileName << "': " << (logFileOk ? "ok" : "failed"));
      

    std::string songFileName="tmp/song.out";
    std::ofstream songFile(songFileName.c_str());
    bool songFileOk = !!songFile;
    LOG("open song file '" << songFileName << "': " << (songFileOk ? "ok" : "failed"));

    std::stringstream sout;

    { NullStreamRetain as; // stop precursion to ancestor retains
      { AddStreamRetain as_if(songFile,songFileOk); // ***
        { AddStreamRetain as(sout); // ***
           sing();
        }
      }
    }
    LOG("sung: " << sout.str());
  }

  LOG("finish");
  return 0;
}
Esempio n. 17
0
/*
 * Separate thread for handling packets asynchronously
 */ 
void *tMain(void *ptr)
{
	while(1) {
		npp_packet *npp = receiveNPPPacket(sock, (struct sockaddr*) &(args.sin));
		if(npp == NULL) {
			continue;
		}
		logFile("New Packet Received", npp);
		switch(npp->priority) {
		
		case 0x01:
			enqueuePacket(q1, m1, &q1_index, npp);
			break;
			
		case 0x02:
			enqueuePacket(q2, m2, &q2_index, npp);
			break;
			
		case 0x03:
			enqueuePacket(q3, m3, &q3_index, npp);
			break;
		}
	}
	exit(0);
}
Esempio n. 18
0
/*bool QLoggerManager::addDestination(const QString &fileDest, const QString &module, LogLevel level)
{
    QLoggerWriter *log;
    if (!moduleDest.contains(module))
    {
        log = new QLoggerWriter(fileDest,level);
        moduleDest.insert(module, log);
        return true;
    }
    return false;
}*/
bool QLoggerManager::addDestination(const QString &fileDest, const QStringList &modules, LogLevel level)
{
    QFile logFile(fileDest);

    if(logFile.exists())
    {
        if(logFile.open(QFile::ReadWrite | QFile::Text | QFile::Append))
        {
            logFile.write(QByteArray("=======================================================\n"));
        }
        logFile.close();
    }

    QLoggerWriter *log;
    bool retour(true);
    foreach (QString module, modules)
    {
        if (!moduleDest.contains(module))
        {
            log = new QLoggerWriter(fileDest,level);
            moduleDest.insert(module, log);
            retour &= true;
        }
        else
            retour &= false;
    }
    return retour;
}
Esempio n. 19
0
void LogWorker::readLog()
{
    QFile logFile(logPath);
    if(!logFile.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        qDebug() << "LogWorker: "<< "Esperando a log accesible...";
        emit sendLog(tr("Log: ERROR:Cannot open log..."));
        return;
    }

    logFile.seek(logSeek);

    char line[2048];
    int lineLenght;

    while((lineLenght = logFile.readLine(line, sizeof(line))) > 0)
    {
        if((line[lineLenght-1] != '\n') &&
                lineLenght<((int)sizeof(line)-1))
        {
//            qDebug() << "LogWorker: "<< "Leida linea a medias.";
            return;
        }

        emit newLogLineRead(QString(line));

        logSeek += lineLenght + 1;
        emit seekChanged(logSeek);
    }

    logFile.close();
}
Esempio n. 20
0
LOCAL_C void InitL()
	{
	TBuf<80> logFile(KLogFileName);

#if defined(__WINS__) && defined(__WINSCW__)
	logFile.Append(_L(".WINSCW"));
#elif(__WINS__)
	logFile.Append(_L(".WINS"));
#else
	logFile.Append(_L(".MARM"));
#endif

#if defined(_DEBUG)
	logFile.Append(_L(".DEB"));
#else
	logFile.Append(_L(".REL"));
#endif
	logFile.Append(_L(".LOG"));

	gTest.Printf(_L("\nLog File "));
	gTest.Printf(logFile);
	gTest.Printf(_L("\n"));
	log = CImLog::NewL(logFile, EAppend);
	CleanupStack::PushL(log);
	log->AppendComment(_L8("Test Results"));
	log->AppendComment(_L8("T_GMXMLFAILURE memory leak test in XMLParser"));
	log->AppendComment(_L8("Test 1 Starting"));
	}
Esempio n. 21
0
void Log::WriteToFile(LogLevel level, const std::string& logMessage)
{
	std::ofstream logFile("log.txt", std::ofstream::app);
	WriteTheTime(logFile);
	logFile << logLevelStrings[level];
	logFile << logMessage;
}
Esempio n. 22
0
 void LogOutput::flush(Buffer& buffer)
 {
     std::lock_guard<std::mutex> lock(::bkzoo::log::logMutex);
     std::ofstream logFile(filepath_, std::ofstream::app);
     logFile << buffer.data << std::flush;
     buffer.reset();
 }
Esempio n. 23
0
///-------------------------------------------------------------
/// Logs constraint list.
///-------------------------------------------------------------
void IKSolver::LogConstraintList(int frameNum, bool append)
{
	std::ios::openmode openMode = std::ios::out;
	if (append)
	{
		openMode = std::ios::app;
	}
	std::ofstream logFile("logs/constraints.txt", openMode);

	logFile << "Frame: " << frameNum << std::endl;
	logFile << "Num Constraints: " << mConstraintList.size() << std::endl;
	// loop and print data
	for (int i = 0; i < mConstraintList.size(); i++)
	{
		// get data
		Constraint & constraint = mConstraintList[i];

		// log data
		logFile << "Constraint " << i << "\tId: " << constraint.GetConstraintId() 
				<< "\tHandle Pos: " << constraint.GetHandleGlobalPos()
				<< "\tConstraint Pos: " << constraint.GetConstraintPos(frameNum)
				<< "\tValue: " << constraint.GetConstraintValue()
				<< "\tSqrLen: " << constraint.GetConstraintSquareLength()
				<< std::endl;
	}
	logFile << std::endl;

	logFile.close();
}
Esempio n. 24
0
void ompl::LTLVis::VRVPlanner::loadVerticesWithMetaData(void)
{
  ompl::LTLVis::VertexQuickStorage quickStorage(si_->getStateSpace());
  std::string fileNameRoadmap, fileNameCCs;
  fileNameRoadmap = ros::package::getPath("PR2_Card_Config");
  fileNameRoadmap = fileNameRoadmap + "/config/cardPuzzleWithMetaData_Roadmap.blg";
  fileNameCCs = ros::package::getPath("PR2_Card_Config");
  fileNameCCs = fileNameCCs + "/config/cardPuzzleWithMetaData_CCs.blg";

std::cout << "Attempting to load from files: " << fileNameRoadmap << " and " << fileNameCCs << std::endl;
  quickStorage.load(fileNameRoadmap.c_str());
std::cout << "Attempting to load from files: " << fileNameRoadmap << " and " << fileNameCCs << std::endl;
  ompl::LTLVis::tIndex maxK = quickStorage.size();
  vertices_.clear();
  nearFinder_.clear();
  for(ompl::LTLVis::tIndex k = 0; k < maxK; k++)
  {
    ompl::LTLVis::VRVVertex dummy(si_, quickStorage.getState(k));
    dummy.readNonFlagsFromMetaData(quickStorage.getMetadata(k));
    vertices_.push_back(dummy);
    nearFinder_.add(k);
  }
  std::ifstream logFile(fileNameCCs.c_str(), std::ios::binary);
  boost::archive::binary_iarchive oa(logFile);
  CCs_.reset();
  oa >> CCs_;
  for(ompl::LTLVis::tIndex k = 0; k < vertices_.size(); k++)
  {
    vertices_[k].setCCIndex(CCs_.find(vertices_[k].getCCIndex()));
  }
std::cout << "Loading done!" << std::endl;
}
Esempio n. 25
0
Common::WriteStream *OSystem_POSIX::createLogFile() {
	const char *home = getenv("HOME");
	if (home == NULL)
		return 0;

	Common::String logFile(home);
#ifdef MACOSX
	logFile += "/Library";
#else
	logFile += "/.scummvm";
#endif
#ifdef SAMSUNGTV
	logFile = "/mtd_ram";
#endif

	struct stat sb;

	// Check whether the dir exists
	if (stat(logFile.c_str(), &sb) == -1) {
		// The dir does not exist, or stat failed for some other reason.
		if (errno != ENOENT)
			return 0;

		// If the problem was that the path pointed to nothing, try
		// to create the dir.
		if (mkdir(logFile.c_str(), 0755) != 0)
			return 0;
	} else if (!S_ISDIR(sb.st_mode)) {
		// Path is no directory. Oops
		return 0;
	}

#ifdef MACOSX
	logFile += "/Logs";
#else
	logFile += "/logs";
#endif

	// Check whether the dir exists
	if (stat(logFile.c_str(), &sb) == -1) {
		// The dir does not exist, or stat failed for some other reason.
		if (errno != ENOENT)
			return 0;

		// If the problem was that the path pointed to nothing, try
		// to create the dir.
		if (mkdir(logFile.c_str(), 0755) != 0)
			return 0;
	} else if (!S_ISDIR(sb.st_mode)) {
		// Path is no directory. Oops
		return 0;
	}

	logFile += "/scummvm.log";

	Common::FSNode file(logFile);
	return file.createWriteStream();
}
Esempio n. 26
0
void
CollectionScanner::doJob() //SLOT
{
    std::cout << "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
    std::cout << "<scanner>";


    QStringList entries;

    if( m_restart ) {
        QFile logFile( m_logfile );
        logFile.open( IO_ReadOnly );
        QString lastFile = logFile.readAll();

        QFile folderFile( amaroK::saveLocation( QString::null ) + "collection_scan.files"   );
        folderFile.open( IO_ReadOnly );
        entries = QStringList::split( "\n", folderFile.readAll() );

        for( int count = entries.findIndex( lastFile ) + 1; count; --count )
            entries.pop_front();

//         debug() << "Restarting at: " << entries.front() << endl;
    }
    else {
        foreachType( QStringList, m_folders ) {
            if( (*it).isEmpty() )
                //apparently somewhere empty strings get into the mix
                //which results in a full-system scan! Which we can't allow
                continue;

            QString dir = *it;
            if( !dir.endsWith( "/" ) )
                dir += '/';

            readDir( dir, entries );
        }

        QFile folderFile( amaroK::saveLocation( QString::null ) + "collection_scan.files"   );
        folderFile.open( IO_WriteOnly );
        QTextStream stream( &folderFile );
        stream << entries.join( "\n" );
        folderFile.close();
    }

    if( !entries.isEmpty() ) {
        if( !m_restart ) {
            AttributeMap attributes;
            attributes["count"] = QString::number( entries.count() );
            writeElement( "itemcount", attributes );
        }

        scanFiles( entries );
    }

    std::cout << "</scanner>" << std::endl;

    quit();
}
Esempio n. 27
0
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
	std::ofstream logFile("logFile.txt", std::ofstream::trunc);

	Logger::addOutput(Logger::Level::DEBUG_L, logFile);
	Logger::addOutput(Logger::Level::INFO, std::cout);

	if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
	{
		Logger::log(Logger::Level::ERROR_L, "Initializing window failed!");
		return -1;
	}

	Direct3D D3D(g_hWnd);
	Logger::log(Logger::Level::INFO, "Initializing input...");
	g_input = Input();

	D3D.init(&g_input);
	

	__int64 cntsPerSec = 0;
	QueryPerformanceFrequency((LARGE_INTEGER*)&cntsPerSec);
	float secsPerCnt = 1.0f / (float)cntsPerSec;

	__int64 prevTimeStamp = 0;
	QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
	Logger::log(Logger::Level::INFO, "Initializing complete starting program");
	// Main message loop
	MSG msg = {0};
	while(WM_QUIT != msg.message)
	{
		if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE) )
		{
			TranslateMessage( &msg );
			DispatchMessage( &msg );
		}
		else
		{
			__int64 currTimeStamp = 0;
			QueryPerformanceCounter((LARGE_INTEGER*)&currTimeStamp);
			float dt = (currTimeStamp - prevTimeStamp) * secsPerCnt;
			POINT tempSize;
			tempSize.x = (LONG)(WIDTH * 0.5f);
			tempSize.y = (LONG)(HEIGHT * 0.5f);
			ClientToScreen(g_hWnd, &tempSize);
			SetCursorPos(tempSize.x, tempSize.y);
			ShowCursor(false);
			//render
			D3D.update(dt);
			D3D.draw();
			prevTimeStamp = currTimeStamp;
		}
	}

	D3D.release();
	logFile.close();
	return (int) msg.wParam;
}
Esempio n. 28
0
/*
 * Performs any neccesssary preparation and then sends the packet off to the destination
 */
void deliverPacket(npp_packet *npp)
{
	struct sockaddr_in sin;
	sin.sin_family = AF_INET;
	sin.sin_port = npp->dest_port;
	sin.sin_addr.s_addr = npp->dest_ip;
	sendNPPPacket(sock,(struct sockaddr*) &sin, npp);
	logFile("Packet successfully passed on", npp);
}
Esempio n. 29
0
Log::Log(LogLevel level)
: logLevel(level)
{
	static bool logFileCreated = false;
	if (!logFileCreated)
	{
		std::ofstream logFile("log.txt", std::ofstream::trunc);
		logFileCreated = true;
	}
}
Esempio n. 30
0
Log::Log(LogLevel level)
{
	static bool logFileCreated = false;	// whether or not the log file has been created this run of the converter
	if (!logFileCreated)
	{
		std::ofstream logFile("log.txt", std::ofstream::trunc);
		logFileCreated = true;
	}
    logLevel = level;
}