NCBI C++ ToolKit
project_service.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: project_service.cpp 47479 2023-05-02 13:24:02Z ucko $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Mike DiCuccio, Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 
35 
36 #include <gui/core/document.hpp>
40 
43 
44 #include <gui/objutils/label.hpp>
46 
51 
55 
56 #include <serial/objistr.hpp>
57 #include <serial/objostr.hpp>
58 #include <serial/serial.hpp>
59 #include <serial/iterator.hpp>
60 
61 #include <wx/msgdlg.h>
62 #include <wx/filename.h>
64 
65 
68 
69 CProjectService::CProjectService() : m_ServiceLocator()
70 {
71  //LOG_POST("CProjectService constructor");
72 }
73 
74 
76 {
77  //LOG_POST("CProjectService destructor");
78 }
79 
81 {
82  LOG_POST(Info << "Initializing Project Service...");
83 
84  LoadSettings();
86 
87  LOG_POST(Info << "Finished initializing Project Service");
88 }
89 
90 
92 {
93  LOG_POST(Info << "Shutting down Project Service...");
94 
95  SaveSettings();
96 
97  /// get rid of our workspace
100 
101  LOG_POST(Info << "Finished shutting down Project Service");
102 }
103 
104 
106 {
107  m_ServiceLocator = locator;
108 }
109 
110 
111 void CProjectService::SetRegistryPath(const string& path)
112 {
113  m_RegPath = path;
114 }
115 
116 
117 static const char* kMRUTag = "MRUProjectsWorkspaces";
118 
120 {
121  _ASSERT(! m_RegPath.empty());
122 
123  if( ! m_RegPath.empty()) {
124  // lock service to avoid races
126  CRegistryWriteView view = gui_reg.GetWriteView(m_RegPath);
127 
128  // save MRU Project and Workspaces
129  vector<string> values;
130  // we package times and paths into the same vector (even elements - time, odd - path)
133 
136  CTime time(it->first);
137  time.ToLocalTime();
138  string s_time = time.AsString(format);
139  string filename = FnToStdString(it->second);
140  values.push_back(s_time);
141  values.push_back(filename);
142  }
143  view.Set(kMRUTag, values);
144  }
145 }
146 
147 
149 {
150  _ASSERT(! m_RegPath.empty());
151 
152  if( ! m_RegPath.empty()) {
153  // lock service to avoid races
154 
156  CRegistryReadView view = gui_reg.GetReadView(m_RegPath);
157 
158  // load MRU Project and Workspaces
160 
161  vector<string> values;
162  view.GetStringVec(kMRUTag, values);
163 
166 
167  for( size_t i = 0; i + 1 < values.size() ; ) {
168  // process two elements at once
169  string s_time = values[i++];
170  wxString path = FnToWxString(values[i++]);
171  CTime time(s_time, format);
172 
173  time_t t = time.GetTimeT();
175  }
176  }
177 }
178 
179 
181 {
182  if(m_Workspace) {
183  _ASSERT(false);
184  NCBI_THROW(CProjectServiceException, eInvalidOperation,
185  "Cannot create a new Workspace - a workspace already exists");
186  } else {
187  {{
189 
190  /// determine a unique(ish) name for the workspace
191  /// this is a generic tag followed by a counter
192  /// we test this against the file system in the *current*
193  /// directory (without bothering to test what current really means)
194 
195  static unsigned int counter = 1;
196  string workspace_title;
197  for (;;) {
198  wxString str = wxString::Format(wxT("Workspace%u"), counter++);
199  if (!wxFileName::FileExists(str + wxT(".gbw"))) {
200  workspace_title = str.ToAscii();
201  break;
202  }
203  }
204  m_Workspace->SetDescr().SetTitle(workspace_title);
205 
206  CTime create_time(CTime::eCurrent);
207  m_Workspace->SetDescr().SetCreateDate(create_time);
208  m_Workspace->SetDescr().SetModifiedDate(create_time);
209  m_Workspace->SetWorkspace().SetInfo().SetTitle(workspace_title);
210  m_Workspace->SetWorkspace().SetInfo().SetCreateDate(create_time);
211  }}
212 
214  }
215 }
216 
217 
219 {
220  return (m_Workspace.GetPointer() != NULL);
221 }
222 
224 {
225 
226  return m_Workspace;
227 }
228 
229 
231 {
232  if (!m_Workspace)
233  return;
234 
235  vector<TProjectId> projIds;
236 
237  for (CTypeIterator<CGBProjectHandle> it(m_Workspace->SetWorkspace()); it; ++it) {
238  CGBDocument* doc = dynamic_cast<CGBDocument*>(&*it);
239  if (!doc) continue;
240 
241  if (doc->IsLoading()) {
242  doc->CancelLoading();
243  } else if (doc->IsLoaded()) {
244  doc->UnloadProject();
245  }
246 
247  projIds.push_back(doc->GetId());
248  }
249 
250  for (auto id : projIds) {
251  CRef<CGBDocument> doc(dynamic_cast<CGBDocument*>(m_Workspace->GetProjectFromId(id)));
252  if (doc) RemoveProject(*doc);
253  }
254 
256 }
257 
259 {
260  //LOG_POST(Info << "CProjectService::SaveWorkspace()");
261 
262  static const string kErr("Error saving workspace");
263 
264  static const string INVALID_WORKSPACE =
265  "Invalid workspace! The Workspace contains projects "
266  "with empty filenames.";
267 
268  string err_msg;
269 
270  try {
271  if (!m_Workspace) {
272  _ASSERT(false);
273  NCBI_THROW(CProjectServiceException, eInvalidOperation,
274  "Cannot save workspace - it does not exists.");
275  }
276 
277  // check that all projects have valid filename
278  for (CTypeConstIterator<CGBProjectHandle> it(m_Workspace->GetWorkspace()); it; ++it) {
279  if (it->GetFilename().empty()) {
280  //_ASSERT(false); // must not be empty at this point
281  NCBI_THROW(CProjectServiceException, eInvalidOperation, INVALID_WORKSPACE);
282  }
283  }
284 
285  wxString filename = FnToWxString(m_Workspace->GetFilename());
286 
287  CNcbiOfstream ostr(filename.fn_str());
288  unique_ptr<CObjectOStream> os(CObjectOStream::Open(eSerial_AsnText, ostr));
289  *os << *m_Workspace;
290 
292 
293  return true;
294  }
295  catch (CException& e) {
296  err_msg = e.GetMsg();
297  }
298  catch (std::exception& e) {
299  err_msg = e.what();
300  }
301  wxMessageBox(ToWxString(err_msg), wxT("Error saving workspace"),
302  wxOK|wxICON_ERROR);
303 
304  NCBI_THROW(CException, eUnknown, kErr + " : \n" + err_msg);
305  return false;
306 }
307 
308 
310 {
311  /// in order, we try ASN.1 text, ASN.1 binary, and XML
312  /// chances are it'll always be ASN.1 text, but we can try the
313  /// others for completeness
314  typedef pair<ESerialDataFormat, const char*> TSerialTypePair;
315  static const TSerialTypePair sc_DataTypes[] = {
316  TSerialTypePair(eSerial_AsnText, "asn-text"),
317  TSerialTypePair(eSerial_AsnBinary, "asn-binary"),
318  TSerialTypePair(eSerial_Xml, "asn-xml")
319  };
320 
321  CRef<CGBWorkspace> wks;
322 
323  size_t n = sizeof(sc_DataTypes) / sizeof(TSerialTypePair);
324  for (size_t i = 0; i < n; ++i) {
325  const char* type_name = sc_DataTypes[i].second;
326  try {
327  wks.Reset(new CGBWorkspace());
328 
330  bool binary = (format == eSerial_AsnBinary);
331  CNcbiIfstream istr(filename.fn_str(), (binary ? (ios::binary|ios::in) : ios::in));
332  unique_ptr<CObjectIStream> obj_istr(CObjectIStream::Open(format, istr));
333  *obj_istr >> *wks;
334 
335  // HACK: promoting CGBPorjectHandles to CGBDocuments
336  CGBWorkspace::TWorkspace& root_folder = wks->SetWorkspace();
337  x_CreateDocuments(root_folder);
338 
339  LOG_POST(Info << "CProjectService::x_LoadWorkspace(): loaded workspace: "
340  << filename << ": " << type_name);
341  break;
342  }
343  catch (CSerialException& e) {
344  wks.Reset();
345  LOG_POST(Error << "CProjectService::x_LoadWorkspace(): workspace: "
346  << filename << ": not " << type_name
347  << ": error reading: " << e.GetMsg());
348  }
349  }
350 
351  return wks;
352 }
353 
354 // recursively iterates folders and wraps Project Handles in Documents
356 {
357  CWorkspaceFolder::TProjects& projects = folder.SetProjects();
358 
360  CRef<CGBProjectHandle>& handle = *it;
361  // create wrapping Document
362  CRef<CGBDocument> doc(new CGBDocument(this));
363  doc->Assign(*handle);
364 
365  // replace handle with the document
366  handle.Reset(doc);
367  }
368 
369  CWorkspaceFolder::TFolders& folders = folder.SetFolders();
371  CWorkspaceFolder& child_folder = **it;
372  x_CreateDocuments(child_folder);
373  }
374 }
375 
376 
379 {
381 }
382 
383 
385 {
387 }
388 
390 {
391  CProjectTreePanel* projectTreePanel = GetProjectTreePanel();
392  if (projectTreePanel)
393  projectTreePanel->ReloadProjectTree();
394 }
395 
396 void sAssertMainThread(const char* err_msg)
397 {
398  bool main_thread = (CThread::GetSelf() == 0);
399  if( ! main_thread) {
400  _ASSERT(false);
401  NCBI_THROW(CProjectServiceException, eThreadAffinityError, err_msg);
402  }
403 }
404 
405 
407  SConstScopedObject& object,
408  const objects::CUser_object* params,
409  bool bFloat)
410 {
412  objects.push_back(object);
413 
414  return AddProjectView (view_name, objects, params, bFloat);
415 }
416 
419  const objects::CUser_object* params,
420  bool bFloat)
421 {
422  sAssertMainThread("Views can be created only from the main thread");
423 
424  IViewManagerService* view_srv =
426  ;
427 
428  _ASSERT(view_srv);
429 
430  CIRef<IView> view( view_srv->CreateViewInstance(view_name) );
431  if( !view ){
432  return null;
433  }
434 
435  CIRef<IProjectView> prj_view(dynamic_cast<IProjectView*>(view.GetPointer()));
436  if( prj_view ){
437  if (objects.size() > 0) {
438  const CSerialObject* so = dynamic_cast<const CSerialObject*>(objects[0].object.GetPointerOrNull());
439  if (so) {
440  string fp = view_name + ":" + so->GetThisTypeInfo()->GetName();
441  dynamic_cast<IWMClient&>(*prj_view).SetFingerprint(fp);
442  }
443  }
444 
445  view_srv->AddToWorkbench(*view, bFloat);
446 
447  bool ok = false;
448  try {
449  // initialization logging
450  //
451  {
452  const CViewTypeDescriptor& vdescr = prj_view->GetTypeDescriptor();
453  LOG_POST(Info << "InitView = " << vdescr.GetLabel());
454 
455  int ix = 0;
456  int trace_limit = 10;
457  string arg_label;
458 
460  #ifdef _DEBUG
461  trace_limit = 100;
462  #endif
463 
464  if( ix++ == trace_limit ){
465  LOG_POST(Info << " and " << (objects.size() - trace_limit) << " objects more" );
466 
467  break;
468  }
469  const CObject* obj = it->object.GetPointer();
470  CScope* scope = const_cast<CScope*>(it->scope.GetPointer());
471  arg_label.clear();
472  try {
473  CLabel::GetLabel(*obj, &arg_label, CLabel::eDefault, scope);
474  }
475  catch (const exception&) {
476  arg_label = "EXCEPTION";
477  }
478 
479  LOG_POST(Info << " object=" << arg_label);
480 
481  }
482  }
483 
484  ok = prj_view->InitView(objects, params);
485 
486  } catch( CException& e ){
487  LOG_POST( Error << e.what() );
488  #ifdef _DEBUG
489  NcbiErrorBox( e.what(), "Error while opening view" );
490  #else
491  NcbiErrorBox( e.GetMsg(), "Open View Error" );
492  #endif
493  }
494 
495  if( ok ){
496 
497  OnViewAttached(prj_view);
498 
499  CProjectViewBase* prj_view_base =
500  dynamic_cast<CProjectViewBase*>(prj_view.GetPointer())
501  ;
502  if( prj_view_base ){
503  prj_view_base->RefreshViewWindow();
504  }
505 
506  } else {
507  view_srv->RemoveFromWorkbench(*view);
508  prj_view.Reset();
509  }
510  } else {
511  _ASSERT(false);
512  NCBI_THROW(CProjectServiceException, eInvalidArguments,
513  "Created view is not a Project View");
514  }
515  return prj_view;
516 }
517 
518 IProjectView* CProjectService::FindView(const CObject& mainObject, const string& viewType)
519 {
520  if (viewType.empty())
521  return 0;
522 
524  _ASSERT(view_srv);
526  view_srv->GetViews(views);
528  IProjectView* project_view = dynamic_cast<IProjectView*>((*it).GetPointer());
529  if (project_view && project_view->GetLabel(IProjectView::eType) == viewType) {
531  project_view->GetMainObject(objects);
532  if (objects.size() == 1 && &mainObject == objects.front().object.GetPointer()) {
533  return project_view;
534  }
535  }
536  }
537  return 0;
538 }
539 
540 void CProjectService::FindViews(vector<CIRef<IProjectView> >& projectViews, const CObject& mainObject)
541 {
543  _ASSERT(view_srv);
545  view_srv->GetViews(views);
547  IProjectView* project_view = dynamic_cast<IProjectView*>((*it).GetPointer());
548  if (project_view) {
550  project_view->GetMainObject(objects);
551  if (objects.size() == 1 && &mainObject == objects.front().object.GetPointer())
552  projectViews.push_back(CIRef<IProjectView>(project_view));
553  }
554  }
555 }
556 
558 {
560  _ASSERT(view_srv);
562  view_srv->GetViews(views);
564  IProjectView* project_view = dynamic_cast<IProjectView*>((*it).GetPointer());
565  if (project_view) {
566  projectViews.push_back(CIRef<IProjectView>(project_view));
567  }
568  }
569 }
570 
572 {
573  if (!projectView)
574  return;
575 
577  IWMClient* client = dynamic_cast<IWMClient*>(projectView);
578  _ASSERT(client);
579  wm_srv->ActivateClient(*client);
580 }
581 
582 CIRef<IProjectView> CProjectService::ShowView(const string& viewName, FWindowFactory widgetFactory, TConstScopedObjects& objects, bool bFloat)
583 {
584  CIRef<IProjectView> view;
585  if (objects.empty()) return view;
586 
587  view.Reset(FindView(*(objects.front().object), viewName));
588  if (view) {
589  ActivateProjectView(view);
590  return view;
591  }
592 
593  if (widgetFactory == 0) {
594  return AddProjectView(viewName, objects, 0, bFloat);
595  } else {
596  return CSimpleProjectView::CreateView(viewName, widgetFactory, m_ServiceLocator, objects, 0, bFloat);
597  }
598 
599  return view;
600 }
601 
602 
604 {
605  sAssertMainThread("Views can be removed only from the main thread");
606 
608 
609  _ASSERT(view_srv);
610 
611  x_RemoveView(*view_srv, view);
612 }
613 
614 
616 {
617  sAssertMainThread("Views can be removed only from the main thread");
618 
620 
621  _ASSERT(view_srv);
622 
624  view_srv->GetViews(views);
625 
626  for( size_t i = 0; i < views.size(); i++ ) {
627  IView& view = *views[i];
628  IProjectView* prj_view = dynamic_cast<IProjectView*>(&view);
629  if(prj_view) {
630  x_RemoveView(*view_srv, *prj_view);
631  }
632  }
633 }
634 
635 
637  IProjectView& view,
638  bool reset_hist_async)
639 {
640  CIRef<IProjectView> hold(&view);
641 
642  // disconnect from the document
643  view.SetAsyncDestroy(reset_hist_async);
644  view.DestroyView();
645 
646  // disconnect for Workbench (removes it from Window Manager)
647  view_srv.RemoveFromWorkbench(view);
648 }
649 
650 // attach a view to the document manager
652 {
653  if( view ){
654  /*
655  const CGuiRegistry& reg = CGuiRegistry::GetInstance();
656  bool save_views = reg.GetBool("GBENCH.Application.SaveViews", false);
657  if (save_views) {
658  RecordViewOpen(view);
659  }
660  */
661 
662  REPORT_USAGE("views", .Add("view_name", view->GetLabel(IProjectView::eType)));
663 
664  if (m_Workspace) {
665  CGBDocument* doc = dynamic_cast<CGBDocument*>(m_Workspace->GetProjectFromId(view->GetProjectId()));
666  if (doc) {
668  doc->Send (&ev);
669  }
670  }
671  }
672 }
673 
675 {
677 
679  view_srv->GetViews(views);
681  CProjectTreeView* projectTree = dynamic_cast<CProjectTreeView*>((*it).GetPointer());
682  if (projectTree) return dynamic_cast<CProjectTreePanel*>(projectTree->GetWindow());
683  }
684 
685  return 0;
686 }
687 
689  vector<TProjectId>& ids)
690 {
691  if (objects.empty())
692  return;
693 
695  if (!ws) return;
696 
697  set<TProjectId> idSet;
699  CScope* scope = it->scope;
700  if (!scope) continue;
701  CGBProjectHandle* project = ws->GetProjectFromScope(*scope);
702  if (project) {
703  idSet.insert(project->GetId());
704  }
705  }
706  copy(idSet.begin(), idSet.end(), back_inserter(ids));
707 }
708 
710 {
711  if (!m_Workspace) return;
712 
713  m_Workspace->SetWorkspace().AddProject(doc);
714 
715  CProjectTreePanel* projectTreePanel = GetProjectTreePanel();
716  if (projectTreePanel)
717  projectTreePanel->ProjectAdded(doc);
718 }
719 
721 {
722  if (!m_Workspace) return;
723 
724  size_t id = doc.GetId();
725  doc.UnloadProject(true);
726  if (m_Workspace->RemoveProject(id)) {
727  CProjectTreePanel* projectTreePanel = GetProjectTreePanel();
728  if (projectTreePanel) projectTreePanel->ProjectRemoved(id);
729  }
730 }
731 
733 {
734  CProjectTreePanel* projectTreePanel = GetProjectTreePanel();
735  if (projectTreePanel) projectTreePanel->UpdateWorkspaceLabel();
736 }
737 
738 const CProjectItem* CProjectService::GetProjectItem(const CObject& object, objects::CScope& scope)
739 {
740  if (!m_Workspace) return 0;
741 
742  CGBDocument* doc = dynamic_cast<CGBDocument*>(m_Workspace->GetProjectFromScope(scope));
743  if (!doc) return 0;
744 
745  for (CTypeConstIterator<CProjectItem> it(doc->GetData()); it; ++it) {
746  if (it->GetObject() == &object) {
747  return &*it;
748  }
749  }
750 
751  return 0;
752 }
753 
User-defined methods of the data storage class.
User-defined methods of the data storage class.
pair< CFormatGuess::EFormat, ESerialDataFormat > TSerialTypePair
static const TSerialTypePair sc_DataTypes[]
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CGBDocument.
Definition: document.hpp:113
void UnloadProject(bool reset_hist_async=true)
Definition: document.cpp:1316
void CancelLoading()
Definition: document.cpp:269
bool IsLoading() const
Definition: document.cpp:264
CGBWorkspace.
Definition: GBWorkspace.hpp:63
CRegistryWriteView GetWriteView(const string &section)
get a read-write view at a particular level.
Definition: registry.cpp:462
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
CRegistryReadView GetReadView(const string &section) const
get a read-only view at a particular level.
Definition: registry.cpp:428
CObject –.
Definition: ncbiobj.hpp:180
CProjectServiceException.
void x_CreateDocuments(objects::CWorkspaceFolder &folder)
CRef< objects::CGBWorkspace > m_Workspace
the only Workspace
virtual void LoadSettings()
CIRef< IProjectView > ShowView(const string &viewName, FWindowFactory widgetFactory, TConstScopedObjects &objects, bool bFloat)
virtual void SetRegistryPath(const string &path)
string m_RegPath
path in the Registry to our settings
virtual void InitService()
void GetObjProjects(TConstScopedObjects &objects, vector< TProjectId > &ids)
bool SaveWorkspace()
Save a workspace.
CIRef< IProjectView > AddProjectView(const string &view_name, SConstScopedObject &object, const objects::CUser_object *params, bool bFloat=false)
void RemoveProject(CGBDocument &doc)
virtual void SaveSettings() const
void ActivateProjectView(IProjectView *projectView)
CProjectTreePanel * GetProjectTreePanel()
CRef< objects::CGBWorkspace > x_LoadWorkspace(const wxString &filename)
virtual void SetServiceLocator(IServiceLocator *locator)
void ResetWorkspace()
release the current workspace and all its contents TODO - review
const TMRUPathList & GetProjectWorkspaceMRUList() const
get MRU Projects and Workspaces
IProjectView * FindView(const CObject &mainObject, const string &viewType)
void RemoveProjectView(IProjectView &view)
removes the view from View manager Service and disconnects it from the project
CRef< objects::CGBWorkspace > GetGBWorkspace()
TMRUPathList m_ProjectWorkspaceMRUList
filename for the workspace
void AddProject(CGBDocument &doc)
void AddToProjectWorkspaceMRUList(const wxString &path)
void OnViewAttached(IProjectView *view)
called by CDocument when IProjectView is attached/detached to it
void x_RemoveView(IViewManagerService &view_srv, IProjectView &view, bool reset_hist_async=true)
void FindViews(vector< CIRef< IProjectView > > &projectViews, const CObject &mainObject)
const objects::CProjectItem * GetProjectItem(const CObject &object, objects::CScope &scope)
void x_ReloadProjectTreeView()
IServiceLocator * m_ServiceLocator
virtual ~CProjectService()
virtual void ShutDownService()
CProjectTreePanel - a window that represents Project View.
void ProjectRemoved(size_t id)
void ProjectAdded(CGBDocument &doc)
CProjectTreeView - a system view that displays Project Tree.
virtual wxWindow * GetWindow()
returns a pointer to the wxWindow representing the client
CProjectViewBase - default implementation of IProjectView, the base class for CProjectView and CProje...
virtual void RefreshViewWindow()
CProjectViewEvent.
Definition: document.hpp:62
CRef –.
Definition: ncbiobj.hpp:618
class CRegistryReadView provides a nested hierarchical view at a particular key.
Definition: reg_view.hpp:58
void GetStringVec(const string &key, vector< string > &val) const
Definition: reg_view.cpp:263
void Set(const string &key, int val)
access a named key at this level, with no recursion
Definition: reg_view.cpp:533
CScope –.
Definition: scope.hpp:92
Root class for all serialization exceptions.
Definition: exception.hpp:50
Base class for all serializable objects.
Definition: serialbase.hpp:150
static CIRef< IProjectView > CreateView(const string &viewName, FWindowFactory widgetFactory, IServiceLocator *serviceLocator, TConstScopedObjects &objects, ISimpleProjectViewCmdHandler *cmdHandler=0, bool bFloat=false)
CTimeFormat –.
Definition: ncbitime.hpp:131
void Clear()
Definition: mru_list.hpp:170
const TTimeToTMap & GetMap() const
Definition: mru_list.hpp:149
void Add(T elem, time_t time=0)
Definition: mru_list.hpp:176
CTime –.
Definition: ncbitime.hpp:296
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
Template class for iteration on objects of class C.
Definition: iterator.hpp:673
@ eViewAttached
general data update notification
Definition: view_event.hpp:51
CViewTypeDescriptor - holds description of a view type.
Definition: view.hpp:98
class IProjectView defines the abstract interface for views observing projects.
virtual TProjectId GetProjectId() const =0
virtual void SetAsyncDestroy(bool reset_hist_async)=0
Set async destruction mode.
virtual void DestroyView()=0
disconnects view from the project and associated data
virtual string GetLabel(ELabelType type) const =0
returns name of the plug-in created this view (view class name)
virtual void GetMainObject(TConstScopedObjects &objects) const =0
Adds the main data objects represented by the client to "objects".
IServiceLocator - an abstract mechanism for locating services.
Definition: service.hpp:71
IViewManagerService IViewManagerService manages views in Workbench.
IView - represents a standard visual part of Workbench UI.
Definition: view.hpp:73
IWClient - abstract Window Manager client.
Definition: wm_client.hpp:50
virtual void SetFingerprint(const string &)
Definition: wm_client.hpp:116
IWindowManagerService Window Manager Service provides access to Window Manager functionality.
Definition: map.hpp:338
Definition: set.hpp:45
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
const_iterator begin() const
Definition: set.hpp:135
const_iterator end() const
Definition: set.hpp:136
static const char fp[]
Definition: des.c:87
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
Definition: ncbimisc.hpp:822
#define NULL
Definition: ncbistd.hpp:225
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
Definition: ncbiexpt.hpp:704
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
Definition: ncbiexpt.cpp:342
void Info(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1185
CIRef< T > GetServiceByType()
retrieves a typed reference to a service, the name of C++ type is used as the name of the service.
Definition: service.hpp:91
virtual void AddToWorkbench(IView &view, bool bFloat=false)=0
adds view to Workbench and connects to the services the view must be already initialized
vector< CIRef< IView > > TViews
virtual void GetViews(TViews &views)=0
get all registered views
virtual void RemoveFromWorkbench(IView &view)=0
disconnects view from services and removes from the Workbench
virtual CIRef< IView > CreateViewInstance(const string &type_ui_name)=0
create a view instance of the specified type
virtual void ActivateClient(IWMClient &client)=0
makes client visible and focused
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
void NcbiErrorBox(const string &message, const string &title="Error")
specialized Message Box function for reporting critical errors
virtual const string & GetLabel() const
Definition: ui_object.cpp:124
vector< SConstScopedObject > TConstScopedObjects
Definition: objects.hpp:65
virtual bool Send(CEvent *evt, EDispatch disp_how=eDispatch_Default, int pool_name=ePool_Default)
Sends an event synchronously.
@ eDefault
Definition: label.hpp:73
virtual const CTypeInfo * GetThisTypeInfo(void) const =0
ESerialDataFormat
Data file format.
Definition: serialdef.hpp:71
@ eSerial_AsnText
ASN.1 text.
Definition: serialdef.hpp:73
@ eSerial_Xml
XML.
Definition: serialdef.hpp:75
@ eSerial_AsnBinary
ASN.1 binary.
Definition: serialdef.hpp:74
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
Definition: objostr.cpp:126
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
Definition: objistr.cpp:195
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ofstream CNcbiOfstream
Portable alias for ofstream.
Definition: ncbistre.hpp:500
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
Definition: ncbistre.hpp:439
static TID GetSelf(void)
Definition: ncbithr.cpp:515
CTime & ToLocalTime(void)
Convert the time into local time.
Definition: ncbitime.hpp:2465
string AsString(const CTimeFormat &format=kEmptyStr, TSeconds out_tz=eCurrentTimeZone) const
Transform time to string.
Definition: ncbitime.cpp:1511
time_t GetTimeT(void) const
Get time in time_t format.
Definition: ncbitime.cpp:1395
static CTimeFormat GetPredefined(EPredefined fmt, TFlags flags=fDefault)
Get predefined format.
Definition: ncbitime.cpp:388
@ eCurrent
Use current time. See also CCurrentTime.
Definition: ncbitime.hpp:300
@ eISO8601_DateTimeSec
Y-M-DTh:m:s (eg 1997-07-16T19:20:30)
Definition: ncbitime.hpp:196
const string & GetName(void) const
Get name of this type.
Definition: typeinfo.cpp:249
TProjects & SetProjects(void)
Assign a value to Projects data member.
TFolders & SetFolders(void)
Assign a value to Folders data member.
list< CRef< CGBProjectHandle > > TProjects
list< CRef< CWorkspaceFolder > > TFolders
wxWindow *(* FWindowFactory)(wxWindow *)
Definition: gui_widget.hpp:45
int i
yy_size_t n
#define wxT(x)
Definition: muParser.cpp:41
EIPRangeType t
Definition: ncbi_localip.c:101
static Format format
Definition: njn_ioutil.cpp:53
std::istream & in(std::istream &in_, double &x_)
Format
Definition: njn_ioutil.hpp:52
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
USING_SCOPE(objects)
void sAssertMainThread(const char *err_msg)
static const char * kMRUTag
static CNamedPipeClient * client
static const char * str(char *buf, int n)
Definition: stats.c:84
#define _ASSERT
#define REPORT_USAGE(event, args)
Convenience macro to log usage statisitics.
wxString ToWxString(const string &s)
Definition: wx_utils.hpp:173
wxString FnToWxString(const string &s)
Definition: wx_utils.cpp:253
string FnToStdString(const wxString &s)
Definition: wx_utils.cpp:268
Modified on Sat Dec 02 09:20:51 2023 by modify_doxy.py rev. 669887