VPTissue Reference Manual
SimShell::Ws::Workspace< ProjectType, index_file > Class Template Reference

Abstraction of workspace on file system. More...

#include <Workspace.h>

Inheritance diagram for SimShell::Ws::Workspace< ProjectType, index_file >:
Inheritance graph
Collaboration diagram for SimShell::Ws::Workspace< ProjectType, index_file >:
Collaboration graph

Public Member Functions

 Workspace (const std::string &path, const std::string &prefs_file)
 Constructor. More...
 
 Workspace (Workspace< ProjectType, index_file > &&)
 Move constructor.
 
virtual ~Workspace ()
 Virtual destructor.
 
virtual ProjectIterator Add (const std::string &type, const std::string &name)
 
virtual std::shared_ptr< IProjectBack ()
 
virtual std::shared_ptr< const IProjectBack () const
 
virtual ProjectIterator begin ()
 
virtual ConstProjectIterator begin () const
 
virtual ProjectIterator end ()
 
virtual ConstProjectIterator end () const
 
virtual ProjectIterator Find (const std::string &name)
 
virtual ConstProjectIterator Find (const std::string &name) const
 
virtual std::shared_ptr< IProjectFront ()
 
virtual std::shared_ptr< const IProjectFront () const
 
virtual std::shared_ptr< IProjectGet (const std::string &name)
 
virtual std::shared_ptr< const IProjectGet (const std::string &name) const
 
virtual const std::string & GetIndexFile () const
 
virtual const std::string & GetPath () const
 
virtual const boost::property_tree::ptree & GetUserData (const std::string &user) const
 
virtual bool IsProject (const std::string &name) const
 
virtual ProjectIterator New (const std::string &type, const std::string &name)
 
virtual void Refresh ()
 
virtual void Remove (ProjectIterator)
 
virtual void Remove (const std::string &name)
 
virtual ProjectIterator Rename (ProjectIterator, const std::string &new_name)
 
virtual ProjectIterator Rename (const std::string &old_name, const std::string &new_name)
 
virtual void SetUserData (const std::string &user, const boost::property_tree::ptree &)
 
- Public Member Functions inherited from SimShell::Ws::IWorkspace
virtual ~IWorkspace ()
 Virtual destructor.
 
- Public Member Functions inherited from SimPT_Sim::Util::Subject< Event::PreferencesChanged, std::weak_ptr< const void > >
void Notify (const EventType &)
 
void Register (const U *, CallbackType)
 
void Unregister (const U *)
 
void UnregisterAll ()
 
- Public Member Functions inherited from SimPT_Sim::Util::Subject< Event::WorkspaceChanged, std::weak_ptr< const void > >
void Notify (const EventType &)
 
void Register (const U *, CallbackType)
 
void Unregister (const U *)
 
void UnregisterAll ()
 
- Public Member Functions inherited from SimShell::Ws::Preferences
 Preferences (const std::string &file)
 
 Preferences (Preferences &&)
 
virtual const boost::property_tree::ptree & GetPreferences () const
 
virtual void SetPreferences (const boost::property_tree::ptree &)
 

Protected Attributes

Util::FileSystemWatcher m_filesystem_watcher
 Watch workspace index file for changes.
 
std::string m_path
 Path workspace was initialized with.
 
std::string m_prefs_file
 Name of preferences file.
 
ProjectMap m_projects
 Mapping from project name to project.
 
boost::property_tree::ptree m_user_data
 GetUserData() with non-existing argument creates an empty user data.
 
- Protected Attributes inherited from SimShell::Ws::Preferences
boost::property_tree::ptree m_preferences
 

Additional Inherited Members

- Public Types inherited from SimShell::Ws::IWorkspace
using ConstProjectIterator = typename ProjectMap::const_iterator
 
using ProjectIterator = typename ProjectMap::iterator
 
using ProjectMap = std::map< std::string, ProjectMapEntry >
 
- Public Types inherited from SimPT_Sim::Util::Subject< Event::PreferencesChanged, std::weak_ptr< const void > >
typedef std::function< void(const EventType &)> CallbackType
 
typedef Event::PreferencesChanged EventType
 
typedef const std::weak_ptr< const void > * KeyType
 
- Public Types inherited from SimPT_Sim::Util::Subject< Event::WorkspaceChanged, std::weak_ptr< const void > >
typedef std::function< void(const EventType &)> CallbackType
 
typedef Event::WorkspaceChanged EventType
 
typedef const std::weak_ptr< const void > * KeyType
 

Detailed Description

template<class ProjectType, const std::string & index_file>
class SimShell::Ws::Workspace< ProjectType, index_file >

Abstraction of workspace on file system.

  • Template parameters:
    • ProjectType: Any class that has a public static data member named 'Constructor' of (function) type IProject::ConstructorType in it. The 'Constructor' function should return any IProject implementation based on the project type string (passed as argument).
    • index_file: String containing the filename of the workspace index file. Possibly a hidden file to discourage manual editing. The workspace index file is a file containing a list of projects, and the workspace user data (see IUserData).

Definition at line 46 of file cpp_simshell/workspace/Workspace.h.

Constructor & Destructor Documentation

template<class ProjectType , const std::string & index_file>
SimShell::Ws::Workspace< ProjectType, index_file >::Workspace ( const std::string &  path,
const std::string &  prefs_file 
)

Constructor.

Parameters
pathPath of work space to initialize model with.
Exceptions
Exceptionif given path is not a valid workspace.

Definition at line 40 of file Workspace_def.h.

References SimShell::Ws::Workspace< ProjectType, index_file >::m_path, SimShell::Ws::Workspace< ProjectType, index_file >::m_prefs_file, SimShell::Ws::Workspace< ProjectType, index_file >::m_projects, and SimShell::Ws::Workspace< ProjectType, index_file >::m_user_data.

Member Function Documentation

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::Add ( const std::string &  type,
const std::string &  name 
)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 236 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
shared_ptr< IProject > SimShell::Ws::Workspace< ProjectType, index_file >::Back ( )
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 165 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
shared_ptr< const IProject > SimShell::Ws::Workspace< ProjectType, index_file >::Back ( ) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 171 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::begin ( )
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 126 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ConstProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::begin ( ) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 133 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::end ( )
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 140 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ConstProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::end ( ) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 147 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::Find ( const std::string &  name)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 178 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ConstProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::Find ( const std::string &  name) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 185 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
shared_ptr< IProject > SimShell::Ws::Workspace< ProjectType, index_file >::Front ( )
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 153 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
shared_ptr< const IProject > SimShell::Ws::Workspace< ProjectType, index_file >::Front ( ) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 159 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
shared_ptr< IProject > SimShell::Ws::Workspace< ProjectType, index_file >::Get ( const std::string &  name)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 208 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
shared_ptr< const IProject > SimShell::Ws::Workspace< ProjectType, index_file >::Get ( const std::string &  name) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 199 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
const string & SimShell::Ws::Workspace< ProjectType, index_file >::GetIndexFile ( ) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 94 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
const string & SimShell::Ws::Workspace< ProjectType, index_file >::GetPath ( ) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 100 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
const ptree & SimShell::Ws::Workspace< ProjectType, index_file >::GetUserData ( const std::string &  user) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IUserData.

Definition at line 106 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
bool SimShell::Ws::Workspace< ProjectType, index_file >::IsProject ( const std::string &  name) const
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 193 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::New ( const std::string &  type,
const std::string &  name 
)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 218 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
void SimShell::Ws::Workspace< ProjectType, index_file >::Refresh ( )
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 260 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
void SimShell::Ws::Workspace< ProjectType, index_file >::Remove ( ProjectIterator  it)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 364 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
void SimShell::Ws::Workspace< ProjectType, index_file >::Remove ( const std::string &  name)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 355 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::Rename ( ProjectIterator  it,
const std::string &  new_name 
)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 335 of file Workspace_def.h.

template<class ProjectType , const std::string & index_file>
IWorkspace::ProjectIterator SimShell::Ws::Workspace< ProjectType, index_file >::Rename ( const std::string &  old_name,
const std::string &  new_name 
)
virtual
See also
IWorkspace

Implements SimShell::Ws::IWorkspace.

Definition at line 325 of file Workspace_def.h.

template<class ProjectType, const std::string & index_file>
void SimShell::Ws::Workspace< ProjectType, index_file >::SetUserData ( const std::string &  user,
const boost::property_tree::ptree &   
)
virtual
See also
IWorkspace

Implements SimShell::Ws::IUserData.

Definition at line 118 of file Workspace_def.h.


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