NCBI C++ ToolKit
Public Types | Public Member Functions | Friends | List of all members
CProjectService Class Reference

Search Toolkit Book for CProjectService

CProjectService - a service providing API for operations with Workspaces and Projects. More...

#include <gui/core/project_service.hpp>

+ Inheritance diagram for CProjectService:
+ Collaboration diagram for CProjectService:

Public Types

typedef CTimeMRUList< wxString > TMRUPathList
 
using TProjectId = objects::CGBProjectHandle::TId
 
- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 

Public Member Functions

 CProjectService ()
 
virtual ~CProjectService ()
 
IServiceLocatorGetServiceLocator ()
 
const TMRUPathListGetProjectWorkspaceMRUList () const
 get MRU Projects and Workspaces More...
 
void AddToProjectWorkspaceMRUList (const wxString &path)
 
IService interface implementation
virtual void InitService ()
 
virtual void ShutDownService ()
 
IServiceLocatorConsumer interface implementation
virtual void SetServiceLocator (IServiceLocator *locator)
 
IRegSettings interface implementation
virtual void SetRegistryPath (const string &path)
 
virtual void SaveSettings () const
 
virtual void LoadSettings ()
 
Workspace manipulators
bool HasWorkspace ()
 
void CreateNewWorkspace ()
 
bool LoadWorkspace (const wxString &filename)
 Loads a workspace from a file and optionally set as current. More...
 
void ResetWorkspace ()
 release the current workspace and all its contents TODO - review More...
 
bool SaveWorkspace ()
 Save a workspace. More...
 
- Public Member Functions inherited from CObjectEx
 CObjectEx (void)
 
virtual ~CObjectEx (void)
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 
- Public Member Functions inherited from CWeakObject
 CWeakObject (void)
 
virtual ~CWeakObject (void)
 
CPtrToObjectProxyGetPtrProxy (void) const
 Get pointer to proxy object containing pointer to this object. More...
 
- Public Member Functions inherited from IService
virtual ~IService ()
 
- Public Member Functions inherited from IServiceLocatorConsumer
virtual ~IServiceLocatorConsumer ()
 
- Public Member Functions inherited from IRegSettings
virtual ~IRegSettings ()
 

Friends

class CWorkspaceAutoSaver
 

Project View Manipulators

initialized view, connects it to a projects and adds to View Manager Service

typedef set< intTWorkspaceIds
 
typedef set< intTProjectIds
 
string m_RegPath
 path in the Registry to our settings More...
 
IServiceLocatorm_ServiceLocator
 
CRef< objects::CGBWorkspace > m_Workspace
 the only Workspace More...
 
string m_Filename
 
TMRUPathList m_ProjectWorkspaceMRUList
 filename for the workspace More...
 
CIRef< IProjectViewAddProjectView (const string &view_name, SConstScopedObject &object, const objects::CUser_object *params, bool bFloat=false)
 
CIRef< IProjectViewAddProjectView (const string &view_name, TConstScopedObjects &objects, const objects::CUser_object *params, bool bFloat=false)
 
IProjectViewFindView (const CObject &mainObject, const string &viewType)
 
void FindViews (vector< CIRef< IProjectView > > &projectViews, const CObject &mainObject)
 
void FindViews (vector< CIRef< IProjectView > > &projectViews)
 
CIRef< IProjectViewShowView (const string &viewName, FWindowFactory widgetFactory, TConstScopedObjects &objects, bool bFloat)
 
void ActivateProjectView (IProjectView *projectView)
 
void RemoveProjectView (IProjectView &view)
 removes the view from View manager Service and disconnects it from the project More...
 
void RemoveAllProjectViews ()
 
void OnViewAttached (IProjectView *view)
 called by CDocument when IProjectView is attached/detached to it More...
 
void GetObjProjects (TConstScopedObjects &objects, vector< TProjectId > &ids)
 
CRef< objects::CGBWorkspace > GetGBWorkspace ()
 
void AddProject (CGBDocument &doc)
 
void RemoveProject (CGBDocument &doc)
 
CProjectTreePanelGetProjectTreePanel ()
 
const objects::CProjectItem * GetProjectItem (const CObject &object, objects::CScope &scope)
 
CRef< objects::CGBWorkspace > x_LoadWorkspace (const wxString &filename)
 
void x_CreateDocuments (objects::CWorkspaceFolder &folder)
 
void x_RemoveView (IViewManagerService &view_srv, IProjectView &view, bool reset_hist_async=true)
 
void x_ReloadProjectTreeView ()
 
void x_UpdateWorkspaceLabel ()
 
 CProjectService (const CProjectService &)
 all constructing / copying of project managers is forbidden More...
 
CProjectServiceoperator= (const CProjectService &)
 

Additional Inherited Members

- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 
- Protected Member Functions inherited from CWeakObject
void CleanWeakRefs (void) const
 Method cleaning all CWeakRefs referencing at this moment to the object After calling to this method all existing CWeakRefs referencing to the object will return NULL, so it effectively will be equal to deleting the object. More...
 

Detailed Description

CProjectService - a service providing API for operations with Workspaces and Projects.

CProjectService

CProjectService shall not have any dependencies on GUI.

Definition at line 76 of file project_service.hpp.

Member Typedef Documentation

◆ TMRUPathList

Definition at line 84 of file project_service.hpp.

◆ TProjectId

using CProjectService::TProjectId = objects::CGBProjectHandle::TId

Definition at line 85 of file project_service.hpp.

◆ TProjectIds

typedef set<int> CProjectService::TProjectIds
protected

Definition at line 178 of file project_service.hpp.

◆ TWorkspaceIds

Definition at line 177 of file project_service.hpp.

Constructor & Destructor Documentation

◆ CProjectService() [1/2]

CProjectService::CProjectService ( )

Definition at line 69 of file project_service.cpp.

◆ ~CProjectService()

CProjectService::~CProjectService ( )
virtual

Definition at line 75 of file project_service.cpp.

◆ CProjectService() [2/2]

CProjectService::CProjectService ( const CProjectService )
private

all constructing / copying of project managers is forbidden

Member Function Documentation

◆ ActivateProjectView()

void CProjectService::ActivateProjectView ( IProjectView projectView)

◆ AddProject()

void CProjectService::AddProject ( CGBDocument doc)

◆ AddProjectView() [1/2]

CIRef< IProjectView > CProjectService::AddProjectView ( const string view_name,
SConstScopedObject object,
const objects::CUser_object *  params,
bool  bFloat = false 
)

◆ AddProjectView() [2/2]

CIRef< IProjectView > CProjectService::AddProjectView ( const string view_name,
TConstScopedObjects objects,
const objects::CUser_object *  params,
bool  bFloat = false 
)

◆ AddToProjectWorkspaceMRUList()

void CProjectService::AddToProjectWorkspaceMRUList ( const wxString &  path)

◆ CreateNewWorkspace()

void CProjectService::CreateNewWorkspace ( )

◆ FindView()

IProjectView * CProjectService::FindView ( const CObject mainObject,
const string viewType 
)

◆ FindViews() [1/2]

void CProjectService::FindViews ( vector< CIRef< IProjectView > > &  projectViews)

◆ FindViews() [2/2]

void CProjectService::FindViews ( vector< CIRef< IProjectView > > &  projectViews,
const CObject mainObject 
)

◆ GetGBWorkspace()

CRef< CGBWorkspace > CProjectService::GetGBWorkspace ( )

◆ GetObjProjects()

void CProjectService::GetObjProjects ( TConstScopedObjects objects,
vector< TProjectId > &  ids 
)

◆ GetProjectItem()

const CProjectItem * CProjectService::GetProjectItem ( const CObject object,
objects::CScope &  scope 
)

Definition at line 738 of file project_service.cpp.

References m_Workspace.

Referenced by CAppDialogs::ExportDialog().

◆ GetProjectTreePanel()

CProjectTreePanel * CProjectService::GetProjectTreePanel ( )

◆ GetProjectWorkspaceMRUList()

const CProjectService::TMRUPathList & CProjectService::GetProjectWorkspaceMRUList ( ) const

get MRU Projects and Workspaces

Definition at line 378 of file project_service.cpp.

References m_ProjectWorkspaceMRUList.

◆ GetServiceLocator()

IServiceLocator* CProjectService::GetServiceLocator ( )
inline

◆ HasWorkspace()

bool CProjectService::HasWorkspace ( )

◆ InitService()

void CProjectService::InitService ( )
virtual

Implements IService.

Definition at line 80 of file project_service.cpp.

References CreateNewWorkspace(), Info(), LoadSettings(), and LOG_POST.

◆ LoadSettings()

void CProjectService::LoadSettings ( )
virtual

◆ LoadWorkspace()

bool CProjectService::LoadWorkspace ( const wxString &  filename)

Loads a workspace from a file and optionally set as current.

◆ OnViewAttached()

void CProjectService::OnViewAttached ( IProjectView view)

