Commit ba3257c8 authored by Oliver Bock's avatar Oliver Bock
Browse files

Initial import (incl. first release tag, without merge)

git-svn-id: https://svn.origo.ethz.ch/fidelity@3 53d1999f-d1a8-4366-aa61-588fded17473
parents
This diff is collapsed.
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#include "ALoggingFacility.h"
Fidelity::Common::ALoggingFacility::ALoggingFacility()
{
initAttributes();
}
Fidelity::Common::ALoggingFacility::~ALoggingFacility()
{
}
void Fidelity::Common::ALoggingFacility::initAttributes()
{
}
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#ifndef ALOGGINGFACILITY_H
#define ALOGGINGFACILITY_H
#include "ILoggingFacility.h"
namespace Fidelity {
namespace Common {
/**
* @author Oliver Bock <bock@tfh-berlin.de>
*
* This abstract class is used to provide the members common to all logging facilities.
*/
class ALoggingFacility : public ILoggingFacility
{
public:
/**
* Constructor
*/
ALoggingFacility();
/**
* Destructor
*/
virtual ~ALoggingFacility();
private:
/**
* Initialise private members of this class.
* Called in the Constructor of this class.
*/
void initAttributes();
};}}
#endif // ALOGGINGFACILITY_H
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#include "ConsoleLogging.h"
Fidelity::Common::ConsoleLogging::ConsoleLogging() : ALoggingFacility()
{
initAttributes();
}
Fidelity::Common::ConsoleLogging::~ConsoleLogging()
{}
void Fidelity::Common::ConsoleLogging::initAttributes()
{
qInstallMsgHandler(messageHandler);
}
void Fidelity::Common::ConsoleLogging::messageHandler(QtMsgType type, const char * msg)
{
switch (type) {
case QtDebugMsg:
fprintf(stderr, "Debug: %s\n", msg);
break;
case QtWarningMsg:
fprintf(stderr, "Warning: %s\n", msg);
break;
case QtCriticalMsg:
fprintf(stderr, "Critical: %s\n", msg);
break;
case QtFatalMsg:
fprintf(stderr, "Fatal: %s (aborting)\n", msg);
abort();
}
}
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#ifndef ACONSOLELOGGING_H
#define ACONSOLELOGGING_H
#include <QtDebug>
#include <stdio.h>
#include <stdlib.h>
#include "ALoggingFacility.h"
namespace Fidelity {
namespace Common {
/**
* @author Oliver Bock <bock@tfh-berlin.de>
*
* This class provides means for console logging by directing any output to STDOUT and STDERR.
*/
class ConsoleLogging : public ALoggingFacility
{
Q_OBJECT;
public:
/**
* Constructor
*/
ConsoleLogging();
/**
* Destructor
*/
virtual ~ConsoleLogging();
/**
* This methods is called by the Qt messaging system, hence is required
* to be implemented by all concrete classes of lLoggingFacility!
* (It's not possible, however, to include a pure virtual version of this
* declaration in lLoggingFacility due to technical reasons).
* The registration as the current Qt-MsgHandler happens in initAttributes()
* using qInstallMsgHandler().
* @return The pointer to the logging facility
* @param type The type of the requested logging facility
* @param msg The log message to be written.
*/
static void messageHandler(QtMsgType type, const char* msg);
private:
/**
* Initialise private members of this class.
* Called in the Constructor of this class.
*/
void initAttributes();
};}}
#endif // ACONSOLELOGGING_H
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#include "GlobalConstants.h"
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
/**
* @author Oliver Bock <bock@tfh-berlin.de>
*
*/
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#ifndef ILOGGINGFACILITY_H
#define ILOGGINGFACILITY_H
#include <QObject>
namespace Fidelity {
namespace Common {
/**
* @author Oliver Bock <bock@tfh-berlin.de>
*
* This interface defines all methods any concrete logging class is required to provide.
*/
class ILoggingFacility : public QObject
{
public:
/**
* Destructor
*/
virtual ~ILoggingFacility() {};
};}}
#endif // ILOGGINGFACILITY_H
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#include "LoggingFactory.h"
Fidelity::Common::LoggingFactory::LoggingFactory()
{
initAttributes();
}
Fidelity::Common::LoggingFactory::~LoggingFactory()
{
}
void Fidelity::Common::LoggingFactory::initAttributes()
{
}
ILoggingFacility* Fidelity::Common::LoggingFactory::createInstance(LoggingFacilityType type)
{
switch (type) {
case Console: {
return(new ConsoleLogging());
break;
}
default: {
return(NULL);
}
}
}
/*************************************************************************
* Copyright (C) 2007 by Oliver Bock *
* bock@tfh-berlin.de *
* *
* This file is part of Fidelity. *
* *
* Fidelity is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation, version 3 of the License. *
* *
* Fidelity is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with Fidelity. If not, see <http://www.gnu.org/licenses/>. *
* *
*************************************************************************/
#ifndef LOGGINGFACTORY_H
#define LOGGINGFACTORY_H
#include "ILoggingFacility.h"
#include "ConsoleLogging.h"
using namespace Fidelity::Common;
namespace Fidelity {
namespace Common {
/**
* This enumeration provides a list of all
* available logging facilities
*/
enum LoggingFacilityType
{
Console
};
/**
* @author Oliver Bock <bock@tfh-berlin.de>
*
* This factory class creates instances of logging facilities implementing the ILoggingFacility interface.
*/
class LoggingFactory : ILoggingFacility
{
Q_OBJECT;
public:
/**
* Constructor
*/
LoggingFactory();
/**
* Destructor
*/
virtual ~LoggingFactory();
/**
* Creates an instance of the requested logging facility
* or returns NULL if it is not available.
* @return The pointer to the logging facility
* @param type The type of the requested logging facility
*/
static ILoggingFacility* createInstance(LoggingFacilityType type);
private:
/**
* Initialise private members of this class.
* Called in the Constructor of this class.
*/
void initAttributes();
};}}
#endif // LOGGINGFACTORY_H
#########################################################################
# Copyright (C) 2007 by Oliver Bock #
# bock@tfh-berlin.de #
# #
# This file is part of Fidelity. #
# #
# Fidelity is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published #
# by the Free Software Foundation, version 3 of the License. #
# #
# Fidelity is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with Fidelity. If not, see <http://www.gnu.org/licenses/>. #
# #
#########################################################################
include( ../fidelity.pri )
TEMPLATE = lib
CONFIG += dll
QT += core
TARGET = fidelitycommon
win32 {
DESTDIR = ../bin
}
else {
DESTDIR = ../bin/libs
}
SOURCES += ConsoleLogging.cpp \
ALoggingFacility.cpp \
LoggingFactory.cpp \
GlobalConstants.cpp
HEADERS += ConsoleLogging.h \
ALoggingFacility.h \
ILoggingFacility.h \
LoggingFactory.h \
GlobalConstants.h
This diff is collapsed.
<hr size="1">
<table col="3" width="100%">
<tr>
<td width="150"><a href="http://fidelity.sourceforge.net"><img src="fidelity_doxygen.png" alt="Fidelity" align="left" border="0"></a></td>
<td width="*"><address align="center"><small>Generated on $datetime</small></address></td>
<td width="150"><a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="right" border="0"></a></td>
<tr>
</table>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>$title</title>
<link href="$relpath$doxygen.css" rel="stylesheet" type="text/css">
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css">
</head><body>
BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
BODY,TD {
font-size: 90%;
}
H1 {
text-align: center;
font-size: 160%;
}
H2 {
font-size: 120%;
}
H3 {
font-size: 100%;
}
CAPTION { font-weight: bold }
DIV.qindex {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.nav {
width: 100%;
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
padding: 2px;
line-height: 140%;
}
DIV.navtab {
background-color: #e8eef2;
border: 1px solid #84b0c7;
text-align: center;
margin: 2px;
margin-right: 15px;
padding: 2px;
}
TD.navtab {
font-size: 70%;
}
A.qindex {
text-decoration: none;
font-weight: bold;
color: #1A419D;
}
A.qindex:visited {
text-decoration: none;
font-weight: bold;
color: #1A419D
}
A.qindex:hover {
text-decoration: none;
background-color: #ddddff;
}
A.qindexHL {
text-decoration: none;
font-weight: bold;
background-color: #6666cc;
color: #ffffff;
border: 1px double #9295C2;
}
A.qindexHL:hover {
text-decoration: none;
background-color: #6666cc;
color: #ffffff;
}
A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff }
A.el { text-decoration: none; font-weight: bold }
A.elRef { font-weight: bold }
A.code:link { text-decoration: none; font-weight: normal; color: #0000FF}
A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF}
A.codeRef:link { font-weight: normal; color: #0000FF}
A.codeRef:visited { font-weight: normal; color: #0000FF}
A:hover { text-decoration: none; background-color: #f2f2ff }
DL.el { margin-left: -1cm }
.fragment {
font-family: monospace, fixed;
font-size: 95%;
}
PRE.fragment {
border: 1px solid #CCCCCC;
background-color: #f5f5f5;
margin-top: 4px;
margin-bottom: 4px;
margin-left: 2px;
margin-right: 8px;
padding-left: 6px;
padding-right: 6px;
padding-top: 4px;
padding-bottom: 4px;
}
DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px }
DIV.groupHeader {
margin-left: 16px;
margin-top: 12px;
margin-bottom: 6px;
font-weight: bold;
}