VPTissue Reference Manual
SimShell::Ws::MergedPreferences Class Reference

Wrapper around workspace to have read and write access to merged (workspace + project) preferences. More...

#include <MergedPreferences.h>

Inheritance diagram for SimShell::Ws::MergedPreferences:
Inheritance graph
Collaboration diagram for SimShell::Ws::MergedPreferences:
Collaboration graph

Public Member Functions

template<typename T >
std::enable_if< std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &) const
 
template<typename T >
std::enable_if<!std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &) const
 
template<typename T >
std::enable_if< std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &, const T &) const
 
template<typename T >
std::enable_if<!std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &, const T &) const
 
template<typename T >
std::enable_if< std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &p) const
 
template<typename T >
std::enable_if<!std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &p) const
 
template<typename T >
std::enable_if< std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &p, const T &v) const
 
template<typename T >
std::enable_if<!std::is_same< T, std::string >::value, T >::type Get (const boost::property_tree::ptree::path_type &p, const T &v) const
 
std::shared_ptr< MergedPreferencesGetChild (const boost::property_tree::ptree::path_type &) const
 Get MergedPreferences instance for working with preferences subtree.
 
std::shared_ptr< MergedPreferencesGetGlobal () const
 Get MergedPreferences instance pointing to global preferences. (undoes GetChild() operations)
 
const std::string & GetPath () const
 Get path of project.
 
const boost::property_tree::ptree & GetProjectPreferencesTree ()
 Get project preferences.
 
template<typename T >
void Put (const boost::property_tree::ptree::path_type &, const T &)
 Put value at given path in project preferences if another value at the same path exists, otherwise, put value in workspace preferences. More...
 
- Public Member Functions inherited from SimPT_Sim::Util::Subject< Event::MergedPreferencesChanged, std::weak_ptr< const void > >
void Notify (const EventType &)
 
void Register (const U *, CallbackType)
 
void Unregister (const U *)
 
void UnregisterAll ()
 

Static Public Member Functions

static std::shared_ptr< MergedPreferencesCreate (const std::shared_ptr< Ws::IWorkspace > &, const std::shared_ptr< Ws::IProject > &)
 

Additional Inherited Members

- Public Types inherited from SimPT_Sim::Util::Subject< Event::MergedPreferencesChanged, std::weak_ptr< const void > >
typedef std::function< void(const EventType &)> CallbackType
 
typedef Event::MergedPreferencesChanged EventType
 
typedef const std::weak_ptr< const void > * KeyType
 

Detailed Description

Wrapper around workspace to have read and write access to merged (workspace + project) preferences.

Translates workspace + project preferences into merged preferences, Listens for Ws::Event::PreferencesChanged events (coming from IWorskpace or IProject) and translates them into (by being a subject of) Event::PreferencesChanged events.

This way, ISession and its viewers can read from and write to preferences without being exposed to workspace details.

Definition at line 50 of file MergedPreferences.h.

Member Function Documentation

template<typename T >
std::enable_if<std::is_same<T, std::string>::value, T>::type SimShell::Ws::MergedPreferences::Get ( const boost::property_tree::ptree::path_type &  ) const
Exceptions
ptree_bad_pathif node was not found in either project or workspace preferences.
ptree_bad_dataif no conversion to type T. (see boost ptree doc for ptree::put_value)
template<typename T >
std::enable_if<!std::is_same<T, std::string>::value, T>::type SimShell::Ws::MergedPreferences::Get ( const boost::property_tree::ptree::path_type &  ) const
Exceptions
ptree_bad_pathif node was not found in either project or workspace preferences.
ptree_bad_dataif no conversion to type T. (see boost ptree doc for ptree::put_value)
template<typename T >
std::enable_if<std::is_same<T, std::string>::value, T>::type SimShell::Ws::MergedPreferences::Get ( const boost::property_tree::ptree::path_type &  ,
const T &   
) const
Exceptions
ptree_bad_dataif no conversion to type T. (see boost ptree doc for ptree::put_value)
template<typename T >
std::enable_if<!std::is_same<T, std::string>::value, T>::type SimShell::Ws::MergedPreferences::Get ( const boost::property_tree::ptree::path_type &  ,
const T &   
) const
Exceptions
ptree_bad_dataif no conversion to type T. (see boost ptree doc for ptree::put_value)
template<typename T >
void SimShell::Ws::MergedPreferences::Put ( const boost::property_tree::ptree::path_type &  p,
const T &  v 
)
inline

Put value at given path in project preferences if another value at the same path exists, otherwise, put value in workspace preferences.

This operation is rather slow since it also causes the internal workspace or project to write preferences to disk.

Exceptions
ptree_bad_dataif no conversion to type T. (see boost ptree doc for ptree::put_value)

Definition at line 173 of file MergedPreferences.h.


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