Document proper way to set services.
PiperOrigin-RevId: 513955214
This commit is contained in:
parent
2963739086
commit
3854d9fcd5
|
@ -383,6 +383,12 @@ class CalculatorGraph {
|
||||||
absl::Status SetGpuResources(std::shared_ptr<GpuResources> resources);
|
absl::Status SetGpuResources(std::shared_ptr<GpuResources> resources);
|
||||||
#endif // !MEDIAPIPE_DISABLE_GPU
|
#endif // !MEDIAPIPE_DISABLE_GPU
|
||||||
|
|
||||||
|
// Sets a service object, essentially a graph-level singleton, which can be
|
||||||
|
// accessed by calculators and subgraphs without requiring an explicit
|
||||||
|
// connection.
|
||||||
|
//
|
||||||
|
// NOTE: must be called before `Initialize`, so subgraphs can access services
|
||||||
|
// as well, as graph expansion happens during initialization.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
absl::Status SetServiceObject(const GraphService<T>& service,
|
absl::Status SetServiceObject(const GraphService<T>& service,
|
||||||
std::shared_ptr<T> object) {
|
std::shared_ptr<T> object) {
|
||||||
|
@ -395,6 +401,13 @@ class CalculatorGraph {
|
||||||
return service_manager_.GetServiceObject(service);
|
return service_manager_.GetServiceObject(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Sets a service object, essentially a graph-level singleton, which can be
|
||||||
|
// accessed by calculators and subgraphs without requiring an explicit
|
||||||
|
// connection.
|
||||||
|
//
|
||||||
|
// NOTE: must be called before `Initialize`, so subgraphs can access services
|
||||||
|
// as well, as graph expansion happens during initialization.
|
||||||
|
//
|
||||||
// Only the Java API should call this directly.
|
// Only the Java API should call this directly.
|
||||||
absl::Status SetServicePacket(const GraphServiceBase& service, Packet p) {
|
absl::Status SetServicePacket(const GraphServiceBase& service, Packet p) {
|
||||||
// TODO: check that the graph has not been started!
|
// TODO: check that the graph has not been started!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user