27 #include "parametersettable.h"
29 #include "configurationexceptions.h"
39 class ResourceHandler;
40 class ResourceCollection;
123 return (m_shared == other.m_shared);
131 QMutex& operator*()
const throw()
133 return m_shared->resourceLock;
142 QMutex* operator->()
const throw()
144 return &(m_shared->resourceLock);
152 struct MutexAndRefCounter
157 MutexAndRefCounter() :
158 resourceLock(QMutex::Recursive),
171 int referenceCounter;
177 MutexAndRefCounter* m_shared;
241 void set(
float* res);
249 void set(
double* res);
281 void set(QObject* res);
302 return dynamic_cast<T*
>(m_pointers.res);
303 case t_paramSettable:
304 return dynamic_cast<T*
>(m_pointers.par);
306 return dynamic_cast<T*
>(m_pointers.obj);
329 return (m_type != t_nonExistent);
366 const QString m_name;
391 ParameterSettable* par;
405 ResourceMutexHolder m_lock;
411 QSet<ResourcesUser *> m_notifees;
416 ResourceHandler(
const ResourceHandler&);
421 ResourceHandler& operator=(
const ResourceHandler&);
425 inline int* ResourceHandler::get<int>()
const
427 if (m_type == t_int) {
428 return m_pointers.intp;
435 inline float* ResourceHandler::get<float>()
const
437 if (m_type == t_float) {
438 return m_pointers.floatp;
445 inline double* ResourceHandler::get<double>()
const
447 if (m_type == t_double) {
448 return m_pointers.doublep;
455 inline bool* ResourceHandler::get<bool>()
const
457 if (m_type == t_bool) {
458 return m_pointers.boolp;
501 QWaitCondition& getWaitCondition()
503 return m_waitCondition;
511 int incrementReferenceCounter() throw()
513 return ++m_referenceCounter;
521 int decrementReferenceCounter() throw()
523 return --m_referenceCounter;
531 int getReferenceCounter() throw()
533 return m_referenceCounter;
555 bool hasResource(QString name)
const
557 return (m_resources.contains(name) && m_resources[name]->exists());
566 QMap<QString, ResourceHandler*> m_resources;
585 QWaitCondition m_waitCondition;
590 int m_referenceCounter;
650 void setUseLock(
bool useLock)
throw()
652 m_useLocks = useLock;
665 return (m_resourceCollection == other.m_resourceCollection);
675 return *m_resourceCollection;
686 return m_resourceCollection;