ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvExternalFactory.cpp
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #include "ecvExternalFactory.h"
9 
11 static QSharedPointer<ccExternalFactory::Container> s_externalFactoryContainer(
12  0);
13 
15  : m_factoryName(factoryName) {}
16 
18  const QString& factoryName) const {
19  if (m_factories.contains(factoryName))
20  return m_factories.value(factoryName);
21  else
22  return 0;
23 }
24 
26  if (!factory) // do nothing
27  return;
28 
29  QString name = factory->getFactoryName();
30 
31  m_factories[name] = factory;
32 }
33 
39  }
41 }
42 
44  Container::Shared container) {
45  s_externalFactoryContainer = container;
46 }
std::string name
A convenience holder for all factories.
ccExternalFactory * getFactoryByName(const QString &factoryName) const
Returns factory using its (unique) name as key.
static Container::Shared GetUniqueInstance()
static void SetUniqueInstance(Container::Shared container)
Sets the unqiue static instance of the external factories container.
void addFactory(ccExternalFactory *factory)
Adds a new factory to the container.
QMap< QString, ccExternalFactory * > m_factories
Set of factories.
QSharedPointer< Container > Shared
Shared pointer type.
ccExternalFactory(QString factoryName)
Default constructor.
QString getFactoryName() const
Returns the (unique) name of the factory.
static QSharedPointer< ccExternalFactory::Container > s_externalFactoryContainer(0)
Container singleton.