Inviwo 0.9.12-pre
Inviwo documentation
Loading...
Searching...
No Matches
inviwo::InviwoApplication Class Reference

The main application which holds the instances of all modules. More...

#include <inviwo/core/common/inviwoapplication.h>

+ Inheritance diagram for inviwo::InviwoApplication:

Classes

struct  Queue
 

Public Types

enum class  LongWait { Start , Update , End }
 

Public Member Functions

virtual void addCallbackAction (ModuleCallbackAction *callbackAction)
 Add an action that can be shown in for example property widget context menu. Will be shown when right clicking on a property in the NetworkEditor. Added callbacks will be removed in ~InviwoModule when your module is destroyed. Example if you want to do it earlier:
 
template<class F , class... Args>
auto dispatchFront (F &&f, Args &&... args) -> std::future< std::invoke_result_t< F, Args... > >
 
void dispatchFrontAndForget (std::function< void()> fun)
 
template<class F , class... Args>
auto dispatchPool (F &&f, Args &&... args) -> std::future< std::invoke_result_t< F, Args... > >
 
const std::function< void(std::string_view message, SourceContext context)> & getAssertionHandler () const
 
virtual std::vector< std::unique_ptr< ModuleCallbackAction > > & getCallbackActions ()
 Get list of ModuleCallbackAction shown in for example property widget context menu. Do not keep references to elements in the list around since you cannot be notified when they will be removed.
 
template<class T >
T * getCapabilitiesByType ()
 
CommandLineParser & getCommandLineParser ()
 
const CommandLineParser & getCommandLineParser () const
 
DataVisualizerManager * getDataVisualizerManager ()
 
const std::string & getDisplayName () const
 
FileSystemObserver * getFileSystemObserver () const
 
LayerRamResizer * getLayerRamResizer () const
 
InviwoModule * getModuleByIdentifier (const std::string &identifier) const
 
std::vector< Capabilities * > getModuleCapabilities ()
 
ModuleManager & getModuleManager ()
 
const ModuleManager & getModuleManager () const
 
const std::vector< Settings * > & getModuleSettings ()
 
NetworkAnnotations & getNetworkAnnotations ()
 
const NetworkAnnotations & getNetworkAnnotations () const
 
size_t getPoolSize () const
 
PortInspectorManager * getPortInspectorManager ()
 
ProcessorNetwork * getProcessorNetwork ()
 
ProcessorNetworkEvaluator * getProcessorNetworkEvaluator ()
 
PropertyPresetManager * getPropertyPresetManager ()
 
ResourceManager * getResourceManager ()
 
template<class T >
T * getSettingsByType ()
 
SystemSettings & getSystemSettings ()
 
ThreadPool & getThreadPool ()
 
TimerThread & getTimerThread ()
 
std::locale getUILocale () const
 
WorkspaceManager * getWorkspaceManager ()
 
 InviwoApplication (const InviwoApplication &rhs)=delete
 
 InviwoApplication (int argc, char **argv, std::string_view displayName)
 
 InviwoApplication (std::string_view displayName)
 
InviwoApplication & operator= (const InviwoApplication &that)=delete
 
virtual void printApplicationInfo ()
 
void processEvents ()
 
size_t processFront ()
 
void registerModules (RuntimeModuleLoading)
 Load modules from dynamic library files in the regular search paths.
 
void registerModules (RuntimeModuleLoading, std::function< bool(std::string_view)> isEnabled)
 
void registerModules (std::vector< std::unique_ptr< InviwoModuleFactoryObject > > modules, const std::function< void(std::string_view)> &progressCallback=nullptr)
 Registers modules from factories and takes ownership of input module factories. Module is registered if dependencies exist and they have correct version.
 
void registerSettings (Settings *settings)
 
void resizePool (size_t newSize)
 
void setAssertionHandler (std::function< void(std::string_view message, SourceContext context)> assertionHandler)
 
void setFileSystemObserver (std::unique_ptr< FileSystemObserver > observer)
 
void setLayerRamResizer (LayerRamResizer *obj)
 
void setPoolResizeWaitCallback (std::function< void(LongWait)> callback)
 
void setPostEnqueueFront (std::function< void()> func)
 
void setProcessEventsCallback (std::function< void()> callback)
 
void setUILocale (const std::locale &locale)
 
void unregisterSettings (Settings *settings)
 
void waitForPool ()
 
- Public Member Functions inherited from inviwo::Singleton< InviwoApplication >
void operator= (const Singleton &)=delete
 
 Singleton (const Singleton &)=delete
 

Protected Attributes

std::function< void(std::string_view message, SourceContext context)> assertionHandler_
 
std::unique_ptr< detail::InviwoApplicationCallbacks > callbacks_
 
std::unique_ptr< CameraFactory > cameraFactory_
 
util::OnScopeExit clearAllSingeltons_
 
std::unique_ptr< CommandLineParser > commandLineParser_
 
std::shared_ptr< ConsoleLogger > consoleLogger_
 
std::unique_ptr< DataReaderFactory > dataReaderFactory_
 
std::unique_ptr< DataVisualizerManager > dataVisualizerManager_
 
std::unique_ptr< DataWriterFactory > dataWriterFactory_
 
std::unique_ptr< DialogFactory > dialogFactory_
 
std::string displayName_
 
std::shared_ptr< FileLogger > filelogger_
 
std::unique_ptr< FileSystemObserver > fileSystemObserver_
 
std::unique_ptr< InportFactory > inportFactory_
 
LayerRamResizer * layerRamResizer_
 
std::unique_ptr< MeshDrawerFactory > meshDrawerFactory_
 
std::unique_ptr< MetaDataFactory > metaDataFactory_
 
std::vector< std::unique_ptr< ModuleCallbackAction > > moduleCallbackActions_
 
std::unique_ptr< ModuleManager > moduleManager_
 
NetworkAnnotations networkAnnotations_
 
std::unique_ptr< OutportFactory > outportFactory_
 
ThreadPool pool_
 
std::function< void(LongWait)> poolResizeCallback_
 
std::unique_ptr< PortInspectorFactory > portInspectorFactory_
 
std::unique_ptr< PortInspectorManager > portInspectorManager_
 
std::function< void()> processEventsCallback_
 
std::unique_ptr< ProcessorFactory > processorFactory_
 
std::unique_ptr< ProcessorNetwork > processorNetwork_
 
std::unique_ptr< ProcessorNetworkEvaluator > processorNetworkEvaluator_
 
std::unique_ptr< ProcessorWidgetFactory > processorWidgetFactory_
 
std::unique_ptr< PropertyConverterManager > propertyConverterManager_
 
std::unique_ptr< PropertyFactory > propertyFactory_
 
std::unique_ptr< PropertyPresetManager > propertyPresetManager_
 
std::unique_ptr< PropertyWidgetFactory > propertyWidgetFactory_
 
Queue queue_
 
std::unique_ptr< RepresentationConverterMetaFactory > representationConverterMetaFactory_
 
std::unique_ptr< RepresentationMetaFactory > representationMetaFactory_
 
std::unique_ptr< ResourceManager > resourceManager_
 
std::vector< Settings * > settingsRegistry_
 
std::unique_ptr< SystemSettings > systemSettings_
 
std::unique_ptr< TimerThread > timerThread_
 
std::locale uiLocale_ {}
 
std::unique_ptr< WorkspaceManager > workspaceManager_
 

Factories

CameraFactory * getCameraFactory () const
 
DataReaderFactory * getDataReaderFactory () const
 
DataWriterFactory * getDataWriterFactory () const
 
DialogFactory * getDialogFactory () const
 
MeshDrawerFactory * getMeshDrawerFactory () const
 
MetaDataFactory * getMetaDataFactory () const
 
InportFactory * getInportFactory () const
 
OutportFactory * getOutportFactory () const
 
PortInspectorFactory * getPortInspectorFactory () const
 
ProcessorFactory * getProcessorFactory () const
 
ProcessorWidgetFactory * getProcessorWidgetFactory () const
 
PropertyConverterManager * getPropertyConverterManager () const
 
PropertyFactory * getPropertyFactory () const
 
PropertyWidgetFactory * getPropertyWidgetFactory () const
 
template<typename BaseRepr >
RepresentationFactory< BaseRepr > * getRepresentationFactory () const
 
RepresentationMetaFactory * getRepresentationMetaFactory () const
 
template<typename BaseRepr >
RepresentationConverterFactory< BaseRepr > * getRepresentationConverterFactory () const
 
RepresentationConverterMetaFactory * getRepresentationConverterMetaFactory () const
 

Additional Inherited Members

- Static Public Member Functions inherited from inviwo::Singleton< InviwoApplication >
static void deleteInstance ()
 
static InviwoApplication * getPtr ()
 
static void init ()
 
static void init (InviwoApplication *instance)
 
static bool isInitialized ()
 

Detailed Description

The main application which holds the instances of all modules.

All modules should be owned and accessed trough this singleton, as well as the processor network and the evaluator.

Member Function Documentation

◆ addCallbackAction()

virtual void inviwo::InviwoApplication::addCallbackAction ( ModuleCallbackAction * callbackAction)
virtual

Add an action that can be shown in for example property widget context menu. Will be shown when right clicking on a property in the NetworkEditor. Added callbacks will be removed in ~InviwoModule when your module is destroyed. Example if you want to do it earlier:

auto& callbackActions = app_->getCallbackActions();
std::erase_if(callbackActions, [&](auto& a) { return a->getModule() == this; });
See also
getCallbackActions

◆ dispatchFront()

template<class F , class... Args>
auto inviwo::InviwoApplication::dispatchFront ( F && f,
Args &&... args ) -> std::future<std::invoke_result_t<F, Args...>>

Enqueue a functor to be run in the GUI thread

Returns
a future with the result of the functor.

◆ dispatchFrontAndForget()

void inviwo::InviwoApplication::dispatchFrontAndForget ( std::function< void()> fun)

Enqueue a functor to be run in the GUI thread.

◆ getCallbackActions()

virtual std::vector< std::unique_ptr< ModuleCallbackAction > > & inviwo::InviwoApplication::getCallbackActions ( )
virtual

Get list of ModuleCallbackAction shown in for example property widget context menu. Do not keep references to elements in the list around since you cannot be notified when they will be removed.

See also
addCallbackAction

◆ getCameraFactory()

CameraFactory * inviwo::InviwoApplication::getCameraFactory ( ) const
inline

Camera factory

See also
Camera
CameraFactory

◆ getDataReaderFactory()

DataReaderFactory * inviwo::InviwoApplication::getDataReaderFactory ( ) const
inline

◆ getDataWriterFactory()

DataWriterFactory * inviwo::InviwoApplication::getDataWriterFactory ( ) const
inline

◆ getDialogFactory()

DialogFactory * inviwo::InviwoApplication::getDialogFactory ( ) const
inline

Dialog factory

See also
Dialog
DialogFactory

◆ getInportFactory()

InportFactory * inviwo::InviwoApplication::getInportFactory ( ) const
inline

Inport factory

See also
Inport
InportFactory

◆ getLayerRamResizer()

LayerRamResizer * inviwo::InviwoApplication::getLayerRamResizer ( ) const

Get the current LayerRamResizer

See also
LayerRamResizer CIMGLayerRamResizer LayerRAM::copyRepresentationsTo()

◆ getMeshDrawerFactory()

MeshDrawerFactory * inviwo::InviwoApplication::getMeshDrawerFactory ( ) const
inline

◆ getMetaDataFactory()

MetaDataFactory * inviwo::InviwoApplication::getMetaDataFactory ( ) const
inline

◆ getModuleCapabilities()

std::vector< Capabilities * > inviwo::InviwoApplication::getModuleCapabilities ( )

Retrieve all Capabilities from all modules, and the system capabilities

See also
Capabilities
InviwoModule

◆ getModuleSettings()

const std::vector< Settings * > & inviwo::InviwoApplication::getModuleSettings ( )

Retrieve all Settings from all modules including the SystemSettings

See also
Settings
InviwoModule

◆ getOutportFactory()

OutportFactory * inviwo::InviwoApplication::getOutportFactory ( ) const
inline

Outport factory

See also
Outport
OutportFactory

◆ getPoolSize()

size_t inviwo::InviwoApplication::getPoolSize ( ) const

Get the current number of worker threads in the thread pool

◆ getPortInspectorFactory()

PortInspectorFactory * inviwo::InviwoApplication::getPortInspectorFactory ( ) const
inline

◆ getProcessorFactory()

ProcessorFactory * inviwo::InviwoApplication::getProcessorFactory ( ) const
inline

◆ getProcessorWidgetFactory()

ProcessorWidgetFactory * inviwo::InviwoApplication::getProcessorWidgetFactory ( ) const
inline

◆ getPropertyConverterManager()

PropertyConverterManager * inviwo::InviwoApplication::getPropertyConverterManager ( ) const
inline

◆ getPropertyFactory()

PropertyFactory * inviwo::InviwoApplication::getPropertyFactory ( ) const
inline

◆ getPropertyWidgetFactory()

PropertyWidgetFactory * inviwo::InviwoApplication::getPropertyWidgetFactory ( ) const
inline

◆ getRepresentationConverterFactory()

template<typename BaseRepr >
RepresentationConverterFactory< BaseRepr > * inviwo::InviwoApplication::getRepresentationConverterFactory ( ) const

Get a Representation converter factory for a specific kind of representation (Volume Representation, Layer Representation, Buffer Representation, etc)

See also
Data
RepresentationConverter
RepresentationConverterFactory

◆ getRepresentationConverterMetaFactory()

RepresentationConverterMetaFactory * inviwo::InviwoApplication::getRepresentationConverterMetaFactory ( ) const
inline

The Representation Converter Meta Factory holds RepresentationConverterFactories for various kinds of representations (Volume Representation, Layer Representation, Buffer Representation, etc)

See also
Data
DataRepresentation
RepresentationConverter
RepresentationConverterFactory
RepresentationConverterMetaFactory

◆ getRepresentationFactory()

template<typename BaseRepr >
RepresentationFactory< BaseRepr > * inviwo::InviwoApplication::getRepresentationFactory ( ) const

Get a Representation factory for a specific kind of representation (Volume Representation, Layer Representation, Buffer Representation, etc)

See also
Data
DataRepresentation
RepresentationFactory

◆ getRepresentationMetaFactory()

RepresentationMetaFactory * inviwo::InviwoApplication::getRepresentationMetaFactory ( ) const
inline

The Representation Meta Factory holds RepresentationFactories for various kinds of representations (Volume Representation, Layer Representation, Buffer Representation, etc)

See also
Data
DataRepresentation
RepresentationFactory
RepresentationMetaFactory

◆ getResourceManager()

ResourceManager * inviwo::InviwoApplication::getResourceManager ( )
inline

Returns the ResourceManager owned the InviwoApplication

See also
ResourceManager

◆ registerModules()

void inviwo::InviwoApplication::registerModules ( RuntimeModuleLoading )

Load modules from dynamic library files in the regular search paths.

Will recursively search for all dll/so/dylib/bundle files in the regular search paths. The library filename must contain "inviwo-module" to be loaded.

Note
Which modules to load can be specified by creating a file (application_name-enabled-modules.txt) containing the names of the modules to load. Forwards to ModuleManager.

◆ resizePool()

void inviwo::InviwoApplication::resizePool ( size_t newSize)

Set the number of worker threads in the thread pool. This will block for working threads to finish

◆ setFileSystemObserver()

void inviwo::InviwoApplication::setFileSystemObserver ( std::unique_ptr< FileSystemObserver > observer)

Sets the a FileSystemObserver for the application The FileObservers will register themselves in the FileSystemObserver of the InviwoApplication by default. Usually one would set the FileSystemObserver in the main function just after creating the app. By default the FileSystemObserver is nullptr, and no file observation is provided.

See also
FileSystemObserver
FileObservers

◆ setLayerRamResizer()

void inviwo::InviwoApplication::setLayerRamResizer ( LayerRamResizer * obj)

Allow a module the register a LayerRamResizer with the inviwoapplication. The module is responsible for unregistering the LayerRamResizer before it is removed, by calling setLayerRamResizer(nullptr), if the current LayerRamResizer was registered by that module.

See also
CIMGLayerRamResizer CImgModule

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