called by CDocument when IProjectView is attached/detached to it

Definition at line 651 of file project_service.cpp.

References IProjectView::eType, CViewEvent::eViewAttached, IProjectView::GetLabel(), IProjectView::GetProjectId(), m_Workspace, REPORT_USAGE, and CEventHandler::Send().

Referenced by AddProjectView().

◆ operator=()

CProjectService& CProjectService::operator= ( const CProjectService )
private

◆ RemoveAllProjectViews()

void CProjectService::RemoveAllProjectViews ( )

◆ RemoveProject()

void CProjectService::RemoveProject ( CGBDocument doc)

◆ RemoveProjectView()

void CProjectService::RemoveProjectView ( IProjectView view)

◆ ResetWorkspace()

void CProjectService::ResetWorkspace ( )

release the current workspace and all its contents TODO - review

Definition at line 230 of file project_service.cpp.

References CGBDocument::CancelLoading(), CGBDocument::IsLoading(), m_Workspace, RemoveProject(), CGBDocument::UnloadProject(), and x_ReloadProjectTreeView().

Referenced by CWorkspaceAutoSaver::CheckCrash(), and ShutDownService().

◆ SaveSettings()

void CProjectService::SaveSettings ( ) const
virtual

◆ SaveWorkspace()

bool CProjectService::SaveWorkspace ( )

Save a workspace.

This will (potentially) ask the user for a filename to which to save the workspace

Definition at line 258 of file project_service.cpp.

References _ASSERT, eSerial_AsnText, eUnknown, FnToWxString(), CException::GetMsg(), m_Workspace, NCBI_THROW, CObjectOStream::Open(), ToWxString(), CException::what(), wxT, and x_UpdateWorkspaceLabel().

◆ SetRegistryPath()

void CProjectService::SetRegistryPath ( const string path)
virtual

Implements IRegSettings.

Definition at line 111 of file project_service.cpp.

References m_RegPath.

◆ SetServiceLocator()

void CProjectService::SetServiceLocator ( IServiceLocator locator)
virtual

Implements IServiceLocatorConsumer.

Definition at line 105 of file project_service.cpp.

References m_ServiceLocator.

◆ ShowView()

CIRef< IProjectView > CProjectService::ShowView ( const string viewName,
FWindowFactory  widgetFactory,
TConstScopedObjects objects,
bool  bFloat 
)

◆ ShutDownService()

void CProjectService::ShutDownService ( )
virtual

◆ x_CreateDocuments()

void CProjectService::x_CreateDocuments ( objects::CWorkspaceFolder &  folder)
protected

◆ x_LoadWorkspace()

CRef< CGBWorkspace > CProjectService::x_LoadWorkspace ( const wxString &  filename)
protected

◆ x_ReloadProjectTreeView()

void CProjectService::x_ReloadProjectTreeView ( )
protected

◆ x_RemoveView()

void CProjectService::x_RemoveView ( IViewManagerService view_srv,
IProjectView view,
bool  reset_hist_async = true 
)
protected

◆ x_UpdateWorkspaceLabel()

void CProjectService::x_UpdateWorkspaceLabel ( )
protected

Definition at line 732 of file project_service.cpp.

References GetProjectTreePanel(), and CProjectTreePanel::UpdateWorkspaceLabel().

Referenced by SaveWorkspace().

Friends And Related Function Documentation

◆ CWorkspaceAutoSaver

friend class CWorkspaceAutoSaver
friend

Definition at line 82 of file project_service.hpp.

Member Data Documentation

◆ m_Filename

string CProjectService::m_Filename
protected

Definition at line 189 of file project_service.hpp.

◆ m_ProjectWorkspaceMRUList

TMRUPathList CProjectService::m_ProjectWorkspaceMRUList
protected

filename for the workspace

Definition at line 191 of file project_service.hpp.

Referenced by AddToProjectWorkspaceMRUList(), GetProjectWorkspaceMRUList(), LoadSettings(), and SaveSettings().

◆ m_RegPath

string CProjectService::m_RegPath
protected

path in the Registry to our settings

Definition at line 182 of file project_service.hpp.

Referenced by LoadSettings(), SaveSettings(), and SetRegistryPath().

◆ m_ServiceLocator

IServiceLocator* CProjectService::m_ServiceLocator
protected

◆ m_Workspace

CRef<objects::CGBWorkspace> CProjectService::m_Workspace
protected

The documentation for this class was generated from the following files:
Modified on Mon May 27 04:40:32 2024 by modify_doxy.py rev. 669887