|
Bifrost SDK
Bifrost SDK documentation
|
The Workspace is the central element of the BifrostGraph Executor. More...
#include <Workspace.h>
Public Types | |
| template<typename T > | |
| using | DeleterFunc = void(*)(T *p) |
The signature for the custom pointer deleter of a pointee p. More... | |
Public Member Functions | |
| virtual | ~Workspace () noexcept |
| Destructor. More... | |
| virtual bool | isValid () const noexcept |
| Check if this Workspace has been successfully initialized. More... | |
| bool | loadConfigFiles (const StringArray &configFiles, const StringArray &disabledPacks=StringArray()) noexcept |
Read the Bifrost configuration JSON files listed in configFiles, excluding from them the packs listed in disabledPacks, and then load all resources listed in these files. More... | |
| bool | registerTypeTranslationsPlugins (TypeTranslation::PluginHostData *hostData) const noexcept |
| Let the TypeTranslations register any plugins or data types they need. More... | |
| bool | unregisterTypeTranslationsPlugins (TypeTranslation::PluginHostData *hostData) const noexcept |
| Let the TypeTranslations unregister any previously registered plugins or data types. More... | |
| template<typename Functor > | |
| GraphContainer & | addGraphContainerT (Functor &&func) noexcept |
Create a new GraphContainer and add it to this Workspace. This template method allows one to create and add an instance of their own subclass of the GraphContainer base class by passing a Functor func that creates such an instance of their subclass. More... | |
| bool | deleteGraphContainer (GraphContainer &graphContainer) noexcept |
Delete the GraphContainer referred by graphContainer and remove it from this Workspace. Once deleted, any attempt to access the methods of graphContainer will produce undefined behavior. More... | |
| const Watchpoint * | getWatchpoint (const Amino::TypeId &typeId) const noexcept |
Get the Watchpoint registered for the Amino::TypeId typeId. More... | |
| const Library & | getLibrary () const noexcept |
| Get the Library that is used by this Workspace. More... | |
| Library & | getLibrary () noexcept |
| Get the Library that is used by this Workspace. More... | |
| GraphContainer & | addGraphContainer () noexcept |
| Aliases for adding an instance of a GraphContainer base class, using an optional custom deleter function. These alias methods call the generic addGraphContainerT<> template method, passing a Functor that creates a new instance of a GraphContainer base class. More... | |
| GraphContainer & | addGraphContainer (DeleterFunc< GraphContainer > deleter) noexcept |
| Aliases for adding an instance of a GraphContainer base class, using an optional custom deleter function. These alias methods call the generic addGraphContainerT<> template method, passing a Functor that creates a new instance of a GraphContainer base class. More... | |
| WatchpointLayoutFactory const & | getWatchpointLayoutFactory () const noexcept |
| Get the watchpoint layout factory. More... | |
| WatchpointLayoutFactory & | getWatchpointLayoutFactory () noexcept |
| Get the watchpoint layout factory. More... | |
| const Private::IRestrictedWorkspaceServices & | getRestrictedServices () const noexcept |
| Obtain an interface giving access to private Workspace services. More... | |
| Private::IRestrictedWorkspaceServices & | getRestrictedServices () noexcept |
| Obtain an interface giving access to private Workspace services. More... | |
Static Public Member Functions | |
| static Workspace & | getInvalid () noexcept |
| Get a statically allocated Workspace that is uninitialized, invalid and not linked to any Library, GraphContainer or Job. Any operation on this instance will always fail and Workspace::isValid will return false. More... | |
Protected Member Functions | |
| Workspace (const Amino::String &name) noexcept | |
| Construct a Workspace. The Workspace is initialized with a newly created BifrostGraph::Executor::Library with the given name. More... | |
| Workspace (Uninitialized uninitialized) noexcept | |
| Constructor that leaves the Workspace in an uninitialized state. More... | |
| EXECUTOR_DECLARE_MAKE_OWNER_FRIENDSHIP () | |
| Allow the makeOwner<> factory functions to access the constructors of this class. More... | |
| void | reportMessage (MessageCategory category, const Amino::String &message) const noexcept |
| Report a message from this Workspace and call the Workspace's onReportedMessage notification method. The source of the reported message will be set to MessageSource::kWorkspace. More... | |
Private Member Functions | |
| virtual void | onReportedMessage (MessageSource source, MessageCategory category, const Amino::String &message) const noexcept |
| The method called by the Workspace to notify the deriving class that a message was reported by this Workspace, its BifrostGraph::Executor::Library, a BifrostGraph::Executor::GraphContainer or a Job. Bifrost can call this method asynchronously in some situations such as reporting information when loading configuration files, loading definition files, loading a compound, terminating a job etc. If overridden, the implementation of this method must be thread safe and must not throw any exception. More... | |
Friends | |
| class | Private::WorkspaceImpl |
The Workspace is the central element of the BifrostGraph Executor.
A Workspace object holds a Library that stores all Bifrost resources and GraphContainers that represent the graphs to be executed. For the time being, a Library should not be shared by multiple Workspaces, since the Library modifications are not yet thread safe. On the other hand, creating a Library, loading resources into it and then sharing it in read-only with another Workspace could be supported in the future, but there are no mechanism that enforces the read-only mode, so users would have to be careful here.
Definition at line 69 of file Workspace.h.
| using BifrostGraph::Executor::Workspace::DeleterFunc = void (*)(T* p) |
The signature for the custom pointer deleter of a pointee p.
This is the custom deleter type used by the Workspace::addGraphContainer(DeleterFunc<GraphContainer>) alias method.
| T | the storage type used for the owned GraphContainer object. |
| [in] | p | a pointer to the owned object to destruct. Can be nullptr. |
Definition at line 234 of file Workspace.h.
|
explicitprotectednoexcept |
Construct a Workspace. The Workspace is initialized with a newly created BifrostGraph::Executor::Library with the given name.
If an error occurs during the construction of this Workspace, or its underlying BifrostGraph::Executor::Library, then BifrostGraph::Executor::Workspace::isValid will return false and all future operations on this Workspace will fail.
This constructor is protected to force the usage of factory functions BifrostGraph::Executor::makeOwner (see Factory.h) to create it. If a class is derived from Workspace, it is recommended to keep protected the constructors on the derived class, and still use the factory functions to create a derived class instance.
| [in] | name | An optional name for the BifrostGraph::Executor::Library. |
|
explicitprotectednoexcept |
Constructor that leaves the Workspace in an uninitialized state.
After this constructor returns, the method BifrostGraph::Executor::Workspace::isValid will return false and all future operations on the Workspace will fail.
| [in] | uninitialized | an Uninitialized enum value. |
|
virtualnoexcept |
Destructor.
|
noexcept |
Aliases for adding an instance of a GraphContainer base class, using an optional custom deleter function. These alias methods call the generic addGraphContainerT<> template method, passing a Functor that creates a new instance of a GraphContainer base class.
|
noexcept |
Aliases for adding an instance of a GraphContainer base class, using an optional custom deleter function. These alias methods call the generic addGraphContainerT<> template method, passing a Functor that creates a new instance of a GraphContainer base class.
|
inlinenoexcept |
Create a new GraphContainer and add it to this Workspace. This template method allows one to create and add an instance of their own subclass of the GraphContainer base class by passing a Functor func that creates such an instance of their subclass.
| Functor | the function used to create a new instance of a GraphContainer, wrapped in an Owner object. The signature of this function must be: Owner<GraphContainer> func(Private::IGraphContainerOwner& owner); |
| func | the function called by this method to create a new GraphContainer. |
func returned a non-empty Owner<> containing a valid GraphContainer, and if the Workspace has successfully added it, then a reference to the newly added GraphContainer is returned; otherwise, a reference to an invalid GraphContainer is returned. Definition at line 207 of file Workspace.h.
References BifrostGraph::Executor::GraphContainer::getInvalid().
|
noexcept |
Delete the GraphContainer referred by graphContainer and remove it from this Workspace. Once deleted, any attempt to access the methods of graphContainer will produce undefined behavior.
graphContainer is owned by this Workspace and it has been successfully deleted and removed; false otherwise.
|
protected |
Allow the makeOwner<> factory functions to access the constructors of this class.
|
staticnoexcept |
Get a statically allocated Workspace that is uninitialized, invalid and not linked to any Library, GraphContainer or Job. Any operation on this instance will always fail and Workspace::isValid will return false.
|
noexcept |
|
noexcept |
|
noexcept |
Obtain an interface giving access to private Workspace services.
|
noexcept |
Obtain an interface giving access to private Workspace services.
|
noexcept |
Get the Watchpoint registered for the Amino::TypeId typeId.
| typeId | The Amino::TypeId for which to get the Watchpoint. |
typeId or nullptr if none is registered for it.
|
noexcept |
Get the watchpoint layout factory.
|
noexcept |
Get the watchpoint layout factory.
|
virtualnoexcept |
Check if this Workspace has been successfully initialized.
If an error occurs during the construction of a Workspace, isValid() will return false and all future operations on the Workspace will fail. If this method is overridden, the deriving implementation should first call the base class implementation to check if this Workspace is valid, then do its own subclass validation.
|
noexcept |
Read the Bifrost configuration JSON files listed in configFiles, excluding from them the packs listed in disabledPacks, and then load all resources listed in these files.
The details about the errors that may occur while reading the configuration data, or while loading the resources, are reported by calls to Workspace's onReportedMessage. All configuration files are read even if errors are detected while reading them. If any error is detected while reading the configuration files, none of the resources they list will be loaded and false will be returned.
|
privatevirtualnoexcept |
The method called by the Workspace to notify the deriving class that a message was reported by this Workspace, its BifrostGraph::Executor::Library, a BifrostGraph::Executor::GraphContainer or a Job. Bifrost can call this method asynchronously in some situations such as reporting information when loading configuration files, loading definition files, loading a compound, terminating a job etc. If overridden, the implementation of this method must be thread safe and must not throw any exception.
| source | The source of this message. |
| category | The message category. |
| message | The message itself. |
|
noexcept |
Let the TypeTranslations register any plugins or data types they need.
This method will call TypeTranslation::registerHostPlugins with the hostData argument on each registered TypeTranslation resource object.
| hostData | The host data to pass to each registerHostPlugins function to call. |
|
protectednoexcept |
Report a message from this Workspace and call the Workspace's onReportedMessage notification method. The source of the reported message will be set to MessageSource::kWorkspace.
| category | The message category. |
| message | The message itself. |
|
noexcept |
Let the TypeTranslations unregister any previously registered plugins or data types.
This method will call TypeTranslation::unregisterHostPlugins with the hostData argument on each registered TypeTranslation resource object.
| hostData | The host data to pass to each unregisterHostPlugins function to call. |
|
friend |
Definition at line 355 of file Workspace.h.