Apollo  6.0
Open source self driving car software
warehouse_base.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 
17 #ifndef CYBER_SERVICE_DISCOVERY_CONTAINER_WAREHOUSE_BASE_H_
18 #define CYBER_SERVICE_DISCOVERY_CONTAINER_WAREHOUSE_BASE_H_
19 
20 #include <cstdint>
21 #include <vector>
22 
24 
25 namespace apollo {
26 namespace cyber {
27 namespace service_discovery {
28 
30  public:
32  virtual ~WarehouseBase() {}
33 
34  virtual bool Add(uint64_t key, const RolePtr& role, bool ignore_if_exist) = 0;
35 
36  virtual void Clear() = 0;
37  virtual std::size_t Size() = 0;
38 
39  virtual void Remove(uint64_t key) = 0;
40  virtual void Remove(uint64_t key, const RolePtr& role) = 0;
41  virtual void Remove(const proto::RoleAttributes& target_attr) = 0;
42 
43  virtual bool Search(uint64_t key) = 0;
44  virtual bool Search(uint64_t key, RolePtr* first_matched_role) = 0;
45  virtual bool Search(uint64_t key,
46  proto::RoleAttributes* first_matched_role_attr) = 0;
47  virtual bool Search(uint64_t key, std::vector<RolePtr>* matched_roles) = 0;
48  virtual bool Search(
49  uint64_t key, std::vector<proto::RoleAttributes>* matched_roles_attr) = 0;
50 
51  virtual bool Search(const proto::RoleAttributes& target_attr) = 0;
52  virtual bool Search(const proto::RoleAttributes& target_attr,
53  RolePtr* first_matched) = 0;
54  virtual bool Search(const proto::RoleAttributes& target_attr,
55  proto::RoleAttributes* first_matched_role_attr) = 0;
56  virtual bool Search(const proto::RoleAttributes& target_attr,
57  std::vector<RolePtr>* matched_roles) = 0;
58  virtual bool Search(
59  const proto::RoleAttributes& target_attr,
60  std::vector<proto::RoleAttributes>* matched_roles_attr) = 0;
61 
62  virtual void GetAllRoles(std::vector<RolePtr>* roles) = 0;
63  virtual void GetAllRoles(std::vector<proto::RoleAttributes>* roles_attr) = 0;
64 };
65 
66 } // namespace service_discovery
67 } // namespace cyber
68 } // namespace apollo
69 
70 #endif // CYBER_SERVICE_DISCOVERY_CONTAINER_WAREHOUSE_BASE_H_
virtual ~WarehouseBase()
Definition: warehouse_base.h:32
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
virtual void GetAllRoles(std::vector< RolePtr > *roles)=0
WarehouseBase()
Definition: warehouse_base.h:31
std::shared_ptr< RoleBase > RolePtr
Definition: role.h:31
virtual bool Add(uint64_t key, const RolePtr &role, bool ignore_if_exist)=0