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.
subsystem_controllers::EntryManager Class Reference

An entry manager keeps track of the set of entries and makes it easy to add or remove entries. More...

#include <entry_manager.h>

Collaboration diagram for subsystem_controllers::EntryManager:
Collaboration graph

Public Member Functions

 EntryManager ()=default
 Default constructor for EntryManager. More...
 
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. More...
 
std::vector< Entryget_entries () const
 Get all entries as a list. More...
 
std::vector< std::string > get_entry_names () const
 Get all entry names as a list. More...
 
boost::optional< Entryget_entry_by_name (const std::string &name) const
 Get a entry using name as the key. More...
 
void delete_entry (const std::string &name)
 Delete an entry using the given name as the key. More...
 

Private Attributes

std::unordered_map< std::string, Entryentry_map_
 private map by entry name to keep track of all entries More...
 

Detailed Description

An entry manager keeps track of the set of entries and makes it easy to add or remove entries.

Definition at line 29 of file entry_manager.h.

Constructor & Destructor Documentation

◆ EntryManager()

subsystem_controllers::EntryManager::EntryManager ( )
default

Default constructor for EntryManager.

Member Function Documentation

◆ delete_entry()

void subsystem_controllers::EntryManager::delete_entry ( const std::string &  name)

Delete an entry using the given name as the key.

Definition at line 51 of file entry_manager.cpp.

52 {
53 if (entry_map_.find(name) != entry_map_.end())
54 entry_map_.erase(name);
55 }
std::unordered_map< std::string, Entry > entry_map_
private map by entry name to keep track of all entries
Definition: entry_manager.h:69

References entry_map_.

◆ get_entries()

std::vector< Entry > subsystem_controllers::EntryManager::get_entries ( ) const

◆ get_entry_by_name()

boost::optional< Entry > subsystem_controllers::EntryManager::get_entry_by_name ( const std::string &  name) const

Get a entry using name as the key.

Definition at line 57 of file entry_manager.cpp.

58 {
59 if (entry_map_.find(name) != entry_map_.end())
60 return entry_map_.at(name);
61
62
63 // use boost::optional because requested entry might not exist
64 return boost::none;
65 }

References entry_map_.

Referenced by subsystem_controllers::PluginManager::activate_plugin(), and subsystem_controllers::PluginManager::update_plugin_status().

Here is the caller graph for this function:

◆ get_entry_names()

std::vector< std::string > subsystem_controllers::EntryManager::get_entry_names ( ) const

Get all entry names as a list.

Definition at line 40 of file entry_manager.cpp.

41 {
42 std::vector<std::string> names;
43 names.reserve(entry_map_.size());
44
45 for (const auto& e : entry_map_)
46 names.push_back(e.second.name_);
47
48 return names;
49 }

References entry_map_.

Referenced by subsystem_controllers::PluginManager::shutdown().

Here is the caller graph for this function:

◆ update_entry()

void subsystem_controllers::EntryManager::update_entry ( const Entry entry)

Member Data Documentation

◆ entry_map_

std::unordered_map<std::string, Entry> subsystem_controllers::EntryManager::entry_map_
private

private map by entry name to keep track of all entries

Definition at line 69 of file entry_manager.h.

Referenced by delete_entry(), get_entries(), get_entry_by_name(), get_entry_names(), and update_entry().


The documentation for this class was generated from the following files: