VPTissue Reference Manual
SimShell::Ws::IWorkspace Class Referenceabstract

Interface for workspace-like behavior. More...

#include <IWorkspace.h>

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

Classes

class  ProjectMapEntry
 

Public Types

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
 

Public Member Functions

virtual ~IWorkspace ()
 Virtual destructor.
 
virtual ProjectIterator Add (const std::string &type, const std::string &name)=0
 Add existing project to workspace. More...
 
virtual std::shared_ptr< IProjectBack ()=0
 Get last project. More...
 
virtual std::shared_ptr< const IProjectBack () const =0
 Get last project. More...
 
virtual ProjectIterator begin ()=0
 Get iterator pointing to first project.
 
virtual ConstProjectIterator begin () const =0
 Get iterator pointing to first project.
 
virtual ProjectIterator end ()=0
 Get iterator pointing to one position after last project.
 
virtual ConstProjectIterator end () const =0
 Get iterator pointing to one position after last project.
 
virtual ProjectIterator Find (const std::string &name)=0
 Get iterator to project with given name. More...
 
virtual ConstProjectIterator Find (const std::string &name) const =0
 Get iterator to project with given name. More...
 
virtual std::shared_ptr< IProjectFront ()=0
 Get first project. More...
 
virtual std::shared_ptr< const IProjectFront () const =0
 Get first project. More...
 
virtual std::shared_ptr< IProjectGet (const std::string &name)=0
 Get project with given name. More...
 
virtual std::shared_ptr< const IProjectGet (const std::string &name) const =0
 Get project with given name. More...
 
virtual const std::string & GetIndexFile () const =0
 Get name of index file for this type of workspace.
 
virtual const std::string & GetPath () const =0
 Get path workspace was initialized with.
 
virtual bool IsProject (const std::string &name) const =0
 Get iterator to project with given name. More...
 
virtual ProjectIterator New (const std::string &type, const std::string &name)=0
 Create new project in workspace. More...
 
virtual void Refresh ()=0
 Refresh workspace. More...
 
virtual void Remove (ProjectIterator it)=0
 Remove project. More...
 
virtual void Remove (const std::string &name)=0
 Remove project. More...
 
virtual ProjectIterator Rename (ProjectIterator, const std::string &new_name)=0
 Rename project. More...
 
virtual ProjectIterator Rename (const std::string &old_name, const std::string &new_name)=0
 Rename project. More...
 
- Public Member Functions inherited from SimShell::Ws::IPreferences
virtual const boost::property_tree::ptree & GetPreferences () const =0
 
virtual void SetPreferences (const boost::property_tree::ptree &)=0
 
- 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 SimShell::Ws::IUserData
virtual const boost::property_tree::ptree & GetUserData (const std::string &user) const =0
 
virtual void SetUserData (const std::string &user, const boost::property_tree::ptree &)=0
 
- 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 ()
 

Detailed Description

Interface for workspace-like behavior.

A workspace is a container of projects, indexed by name. Projects can be created, removed and renamed.

Additionally, workspace also has associated with it a tree of workspace preferences, and a tree of user data.

See also
IPreferences IUserData

Definition at line 48 of file IWorkspace.h.

Member Function Documentation

virtual ProjectIterator SimShell::Ws::IWorkspace::Add ( const std::string &  type,
const std::string &  name 
)
pure virtual

Add existing project to workspace.

Workspace must already contain directory with project before calling this method.

Parameters
typeType of project.
nameName of project (= name of directory).
Returns
iterator to added project

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual std::shared_ptr<IProject> SimShell::Ws::IWorkspace::Back ( )
pure virtual

Get last project.

Returns
Last project or nullptr if there are no projects in workspace.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual std::shared_ptr<const IProject> SimShell::Ws::IWorkspace::Back ( ) const
pure virtual

Get last project.

Returns
Last project or nullptr if there are no projects in workspace.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual ProjectIterator SimShell::Ws::IWorkspace::Find ( const std::string &  name)
pure virtual

Get iterator to project with given name.

Returns
Iterator to project or Workspace::end() if not found.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual ConstProjectIterator SimShell::Ws::IWorkspace::Find ( const std::string &  name) const
pure virtual

Get iterator to project with given name.

Returns
Iterator to project or Workspace::end() if not found.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual std::shared_ptr<IProject> SimShell::Ws::IWorkspace::Front ( )
pure virtual

Get first project.

Returns
First project or nullptr if there are no projects in workspace.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual std::shared_ptr<const IProject> SimShell::Ws::IWorkspace::Front ( ) const
pure virtual

Get first project.

Returns
First project or nullptr if there are no projects in workspace.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual std::shared_ptr<IProject> SimShell::Ws::IWorkspace::Get ( const std::string &  name)
pure virtual

Get project with given name.

Exceptions
Exceptionif no project with given name exists.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual std::shared_ptr<const IProject> SimShell::Ws::IWorkspace::Get ( const std::string &  name) const
pure virtual

Get project with given name.

Exceptions
Exceptionif no project with given name exists.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual bool SimShell::Ws::IWorkspace::IsProject ( const std::string &  name) const
pure virtual

Get iterator to project with given name.

Returns
True iff project exists.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual ProjectIterator SimShell::Ws::IWorkspace::New ( const std::string &  type,
const std::string &  name 
)
pure virtual

Create new project in workspace.

A directory will be created for you.

Returns
iterator to newly created project
Exceptions
Exceptionif another project with given name exists.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual void SimShell::Ws::IWorkspace::Refresh ( )
pure virtual

Refresh workspace.

Will generate WorkspaceChanged events for newly discovered projects and projects that dissappeared.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual void SimShell::Ws::IWorkspace::Remove ( ProjectIterator  it)
pure virtual

Remove project.

Parameters
itIterator pointing to project to remove.

Implemented in SimShell::Ws::Workspace< ProjectType, index_file >, and SimShell::Ws::Workspace< Project, WorkspaceFactory::g_workspace_index_file >.

virtual void SimShell::Ws::IWorkspace::Remove ( const std::string &  name)
pure virtual
virtual ProjectIterator SimShell::Ws::IWorkspace::Rename ( ProjectIterator  ,
const std::string &  new_name 
)
pure virtual
virtual ProjectIterator SimShell::Ws::IWorkspace::Rename ( const std::string &  old_name,
const std::string &  new_name 
)
pure virtual

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