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 <inviwoapplication.h>

Inheritance diagram for inviwo::InviwoApplication:

Classes

struct  Queue

Public Types

enum class  LongWait { Start , Update , End }

Public Member Functions

 InviwoApplication (std::string_view displayName)
 InviwoApplication (int argc, char **argv, std::string_view displayName)
 InviwoApplication (const InviwoApplication &rhs)=delete
InviwoApplicationoperator= (const InviwoApplication &that)=delete
void registerModules (std::vector< std::unique_ptr< InviwoModuleFactoryObject > > modules)
 Registers modules from factories and takes ownership of input module factories. Module is registered if dependencies exist and they have correct version.
void registerModules (RuntimeModuleLoading)
 Load modules from dynamic library files in the regular search paths.
void registerModules (RuntimeModuleLoading, std::function< bool(std::string_view)> isEnabled)
ModuleManagergetModuleManager ()
const ModuleManagergetModuleManager () const
InviwoModulegetModuleByIdentifier (const std::string &identifier) const
ProcessorNetworkgetProcessorNetwork ()
ProcessorNetworkEvaluatorgetProcessorNetworkEvaluator ()
WorkspaceManagergetWorkspaceManager ()
PropertyPresetManagergetPropertyPresetManager ()
PortInspectorManagergetPortInspectorManager ()
DataVisualizerManagergetDataVisualizerManager ()
CommandLineParsergetCommandLineParser ()
const CommandLineParsergetCommandLineParser () const
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:
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.
const std::vector< Settings * > & getModuleSettings ()
SystemSettingsgetSystemSettings ()
void registerSettings (Settings *settings)
void unregisterSettings (Settings *settings)
template<class T>
T * getSettingsByType ()
std::vector< Capabilities * > getModuleCapabilities ()
template<class T>
T * getCapabilitiesByType ()
std::locale getUILocale () const
void setUILocale (const std::locale &locale)
template<class F, class... Args>
auto dispatchPool (F &&f, Args &&... args) -> std::future< std::invoke_result_t< F, Args... > >
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)
size_t processFront ()
void processEvents ()
void setProcessEventsCallback (std::function< void()> callback)
size_t getPoolSize () const
void resizePool (size_t newSize)
void setPoolResizeWaitCallback (std::function< void(LongWait)> callback)
void waitForPool ()
void setPostEnqueueFront (std::function< void()> func)
void setProgressCallback (std::function< void(std::string_view)> progressCallback)
ThreadPoolgetThreadPool ()
ResourceManagergetResourceManager ()
void setFileSystemObserver (std::unique_ptr< FileSystemObserver > observer)
FileSystemObservergetFileSystemObserver () const
TimerThreadgetTimerThread ()
const std::string & getDisplayName () const
virtual void printApplicationInfo ()
void postProgress (std::string_view progress) const
LayerRamResizergetLayerRamResizer () const
void setLayerRamResizer (LayerRamResizer *obj)
void setAssertionHandler (std::function< void(std::string_view message, SourceContext context)> assertionHandler)
const std::function< void(std::string_view message, SourceContext context)> & getAssertionHandler () const
Public Member Functions inherited from inviwo::Singleton< InviwoApplication >
void operator= (const Singleton &)=delete

Protected Attributes

std::string displayName_
std::unique_ptr< CommandLineParsercommandLineParser_
std::shared_ptr< ConsoleLoggerconsoleLogger_
std::shared_ptr< FileLoggerfilelogger_
std::function< void(std::string_view)> progressCallback_
std::unique_ptr< FileSystemObserverfileSystemObserver_
std::locale uiLocale_ {}
std::function< void(LongWait)> poolResizeCallback_
std::function< void()> processEventsCallback_
ThreadPool pool_
Queue queue_
util::OnScopeExit clearAllSingeltons_
std::unique_ptr< ResourceManagerresourceManager_
std::unique_ptr< CameraFactorycameraFactory_
std::unique_ptr< DataReaderFactorydataReaderFactory_
std::unique_ptr< DataWriterFactorydataWriterFactory_
std::unique_ptr< DialogFactorydialogFactory_
std::unique_ptr< MeshDrawerFactorymeshDrawerFactory_
std::unique_ptr< MetaDataFactorymetaDataFactory_
std::unique_ptr< OutportFactoryoutportFactory_
std::unique_ptr< InportFactoryinportFactory_
std::unique_ptr< PortInspectorFactoryportInspectorFactory_
std::unique_ptr< DataVisualizerManagerdataVisualizerManager_
std::unique_ptr< ProcessorFactoryprocessorFactory_
std::unique_ptr< ProcessorWidgetFactoryprocessorWidgetFactory_
std::unique_ptr< PropertyConverterManagerpropertyConverterManager_
std::unique_ptr< PropertyFactorypropertyFactory_
std::unique_ptr< PropertyWidgetFactorypropertyWidgetFactory_
std::unique_ptr< RepresentationMetaFactoryrepresentationMetaFactory_
std::unique_ptr< RepresentationConverterMetaFactoryrepresentationConverterMetaFactory_
std::vector< Settings * > settingsRegistry_
std::unique_ptr< SystemSettingssystemSettings_
std::vector< std::unique_ptr< ModuleCallbackAction > > moduleCallbackActions_
std::unique_ptr< ModuleManagermoduleManager_
std::unique_ptr< ProcessorNetworkprocessorNetwork_
std::unique_ptr< ProcessorNetworkEvaluatorprocessorNetworkEvaluator_
std::unique_ptr< WorkspaceManagerworkspaceManager_
std::unique_ptr< PropertyPresetManagerpropertyPresetManager_
std::unique_ptr< PortInspectorManagerportInspectorManager_
std::unique_ptr< detail::InviwoApplicationCallbacks > callbacks_
std::unique_ptr< TimerThreadtimerThread_
LayerRamResizerlayerRamResizer_
std::function< void(std::string_view message, SourceContext context)> assertionHandler_

Factories

CameraFactorygetCameraFactory () const
DataReaderFactorygetDataReaderFactory () const
DataWriterFactorygetDataWriterFactory () const
DialogFactorygetDialogFactory () const
MeshDrawerFactorygetMeshDrawerFactory () const
MetaDataFactorygetMetaDataFactory () const
InportFactorygetInportFactory () const
OutportFactorygetOutportFactory () const
PortInspectorFactorygetPortInspectorFactory () const
ProcessorFactorygetProcessorFactory () const
ProcessorWidgetFactorygetProcessorWidgetFactory () const
PropertyConverterManagergetPropertyConverterManager () const
PropertyFactorygetPropertyFactory () const
PropertyWidgetFactorygetPropertyWidgetFactory () const
template<typename BaseRepr>
RepresentationFactory< BaseRepr > * getRepresentationFactory () const
RepresentationMetaFactorygetRepresentationMetaFactory () const
template<typename BaseRepr>
RepresentationConverterFactory< BaseRepr > * getRepresentationConverterFactory () const
RepresentationConverterMetaFactorygetRepresentationConverterMetaFactory () const

Additional Inherited Members

Static Public Member Functions inherited from inviwo::Singleton< InviwoApplication >
static void init ()
static InviwoApplicationgetPtr ()
static void deleteInstance ()
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:
  • inviwoapplication.h