* ./hurricane/src/hurricane/Name.h

./hurricane/src/hurricane/Name.cpp :
   - New feature : Allocate a static member "_emptyName" which could be used
       to manage effeciently empty Name (for functions returning reference on
       Name, by example).

 * ./hurricane/src/hurricane/Property.h
   ./hurricane/src/hurricane/Property.cpp :
   - Change : Now StandardPrivateProperty & StandardSharedProperty templates
       systematically uses static member for the property's name. This leads
       to suppress the "const Name&" argument when creating a property, and
       the _name member is no longer present in each object instance.
   - Change : Property must now be created/get through static methods :
               StandardPrivateProperty<Value>::get ( DBo* );
               StandardPrivateProperty<Value>::create ( DBo* );
               StandardPrivateProperty<Value>::create ( DBo*, const Value& );
       Note that, as before, the Value type must provide a default constructor
       and a copy constructor.

  * ./hurricane/src/hviewer/DisplayStyle.cpp :
    Bug : early Graphics::enable() no longer makes application crash.
This commit is contained in:
Jean-Paul Chaput 2008-10-04 15:44:15 +00:00
parent 8fe480ea30
commit e32a20b23f
13 changed files with 995 additions and 814 deletions

View File

@ -1,49 +1,68 @@
// ****************************************************************************************************
// File: DBo.cpp // -*- C++ -*-
// Authors: R. Escassut //
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved // This file is part of the Hurricane Software.
// **************************************************************************************************** // Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./DBo.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/DBo.h" #include "hurricane/DBo.h"
#include "hurricane/Property.h" #include "hurricane/Property.h"
#include "hurricane/Quark.h" #include "hurricane/Quark.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
namespace Hurricane { namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::DBo".
// ****************************************************************************************************
// DBo implementation
// ****************************************************************************************************
DBo::DBo() DBo::DBo (): _propertySet()
// ******* { }
: _propertySet()
{
}
DBo::~DBo () DBo::~DBo ()
// ******** { }
void DBo::_postCreate ()
{ }
void DBo::_preDestroy ()
{ {
clearProperties ();
} }
void DBo::destroy()
// ***************
{
// trace << "entering DBo::destroy: " << this << endl;
// trace_in();
void DBo::destroy ()
{
_preDestroy(); _preDestroy();
delete this; delete this;
// trace << "exiting DBo::destroy:" << endl;
// trace_out();
} }
Property* DBo::getProperty ( const Name& name ) const Property* DBo::getProperty ( const Name& name ) const
// ***********************************************
{ {
PropertySet::const_iterator iterator = _propertySet.begin(); PropertySet::const_iterator iterator = _propertySet.begin();
while ( iterator != _propertySet.end() ) { while ( iterator != _propertySet.end() ) {
@ -54,11 +73,17 @@ Property* DBo::getProperty(const Name& name) const
return NULL; return NULL;
} }
Properties DBo::getProperties () const
{
return getCollection(_propertySet);
}
void DBo::put ( Property* property ) void DBo::put ( Property* property )
// ******************************
{ {
if ( !property ) if ( !property )
throw Error("Can't put property : null property"); throw Error("DBo::put(): Can't put property : NULL property.");
Property* oldProperty = getProperty ( property->getName() ); Property* oldProperty = getProperty ( property->getName() );
if ( property != oldProperty ) { if ( property != oldProperty ) {
@ -71,96 +96,71 @@ void DBo::put(Property* property)
} }
} }
void DBo::remove ( Property* property ) void DBo::remove ( Property* property )
// *********************************
{ {
if ( !property ) if ( !property )
throw Error("Can't remove property : null property"); throw Error("DBo::remove(): Can't remove property : NULL property.");
if ( _propertySet.find(property) != _propertySet.end() ) { if ( _propertySet.find(property) != _propertySet.end() ) {
_propertySet.erase ( property ); _propertySet.erase ( property );
property->onReleasedBy ( this ); property->onReleasedBy ( this );
if (dynamic_cast<Quark*>(this) && _propertySet.empty()) destroy(); if ( dynamic_cast<Quark*>(this) && _propertySet.empty() )
destroy();
} }
} }
void DBo::removeProperty ( const Name& name ) void DBo::removeProperty ( const Name& name )
// ***************************************
{ {
Property* property = getProperty ( name ); Property* property = getProperty ( name );
if ( property ) { if ( property ) {
_propertySet.erase ( property ); _propertySet.erase ( property );
property->onReleasedBy ( this ); property->onReleasedBy ( this );
if (dynamic_cast<Quark*>(this) && _propertySet.empty()) destroy(); if ( dynamic_cast<Quark*>(this) && _propertySet.empty() )
destroy();
} }
} }
void DBo::_onDestroyed ( Property* property )
{
if ( property && ( _propertySet.find(property) != _propertySet.end() ) ) {
_propertySet.erase ( property );
if ( dynamic_cast<Quark*>(this) && _propertySet.empty() )
destroy();
}
}
void DBo::clearProperties () void DBo::clearProperties ()
// ************************
{ {
// trace << "entering DBo::ClearProperties: " << this << endl;
// trace_in();
while ( !_propertySet.empty() ) { while ( !_propertySet.empty() ) {
Property* property = *_propertySet.begin(); Property* property = *_propertySet.begin();
// trace << property << endl;
_propertySet.erase ( property ); _propertySet.erase ( property );
property->onReleasedBy ( this ); property->onReleasedBy ( this );
} }
// trace << "exiting DBo::ClearProperties:" << endl;
// trace_out();
} }
void DBo::_postCreate()
// ********************
{
}
void DBo::_preDestroy()
// *******************
{
// trace << "entering DBo::_Predestroy: " << this << endl;
// trace_in();
clearProperties();
// trace << "exiting DBo::_Predestroy:" << endl;
// trace_out();
}
string DBo::_getTypeName () const string DBo::_getTypeName () const
// ******************************
{ {
return "DBo"; return "DBo";
} }
string DBo::_getString () const string DBo::_getString () const
// ***************************
{ {
return "<" + _getTypeName() + ">"; return "<" + _getTypeName() + ">";
} }
Record* DBo::_getRecord () const Record* DBo::_getRecord () const
// **********************
{ {
Record* record = new Record ( getString(this) ); Record* record = new Record ( getString(this) );
record->add ( getSlot("Properties", &_propertySet) ); record->add ( getSlot("Properties", &_propertySet) );
return record; return record;
} }
void DBo::_onDestroyed(Property* property)
// *************************************
{
if (property && (_propertySet.find(property) != _propertySet.end())) {
_propertySet.erase(property);
if (dynamic_cast<Quark*>(this) && _propertySet.empty()) destroy();
}
}
} // End of Hurricane namespace. } // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -39,21 +39,19 @@ namespace Hurricane {
: Exception() : Exception()
, _reason(reason) , _reason(reason)
, _code(0) , _code(0)
{ { }
}
Error::Error ( int code, const string& reason ) Error::Error ( int code, const string& reason )
: Exception() : Exception()
, _reason(reason) , _reason(reason)
, _code(code) , _code(code)
{ { }
}
Error::Error ( const char* format, ... ) Error::Error ( const char* format, ... )
: Exception() : Exception()
, _reason("") , _reason()
, _code(0) , _code(0)
{ {
static char formatted [ 8192 ]; static char formatted [ 8192 ];
@ -69,7 +67,7 @@ namespace Hurricane {
Error::Error ( int code, const char* format, ... ) Error::Error ( int code, const char* format, ... )
: Exception() : Exception()
, _reason("") , _reason()
, _code(code) , _code(code)
{ {
static char formatted [ 8192 ]; static char formatted [ 8192 ];

View File

@ -15,6 +15,10 @@ namespace Hurricane {
// Name implementation // Name implementation
// **************************************************************************************************** // ****************************************************************************************************
const Name Name::_emptyName;
Name::Name() Name::Name()
// ********* // *********
: _sharedName(NULL) : _sharedName(NULL)

View File

@ -1,102 +1,129 @@
// ****************************************************************************************************
// File: Property.cpp // -*- C++ -*-
// Authors: R. Escassut //
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved // This file is part of the Hurricane Software.
// **************************************************************************************************** // Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./Property.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#include "hurricane/Property.h" #include "hurricane/Property.h"
#include "hurricane/DBo.h" #include "hurricane/DBo.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
namespace Hurricane { namespace Hurricane {
// Error messages.
const char* propertyTypeNameError =
"Property<%s>::get():\n Discrepency between type and property name on %s.\n";
// -------------------------------------------------------------------
// Class : "Hurricane::Property".
Name Property::_baseName = "Property";
Name Property::staticGetName ()
{
return _baseName;
}
// ****************************************************************************************************
// Property implementation
// ****************************************************************************************************
Property::Property () Property::Property ()
// ***************** { }
{
}
Property::~Property () Property::~Property ()
// ****************** { }
{
}
void Property::destroy () void Property::destroy ()
// ********************
{ {
_preDestroy(); _preDestroy();
delete this; delete this;
} }
string Property::_getString () const string Property::_getString () const
// ********************************
{ {
string s = "<" + _getTypeName() + ">"; string s = "<" + _getTypeName() + ">";
s.insert(s.length() - 1, " " + getString(getName())); s.insert(s.length() - 1, " " + getString(getName()));
return s; return s;
} }
Record* Property::_getRecord () const Record* Property::_getRecord () const
// ***************************
{ {
return new Record(getString(this)); return new Record(getString(this));
} }
// -------------------------------------------------------------------
// Class : "Hurricane::PrivateProperty".
// ****************************************************************************************************
// PrivateProperty implementation
// ****************************************************************************************************
PrivateProperty::PrivateProperty () PrivateProperty::PrivateProperty ()
// ******************************* : Property()
: Inherit(), , _owner(NULL)
_owner(NULL) { }
{
}
void PrivateProperty::_preDestroy () void PrivateProperty::_preDestroy ()
// *******************************
{ {
Inherit::_preDestroy(); Property::_preDestroy();
if ( _owner ) _owner->_onDestroyed(this); if ( _owner ) _owner->_onDestroyed(this);
} }
void PrivateProperty::onCapturedBy ( DBo* owner ) void PrivateProperty::onCapturedBy ( DBo* owner )
// *******************************************
{ {
_owner = owner; _owner = owner;
} }
void PrivateProperty::onReleasedBy ( DBo* owner ) void PrivateProperty::onReleasedBy ( DBo* owner )
// *******************************************
{ {
if ( _owner == owner ) onNotOwned(); if ( _owner == owner ) onNotOwned();
} }
void PrivateProperty::onNotOwned () void PrivateProperty::onNotOwned ()
// *******************************
{ {
destroy(); destroy();
} }
string PrivateProperty::_getString () const string PrivateProperty::_getString () const
// ***************************************
{ {
return Inherit::_getString(); return Property::_getString ();
} }
Record* PrivateProperty::_getRecord () const Record* PrivateProperty::_getRecord () const
// **********************************
{ {
Record* record = Inherit::_getRecord(); Record* record = Property::_getRecord();
if (record) { if (record) {
record->add(getSlot("Owner", _owner)); record->add(getSlot("Owner", _owner));
} }
@ -104,22 +131,19 @@ Record* PrivateProperty::_getRecord() const
} }
// -------------------------------------------------------------------
// Class : "Hurricane::SharedProperty".
// ****************************************************************************************************
// SharedProperty implementation
// ****************************************************************************************************
SharedProperty::SharedProperty () SharedProperty::SharedProperty ()
// ***************************** : Property()
: Inherit(), , _ownerSet()
_ownerSet() { }
{
}
void SharedProperty::_preDestroy () void SharedProperty::_preDestroy ()
// ******************************
{ {
Inherit::_preDestroy(); Property::_preDestroy();
while (!_ownerSet.empty()) { while (!_ownerSet.empty()) {
DBo* owner = *_ownerSet.begin(); DBo* owner = *_ownerSet.begin();
@ -128,36 +152,36 @@ void SharedProperty::_preDestroy()
} }
} }
void SharedProperty::onCapturedBy ( DBo* owner ) void SharedProperty::onCapturedBy ( DBo* owner )
// ******************************************
{ {
_ownerSet.insert(owner); _ownerSet.insert(owner);
} }
void SharedProperty::onReleasedBy ( DBo* owner ) void SharedProperty::onReleasedBy ( DBo* owner )
// ******************************************
{ {
_ownerSet.erase(owner); _ownerSet.erase(owner);
if (_ownerSet.empty()) onNotOwned(); if (_ownerSet.empty()) onNotOwned();
} }
void SharedProperty::onNotOwned () void SharedProperty::onNotOwned ()
// ******************************
{ {
destroy(); destroy();
} }
string SharedProperty::_getString () const string SharedProperty::_getString () const
// **************************************
{ {
return Inherit::_getString(); return Property::_getString ();
} }
Record* SharedProperty::_getRecord () const Record* SharedProperty::_getRecord () const
// *********************************
{ {
Record* record = Inherit::_getRecord(); Record* record = Property::_getRecord();
if (record) { if (record) {
record->add(getSlot("Owners", &_ownerSet)); record->add(getSlot("Owners", &_ownerSet));
} }
@ -165,9 +189,4 @@ Record* SharedProperty::_getRecord() const
} }
} // End of Hurricane namespace. } // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -1,55 +1,112 @@
// ****************************************************************************************************
// File: Warning.cpp // -*- C++ -*-
// Authors: R. Escassut //
// This file is part of the Hurricane Software.
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved // Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// **************************************************************************************************** //
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Remy Escassut |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Module : "./Warning.cpp" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# include <cstdarg>
# include "hurricane/Warning.h" # include "hurricane/Warning.h"
namespace Hurricane { namespace Hurricane {
// -------------------------------------------------------------------
// Class : "Hurricane::Warning".
// ****************************************************************************************************
// Warning implementation
// ****************************************************************************************************
Warning::Warning(const string& reason, int code) Warning::Warning ( const string& reason )
// ********************************************* : Exception()
: Inherit(), , _reason(reason)
_reason(reason), , _code(0)
_code(code) { }
Warning::Warning ( int code, const string& reason )
: Exception()
, _reason(reason)
, _code(code)
{ }
Warning::Warning ( const char* format, ... )
: Exception()
, _reason()
, _code(0)
{ {
static char formatted [ 8192 ];
va_list args;
va_start ( args, format );
vsnprintf ( formatted, 8191, format, args );
va_end ( args );
_reason = formatted;
} }
Warning::Warning ( int code, const char* format, ... )
: Exception()
, _reason()
, _code(code)
{
static char formatted [ 8192 ];
va_list args;
va_start ( args, format );
vsnprintf ( formatted, 8191, format, args );
va_end ( args );
_reason = formatted;
}
Warning::Warning ( const Warning& warning ) Warning::Warning ( const Warning& warning )
// ************************************* : Exception()
: Inherit(), , _reason(warning._reason)
_reason(warning._reason), , _code(warning._code)
_code(warning._code) { }
{
}
Warning& Warning::operator= ( const Warning& warning ) Warning& Warning::operator= ( const Warning& warning )
// ************************************************
{ {
_reason = warning._reason; _reason = warning._reason;
_code = warning._code; _code = warning._code;
return *this; return *this;
} }
string Warning::_getTypeName () const
{ return _TName("Warning"); }
string Warning::_getString () const string Warning::_getString () const
// *******************************
{ {
if (!_code) return "[WARNING] " + _reason; if (!_code)
return "[WARNING] " + _reason;
return "[WARNING:" + getString(_code) + "] " + _reason; return "[WARNING:" + getString(_code) + "] " + _reason;
} }
} // End of Hurricane namespace. } // End of Hurricane namespace.
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -129,7 +129,7 @@ template<typename Data> inline Hurricane::Slot* getSlot ( const std::string& nam
// Default match. // Default match.
template<typename Data> inline std::string getString ( Data data ) template<typename Data> inline std::string getString ( Data data )
{ return "<Data Unsupported by getString>"; } { return "<Data type unsupported by getString()>"; }
// "const *" flavors. // "const *" flavors.
@ -524,6 +524,14 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
} }
# define GETSTRING_POINTER_SUPPORT(Data) \
template<> inline std::string getString<Data*>( Data* data ) \
{ if (!data) return "NULL " #Data; return data->_getString(); } \
\
template<> inline std::string getString<const Data*>( const Data* data ) \
{ if (!data) return "NULL const " #Data; return data->_getString(); }
# define IOSTREAM_POINTER_SUPPORT(Data) \ # define IOSTREAM_POINTER_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data* d ) \ inline std::ostream& operator<< ( std::ostream& o, Data* d ) \
{ \ { \
@ -537,13 +545,7 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
} }
# define INSPECTOR_POINTER_SUPPORT(Data) \ # define GETRECORD_POINTER_SUPPORT(Data) \
template<> inline std::string getString<Data*>( Data* data ) \
{ if (!data) return "NULL " #Data; return data->_getString(); } \
\
template<> inline std::string getString<const Data*>( const Data* data ) \
{ if (!data) return "NULL const " #Data; return data->_getString(); } \
\
template<> inline Hurricane::Record* getRecord<Data*>( Data* data ) \ template<> inline Hurricane::Record* getRecord<Data*>( Data* data ) \
{ if (!data) return NULL; return data->_getRecord(); } \ { if (!data) return NULL; return data->_getRecord(); } \
\ \
@ -551,6 +553,14 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
{ if (!data) return NULL; return data->_getRecord(); } \ { if (!data) return NULL; return data->_getRecord(); } \
# define GETSTRING_REFERENCE_SUPPORT(Data) \
template<> inline std::string getString<Data&>( Data& data ) \
{ return data._getString(); } \
\
template<> inline std::string getString<const Data&>( const Data& data ) \
{ return data._getString(); }
# define IOSTREAM_REFERENCE_SUPPORT(Data) \ # define IOSTREAM_REFERENCE_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data& d ) \ inline std::ostream& operator<< ( std::ostream& o, Data& d ) \
{ return o << getString<Data&>(d); } \ { return o << getString<Data&>(d); } \
@ -559,13 +569,7 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
{ return o << getString<Data&>(d); } { return o << getString<Data&>(d); }
# define INSPECTOR_REFERENCE_SUPPORT(Data) \ # define GETRECORD_REFERENCE_SUPPORT(Data) \
template<> inline std::string getString<Data&>( Data& data ) \
{ return data._getString(); } \
\
template<> inline std::string getString<const Data&>( const Data& data ) \
{ return data._getString(); } \
\
template<> inline Hurricane::Record* getRecord<Data&>( Data& data ) \ template<> inline Hurricane::Record* getRecord<Data&>( Data& data ) \
{ return data._getRecord(); } \ { return data._getRecord(); } \
\ \
@ -573,44 +577,53 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
{ return data._getRecord(); } { return data._getRecord(); }
# define GETSTRING_VALUE_SUPPORT(Data) \
template<> inline std::string getString<Data>( Data data ) \
{ return data._getString(); }
# define IOSTREAM_VALUE_SUPPORT(Data) \ # define IOSTREAM_VALUE_SUPPORT(Data) \
inline std::ostream& operator<< ( std::ostream& o, Data d ) \ inline std::ostream& operator<< ( std::ostream& o, Data d ) \
{ return o << getString<Data>(d); } { return o << getString<Data>(d); }
# define INSPECTOR_VALUE_SUPPORT(Data) \ # define GETRECORD_VALUE_SUPPORT(Data) \
template<> inline std::string getString<Data>( Data data ) \
{ return data._getString(); } \
\
template<> inline Hurricane::Record* getRecord<Data>( Data data ) \ template<> inline Hurricane::Record* getRecord<Data>( Data data ) \
{ return data._getRecord(); } { return data._getRecord(); }
# define INSPECTOR_P_SUPPORT(Data) \ # define INSPECTOR_P_SUPPORT(Data) \
INSPECTOR_POINTER_SUPPORT(Data) \ GETRECORD_POINTER_SUPPORT(Data) \
GETSTRING_POINTER_SUPPORT(Data) \
IOSTREAM_POINTER_SUPPORT(Data) IOSTREAM_POINTER_SUPPORT(Data)
# define INSPECTOR_R_SUPPORT(Data) \ # define INSPECTOR_R_SUPPORT(Data) \
INSPECTOR_REFERENCE_SUPPORT(Data) \ GETRECORD_REFERENCE_SUPPORT(Data) \
GETSTRING_REFERENCE_SUPPORT(Data) \
IOSTREAM_REFERENCE_SUPPORT(Data) IOSTREAM_REFERENCE_SUPPORT(Data)
# define INSPECTOR_V_SUPPORT(Data) \ # define INSPECTOR_V_SUPPORT(Data) \
INSPECTOR_VALUE_SUPPORT(Data) \ GETRECORD_VALUE_SUPPORT(Data) \
GETSTRING_VALUE_SUPPORT(Data) \
IOSTREAM_VALUE_SUPPORT(Data) IOSTREAM_VALUE_SUPPORT(Data)
# define INSPECTOR_PR_SUPPORT(Data) \ # define INSPECTOR_PR_SUPPORT(Data) \
INSPECTOR_POINTER_SUPPORT(Data) \ GETRECORD_POINTER_SUPPORT(Data) \
INSPECTOR_REFERENCE_SUPPORT(Data) \ GETSTRING_POINTER_SUPPORT(Data) \
GETRECORD_REFERENCE_SUPPORT(Data) \
GETSTRING_REFERENCE_SUPPORT(Data) \
IOSTREAM_POINTER_SUPPORT(Data) \ IOSTREAM_POINTER_SUPPORT(Data) \
IOSTREAM_REFERENCE_SUPPORT(Data) IOSTREAM_REFERENCE_SUPPORT(Data)
# define INSPECTOR_PV_SUPPORT(Data) \ # define INSPECTOR_PV_SUPPORT(Data) \
INSPECTOR_POINTER_SUPPORT(Data) \ GETRECORD_POINTER_SUPPORT(Data) \
INSPECTOR_VALUE_SUPPORT(Data) \ GETSTRING_POINTER_SUPPORT(Data) \
GETRECORD_VALUE_SUPPORT(Data) \
GETSTRING_VALUE_SUPPORT(Data) \
IOSTREAM_POINTER_SUPPORT(Data) \ IOSTREAM_POINTER_SUPPORT(Data) \
IOSTREAM_VALUE_SUPPORT(Data) IOSTREAM_VALUE_SUPPORT(Data)

View File

@ -1,99 +1,89 @@
// ****************************************************************************************************
// File: DBo.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_DBO // -*- C++ -*-
#define HURRICANE_DBO //
// This file is part of the Hurricane Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./DBo.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_DBO__
#define __HURRICANE_DBO__
#include "hurricane/DBos.h" #include "hurricane/DBos.h"
#include "hurricane/Properties.h"
#include "hurricane/Name.h" #include "hurricane/Name.h"
#include "hurricane/Property.h"
namespace Hurricane { namespace Hurricane {
class Property;
// -------------------------------------------------------------------
// Class : "Hurricane::DBo".
// ****************************************************************************************************
// DBo declaration
// ****************************************************************************************************
class DBo { class DBo {
// ********
#if !defined(__DOXYGEN_PROCESSOR__) public:
// Types.
typedef set<Property*> PropertySet;
// Methods.
virtual void destroy();
inline PropertySet& _getPropertySet ();
void _onDestroyed ( Property* property );
Property* getProperty ( const Name& ) const;
Properties getProperties () const;
inline bool hasProperty () const;
void put ( Property* );
void remove ( Property* );
void removeProperty ( const Name& );
void clearProperties ();
// Hurricane Managment.
virtual string _getTypeName () const;
virtual string _getString () const;
virtual Record* _getRecord () const;
// Types private:
// ***** // Internal: Attributes.
mutable PropertySet _propertySet;
public: typedef set<Property*> PropertySet;
// Attributs
// *********
private: mutable PropertySet _propertySet;
// Constructors
// ************
protected: DBo();
private: DBo(const DBo& dbo); // not implemented to forbid copy construction
// Destructors
// ***********
protected: virtual ~DBo();
// Operators
// *********
private: DBo& operator=(const DBo& dbo); // not implemented to forbid assignment
// Others
// ******
protected: virtual void _postCreate();
protected: virtual void _preDestroy();
public: virtual string _getTypeName() const;
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
public: PropertySet& _getPropertySet() {return _propertySet;};
public: void _onDestroyed(Property* property);
#endif
// Destructors
// ***********
public: virtual void destroy();
// Accessors
// *********
public: Property* getProperty(const Name& name) const;
public: Properties getProperties() const {return getCollection(_propertySet);};
// Predicates
// **********
public: bool hasProperty() const {return !_propertySet.empty();};
// Updators
// ********
public: void put(Property* property);
public: void remove(Property* property);
public: void removeProperty(const Name& name);
public: void clearProperties();
protected:
// Internal: Constructors & Destructors.
DBo ();
virtual ~DBo ();
virtual void _postCreate ();
virtual void _preDestroy ();
private:
// Forbidden: Copies.
DBo ( const DBo& );
DBo& operator= ( const DBo& );
}; };
// Inline Functions.
inline DBo::PropertySet& DBo::_getPropertySet () { return _propertySet; }
inline bool DBo::hasProperty () const { return !_propertySet.empty(); }
} // End of Hurricane namespace. } // End of Hurricane namespace.
@ -114,8 +104,4 @@ inline Hurricane::Slot* getSlot ( const std::string& name, std::set<Hurricane::P
} }
#endif // HURRICANE_DBO #endif // __HURRICANE_DBO__
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -63,4 +63,10 @@ namespace Hurricane {
} // End of Hurricane namespace. } // End of Hurricane namespace.
GETSTRING_POINTER_SUPPORT(Hurricane::Error);
GETSTRING_VALUE_SUPPORT(Hurricane::Error);
IOSTREAM_POINTER_SUPPORT(Hurricane::Error);
IOSTREAM_VALUE_SUPPORT(Hurricane::Error);
# endif // __HURRICANE_ERROR__ # endif // __HURRICANE_ERROR__

View File

@ -23,6 +23,9 @@ class SharedName;
class Name { class Name {
// ******* // *******
private: static const Name _emptyName;
public: static const Name& emptyName () { return _emptyName; };
// Attributes // Attributes
// ********** // **********

View File

@ -1,365 +1,449 @@
// ****************************************************************************************************
// File: Property.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_PROPERTY // -*- C++ -*-
#define HURRICANE_PROPERTY //
// This file is part of the Hurricane Software.
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Jean-Paul Chaput |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./Property.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
#ifndef __HURRICANE_PROPERTY__
#define __HURRICANE_PROPERTY__
#include "hurricane/Name.h" #include "hurricane/Name.h"
#include "hurricane/Properties.h" #include "hurricane/Properties.h"
#include "hurricane/DBos.h" #include "hurricane/DBo.h"
#include "hurricane/Error.h" #include "hurricane/Error.h"
namespace Hurricane { namespace Hurricane {
extern const char* propertyTypeNameError;
// -------------------------------------------------------------------
// Class : "Hurricane::Property".
// ****************************************************************************************************
// Property declaration
// ****************************************************************************************************
class Property { class Property {
// *************
// Constructors public:
// ************ // Static Method.
template<typename DerivedProperty>
protected: Property(); static DerivedProperty* get ( const DBo* );
static Name staticGetName ();
private: Property(const Property& property); // not implemented to forbid copy construction // Constructor.
template<typename DerivedProperty>
// Destructors static DerivedProperty* create ();
// *********** template<typename DerivedProperty, typename Value>
static DerivedProperty* create ( const Value& );
protected: virtual ~Property(); // Destructor.
virtual void destroy ();
public: virtual void destroy(); // Methods.
virtual Name getName () const = 0;
// Operators virtual void onCapturedBy ( DBo* owner ) = 0;
// ********* virtual void onReleasedBy ( DBo* owner ) = 0;
// Hurricane Managment.
private: Property& operator=(const Property& property); // not implemented to forbid assignment virtual string _getTypeName () const = 0;
virtual string _getString () const;
// Accessors virtual Record* _getRecord () const;
// *********
public: virtual Name getName() const = 0;
// Managers
// ********
public: virtual void onCapturedBy(DBo* owner) = 0;
public: virtual void onReleasedBy(DBo* owner) = 0;
// Others
// ******
protected: virtual void _postCreate() {};
protected: virtual void _preDestroy() {};
public: virtual string _getTypeName() const = 0;
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
private:
static Name _baseName;
protected:
// Internal: Constructors & Destructors.
Property ();
virtual ~Property ();
virtual void _postCreate () {};
virtual void _preDestroy () {};
private:
Property ( const Property& );
Property& operator= ( const Property& );
}; };
template<typename DerivedProperty>
DerivedProperty* Property::create ()
{
DerivedProperty* property = new DerivedProperty();
property->_postCreate();
return property;
}
template<typename DerivedProperty, typename Value>
DerivedProperty* Property::create ( const Value& value )
{
DerivedProperty* property = new DerivedProperty(value);
property->_postCreate();
return property;
}
template<typename DerivedProperty>
DerivedProperty* Property::get ( const DBo* object )
{
Property* property1 = object->getProperty ( DerivedProperty::staticGetName() );
DerivedProperty* property2 = dynamic_cast<DerivedProperty*> ( property1 );
if ( property1 && !property2 )
throw Error ( propertyTypeNameError
, getString(DerivedProperty::staticGetName()).c_str()
, getString(object).c_str() );
return property2;
}
// -------------------------------------------------------------------
// Class : "Hurricane::PrivateProperty".
// ****************************************************************************************************
// PrivateProperty declaration
// ****************************************************************************************************
class PrivateProperty : public Property { class PrivateProperty : public Property {
// ************************************
// Types public:
// ***** // Methods.
inline DBo* getOwner () const;
public: typedef Property Inherit; virtual void onCapturedBy ( DBo* owner );
virtual void onReleasedBy ( DBo* owner );
// Attributes virtual void onNotOwned ();
// ********** virtual string _getString () const;
virtual Record* _getRecord () const;
private: DBo* _owner;
// Constructors
// ************
protected: PrivateProperty();
// Accessors
// *********
public: DBo* getOwner() const {return _owner;};
// Managers
// ********
public: virtual void onCapturedBy(DBo* owner);
public: virtual void onReleasedBy(DBo* owner);
public: virtual void onNotOwned();
// Others
// ******
protected: virtual void _preDestroy();
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
private:
// Internal: Attributes.
DBo* _owner;
protected:
// Internal: Constructor & Destructors.
PrivateProperty ();
virtual void _preDestroy ();
}; };
// Inline Functions.
inline DBo* PrivateProperty::getOwner () const { return _owner; };
// ****************************************************************************************************
// StandardPrivateProperty declaration
// ****************************************************************************************************
template<class Value> class StandardPrivateProperty : public PrivateProperty { // -------------------------------------------------------------------
// ************************************************************************* // Template Class : "Hurricane::StandardPrivateProperty".
// Types
// *****
public: typedef PrivateProperty Inherit; template<typename Value> class StandardPrivateProperty : public PrivateProperty {
// Attributes public:
// ********** static Name staticGetName ();
static StandardPrivateProperty* get ( const DBo* );
// Constructors.
static StandardPrivateProperty* create ();
static StandardPrivateProperty* create ( const Value& );
// Methods.
virtual Name getName () const;
Value& getValue () const;
void setValue ( const Value& );
virtual string _getTypeName () const;
virtual string _getString () const;
virtual Record* _getRecord () const;
private: Name _name; private:
private: Value _value; // Internal: Attributes.
static Name _name;
mutable Value _value;
// Constructors protected:
// ************ // Internal: Constructor.
StandardPrivateProperty ();
protected: StandardPrivateProperty(const Name& name, const Value& value) StandardPrivateProperty ( const Value& );
// *********************************************************************
: Inherit(),
_name(name),
_value(value)
{
}; };
public: static StandardPrivateProperty* create(const Name& name, const Value& value )
// **********************************************************************************
{
StandardPrivateProperty* property = new StandardPrivateProperty(name, value);
property->_postCreate(); template<typename Value>
Name StandardPrivateProperty<Value>::staticGetName ()
return property;
};
// Accessors
// *********
public: virtual Name getName() const
// *********************************
{ {
return _name; return _name;
}; }
public: const Value& getValue() const
// ********************************** template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::create ()
{
StandardPrivateProperty<Value>* property = new StandardPrivateProperty<Value>();
property->_postCreate();
return property;
}
template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::create ( const Value& value )
{
StandardPrivateProperty<Value>* property = new StandardPrivateProperty<Value>(value);
property->_postCreate();
return property;
}
template<typename Value>
StandardPrivateProperty<Value>* StandardPrivateProperty<Value>::get ( const DBo* object )
{
Property* property1 = object->getProperty ( StandardPrivateProperty<Value>::staticGetName() );
StandardPrivateProperty* property2 = dynamic_cast<StandardPrivateProperty<Value>*> ( property1 );
if ( property1 && !property2 )
throw Error ( propertyTypeNameError
, getString(StandardPrivateProperty<Value>::staticGetName()).c_str()
, getString(object).c_str() );
return property2;
}
template<typename Value>
StandardPrivateProperty<Value>::StandardPrivateProperty ()
: PrivateProperty(), _value()
{ }
template<typename Value>
StandardPrivateProperty<Value>::StandardPrivateProperty ( const Value& value )
: PrivateProperty(), _value(value)
{ }
template<typename Value>
Name StandardPrivateProperty<Value>::getName() const
{
return staticGetName();
}
template<typename Value>
Value& StandardPrivateProperty<Value>::getValue () const
{ {
return _value; return _value;
}; }
// Modifieurs
// **********
public: void setValue(const Value& value) template<typename Value>
// ************************************** void StandardPrivateProperty<Value>::setValue ( const Value& value )
{ {
_value = value; _value = value;
}; }
// Others
// ******
public: virtual string _getTypeName() const template<typename Value>
// **************************************** string StandardPrivateProperty<Value>::_getTypeName () const
{ {
return _TName("StandardPrivateProperty"); return _TName("StandardPrivateProperty");
};
public: virtual string _getString() const
// **************************************
{
string s = Inherit::_getString();
s.insert(s.length() - 1, " " + getString(_value));
return s;
};
public: virtual Record* _getRecord() const
// *********************************
{
Record* record = Inherit::_getRecord();
if (record) {
record->add(getSlot("Name", &_name));
record->add(getSlot("Value", _value));
} }
return record;
};
}; template<typename Value>
string StandardPrivateProperty<Value>::_getString () const
// ****************************************************************************************************
// SharedProperty declaration
// ****************************************************************************************************
class SharedProperty : public Property {
// ***********************************
// Types
// *****
public: typedef Property Inherit;
public: typedef set<DBo*> DBoSet;
// Attributes
// **********
private: DBoSet _ownerSet;
// Constructors
// ************
protected: SharedProperty();
// Accessors
// *********
public: DBos getOwners() const {return getCollection(_ownerSet);};
// Managers
// ********
public: virtual void onCapturedBy(DBo* owner);
public: virtual void onReleasedBy(DBo* owner);
public: virtual void onNotOwned();
// Accessors
// *********
protected: virtual void _preDestroy();
public: virtual string _getString() const;
public: virtual Record* _getRecord() const;
public: DBoSet& _getOwnerSet() {return _ownerSet;};
};
// ****************************************************************************************************
// StandardSharedProperty declaration
// ****************************************************************************************************
template<class Value> class StandardSharedProperty : public SharedProperty {
// ***********************************************************************
// Types
// *****
public: typedef SharedProperty Inherit;
// Attributes
// **********
private: Name _name;
private: Value _value;
// Constructors
// ************
protected: StandardSharedProperty(const Name& name, const Value& value)
// ********************************************************************
: Inherit(),
_name(name),
_value(value)
{ {
}; string s = PrivateProperty::_getString();
public: static StandardSharedProperty* create(const Name& name, const Value& value )
// *********************************************************************************
{
StandardSharedProperty* property = new StandardSharedProperty(name, value);
property->_postCreate();
return property;
};
// Accessors
// *********
public: virtual Name getName() const
// *********************************
{
return _name;
};
public: const Value& getValue() const
// **********************************
{
return _value;
};
// Modifieurs
// **********
public: void setValue(const Value& value)
// **************************************
{
_value = value;
};
// Others
// ******
public: virtual string _getTypeName() const
// ****************************************
{
return _TName("StandardSharedProperty");
};
public: virtual string _getString() const
// **************************************
{
string s = Inherit::_getString();
s.insert(s.length() - 1, " " + getString(_value)); s.insert(s.length() - 1, " " + getString(_value));
return s; return s;
}; }
public: virtual Record* _getRecord() const template<typename Value>
// ********************************* Record* StandardPrivateProperty<Value>::_getRecord () const
{ {
Record* record = Inherit::_getRecord(); Record* record = PrivateProperty::_getRecord();
if (record) { if (record) {
record->add(getSlot("Name", &_name)); record->add ( getSlot("Name" , staticGetName()) );
record->add ( getSlot("Value",&_value) ); record->add ( getSlot("Value",&_value) );
} }
return record; return record;
}
// -------------------------------------------------------------------
// Class : "Hurricane::SharedProperty".
class SharedProperty : public Property {
public:
// Types.
typedef set<DBo*> DBoSet;
// Methods.
inline DBos getOwners () const;
virtual void onCapturedBy ( DBo* owner );
virtual void onReleasedBy ( DBo* owner );
virtual void onNotOwned ();
inline DBoSet& _getOwnerSet ();
virtual string _getString () const;
virtual Record* _getRecord () const;
private:
// Internal: Attributes.
DBoSet _ownerSet;
protected:
// Internal: Constructor & Destructor.
SharedProperty ();
virtual void _preDestroy ();
}; };
// Inline Functions.
DBos SharedProperty::getOwners () const { return getCollection(_ownerSet); }
SharedProperty::DBoSet& SharedProperty::_getOwnerSet () { return _ownerSet; }
// -------------------------------------------------------------------
// Template Class : "Hurricane::StandardSharedProperty".
template<typename Value> class StandardSharedProperty : public SharedProperty {
public:
static Name staticGetName ();
static StandardSharedProperty* get ( const DBo* );
// Constructors.
static StandardSharedProperty* create ();
static StandardSharedProperty* create ( const Value& );
// Methods.
virtual Name getName () const;
Value& getValue () const;
void setValue ( const Value& );
virtual string _getTypeName () const;
virtual string _getString () const;
virtual Record* _getRecord () const;
private:
// Internal: Attributes.
static Name _name;
mutable Value _value;
protected:
// Internal: Constructor.
StandardSharedProperty ();
StandardSharedProperty ( const Value& );
}; };
// Template function members.
template<typename Value>
Name StandardSharedProperty<Value>::staticGetName ()
{
return _name;
}
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::create ()
{
StandardSharedProperty<Value>* property = new StandardSharedProperty<Value>();
property->_postCreate();
return property;
}
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::create ( const Value& value )
{
StandardSharedProperty<Value>* property = new StandardPrivateProperty<Value>(value);
property->_postCreate();
return property;
}
template<typename Value>
StandardSharedProperty<Value>* StandardSharedProperty<Value>::get ( const DBo* object )
{
Property* property1 = object->getProperty ( StandardSharedProperty<Value>::staticGetName() );
StandardSharedProperty* property2 = dynamic_cast<StandardSharedProperty<Value>*> ( property1 );
if ( property1 && !property2 )
throw Error ( propertyTypeNameError
, getString(StandardSharedProperty<Value>::staticGetName()).c_str()
, getString(object).c_str() );
return property2;
}
template<typename Value>
StandardSharedProperty<Value>::StandardSharedProperty ()
: SharedProperty(), _value()
{ }
template<typename Value>
StandardSharedProperty<Value>::StandardSharedProperty ( const Value& value )
: SharedProperty(), _value(value)
{ }
template<typename Value>
Name StandardSharedProperty<Value>::getName() const
{
return staticGetName();
}
template<typename Value>
Value& StandardSharedProperty<Value>::getValue() const
{
return _value;
}
template<typename Value>
void StandardSharedProperty<Value>::setValue(const Value& value)
{
_value = value;
}
template<typename Value>
string StandardSharedProperty<Value>::_getTypeName() const
{
return _TName("StandardSharedProperty");
}
template<typename Value>
string StandardSharedProperty<Value>::_getString() const
{
string s = SharedProperty::_getString();
s.insert(s.length() - 1, " " + getString(_value));
return s;
}
template<typename Value>
Record* StandardSharedProperty<Value>::_getRecord() const
{
Record* record = SharedProperty::_getRecord();
if (record) {
record->add ( getSlot("Name" , staticGetName()) );
record->add ( getSlot("Value", &_value) );
}
return record;
}
} // End of Hurricane namespace. } // End of Hurricane namespace.
INSPECTOR_P_SUPPORT(Hurricane::Property); INSPECTOR_P_SUPPORT(Hurricane::Property);
#endif // HURRICANE_PROPERTY #endif // __HURRICANE_PROPERTY__
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************

View File

@ -1,68 +1,73 @@
// ****************************************************************************************************
// File: Warning.h
// Authors: R. Escassut
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
// ****************************************************************************************************
#ifndef HURRICANE_WARNING // -*- C++ -*-
#define HURRICANE_WARNING //
// This file is part of the Hurricane Software.
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved
//
// ===================================================================
//
// $Id$
//
// x-----------------------------------------------------------------x
// | |
// | H U R R I C A N E |
// | V L S I B a c k e n d D a t a - B a s e |
// | |
// | Author : Remy Escassut |
// | E-mail : Jean-Paul.Chaput@lip6.fr |
// | =============================================================== |
// | C++ Header : "./Warning.h" |
// | *************************************************************** |
// | U p d a t e s |
// | |
// x-----------------------------------------------------------------x
# ifndef __HURRICANE_WARNING__
# define __HURRICANE_WARNING__
#include "hurricane/Exception.h" #include "hurricane/Exception.h"
namespace Hurricane { namespace Hurricane {
// ****************************************************************************************************
// Warning declaration
// ****************************************************************************************************
class Warning : public Exception { class Warning : public Exception {
// *****************************
// Types public:
// ***** // Constructors.
Warning ( const string& reason );
public: typedef Exception Inherit; Warning ( const char* format, ... );
Warning ( int code, const string& reason );
// Attributes Warning ( int code, const char* format, ... );
// ********** Warning ( const Warning& warning );
Warning& operator= ( const Warning& warning );
private: string _reason; // Methods.
private: int _code; inline string getReason () const;
inline int getCode () const;
// Constructors // Hurricane Managment.
// ************ virtual string _getTypeName () const;
virtual string _getString () const;
public: Warning(const string& reason, int code = 0);
public: Warning(const Warning& warning);
// Operators
// *********
public: Warning& operator=(const Warning& warning);
// Accessors
// *********
public: string getReason() const {return _reason;};
public: int getCode() const {return _code;};
// Others
// ******
public: virtual string _getTypeName() const { return _TName("Warning"); };
public: virtual string _getString() const;
protected:
// Internal: Attributes.
string _reason;
int _code;
}; };
// Inline Functions.
inline string Warning::getReason () const { return _reason; }
inline int Warning::getCode () const { return _code; }
} // End of Hurricane namespace. } // End of Hurricane namespace.
#endif // HURRICANE_WARNING GETSTRING_POINTER_SUPPORT(Hurricane::Warning);
GETSTRING_VALUE_SUPPORT(Hurricane::Warning);
IOSTREAM_POINTER_SUPPORT(Hurricane::Warning);
IOSTREAM_VALUE_SUPPORT(Hurricane::Warning);
// ****************************************************************************************************
// Copyright (c) BULL S.A. 2000-2004, All Rights Reserved # endif // __HURRICANE_WARNING__
// ****************************************************************************************************

View File

@ -53,6 +53,7 @@
# include <cassert> # include <cassert>
# include "hurricane/viewer/DisplayStyle.h" # include "hurricane/viewer/DisplayStyle.h"
# include "hurricane/viewer/Graphics.h"
@ -112,7 +113,11 @@ namespace Hurricane {
, float threshold , float threshold
) )
{ {
return new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold ); DrawingStyle* style = new DrawingStyle ( name, pattern, red, green, blue, borderWidth, threshold );
//if ( Graphics::isEnabled() )
// style->qtAllocate ();
return style;
} }

View File

@ -76,9 +76,6 @@ namespace Hurricane {
, _active(NULL) , _active(NULL)
, _qtEnabled(false) , _qtEnabled(false)
{ {
_styles.push_back ( new DisplayStyle("Fallback") );
_active = _styles[0];
_active->setDescription ( "Builtin fallback style" );
} }
@ -90,8 +87,12 @@ namespace Hurricane {
Graphics* Graphics::getGraphics () Graphics* Graphics::getGraphics ()
{ {
if ( !_singleton ) if ( !_singleton ) {
_singleton = new Graphics (); _singleton = new Graphics ();
DisplayStyle* fallback = new DisplayStyle("Fallback");
fallback->setDescription ( "Builtin fallback style" );
_singleton->_addStyle ( fallback );
}
return _singleton; return _singleton;
} }