#ifndef MEDIAPIPE_FRAMEWORK_GRAPH_SERVICE_MANAGER_H_ #define MEDIAPIPE_FRAMEWORK_GRAPH_SERVICE_MANAGER_H_ #include #include "absl/status/status.h" #include "mediapipe/framework/graph_service.h" #include "mediapipe/framework/packet.h" namespace mediapipe { class GraphServiceManager { public: template absl::Status SetServiceObject(const GraphService& service, std::shared_ptr object) { return SetServicePacket(service, MakePacket>(std::move(object))); } absl::Status SetServicePacket(const GraphServiceBase& service, Packet p); template std::shared_ptr GetServiceObject(const GraphService& service) const { Packet p = GetServicePacket(service); if (p.IsEmpty()) return nullptr; return p.Get>(); } const std::map& ServicePackets() { return service_packets_; } private: Packet GetServicePacket(const GraphServiceBase& service) const; std::map service_packets_; friend class CalculatorGraph; }; } // namespace mediapipe #endif // MEDIAPIPE_FRAMEWORK_GRAPH_SERVICE_MANAGER_H_