Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
MantidQt::API::UserSubWindowFactoryImpl Class Reference

The UserSubWindowFactory is responsible for creating concrete instances of user interface classes. More...

#include <UserSubWindowFactory.h>

Inheritance diagram for MantidQt::API::UserSubWindowFactoryImpl:
Mantid::Kernel::DynamicFactory< UserSubWindow >

Public Member Functions

QSet< QString > categories (const QString &interfaceName) const
 Return the set of categories that the interface with the given name belongs to. More...
 
UserSubWindowcreateUnwrapped (const std::string &name) const override
 Create a raw pointer to the interface with the given name. More...
 
BaseDecoderfindDecoder (const std::string &decodeString)
 Finds the Decoder for the given window and returns a raw pointer to it. More...
 
BaseEncoderfindEncoder (QWidget *window)
 Finds the Encoder for the given window and returns a raw pointer to it. More...
 
QStringList keys () const
 The keys associated with UserSubWindow classes. More...
 
UserSubWindowFactoryImploperator= (const UserSubWindowFactoryImpl &)=delete
 
template<typename TYPE >
void subscribe ()
 
template<typename WindowType , typename EncoderType , typename DecoderType >
void subscribe (const std::string &decoderTag)
 
 UserSubWindowFactoryImpl (const UserSubWindowFactoryImpl &)=delete
 
- Public Member Functions inherited from Mantid::Kernel::DynamicFactory< UserSubWindow >
virtual std::shared_ptr< UserSubWindow > create (const std::string &className) const
 Creates a new instance of the class with the given name. More...
 
virtual UserSubWindow * createUnwrapped (const std::string &className) const
 Creates a new instance of the class with the given name, which is not wrapped in a boost shared_ptr. More...
 
void disableNotifications ()
 Disable notifications. More...
 
 DynamicFactory (const DynamicFactory &)=delete
 
void enableNotifications ()
 Enable notifications. More...
 
bool exists (const std::string &className) const
 Returns true if the given class is currently registered. More...
 
virtual const std::vector< std::string > getKeys () const
 Returns the keys in the map. More...
 
DynamicFactoryoperator= (const DynamicFactory &)=delete
 
void subscribe (const std::string &className)
 Registers the instantiator for the given class with the DynamicFactory. More...
 
void subscribe (const std::string &className, std::unique_ptr< AbstractFactory > pAbstractFactory, SubscribeAction replace=ErrorIfExists)
 Registers the instantiator for the given class with the DynamicFactory. More...
 
void unsubscribe (const std::string &className)
 Unregisters the given class and deletes the instantiator for the class. More...
 
virtual ~DynamicFactory ()=default
 Destroys the DynamicFactory and deletes the instantiators for all registered classes. More...
 

Private Member Functions

UserSubWindowcreateFromAlias (const std::string &name) const
 Try to create a sub window from the list of aliases for an interface. More...
 
template<typename TYPE >
void saveAliasNames (const std::string &realName)
 Save the list of aliases. More...
 
 UserSubWindowFactoryImpl ()
 Private Constructor for singleton class. More...
 
 ~UserSubWindowFactoryImpl () override=default
 Private Destructor. More...
 

Private Attributes

QHash< QString, std::string > m_aliasLookup
 A map of alias names to "real" names. More...
 
QHash< QString, QList< std::string > > m_badAliases
 An index of multiply defined aliases. More...
 
QHash< QString, QSet< QString > > m_categoryLookup
 A map of interfaces to their categories. More...
 
std::map< std::string, std::shared_ptr< Mantid::Kernel::AbstractInstantiator< BaseDecoder > > > m_decoders
 
std::map< std::string, std::shared_ptr< Mantid::Kernel::AbstractInstantiator< BaseEncoder > > > m_encoders
 

Friends

struct Mantid::Kernel::CreateUsingNew< UserSubWindowFactoryImpl >
 

Additional Inherited Members

- Public Types inherited from Mantid::Kernel::DynamicFactory< UserSubWindow >
using AbstractFactory = AbstractInstantiator< UserSubWindow >
 A typedef for the instantiator. More...
 
enum  NotificationStatus
 Defines the whether notifications are dispatched. More...
 
enum  SubscribeAction
 Defines replacement behaviour. More...
 
- Public Attributes inherited from Mantid::Kernel::DynamicFactory< UserSubWindow >
Poco::NotificationCenter notificationCenter
 Sends notifications to observers. More...
 
- Protected Member Functions inherited from Mantid::Kernel::DynamicFactory< UserSubWindow >
 DynamicFactory ()
 Protected constructor for base class. More...
 

Detailed Description

The UserSubWindowFactory is responsible for creating concrete instances of user interface classes.

It is implemented as a singleton class.

Author
Martyn Gigg, Tessella plc
Date
06/07/2010

Definition at line 40 of file UserSubWindowFactory.h.

Constructor & Destructor Documentation

◆ UserSubWindowFactoryImpl() [1/2]

MantidQt::API::UserSubWindowFactoryImpl::UserSubWindowFactoryImpl ( const UserSubWindowFactoryImpl )
delete

◆ UserSubWindowFactoryImpl() [2/2]

UserSubWindowFactoryImpl::UserSubWindowFactoryImpl ( )
private

Private Constructor for singleton class.

Default constructor.

Definition at line 78 of file UserSubWindowFactory.cpp.

◆ ~UserSubWindowFactoryImpl()

MantidQt::API::UserSubWindowFactoryImpl::~UserSubWindowFactoryImpl ( )
overrideprivatedefault

Private Destructor.

Member Function Documentation

◆ categories()

QSet< QString > UserSubWindowFactoryImpl::categories ( const QString &  interfaceName) const

