segment_selection_result.h 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_SEGMENT_SELECTION_RESULT_H_
  5. #define COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_SEGMENT_SELECTION_RESULT_H_
  6. #include "components/segmentation_platform/public/proto/segmentation_platform.pb.h"
  7. #include "third_party/abseil-cpp/absl/types/optional.h"
  8. namespace segmentation_platform {
  9. // The result of segmentation and related metadata.
  10. struct SegmentSelectionResult {
  11. SegmentSelectionResult();
  12. ~SegmentSelectionResult();
  13. SegmentSelectionResult(const SegmentSelectionResult& other);
  14. SegmentSelectionResult& operator=(const SegmentSelectionResult& other);
  15. bool operator==(const SegmentSelectionResult& other) const;
  16. // Whether or not the segmentation backend is ready, and has enough data for
  17. // computing a segment.
  18. bool is_ready{false};
  19. // The result of segmentation. Can be empty if the the backend couldn't select
  20. // a segment with confidence.
  21. absl::optional<proto::SegmentId> segment;
  22. };
  23. } // namespace segmentation_platform
  24. #endif // COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_SEGMENT_SELECTION_RESULT_H_