Mantid
|
The UserSubWindowFactory is responsible for creating concrete instances of user interface classes. More...
#include <UserSubWindowFactory.h>
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... | |
UserSubWindow * | createUnwrapped (const std::string &name) const override |
Create a raw pointer to the interface with the given name. More... | |
BaseDecoder * | findDecoder (const std::string &decodeString) |
Finds the Decoder for the given window and returns a raw pointer to it. More... | |
BaseEncoder * | findEncoder (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... | |
UserSubWindowFactoryImpl & | operator= (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... | |
DynamicFactory & | operator= (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 | |
UserSubWindow * | createFromAlias (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... | |
The UserSubWindowFactory is responsible for creating concrete instances of user interface classes.
It is implemented as a singleton class.
Definition at line 40 of file UserSubWindowFactory.h.
|
delete |
|
private |
Private Constructor for singleton class.
Default constructor.
Definition at line 78 of file UserSubWindowFactory.cpp.
|
overrideprivatedefault |
Private Destructor.
QSet< QString > UserSubWindowFactoryImpl::categories | ( | const QString & | interfaceName | ) | const |
Return the set of categories that the interface with the given name belongs to.
interfaceName | :: The name of the interface. |
Definition at line 66 of file UserSubWindowFactory.cpp.
References m_categoryLookup.
Referenced by subscribe().
|
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.
name | :: The alias name to use to try and create an interface |
Definition at line 86 of file UserSubWindowFactory.cpp.
References createUnwrapped(), error, Mantid::Kernel::Logger::error(), m_aliasLookup, and m_badAliases.
Referenced by createUnwrapped().
|
overridevirtual |
Create a raw pointer to the interface with the given name.
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().
BaseDecoder * UserSubWindowFactoryImpl::findDecoder | ( | const std::string & | decodeString | ) |
Finds the Decoder for the given window and returns a raw pointer to it.
decodeString | Is the string from which the decoder should be found |
Definition at line 148 of file UserSubWindowFactory.cpp.
References m_decoders.
BaseEncoder * UserSubWindowFactoryImpl::findEncoder | ( | QWidget * | window | ) |
Finds the Encoder for the given window and returns a raw pointer to it.
window | Is the window that needs to have an encoder found for it. |
Definition at line 129 of file UserSubWindowFactory.cpp.
References m_encoders.
QStringList UserSubWindowFactoryImpl::keys | ( | ) | const |
The keys associated with UserSubWindow classes.
Definition at line 113 of file UserSubWindowFactory.cpp.
References Mantid::Kernel::DynamicFactory< UserSubWindow >::getKeys(), and keys().
Referenced by keys().
|
delete |
|
private |
Save the list of aliases.
Save the alias names of an interface.
realName | :: The real name of the interface |
Definition at line 111 of file UserSubWindowFactory.h.
References m_aliasLookup, and m_badAliases.
void MantidQt::API::UserSubWindowFactoryImpl::subscribe |
Definition at line 88 of file UserSubWindowFactory.h.
References categories(), and m_categoryLookup.
void MantidQt::API::UserSubWindowFactoryImpl::subscribe | ( | const std::string & | decoderTag | ) |
Definition at line 101 of file UserSubWindowFactory.h.
References m_decoders, and m_encoders.
|
friend |
Definition at line 55 of file UserSubWindowFactory.h.
|
private |
A map of alias names to "real" names.
Definition at line 76 of file UserSubWindowFactory.h.
Referenced by createFromAlias(), and saveAliasNames().
An index of multiply defined aliases.
Definition at line 78 of file UserSubWindowFactory.h.
Referenced by createFromAlias(), and saveAliasNames().
|
private |
A map of interfaces to their categories.
Definition at line 80 of file UserSubWindowFactory.h.
Referenced by categories(), and subscribe().
|
private |
Definition at line 85 of file UserSubWindowFactory.h.
Referenced by findDecoder(), and subscribe().
|
private |
Definition at line 84 of file UserSubWindowFactory.h.
Referenced by findEncoder(), and subscribe().