tp: DBv2 - Overlays::Types

Bug:283763282
Change-Id: I373278567a3b3513efaf473608975aec10b5db83
diff --git a/BUILD b/BUILD
index 81affad..a62edb8 100644
--- a/BUILD
+++ b/BUILD
@@ -1278,6 +1278,7 @@
     name = "src_trace_processor_db_overlays_overlays",
     srcs = [
         "src/trace_processor/db/overlays/storage_overlay.h",
+        "src/trace_processor/db/overlays/types.h",
     ],
 )
 
diff --git a/src/trace_processor/db/overlays/BUILD.gn b/src/trace_processor/db/overlays/BUILD.gn
index 6a0bf99..c1d50d8 100644
--- a/src/trace_processor/db/overlays/BUILD.gn
+++ b/src/trace_processor/db/overlays/BUILD.gn
@@ -13,7 +13,10 @@
 # limitations under the License.
 
 source_set("overlays") {
-  sources = [ "storage_overlay.h" ]
+  sources = [
+    "storage_overlay.h",
+    "types.h",
+  ]
   deps = [
     "../../../../gn:default_deps",
     "../../containers",
diff --git a/src/trace_processor/db/overlays/storage_overlay.h b/src/trace_processor/db/overlays/storage_overlay.h
index bee562e..58dbf50 100644
--- a/src/trace_processor/db/overlays/storage_overlay.h
+++ b/src/trace_processor/db/overlays/storage_overlay.h
@@ -17,10 +17,7 @@
 #ifndef SRC_TRACE_PROCESSOR_DB_OVERLAYS_STORAGE_OVERLAY_H_
 #define SRC_TRACE_PROCESSOR_DB_OVERLAYS_STORAGE_OVERLAY_H_
 
-#include <vector>
-
-#include "src/trace_processor/containers/bit_vector.h"
-#include "src/trace_processor/containers/row_map.h"
+#include "src/trace_processor/db/overlays/types.h"
 
 namespace perfetto {
 namespace trace_processor {
@@ -44,51 +41,9 @@
   // be in terms of storage indices and output might be in terms of table
   // indices).
   //
-  // For this reason, we define a bunch of wrapper structs which "tag" the data
+  // For this reason, we use the defined wrapper structs which "tag" the data
   // structure with the semantics.
 
-  // A range of indices in the table space.
-  struct TableRange {
-    RowMap::Range range;
-  };
-  // A range of indices in the storage space.
-  struct StorageRange {
-    RowMap::Range range;
-  };
-  // A BitVector with set bits corresponding to indices in the table space.
-  struct TableBitVector {
-    BitVector bv;
-  };
-  // A BitVector with set bits corresponding to indices in the table space.
-  struct StorageBitVector {
-    BitVector bv;
-  };
-  // Represents a vector of indices in the table space.
-  struct TableIndexVector {
-    std::vector<uint32_t> indices;
-  };
-  // Represents a vector of indices in the storage space.
-  struct StorageIndexVector {
-    std::vector<uint32_t> indices;
-  };
-
-  // A subset of FilterOp containing operations which can be handled by
-  // overlays.
-  enum class OverlayOp {
-    kIsNull,
-    kIsNotNull,
-    kOther,
-  };
-
-  // Contains estimates of the cost for each of method in this class per row.
-  struct CostEstimatePerRow {
-    uint32_t to_storage_range;
-    uint32_t to_table_bit_vector;
-    uint32_t is_storage_search_required;
-    uint32_t map_to_storage_index_vector;
-    uint32_t index_search;
-  };
-
   virtual ~StorageOverlay();
 
   // Maps a range of indices in table space to an equivalent range of
diff --git a/src/trace_processor/db/overlays/types.h b/src/trace_processor/db/overlays/types.h
new file mode 100644
index 0000000..4e72a41
--- /dev/null
+++ b/src/trace_processor/db/overlays/types.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef SRC_TRACE_PROCESSOR_DB_OVERLAYS_TYPES_H_
+#define SRC_TRACE_PROCESSOR_DB_OVERLAYS_TYPES_H_
+
+#include "src/trace_processor/containers/bit_vector.h"
+#include "src/trace_processor/containers/row_map.h"
+
+namespace perfetto {
+namespace trace_processor {
+namespace overlays {
+
+// A range of indices in the table space.
+struct TableRange {
+  RowMap::Range range;
+};
+
+// A range of indices in the storage space.
+struct StorageRange {
+  RowMap::Range range;
+};
+
+// A BitVector with set bits corresponding to indices in the table space.
+struct TableBitVector {
+  BitVector bv;
+};
+
+// A BitVector with set bits corresponding to indices in the table space.
+struct StorageBitVector {
+  BitVector bv;
+};
+
+// Represents a vector of indices in the table space.
+struct TableIndexVector {
+  std::vector<uint32_t> indices;
+};
+
+// Represents a vector of indices in the storage space.
+struct StorageIndexVector {
+  std::vector<uint32_t> indices;
+};
+
+// A subset of FilterOp containing operations which can be handled by
+// overlays.
+enum class OverlayOp {
+  kIsNull,
+  kIsNotNull,
+  kOther,
+};
+
+// Contains estimates of the cost for each of method in this class per row.
+struct CostEstimatePerRow {
+  uint32_t to_storage_range;
+  uint32_t to_table_bit_vector;
+  uint32_t is_storage_search_required;
+  uint32_t map_to_storage_index_vector;
+  uint32_t index_search;
+};
+
+}  // namespace overlays
+}  // namespace trace_processor
+}  // namespace perfetto
+
+#endif  // SRC_TRACE_PROCESSOR_DB_OVERLAYS_TYPES_H_