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

The EntryManager serves as a component to track the status of each required CARMA ROS 1 driver. More...

#include <entry_manager.hpp>

Collaboration diagram for subsystem_controllers::EntryManager:
Collaboration graph

Public Member Functions

 EntryManager ()
 Default constructor for EntryManager. More...
 
 EntryManager (std::vector< std::string > required_entries)
 Constructor for EntryManager to set required entries. More...
 
 EntryManager (std::vector< std::string > required_entries, std::vector< std::string > camera_entries)
 Constructor for EntryManager to set required entries and camera entires. 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 registed entries 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...
 
bool is_entry_required (const std::string &name) const
 Check if the entry is required. More...
 
int is_camera_entry_required (const std::string &name) const
 Check if the entry is a required camera entry. More...
 
 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::vector< Entryentry_list_
 private list to keep track of all entries More...
 
std::vector< std::string > required_entries_
 
std::vector< std::string > camera_entries_
 
std::unordered_map< std::string, Entryentry_map_
 private map by entry name to keep track of all entries More...
 

Detailed Description

The EntryManager serves as a component to track the status of each required CARMA ROS 1 driver.

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

Definition at line 30 of file entry_manager.hpp.

Constructor & Destructor Documentation

◆ EntryManager() [1/4]

subsystem_controllers::EntryManager::EntryManager ( )

Default constructor for EntryManager.

Definition at line 22 of file entry_manager.cpp.

22{}

◆ EntryManager() [2/4]

subsystem_controllers::EntryManager::EntryManager ( std::vector< std::string >  required_entries)

Constructor for EntryManager to set required entries.

Definition at line 24 of file entry_manager.cpp.

24:required_entries_(required_entries) {}
std::vector< std::string > required_entries_

◆ EntryManager() [3/4]

subsystem_controllers::EntryManager::EntryManager ( std::vector< std::string >  required_entries,
std::vector< std::string >  camera_entries 
)

Constructor for EntryManager to set required entries and camera entires.

Definition at line 26 of file entry_manager.cpp.

27 :required_entries_(required_entries), camera_entries_(camera_entries){}
std::vector< std::string > camera_entries_

◆ EntryManager() [4/4]

subsystem_controllers::EntryManager::EntryManager ( )
default

Default constructor for EntryManager.

Member Function Documentation

◆ delete_entry() [1/2]

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

Delete an entry using the given name as the key.

Definition at line 50 of file entry_manager.cpp.

51 {
52 for(auto i = entry_list_.begin(); i < entry_list_.end(); ++i)
53 {
54 if(i->name_.compare(name) == 0)
55 {
56 entry_list_.erase(i);
57 return;
58 }
59 }
60 }
std::vector< Entry > entry_list_
private list to keep track of all entries

References entry_list_, and process_bag::i.

◆ delete_entry() [2/2]

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

Delete an entry using the given name as the key.

◆ get_entries() [1/2]

◆ get_entries() [2/2]

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

Get all entries as a list.

◆ get_entry_by_name() [1/2]

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 62 of file entry_manager.cpp.

63 {
64 for(auto i = entry_list_.begin(); i < entry_list_.end(); ++i)
65 {
66 if(i->name_.compare(name) == 0)
67 {
68 return *i;
69 }
70 }
71 // use boost::optional because requested entry might not exist
72 return boost::none;
73 }

References entry_list_, and process_bag::i.

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

Here is the caller graph for this function:

◆ get_entry_by_name() [2/2]

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

Get a entry using name as the key.

◆ 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 }
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_.

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

Here is the caller graph for this function:

◆ is_camera_entry_required()

int subsystem_controllers::EntryManager::is_camera_entry_required ( const std::string &  name) const

Check if the entry is a required camera entry.

Definition at line 87 of file entry_manager.cpp.

88 {
89 for(int i = 0;i < camera_entries_.size(); i++)
90 {
91 if(camera_entries_[i].compare(name) == 0)
92 {
93 return i;
94 }
95 }
96
97 // default like above?
98 return -1;
99 }

References camera_entries_, and process_bag::i.

◆ is_entry_required()

bool subsystem_controllers::EntryManager::is_entry_required ( const std::string &  name) const

Check if the entry is required.

Definition at line 75 of file entry_manager.cpp.

76 {
77 for(auto i = required_entries_.begin(); i < required_entries_.end(); ++i)
78 {
79 if(i->compare(name) == 0)
80 {
81 return true;
82 }
83 }
84 return false;
85 }

References process_bag::i, and required_entries_.

◆ update_entry() [1/2]

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

Definition at line 29 of file entry_manager.cpp.

30 {
31 for(auto i = entry_list_.begin(); i < entry_list_.end(); ++i)
32 {
33 if(i->name_.compare(entry.name_) == 0)
34 {
35 // name entry wont change
36 i->available_ = entry.available_;
37 i->timestamp_ = entry.timestamp_;
38 return;
39 }
40 }
41 entry_list_.push_back(entry);
42 }

References subsystem_controllers::Entry::available_, entry_list_, process_bag::i, subsystem_controllers::Entry::name_, and subsystem_controllers::Entry::timestamp_.

Referenced by subsystem_controllers::PluginManager::PluginManager(), subsystem_controllers::PluginManager::activate(), subsystem_controllers::PluginManager::activate_plugin(), subsystem_controllers::PluginManager::add_plugin(), subsystem_controllers::PluginManager::cleanup(), subsystem_controllers::PluginManager::configure(), subsystem_controllers::PluginManager::deactivate(), and subsystem_controllers::PluginManager::update_plugin_status().

Here is the caller graph for this function:

◆ update_entry() [2/2]

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

Parameters
entryThe entry to update or add

Member Data Documentation

◆ camera_entries_

std::vector<std::string> subsystem_controllers::EntryManager::camera_entries_
private

Definition at line 89 of file entry_manager.hpp.

Referenced by is_camera_entry_required().

◆ entry_list_

std::vector<Entry> subsystem_controllers::EntryManager::entry_list_
private

private list to keep track of all entries

Definition at line 83 of file entry_manager.hpp.

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

◆ 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 get_entry_names().

◆ required_entries_

std::vector<std::string> subsystem_controllers::EntryManager::required_entries_
private

Definition at line 86 of file entry_manager.hpp.

Referenced by is_entry_required().


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