Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
entry_manager.h
Go to the documentation of this file.
1#pragma once
2
3/*
4 * Copyright (C) 2019-2022 LEIDOS.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
7 * use this file except in compliance with the License. You may obtain a copy of
8 * the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 * License for the specific language governing permissions and limitations under
16 * the License.
17 */
18
19#include <vector>
20#include <boost/optional.hpp>
21#include <unordered_map>
22#include "entry.h"
23
25{
29 class EntryManager
30 {
31 public:
32
36 EntryManager() = default;
37
44 void update_entry(const Entry& entry);
45
49 std::vector<Entry> get_entries() const;
50
54 std::vector<std::string> get_entry_names() const;
55
59 boost::optional<Entry> get_entry_by_name(const std::string& name) const;
60
64 void delete_entry(const std::string& name);
65
66 private:
67
69 std::unordered_map<std::string, Entry> entry_map_;
70
71 };
72}
EntryManager()=default
Default constructor for EntryManager.
std::vector< std::string > get_entry_names() const
Get all entry names as a list.
boost::optional< Entry > get_entry_by_name(const std::string &name) const
Get a entry using name as the key.
void delete_entry(const std::string &name)
Delete an entry using the given name as the key.
void update_entry(const Entry &entry)
Add a new entry if the given name does not exist. Update an existing entry if the given name exists.
std::vector< Entry > get_entries() const
Get all entries as a list.
std::unordered_map< std::string, Entry > entry_map_
private map by entry name to keep track of all entries
Definition: entry_manager.h:69
An entry represents a driver details for the purposes of tracking.
Definition: entry.hpp:27