Return the set of categories that the interface with the given name belongs to.

Parameters
interfaceName:: The name of the interface.
Returns
the set of category names if an interface with the given name has been registered, else an empty set.

Definition at line 66 of file UserSubWindowFactory.cpp.

References m_categoryLookup.

Referenced by subscribe().

◆ createFromAlias()

UserSubWindow * UserSubWindowFactoryImpl::createFromAlias ( const std::string &  name) const
private

Try to create a sub window from the list of aliases for an interface.

Create a user sub window by searching for an alias name.

Parameters
name:: The alias name to use to try and create an interface
Returns
A pointer to a created interface pointer if this alias exists and is not multiply defined

Definition at line 86 of file UserSubWindowFactory.cpp.

References createUnwrapped(), error, Mantid::Kernel::Logger::error(), m_aliasLookup, and m_badAliases.

Referenced by createUnwrapped().

◆ createUnwrapped()

UserSubWindow * UserSubWindowFactoryImpl::createUnwrapped ( const std::string &  name) const
overridevirtual

Create a raw pointer to the interface with the given name.

Parameters
name:: The name of the interface that should have been registered into the factory

Reimplemented from Mantid::Kernel::DynamicFactory< UserSubWindow >.

Definition at line 35 of file UserSubWindowFactory.cpp.

References createFromAlias(), Mantid::Kernel::DynamicFactory< Base, Comparator >::createUnwrapped(), Mantid::Kernel::Logger::debug(), and Mantid::Kernel::Logger::error().

Referenced by createFromAlias().

◆ findDecoder()

BaseDecoder * UserSubWindowFactoryImpl::findDecoder ( const std::string &  decodeString)

Finds the Decoder for the given window and returns a raw pointer to it.

Parameters
decodeStringIs the string from which the decoder should be found
Returns
BaseDecoder* Need to return a raw pointer so sip can understand and then wrap the function for use in python

Definition at line 148 of file UserSubWindowFactory.cpp.

References m_decoders.

◆ findEncoder()

BaseEncoder * UserSubWindowFactoryImpl::findEncoder ( QWidget *  window)

Finds the Encoder for the given window and returns a raw pointer to it.

Parameters
windowIs the window that needs to have an encoder found for it.
Returns
BaseEncoder* Need to return a raw pointer so sip can understand and then wrap the function for use in python

Definition at line 129 of file UserSubWindowFactory.cpp.

References m_encoders.

◆ keys()

QStringList UserSubWindowFactoryImpl::keys ( ) const

The keys associated with UserSubWindow classes.

Returns
A QStringList containing the keys from the UserSubWindowFactory that refer to UserSubWindow classes

Definition at line 113 of file UserSubWindowFactory.cpp.

References Mantid::Kernel::DynamicFactory< UserSubWindow >::getKeys(), and keys().

Referenced by keys().

◆ operator=()

UserSubWindowFactoryImpl & MantidQt::API::UserSubWindowFactoryImpl::operator= ( const UserSubWindowFactoryImpl )
delete

◆ saveAliasNames()

template<typename TYPE >
void MantidQt::API::UserSubWindowFactoryImpl::saveAliasNames ( const std::string &  realName)
private

Save the list of aliases.

Save the alias names of an interface.

Parameters
realName:: The real name of the interface

Definition at line 111 of file UserSubWindowFactory.h.

References m_aliasLookup, and m_badAliases.

◆ subscribe() [1/2]

template<typename TYPE >
void MantidQt::API::UserSubWindowFactoryImpl::subscribe

Definition at line 88 of file UserSubWindowFactory.h.

References categories(), and m_categoryLookup.

◆ subscribe() [2/2]

template<typename WindowType , typename EncoderType , typename DecoderType >
void MantidQt::API::UserSubWindowFactoryImpl::subscribe ( const std::string &  decoderTag)

Definition at line 101 of file UserSubWindowFactory.h.

References m_decoders, and m_encoders.

Friends And Related Function Documentation

◆ Mantid::Kernel::CreateUsingNew< UserSubWindowFactoryImpl >

Definition at line 55 of file UserSubWindowFactory.h.

Member Data Documentation

◆ m_aliasLookup

QHash<QString, std::string> MantidQt::API::UserSubWindowFactoryImpl::m_aliasLookup
private

A map of alias names to "real" names.

Definition at line 76 of file UserSubWindowFactory.h.

Referenced by createFromAlias(), and saveAliasNames().

◆ m_badAliases

QHash<QString, QList<std::string> > MantidQt::API::UserSubWindowFactoryImpl::m_badAliases
private

An index of multiply defined aliases.

Definition at line 78 of file UserSubWindowFactory.h.

Referenced by createFromAlias(), and saveAliasNames().

◆ m_categoryLookup

QHash<QString, QSet<QString> > MantidQt::API::UserSubWindowFactoryImpl::m_categoryLookup
private

A map of interfaces to their categories.

Definition at line 80 of file UserSubWindowFactory.h.

Referenced by categories(), and subscribe().

◆ m_decoders

std::map<std::string, std::shared_ptr<Mantid::Kernel::AbstractInstantiator<BaseDecoder> > > MantidQt::API::UserSubWindowFactoryImpl::m_decoders
private

Definition at line 85 of file UserSubWindowFactory.h.

Referenced by findDecoder(), and subscribe().

◆ m_encoders

std::map<std::string, std::shared_ptr<Mantid::Kernel::AbstractInstantiator<BaseEncoder> > > MantidQt::API::UserSubWindowFactoryImpl::m_encoders
private

Definition at line 84 of file UserSubWindowFactory.h.

Referenced by findEncoder(), and subscribe().


The documentation for this class was generated from the following files: