mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Remove observer_list.h from location/nearby/cpp/fastpair and third_party/nearby/fastpair
PiperOrigin-RevId: 500331550
This commit is contained in:
committed by
Copybara-Service
parent
22c6db1473
commit
d9b6897189
@@ -18,19 +18,6 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "base",
|
||||
srcs = [
|
||||
],
|
||||
hdrs = [
|
||||
"observer_list.h",
|
||||
],
|
||||
visibility = [
|
||||
"//fastpair:__subpackages__",
|
||||
],
|
||||
deps = ["@com_google_absl//absl/container:flat_hash_set"],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "base_test",
|
||||
size = "small",
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
// Copyright 2022 Google LLC
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// https://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 THIRD_PARTY_NEARBY_FASTPAIR_INTERNAL_BASE_OBSERVER_LIST_H_
|
||||
#define THIRD_PARTY_NEARBY_FASTPAIR_INTERNAL_BASE_OBSERVER_LIST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
|
||||
namespace nearby {
|
||||
namespace fastpair {
|
||||
|
||||
template <class ObserverType>
|
||||
class ObserverList {
|
||||
public:
|
||||
using iterator = typename absl::flat_hash_set<ObserverType*>::iterator;
|
||||
using const_iterator =
|
||||
typename absl::flat_hash_set<ObserverType*>::const_iterator;
|
||||
|
||||
void AddObserver(ObserverType* observer) { observers_.emplace(observer); }
|
||||
|
||||
void RemoveObserver(ObserverType* observer) { observers_.erase(observer); }
|
||||
|
||||
bool HasObserver(ObserverType* observer) {
|
||||
return observers_.contains(observer);
|
||||
}
|
||||
|
||||
void Clear() { observers_.clear(); }
|
||||
|
||||
bool empty() const { return observers_.empty(); }
|
||||
|
||||
int size() const { return observers_.size(); }
|
||||
|
||||
// Supports iterators
|
||||
iterator begin() { return observers_.begin(); }
|
||||
iterator end() { return observers_.end(); }
|
||||
const_iterator begin() const { return observers_.begin(); }
|
||||
const_iterator end() const { return observers_.end(); }
|
||||
|
||||
private:
|
||||
absl::flat_hash_set<ObserverType*> observers_;
|
||||
};
|
||||
|
||||
} // namespace fastpair
|
||||
} // namespace nearby
|
||||
|
||||
#endif // THIRD_PARTY_NEARBY_FASTPAIR_INTERNAL_BASE_OBSERVER_LIST_H_
|
||||
@@ -45,7 +45,6 @@ cc_library(
|
||||
visibility = ["//fastpair:__subpackages__"],
|
||||
deps = [
|
||||
"//fastpair/internal/api:platform",
|
||||
"//fastpair/internal/base",
|
||||
"//fastpair/internal/base:bluetooth_address",
|
||||
"//internal/platform:base",
|
||||
"//internal/platform:logging",
|
||||
|
||||
@@ -32,7 +32,6 @@ cc_library(
|
||||
":device_info",
|
||||
":types",
|
||||
"//fastpair/internal/api:platform",
|
||||
"//fastpair/internal/base", # fixdeps: keep
|
||||
"//fastpair/internal/impl/g3:platform_g3",
|
||||
"//internal/platform:logging",
|
||||
"//internal/platform:types",
|
||||
|
||||
Reference in New Issue
Block a user