Commit 1ec4d825 authored by cvs2svn's avatar cvs2svn
Browse files

This commit was manufactured by cvs2svn to create tag 'COOL_2_7_0'.

git-svn-id: file:///git/lcgcool.svndb/cool/tags/COOL_2_7_0@15130 4525493e-7705-40b1-a816-d608a930855b
parent 0e4b3ad6
// $Id: Application.h,v 1.28 2008-11-04 11:56:26 avalassi Exp $
#ifndef COOLAPPLICATION_APPLICATION_H
#define COOLAPPLICATION_APPLICATION_H 1
// Include files
#include "CoolApplication/IApplication.h"
namespace cool
{
/**********************************************************************
** NB: this class should only be used in _STANDALONE_ applications **
** that cannot retrieve the IDatabaseSvc as a plugin because they **
** do not directly manage the loading of plugins into contexts. **
***********************************************************************
*
* @class Application Application.h
*
* COOL application class.
*
* This class takes care of loading all plugins needed to run COOL, using
* the relevant plugin technology. The implementation details (presently
* based on SEAL, later on CORAL or ROOT) are hidden from the public API.
*
* @author Andrea Valassi, Sven A. Schmidt and Marco Clemencic
* @date 2007-01-17
*/
/// AV 18.01.2007 - do NOT use virtual inheritance here!
/// For reasons that are still unclear, this makes it impossible to fetch
/// the COOL database service (the concrete RalDatabaseSvc is loaded and
/// instantiated, but it cannot be dynamic cast to an IDatabaseSvc...?
/// AV 05.07.2007 - removed all unnecessary virtual inheritance (task #4879).
//class Application : virtual public IApplication
class Application : public IApplication
{
public:
/// Constructor from a CORAL ConnectionService (if one is provided,
/// the user is responsible to keep it alive until the application is
/// alive; if none is provided, a new own one is created if necessary).
Application( coral::IConnectionService* connSvc = 0 );
/// Destructor.
virtual ~Application();
/// Retrieve a reference to the COOL database service.
IDatabaseSvc& databaseService()
{
return m_application->databaseService();
}
/// Get the output level threshold for COOL (and CORAL) messages.
/// *** WARNING: this may actually return a shared (static) value. ***
MSG::Level outputLevel()
{
return m_application->outputLevel();
}
/// Set the output level threshold for COOL (and CORAL) messages.
/// *** WARNING: this may actually change a shared (static) value. ***
void setOutputLevel( MSG::Level level )
{
m_application->setOutputLevel( level );
}
/// Get the SEAL context (if any) associated with this application.
/// *** WARNING: throws an exception for applications not using SEAL. ***
seal::Context* context() const
{
return m_application->context();
}
/// Get the CORAL connection service (if any) used in this application.
/// *** WARNING: throws an exception for applications not using CORAL. ***
coral::IConnectionService& connectionSvc() const
{
return m_application->connectionSvc();
}
private:
/// Privately owned implementation class to which all calls are delegated.
IApplication* m_application;
};
}
#endif // COOLAPPLICATION_APPLICATION_H
// $Id: DatabaseSvcFactory.h,v 1.7 2007-01-18 16:01:43 avalassi Exp $
#ifndef COOLAPPLICATION_DATABASESVCFACTORY_H
#define COOLAPPLICATION_DATABASESVCFACTORY_H 1
namespace cool
{
// Forward declarations
class IDatabaseSvc;
/**********************************************************************
** NB: this class should only be used in _STANDALONE_ applications **
** that cannot retrieve the IDatabaseSvc as a plugin because they **
** do not directly manage the loading of plugins into contexts. **
***********************************************************************
*
* @class DatabaseSvcFactory DatabaseSvcFactory.h
*
* Factory of standalone DatabaseSvc instances.
*
* This class takes care of loading all plugins needed to run COOL, using
* the relevant plugin technology. The implementation details (presently
* based on SEAL, later on CORAL or ROOT) are hidden from the public API.
*
* The application used to retrieve the service is a singleton owned by the
* class: the same service is returned by successive calls to databaseSvc().
*
* @author Andrea Valassi and Sven A. Schmidt
* @date 2004-12-08
*/
class DatabaseSvcFactory {
public:
/// Retrieve a reference to the COOL database service.
static IDatabaseSvc& databaseService();
};
}
#endif // COOLAPPLICATION_DATABASESVCFACTORY_H
// $Id: IApplication.h,v 1.10 2008-08-27 09:44:48 avalassi Exp $
#ifndef COOLAPPLICATION_IAPPLICATION_H
#define COOLAPPLICATION_IAPPLICATION_H 1
// Header was moved to CoolKernel in COOL 2.6.0 to remove cyclic dependencies
// The CoolApplication copy is kept for backward compatibility in the user API
#include "CoolKernel/IApplication.h"
#endif // COOLAPPLICATION_IAPPLICATION_H
// $Id: MessageLevels.h,v 1.6 2008-08-27 09:44:48 avalassi Exp $
#ifndef COOLAPPLICATION_MESSAGELEVELS_H
#define COOLAPPLICATION_MESSAGELEVELS_H 1
// Header was moved to CoolKernel in COOL 2.6.0 to remove cyclic dependencies
// The CoolApplication copy is kept for backward compatibility in the user API
#include "CoolKernel/MessageLevels.h"
#endif // COOLAPPLICATION_MESSAGELEVELS_H
#============================================================================
# $ Id: requirements,v 1.1 2005/08/19 10:22:00 marcocle Exp $
#============================================================================
package CoolApplication
#============================================================================
#============================================================================
# Public dependencies
#============================================================================
use CoolKernel v*
use RelationalCool v*
#============================================================================
# Build rules
#============================================================================
apply_pattern include_dir_policy
apply_pattern lcg_shared_library
#============================================================================
private
#============================================================================
macro_append use_linkopts ' $(Boost_linkopts_thread)'
# Link the CORAL libraries
apply_tag NEEDS_CORAL_BASE
# Fake target for tests
action tests "echo No tests in this package"
macro_remove cmt_actions_constituents "tests"
# Fake target for examples
action examples "echo No examples in this package"
macro_remove cmt_actions_constituents "examples"
This diff is collapsed.
// $Id: Application.cpp,v 1.22 2008-06-03 15:22:13 avalassi Exp $
// Include files
//#include <iostream>
#include "CoolApplication/Application.h"
#include "../RelationalCool/src/CoralApplication.h"
// Namespace
using namespace cool;
// Message output
//#define COUT std::cout << "__cool::Application "
//#define ENDL std::endl
//-----------------------------------------------------------------------------
Application::Application( coral::IConnectionService* connSvc )
{
//COUT << "Application(): ** START **" << std::endl;
m_application = new CoralApplication( connSvc );
//COUT << "Application(): *** END ***" << ENDL;
}
//-----------------------------------------------------------------------------
Application::~Application()
{
//COUT << "~Application(): ** START **" << ENDL;
delete m_application;
//COUT << "~Application(): *** END ***" << ENDL;
}
//-----------------------------------------------------------------------------
// $Id: DatabaseSvcFactory.cpp,v 1.10 2008-04-14 16:54:45 avalassi Exp $
// Include files
#include <memory>
#include "CoolApplication/Application.h"
#include "CoolApplication/DatabaseSvcFactory.h"
// Namespace
using namespace cool;
//-----------------------------------------------------------------------------
IDatabaseSvc&
DatabaseSvcFactory::databaseService()
{
/*
static std::auto_ptr<Application> pApp;
if ( ! pApp.get() ) {
pApp.reset( new Application() );
}
return pApp->databaseService();
*/
static Application app;
return app.databaseService();
}
//-----------------------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment