Inviwo  0.9.10.1
Inviwo documentation
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  Message { Ok, Error }
 

Public Member Functions

 InviwoApplication (std::string displayName)
 
 InviwoApplication (int argc, char **argv, std::string displayName)
 
 InviwoApplication (const InviwoApplication &rhs)=delete
 
InviwoApplicationoperator= (const InviwoApplication &that)=delete
 
virtual 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.
 
virtual void registerModules (RuntimeModuleLoading)
 Load modules from dynamic library files in the regular search paths. More...
 
std::string getBasePath () const
 
std::string getPath (PathType pathType, const std::string &suffix="", const bool &createFolder=false)
 
ModuleManagergetModuleManager ()
 
const ModuleManagergetModuleManager () const
 
const std::vector< std::unique_ptr< InviwoModule > > & getModules () const
 
template<class T >
T * getModuleByType () 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: More...
 
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. More...
 
std::vector< Settings * > getModuleSettings ()
 
SystemSettingsgetSystemSettings ()
 
template<class T >
T * getSettingsByType ()
 
std::vector< Capabilities * > getModuleCapabilities ()
 
SystemCapabilitiesgetSystemCapabilities ()
 
template<class T >
T * getCapabilitiesByType ()
 
virtual std::locale getUILocale () const
 
template<class F , class... Args>
auto dispatchPool (F &&f, Args &&... args) -> std::future< typename std::result_of< F(Args...)>::type >
 
template<class F , class... Args>
auto dispatchFront (F &&f, Args &&... args) -> std::future< typename std::result_of< F(Args...)>::type >
 
void dispatchFrontAndForget (std::function< void()> fun)
 
virtual void processFront ()
 
size_t getPoolSize () const
 
virtual void resizePool (size_t newSize)
 
void waitForPool ()
 
void setPostEnqueueFront (std::function< void()> func)
 
void setProgressCallback (std::function< void(std::string)> progressCallback)
 
ResourceManagergetResourceManager ()
 
virtual void closeInviwoApplication ()
 
virtual void registerFileObserver (FileObserver *fileObserver)
 
virtual void unRegisterFileObserver (FileObserver *fileObserver)
 
virtual void startFileObservation (std::string fileName)
 
virtual void stopFileObservation (std::string fileName)
 
virtual void playSound (Message soundID)
 
TimerThreadgetTimerThread ()
 
const std::string & getDisplayName () const
 
virtual void printApplicationInfo ()
 
void postProgress (std::string progress)
 
UsageMode getApplicationUsageMode () const
 
void setApplicationUsageMode (UsageMode mode)
 
virtual void onResourceManagerEnableStateChanged () override
 
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
 
- Public Member Functions inherited from inviwo::Singleton< InviwoApplication >
 Singleton (Singleton< InviwoApplication > const &)=delete
 
void operator= (Singleton< InviwoApplication > const &)=delete
 
- Public Member Functions inherited from inviwo::ResourceManagerObserver
virtual void onResourceAdded (const std::string &, const std::type_index &, Resource *)
 
virtual void onResourceRemoved (const std::string &, const std::type_index &, Resource *)
 
- Public Member Functions inherited from inviwo::Observer
 Observer (const Observer &other)
 
 Observer (Observer &&other)
 
Observeroperator= (Observer &&other)
 
Observeroperator= (const Observer &other)
 
virtual ~Observer ()
 
void removeObservation (ObservableInterface *observable)
 
void removeObservations ()
 

Protected Attributes

std::string displayName_
 
CommandLineParser commandLineParser_
 
std::shared_ptr< ConsoleLoggerconsoleLogger_
 
std::shared_ptr< FileLoggerfilelogger_
 
std::function< void(std::string)> progressCallback_
 
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::unique_ptr< SystemSettingssystemSettings_
 
std::unique_ptr< SystemCapabilitiessystemCapabilities_
 
std::vector< std::unique_ptr< ModuleCallbackAction > > moduleCallbackActions_
 
ModuleManager moduleManager_
 
std::unique_ptr< ProcessorNetworkprocessorNetwork_
 
std::unique_ptr< ProcessorNetworkEvaluatorprocessorNetworkEvaluator_
 
std::unique_ptr< WorkspaceManagerworkspaceManager_
 
std::unique_ptr< PropertyPresetManagerpropertyPresetManager_
 
std::unique_ptr< PortInspectorManagerportInspectorManager_
 
WorkspaceManager::ClearHandle networkClearHandle_
 
WorkspaceManager::SerializationHandle networkSerializationHandle_
 
WorkspaceManager::DeserializationHandle networkDeserializationHandle_
 
WorkspaceManager::ClearHandle presetsClearHandle_
 
WorkspaceManager::SerializationHandle presetsSerializationHandle_
 
WorkspaceManager::DeserializationHandle presetsDeserializationHandle_
 
std::unique_ptr< TimerThreadtimerThread_
 
- Protected Attributes inherited from inviwo::Observer
ObservableSet observables_
 

Additional Inherited Members

- Static Public Member Functions inherited from inviwo::Singleton< InviwoApplication >
static void init ()
 
static void init (InviwoApplication *instance)
 
static InviwoApplicationgetPtr ()
 
static void deleteInstance ()
 
static bool isInitialized ()
 
- Protected Types inherited from inviwo::Observer
using ObservableSet = std::unordered_set< ObservableInterface * >
 
- Protected Member Functions inherited from inviwo::Observer
void addObservation (ObservableInterface *observable)
 

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()

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();
util::erase_remove_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<typename std::result_of<F(Args...)>::type>

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.

◆ getApplicationUsageMode()

UsageMode inviwo::InviwoApplication::getApplicationUsageMode ( ) const

Convenience method to get the current ApplicationUsageMode from the system settings

◆ getBasePath()

std::string inviwo::InviwoApplication::getBasePath ( ) const

Get the base path of the application. i.e. where the core data and modules folder and etc are.

◆ getCallbackActions()

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

◆ 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()

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

◆ getPath()

std::string inviwo::InviwoApplication::getPath ( PathType  pathType,
const std::string &  suffix = "",
const bool &  createFolder = false 
)

Get basePath + pathType + suffix.

See also
PathType
Parameters
pathTypeEnum for type of path
suffixPath extension
createFolderwhether to create the folder if it does not exist.
Returns
basePath + pathType + suffix

◆ 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  token)
virtual

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)
virtual

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

Reimplemented in inviwo::InviwoApplicationQt.

◆ setApplicationUsageMode()

void inviwo::InviwoApplication::setApplicationUsageMode ( UsageMode  mode)

Convenience method to set the current ApplicationUsageMode in the system settings


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