This class is used to store profiles used by various tasks.
More...
#include <profile_dictionary.h>
|
|
using | Ptr = std::shared_ptr<ProfileDictionary> |
|
using | ConstPtr = std::shared_ptr<const ProfileDictionary> |
|
|
| ProfileDictionary (const ProfileDictionary &) |
|
ProfileDictionary & | operator= (const ProfileDictionary &) |
|
| ProfileDictionary (ProfileDictionary &&) noexcept |
|
ProfileDictionary & | operator= (ProfileDictionary &&) noexcept |
| void | addProfile (const std::string &ns, const std::string &profile_name, const Profile::ConstPtr &profile) |
| | Add a profile.
|
|
void | addProfile (const std::string &ns, const std::vector< std::string > &profile_names, const Profile::ConstPtr &profile) |
| bool | hasProfile (std::size_t key, const std::string &ns, const std::string &profile_name) const |
| | Check if a profile exists.
|
| Profile::ConstPtr | getProfile (std::size_t key, const std::string &ns, const std::string &profile_name) const |
| | Get a profile by name.
|
| template<typename ProfileType> |
| std::shared_ptr< const ProfileType > | getProfile (const std::string &ns, const std::string &profile_name, std::shared_ptr< const ProfileType > default_profile=nullptr) const |
| | Gets the profile specified from the profile map.
|
| void | removeProfile (std::size_t key, const std::string &ns, const std::string &profile_name) |
| | Remove a profile.
|
| bool | hasProfileEntry (std::size_t key, const std::string &ns) const |
| | Check if a profile entry exists.
|
| void | removeProfileEntry (std::size_t key, const std::string &ns) |
| | Remove a profile entry.
|
| std::unordered_map< std::string, Profile::ConstPtr > | getProfileEntry (std::size_t key, const std::string &ns) const |
| | Get a profile entry.
|
| std::unordered_map< std::string, std::unordered_map< std::size_t, std::unordered_map< std::string, Profile::ConstPtr > > > | getAllProfileEntries () const |
| | Get all profile entries.
|
|
void | clear () |
| | Clear the dictionary.
|
|
|
std::shared_mutex | mutex_ |
|
std::unordered_map< std::string, std::unordered_map< std::size_t, std::unordered_map< std::string, Profile::ConstPtr > > > | profiles_ |
|
|
template<class Archive> |
| friend | void::tesseract::common::serialize (Archive &ar, ProfileDictionary &obj) |
This class is used to store profiles used by various tasks.
This is a thread safe class
◆ addProfile()
| void tesseract::common::ProfileDictionary::addProfile |
( |
const std::string & | ns, |
|
|
const std::string & | profile_name, |
|
|
const Profile::ConstPtr & | profile ) |
Add a profile.
If the profile entry does not exist it will create one
- Parameters
-
| ns | The profile namespace |
| profile_name | The profile name |
| profile | The profile to add |
◆ hasProfile()
| bool tesseract::common::ProfileDictionary::hasProfile |
( |
std::size_t | key, |
|
|
const std::string & | ns, |
|
|
const std::string & | profile_name ) const |
Check if a profile exists.
If profile entry does not exist it also returns false
- Parameters
-
| key | The profile key |
| ns | The profile namespace |
| profile_name | The profile name |
- Returns
- True if profile exists, otherwise false
◆ getProfile() [1/2]
| Profile::ConstPtr tesseract::common::ProfileDictionary::getProfile |
( |
std::size_t | key, |
|
|
const std::string & | ns, |
|
|
const std::string & | profile_name ) const |
Get a profile by name.
Check if the profile exist before calling this function, if missing an exception is thrown
- Parameters
-
| key | The profile key |
| ns | The profile namespace |
| profile_name | The profile name |
- Returns
- The profile
◆ getProfile() [2/2]
template<typename ProfileType>
| std::shared_ptr< const ProfileType > tesseract::common::ProfileDictionary::getProfile |
( |
const std::string & | ns, |
|
|
const std::string & | profile_name, |
|
|
std::shared_ptr< const ProfileType > | default_profile = nullptr ) const |
|
inline |
Gets the profile specified from the profile map.
- Parameters
-
| ns | The profile namespace |
| profile_name | The profile name |
| default_profile | Profile that is returned if the requested profile is not found. Default = nullptr |
- Returns
- The profile requested if found. Otherwise the default_profile
◆ removeProfile()
| void tesseract::common::ProfileDictionary::removeProfile |
( |
std::size_t | key, |
|
|
const std::string & | ns, |
|
|
const std::string & | profile_name ) |
Remove a profile.
- Parameters
-
| key | The profile key |
| ns | The profile namespace |
| profile_name | The profile to be removed |
◆ hasProfileEntry()
| bool tesseract::common::ProfileDictionary::hasProfileEntry |
( |
std::size_t | key, |
|
|
const std::string & | ns ) const |
Check if a profile entry exists.
- Parameters
-
| key | The profile key |
| ns | The profile namespace |
- Returns
- True if exists, otherwise false
◆ removeProfileEntry()
| void tesseract::common::ProfileDictionary::removeProfileEntry |
( |
std::size_t | key, |
|
|
const std::string & | ns ) |
Remove a profile entry.
- Parameters
-
| key | The profile key |
| ns | The profile namespace |
◆ getProfileEntry()
| std::unordered_map< std::string, Profile::ConstPtr > tesseract::common::ProfileDictionary::getProfileEntry |
( |
std::size_t | key, |
|
|
const std::string & | ns ) const |
Get a profile entry.
- Parameters
-
| key | The profile key |
| ns | The profile namespace |
- Returns
- The profile map associated with the profile entry
◆ getAllProfileEntries()
| std::unordered_map< std::string, std::unordered_map< std::size_t, std::unordered_map< std::string, Profile::ConstPtr > > > tesseract::common::ProfileDictionary::getAllProfileEntries |
( |
| ) |
const |
Get all profile entries.
- Returns
- All profile entries