omni::graph::exec::unstable::GraphT

Defined in omni/graph/exec/unstable/Graph.h

template<typename ...Bases>
class GraphT : public omni::graph::exec::unstable::Implements<Bases...>

Top-level container for storing the Execution Framework’s graph of graphs.

omni::graph::exec::unstable::IGraph is the top-level container used to store the graph of graphs. This top-level container is referred to as the execution graph.

omni::graph::exec::unstable::IGraph’s responsibilities include:

  • Tracking if the graph is currently being constructed. See omni::graph::exec::unstable::IGraph::inBuild().

  • Tracking gross changes to the topologies of graphs within the execution graph. This is done with the global topology stamp (see omni::graph::exec::unstable::IGraph::getGlobalTopologyStamp()). Each time a topology is invalidated, the global topology stamp is incremented. Consumers of the execution graph can use this stamp to detect changes in the graph. See Graph Invalidation for details.

  • Owning and providing access to the top level graph definition (see omni::graph::exec::unstable::IGraph::getNodeGraphDef()). The root node of the top-level graph definition is the root of execution graph. omni::graph::exec::unstable::IGraph is the only container, other than omni::graph::exec::unstable::INode, that attaches to definitions.

See Graph Concepts for more information on how omni::graph::exec::unstable::IGraph fits into the Execution Framework.

See omni::graph::exec::unstable::Graph for a concrete implementation of this interface.

Public Functions

inline void acquire() noexcept

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release() noexcept

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline uint32_t getUseCount() noexcept

Returns the number of different instances (this included) referencing the current object.

Thread Safety

This method is thread safe.

inline void *cast(omni::core::TypeId id) noexcept

See omni::core::IObject::cast.

inline void *castWithoutAcquire(omni::core::TypeId id) noexcept

See omni::graph::exec::unstable::IBase_abi::castWithoutAcquire_abi.

Public Static Functions

static inline omni::core::ObjectPtr<GraphT> create(const carb::cpp::string_view &name) noexcept

Construct a graph with default executor attached to an empty node graph.

name is the name of the graph and must not be nullptr.

A valid pointer is always returned.

static inline omni::core::ObjectPtr<GraphT> create(const ExecutorFactory &executorFactory, const carb::cpp::string_view &name) noexcept

Construct a graph with a given executor and an empty node graph.

executorFactory is a factory to create a user defined executor to execute the graph.

name is the name of the graph and must not be nullptr.

A valid pointer is always returned.

template<typename Fn>
static inline omni::core::ObjectPtr<GraphT> create(const carb::cpp::string_view &name, Fn &&nodeGraphDefFactory) noexcept

Construct a graph with the given node graph.

nodeGraphDefFactory will be used to create the graph’s top-level graph definition.

The signature of nodeGraphDefFactory must be equivalent to NodeGraphDefPtr(IGraph*).

A valid pointer is always returned.

Protected Functions

inline INodeGraphDef *getNodeGraphDef_abi() noexcept override

Access the top-level node graph definition.

The returned omni::graph::exec::unstable::INodeGraphDef will not have omni::core::IObject::acquire() called before being returned.

This method always returns a valid pointer.

Thread Safety

This method is thread safe. The returned pointer will be valid for the lifetime of this omni::graph::exec::unstable::IGraph.

inline const ConstName *getName_abi() noexcept override

Name set on the graph during construction.

This method always returns a valid pointer.

Thread Safety

This method is thread safe. The returned pointer will be valid for the lifetime of this omni::graph::exec::unstable::IGraph.

inline Stamp *getGlobalTopologyStamp_abi() noexcept override

Return global topology of the graph. Useful when detecting that graph transformation pipeline needs to run.

See Graph Invalidation to understand how this stamp is used to detect changes in the graph.

This method always returns a valid pointer.

Thread Safety

This method is thread safe. The returned pointer will be valid for the lifetime of this omni::graph::exec::unstable::IGraph. It is up to the caller to mutate the stamp in a thread safe manner.

inline virtual bool inBuild_abi() noexcept override

Return true if a omni::graph::exec::unstable::IGraphBuilder is currently building a part of this graph.

Thread Safety

This method is thread safe.

inline virtual void _setInBuild_abi(bool inBuild) noexcept override

Mark that an omni::graph::exec::unstable::IGraphBuilder is currently building a part of this graph.

Each builder should call _setInBuild(true) followed by _setInBuild(false) once building is complete. Since multiple builders can be active at a time, it is safe for this method to be called multiple times.

This method should only be called by omni::graph::exec::unstable::IGraphBuilder.

Thread Safety

This method is thread safe.

inline GraphT(const carb::cpp::string_view &name) noexcept

Construct with a default top level graph definition.

inline GraphT(const ExecutorFactory &executorFactory, const carb::cpp::string_view &name) noexcept

Construct with a custom executor for a top level graph definition.

template<typename Fn>
inline GraphT(const carb::cpp::string_view &name, Fn &&nodeGraphDefFactory) noexcept

Construct with a custom top level graph factory.

inline void acquire_abi() noexcept override

Increments the object’s reference count.

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline void release_abi() noexcept override

Decrements the objects reference count.

Most implementations will destroy the object if the reference count reaches 0 (though this is not a requirement).

Objects may have multiple reference counts (e.g. one per interface implemented). As such, it is important that you call omni::core::IObject::release() on the same pointer from which you called omni::core::IObject::acquire().

Do not directly use this method, rather use omni::core::ObjectPtr, which will manage calling omni::core::IObject::acquire() and omni::core::IObject::release() for you.

Thread Safety

This method is thread safe.

inline uint32_t getUseCount_abi() noexcept override

Returns the number of different instances (this included) referencing the current object.

inline void *cast_abi(omni::core::TypeId id) noexcept override

Returns a pointer to the interface defined by the given type id if this object implements the type id’s interface.

Objects can support multiple interfaces, even interfaces that are in different inheritance chains.

The returned object will have omni::core::IObject::acquire() called on it before it is returned, meaning it is up to the caller to call omni::core::IObject::release() on the returned pointer.

The returned pointer can be safely reinterpret_cast<> to the type id’s C++ class. For example, “omni.windowing.IWindow” can be cast to omni::windowing::IWindow.

Do not directly use this method, rather use a wrapper function like omni::core::cast() or omni::core::ObjectPtr::as().

Thread Safety

This method is thread safe.

inline void *castWithoutAcquire_abi(omni::core::TypeId id) noexcept override

Casts this object to the type described the the given id.

Returns nullptr if the cast was not successful.

Unlike omni::core::IObject::cast(), this casting method does not call omni::core::IObject::acquire().

Thread Safety

This method is thread safe.

Protected Attributes

std::atomic<uint32_t> m_refCount

Reference count.