Project import generated by Copybara.
GitOrigin-RevId: 6e4aff1cc351be3ae4537b677f36d139ee50ce09
This commit is contained in:
@@ -41,6 +41,19 @@ struct GraphService : public GraphServiceBase {
|
||||
constexpr GraphService(const char* key) : GraphServiceBase(key) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class ServiceBinding {
|
||||
public:
|
||||
bool IsAvailable() { return service_ != nullptr; }
|
||||
T& GetObject() { return *service_; }
|
||||
|
||||
ServiceBinding() {}
|
||||
explicit ServiceBinding(std::shared_ptr<T> service) : service_(service) {}
|
||||
|
||||
private:
|
||||
std::shared_ptr<T> service_;
|
||||
};
|
||||
|
||||
} // namespace mediapipe
|
||||
|
||||
#endif // MEDIAPIPE_FRAMEWORK_GRAPH_SERVICE_H_
|
||||
|
||||
Reference in New Issue
Block a user