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

Go to the SVN repository for this file.

1 /* $Id: GBProjectHandle.cpp 45983 2021-01-20 17:04:13Z grichenk $
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  * Author: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'gui_project.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 #include <serial/objistr.hpp>
41 #include <serial/serial.hpp>
43 
44 #include <gui/objutils/label.hpp>
46 
48 
49 #include <corelib/rwstream.hpp>
50 #include <serial/pack_string.hpp>
51 #include <serial/objostr.hpp>
52 #include <serial/iterator.hpp>
57 #include <util/format_guess.hpp>
58 
59 #include <corelib/ncbifile.hpp>
60 
61 // generated includes
65 
66 
67 // generated classes
68 
70 
71 BEGIN_objects_SCOPE // namespace ncbi::objects::
72 
73 /// This class is intended to skip over plugin messages in
74 /// gbench projects that do not meet the current spec for a plugin message
76 {
77 public:
78  CReadHook_SkipError(const string& msg, bool discard = true)
79  : m_Message(msg)
80  , m_Discard(discard)
81  {
82  }
83 
84  virtual void ReadObject(CObjectIStream& in, const CObjectInfo& info)
85  {
87  in.SkipAnyContentObject();
88  CRef<CByteSource> bytes = guard.EndDelayBuffer();
89  try {
90  unique_ptr<CObjectIStream> tmp
91  (CObjectIStream::Create(in.GetDataFormat(), *bytes));
92  tmp->ReadObject(info);
93  }
94  catch (CException& e) {
95  LOG_POST(Error << "Failed to read " << m_Message << ": " << e.what());
96  if (m_Discard) {
97  in.SetDiscardCurrObject();
98  }
99  }
100  }
101 
102 private:
103  string m_Message;
104  bool m_Discard;
105 };
106 
107 typedef pair<CFormatGuess::EFormat, ESerialDataFormat> TSerialTypePair;
108 static const TSerialTypePair sc_DataTypes[] = {
112 };
113 
114 
115 template <class ProjectType>
116 CRef<ProjectType> ReadProject(CNcbiIstream& istr, const char* typeName, ICanceled* canceledCallback)
117 {
119 
120  /// do we use memory pooling on deserialization?
121  /// we have a compile-time constant as well as a config file override
122  bool use_mempool =
123 #ifdef _DEBUG
124  false;
125 #else
126  true;
127 #endif
128  use_mempool =
129  reg.GetBool("GBENCH.Application.IO.UseMempool", use_mempool);
130 
131  /// should we pack strings?
132  bool pack_strings =
133  reg.GetBool("GBENCH.Application.IO.PackStrings", true);
134 
135  /// we try, in order, ASN.1 binary, ASN.1 text, and XML
136  /// this is a different order from workspaces, and this
137  /// is intentional. For the release mode builds, binary ASN.1 projects
138  /// will be written, so we try these first. Debug mode will write
139  /// ASN.1 text.
140  CFormatGuess fg(istr);
141  for (size_t i = 0; i < sizeof(sc_DataTypes) / sizeof(TSerialTypePair); ++i) {
142  if (!fg.TestFormat(sc_DataTypes[i].first))
143  continue;
144 
145  string errMsg = "ReadProject<";
146  errMsg += typeName;
147  errMsg += ">() : failed to read ";
149 
150  try {
151  CRef<ProjectType> project(new ProjectType());
152  istr.clear();
153  istr.seekg(0);
154  unique_ptr<CObjectIStream> obj_istr
155  (CObjectIStream::Open(sc_DataTypes[i].second, istr));
156 
157  if (canceledCallback)
158  obj_istr->SetCanceledCallback(canceledCallback);
159 
160  /// memory profile optimization:
161  /// we should use pooled strings to reduce the memory burden
162  /// (from Eugene Vasilchenko)
163  if (pack_strings) {
166  info.FindVariant("str")
167  .SetLocalReadHook(*obj_istr, new CPackStringChoiceHook);
168 
170  info.FindMember("key")
171  .SetLocalReadHook(*obj_istr, new CPackStringClassHook(32, 128));
172 
174  info.FindMember("db")
175  .SetLocalReadHook(*obj_istr, new CPackStringClassHook);
176 
177  info = CType<CGb_qual>();
178  info.FindMember("qual")
179  .SetLocalReadHook(*obj_istr, new CPackStringClassHook);
180  }
181  if (use_mempool) {
182  obj_istr->UseMemoryPool();
183  }
184 
185  /// add a read hook to track the reading of a plugin message
186  /// we will permit a plugin message to be ill-formed
187  /// in the case of an ill-formed object, we will ignore it
189  CRef<CReadHook_SkipError> msg_hook_monitor
190  (new CReadHook_SkipError("PluginMessage"));
191  msg_hook.SetLocalReadHook(*obj_istr, msg_hook_monitor);
192 
193  /**
194  CObjectTypeInfo item_hook = CType<CProjectItem>();
195  CRef<CReadHook_SkipError> item_hook_monitor
196  (new CReadHook_SkipError("ProjectItem"));
197  item_hook.SetLocalReadHook(*obj_istr, item_hook_monitor);
198  **/
199 
200  *obj_istr >> *project;
201  return project;
202  } NCBI_CATCH(errMsg);
203  }
204 
205  return CRef<ProjectType>();
206 }
207 
208 
209 ///////////////////////////////////////////////////////////
210 // label handler for genome workbench projects
211 
213 {
214 public:
215  void GetLabel(const CObject& obj, string* str,
217  CScope* scope) const
218  {
219  const CGBProjectHandle* project = dynamic_cast<const CGBProjectHandle*>(&obj);
220  if (project) {
221  switch (type) {
222  case CLabel::eUserType:
224  *str += "CGBDocument - must not be shown";
225  break;
226 
227  case CLabel::eType:
228  *str += "Project";
229  break;
230 
233  case CLabel::eContent:
234  if (project->IsLoaded()) {
235  string title;
236  if (project->GetDescr().IsSetTitle()) {
237  title = project->GetDescr().GetTitle();
238  } else {
239  ///
240  /// poke around in the internals
241  ///
242  const IGBProject& proj = project->GetProject();
243  const CGBProject* ver1 =
244  dynamic_cast<const CGBProject*>(&proj);
245  const CGBProject_ver2* ver2 =
246  dynamic_cast<const CGBProject_ver2*>(&proj);
247  if (ver1) {
248  CLabel::GetLabel(*ver1, &title, type, scope);
249  } else if (ver2) {
250  CLabel::GetLabel(*ver2, &title, type, scope);
251  }
252  }
253  if ( !title.empty() ) {
254  *str += title;
255  }
256  } else {
257  /// unloaded - just report the file name
258  const string& fname = project->GetFilename();
259  if ( ! fname.empty() ) {
260  *str += fname;
261  } else {
262  *str += "(empty project)";
263  }
264  }
265  break;
266 
267 
269  default:
270  {{
271  string type_str;
272  GetLabel(obj, &type_str, CLabel::eType, scope);
273  string content_str;
274  GetLabel(obj, &content_str, CLabel::eContent, scope);
275  *str += type_str;
276  if ( !type_str.empty() && !content_str.empty() ) {
277  *str += ": ";
278  }
279  if ( !content_str.empty() ) {
280  *str += content_str;
281  }
282  }}
283  break;
284  }
285  }
286  }
287 };
288 
289 //////////////////////////////////////////////////////////////////////////////////////
290 /// CGBProjectHandle
292 
294 
296  : m_Dirty(false)
297  , m_Loaded(false)
298 {
299  //m_Id = GetNextId();
300  if ( !CLabel::HasHandler(*CGBProjectHandle::GetTypeInfo()) ) {
301  CLabel::RegisterLabelHandler(*CGBProjectHandle::GetTypeInfo(),
302  *new CGBDocumentLabelHandler());
303  }
304 
305  SetFilename("");
306 }
307 
309  : m_Dirty(false)
310  , m_Loaded(true)
311 {
312  m_Project = &proj_impl;
313  //m_Id = GetNextId();
314 
315  if ( !CLabel::HasHandler(*CGBProjectHandle::GetTypeInfo()) ) {
316  CLabel::RegisterLabelHandler(*CGBProjectHandle::GetTypeInfo(),
317  *new CGBDocumentLabelHandler());
318  }
319 
320  SetFilename("");
322 }
323 
324 
326 {
327 }
328 
329 
331 {
333  return m_Project.GetObject();
334 }
335 
336 
338 {
339  // this function shall not create projects "on first use";
340  // projects must be created explicitly!
342  return m_Project.GetObject();
343 }
344 
345 
347 {
350  m_Scope.Reset(scope);
351 }
352 
353 
355 {
356  return const_cast<CScope*>(m_Scope.GetPointer());
357 }
358 
359 
361 {
362  return m_Id;
363 }
364 
365 
367 {
368  TId id = sm_Counter.Add(1);
369  LOG_POST(Info << "CGBProjectHandle::GetNextId() " << id);
370  return id;
371 }
372 
373 
375 {
376  return (m_Loaded.Get() != 0);
377 }
378 
380 {
381  m_Loaded.Set(1);
382 }
383 
385 {
386  if (m_Loaded.Get() == 0)
387  return false;
388 
389  return m_Project && (m_Dirty || m_DataModified);
390 }
391 
392 
394 {
395  // SetFileName can be called on not loaded project
396  // _ASSERT(m_Project);
397 
398  if(m_Project) {
399  m_Dirty = dirty;
400 
401  if (dirty)
402  m_Project->SetModifiedDate(CTime(CTime::eCurrent));
403  else
404  m_DataModified = false;
405  }
406 }
407 
408 
410 {
411  if (m_Loaded.Get() == 0)
412  return false;
413 
414  return m_Project && m_DataModified;
415 }
416 
417 
419 {
420  if (m_Project) {
421  m_DataModified = modified;
422 
423  if (modified)
424  m_Project->SetModifiedDate(CTime(CTime::eCurrent));
425  }
426 }
427 
428 
429 /// retrieve our project's descriptor set
431 {
432  return GetProject().GetDescr();
433 }
434 
435 
437 {
438  return SetProject().SetDescr();
439 }
440 
441 
442 // Get a description of our contents.
443 // This is suitable for display in a GUI component such as a list view.
444 const string& CGBProjectHandle::GetTitle(void) const
445 {
446  m_Title.erase();
447  const CObject* obj = dynamic_cast<const CObject*>(m_Project.GetPointer());
448  if (obj) {
450  }
451  return m_Title;
452 }
453 
454 
455 const string& CGBProjectHandle::GetShortTitle(void) const
456 {
457  m_ShortTitle.erase();
458  const CObject* obj = dynamic_cast<const CObject*>(m_Project.GetPointer());
460  return m_ShortTitle;
461 }
462 
463 
464 bool CGBProjectHandle::Load(CNcbiIstream& istr, ICanceled* canceledCallback)
465 {
466  /// try to read version 2 first
467  {{
468  CRef<CGBProject_ver2> ver2 = ReadProject<CGBProject_ver2>(istr, "CGBProject_ver2", canceledCallback);
469  if (ver2) {
470  m_Project.Reset(ver2.GetPointer());
471  SetDirty(false);
473  x_FixIdGenerator(*ver2);
474  return true;
475  }
476  }}
477 
478  /// now try to read version 1
479  {{
480  CRef<CGBProject> ver1 = ReadProject<CGBProject>(istr, "CGBProject", canceledCallback);
481  if (ver1) {
482  /// convert to version-2
483 
485  ver2->SetCounter(ver1->GetCounter());
486  ver2->SetDescr(ver1->SetDescr());
487  ver2->SetData().SetItems()
488  .push_back(CRef<CProjectItem>(&ver1->SetCore()));
489  if (ver1->IsSetExtra()) {
490  if (ver1->GetExtra().IsSetFolders()) {
491  NON_CONST_ITERATE (CProjectFolder::TFolders, iter, ver1->SetExtra().SetFolders()) {
492  ver2->SetData().SetFolders().push_back(*iter);
493  }
494  }
495 
496  if (ver1->GetExtra().IsSetItems()) {
497  NON_CONST_ITERATE (CProjectFolder::TItems, iter, ver1->SetExtra().SetItems()) {
498  ver2->SetData().SetItems().push_back(*iter);
499  }
500  }
501  }
502  if (ver1->IsSetOrig_message()) {
503  // Orig_message is ingored intentionally after removal of
504  // 'orig-message PluginMessage' from GBProject-ver2.
505  //ver2->SetOrig_message(ver1->SetOrig_message());
506  }
507  if (ver1->IsSetHistory()) {
508  ver2->SetHistory().swap(ver1->SetHistory());
509  }
510  if (ver1->IsSetData_plugin()) {
511  ver2->SetData_plugin(ver1->SetData_plugin());
512  }
513  if (ver1->IsSetPlugin_param()) {
514  ver2->SetPlugin_param(ver1->SetPlugin_param());
515  }
516  if (ver1->IsSetAnnot()) {
517  ver2->SetAnnot().swap(ver1->SetAnnot());
518  }
519 
520  /// save the project
521  m_Project.Reset(ver2.GetPointer());
522  SetDirty(false);
524  return true;
525  }
526  }}
527  return false;
528 }
529 
530 
532 {
533  unique_ptr<CObjectOStream> os(CObjectOStream::Open(fmt, ostr));
534 
535  const IGBProject& project = GetProject();
536  switch (project.GetVersion()) {
538  *os << dynamic_cast<const CGBProject&>(project);
539  break;
540 
542  *os << dynamic_cast<const CGBProject_ver2&>(project);
543  break;
544 
545  default:
546  _ASSERT(false);
547  NCBI_THROW(CException, eUnknown, "Unknown project version");
548  break;
549  }
550 
551  /// shut 'er down cleanly
552  /// if we rely on destructors, we never see the exception
553  os->Close();
554  ostr.flush();
555  if ( ! ostr) {
556  NCBI_THROW(CException, eUnknown, "stream write failure");
557  } else {
558  CGBProjectHandle* nc_this = const_cast<CGBProjectHandle*>(this);
559  nc_this->SetDirty(false);
560  }
561 }
562 
563 
565 {
566  m_Loaded.Set(0);
567  m_Project.Reset();
568  m_Scope.Reset();
569 }
570 
571 
573 {
574  const CProjectFolder& data = GetData();
575  // TODO - iterator
576  for ( CTypeConstIterator<CProjectItem> it(data); it; ++it) {
577  const string& s = it->GetLabel();
578  if(s == label)
579  return false;
580  }
581  return true;
582 }
583 
584 
585 string CGBProjectHandle::MakeUniqueItemLabel(const string& label) const
586 {
587  CUniqueLabelGenerator generator;
588  const CProjectFolder& data = GetData();
589  // TODO - iterator
590  for ( CTypeConstIterator<CProjectItem> it(data); it; ++it) {
591  const string& s = it->GetLabel();
592  generator.AddExistingLabel(s);
593  }
594  return generator.MakeUniqueLabel(label);
595 }
596 
597 
598 // folder labels is not stored in m_LabelsSet and should be unique in the scope
599 // of its parent folder
601  CProjectFolder& parent_folder) const
602 {
603  CUniqueLabelGenerator generator;
604  if(parent_folder.CanGetFolders()) {
605  ITERATE(CProjectFolder::TFolders, it, parent_folder.GetFolders()) {
606  const string& s = (*it)->GetInfo().GetTitle();
607  generator.AddExistingLabel(s);
608  }
609  }
610  return generator.MakeUniqueLabel(label);
611 }
612 
613 
615 {
616  CUniqueLabelGenerator generator;
617  if (m_Project->IsSetDataLoaders()) {
618  ITERATE (IGBProject::TDataLoaders, iter, m_Project->GetDataLoaders()) {
619  const string& s = (*iter)->GetLabel();
620  generator.AddExistingLabel(s);
621  }
622  }
623  return generator.MakeUniqueLabel(label);
624 
625 }
626 
627 
628 /// retrieve this project's version
629 /// this is fixed per subclass
631 {
632  return GetProject().GetVersion();
633 }
634 
635 
637 {
638  m_Project->SetDataLoaders().push_back(CRef<CLoaderDescriptor>(&loader));
639 }
640 
641 
643 {
644  return m_Project->GetDataLoaders();
645 }
646 
647 
649 {
650  return m_Project->SetDataLoaders();
651 }
652 
653 
655 {
657  if (m_Project->IsSetDataLoaders()) {
659  iter, m_Project->SetDataLoaders()) {
660  if ((*iter)->GetLabel() == label) {
661  loader = *iter;
662  break;
663  }
664  }
665  }
666  return loader;
667 }
668 
670 {
671  CProjectFolder& data_folder = SetData();
672  if (data_folder.GetId() == id)
673  return &data_folder;
674  return data_folder.FindChildFolderById(id);
675 }
676 
678 {
679  return SetData().FindProjectItemById(id);
680 }
681 
682 string CGBProjectHandle::GetViewSettings(const string& view_type,
683  const string& view_ins_id) const
684 {
685  string settings;
686  if (m_Project->IsSetViewSettings()) {
687  ITERATE (IGBProject::TViewSettings, iter, m_Project->GetViewSettings()) {
688  if ((*iter)->GetType().IsStr() &&
689  (*iter)->GetType().GetStr() == view_type) {
690  CConstRef<CUser_field> field = (*iter)->GetFieldRef(view_ins_id);
691  if (field) {
692  settings = field->GetData().GetStr();
693  }
694  break;
695  }
696  }
697  }
698  return settings;
699 }
700 
701 
702 void CGBProjectHandle::SaveViewSettings(const string& view_type,
703  const string& view_ins_id,
704  const string& settings)
705 {
706  CRef<CUser_object> obj;
707  if (m_Project->IsSetViewSettings()) {
708  // first check if there is settings for this view type
709  NON_CONST_ITERATE (IGBProject::TViewSettings, iter, m_Project->SetViewSettings()) {
710  if ((*iter)->GetType().IsStr() &&
711  (*iter)->GetType().GetStr() == view_type) {
712  obj = *iter;
713  break;
714  }
715  }
716  }
717  if ( !obj ) {
718  obj.Reset(new CUser_object);
719  obj->SetType().SetStr(view_type);
720  m_Project->SetViewSettings().push_back(obj);
721  }
722 
723  CUser_field& field = obj->SetField(view_ins_id);
724  field.SetData().SetStr(settings);
725 }
726 
727 
729 {
730  m_Project->AddItem(item, folder);
731 }
732 
733 
734 /// retrieve our project's data, in the form of a project folder
735 /// this may be a contrived entity, and it is up to a project to determine
736 /// what parts belong where
738 {
739  return GetProject().GetData();
740 }
741 
742 
744 {
745  return SetProject().SetData();
746 }
747 
748 
749 /// retrieve a set of annotations for this project
751 {
752  return GetProject().IsSetAnnot();
753 }
754 
755 
757 {
758  return GetProject().GetAnnot();
759 }
760 
761 
763 {
764  return SetProject().SetAnnot();
765 }
766 
767 
769 {
770  SetProject().SetCreateDate(date);
771 }
772 
773 
775 {
776  SetProject().SetModifiedDate(date);
777 }
778 
779 
780 // updates links to Parent Folder in Project Folders and Items
782 {
783  if(folder.CanGetItems()) {
784  CProjectFolder::TItems& items = folder.SetItems();
786  CProjectItem& item = **it;
787  if( ! item.CanGetLabel()) {
789  }
790  }
791  }
792  if(folder.CanGetFolders()) {
793  CProjectFolder::TFolders& folders = folder.SetFolders();
795  CProjectFolder& sub_folder = **it;
796  x_LinkChildFolders(sub_folder);
797  }
798  }
799 }
800 
802 {
803  int counter = 0;
804  CTypeConstIterator<CProjectItem> item_iter(project.GetData());
805  for (; item_iter; ++item_iter) {
806  const CProjectItem& item = *item_iter;
807  counter = max(counter, item.GetId());
808  }
809  ++counter;
810  if (!project.IsSetCounter() || project.GetCounter() < counter) {
811  project.SetCounter(counter);
812  }
813 }
814 
815 END_objects_SCOPE // namespace ncbi::objects::
816 
818 
819 /* Original file checksum: lines: 57, chars: 1754, CRC32: 1289f084 */
pair< CFormatGuess::EFormat, ESerialDataFormat > TSerialTypePair
static const TSerialTypePair sc_DataTypes[]
CRef< ProjectType > ReadProject(CNcbiIstream &istr, const char *typeName, ICanceled *canceledCallback)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CAtomicCounter –.
Definition: ncbicntr.hpp:71
Definition: Date.hpp:53
Class implements different ad-hoc unreliable file format identifications.
@ eBinaryASN
Binary ASN.1.
@ eTextASN
Text ASN.1.
static const char * GetFormatName(EFormat format)
void GetLabel(const CObject &obj, string *str, CLabel::ELabelType type, CScope *scope) const
CRef< CLoaderDescriptor > FindDataLoaderByLabel(const string &label)
IGBProject::TDataLoaders TDataLoaders
IGBProject::TAnnot & SetAnnot()
const IGBProject & GetProject() const
CProjectFolder & SetData()
bool IsSetAnnot() const
retrieve a set of annotations for this project
virtual void SetScope(CScope *scope)
establish a tie to the object manager via a scope
bool GetDataModified() const
static TId GetNextId()
Retrieve the unique ID for our project.
void AddDataLoader(CLoaderDescriptor &loader)
bool IsDirty() const
void SetModifiedDate(const CDate &date)
SetModifiedDate() will add a descriptor for the update date.
string MakeUniqueFolderLabel(const string &label, objects::CProjectFolder &parent_folder) const
Create a label for a folder that will be unique in the scope of the parent folder.
CProjectDescr & SetDescr()
void SetLoaded(bool loaded=true)
void x_LinkChildFolders(CProjectFolder &folder)
const string & GetTitle(void) const
Get a description of our contents.
CProjectFolder * FindProjectFolderById(CProjectFolder::TId id)
void SetCreateDate(const CDate &date)
SetCreateDate() will add a descriptor for creation date.
void SetDataModified(bool modified=true)
string GetViewSettings(const string &view_type, const string &view_ins_id) const
CRef< CScope > m_Scope
string MakeUniqueItemLabel(const string &label) const
Create a unique label for a project item.
CIRef< IGBProject > m_Project
the pointer to the actual project
virtual void Clear(void)
Clear project.
void AddItem(CProjectItem &item, CProjectFolder &parent_folder)
bool IsLoaded() const
check to see if our project is loaded
CAtomicCounter::TValue TId
IGBProject::EProjectVersion GetVersion() const
retrieve this project's version this is fixed per subclass
virtual ~CGBProjectHandle(void)
void SaveViewSettings(const string &view_type, const string &view_ins_id, const string &settings)
virtual CScope * GetScope() const
void x_FixIdGenerator(CGBProject_ver2 &project)
static CAtomicCounter sm_Counter
auto incremented ID counter
bool IsProjectItemLabelUnique(const string &label) const
string MakeUniqueDataLoaderLabel(const string &label) const
Create a unique label for a data loader.
void SetDirty(bool dirty=true)
TId m_Id
unique runtime identifier for this project
IGBProject & SetProject()
void Save(CNcbiOstream &ostr, ESerialDataFormat fmt) const
Serialize to a stream in a given format.
bool Load(CNcbiIstream &istr, ICanceled *canceledCallback)
force a project to be loaded from an external stream
const TDataLoaders & GetDataLoaders() const
CAtomicCounter_WithAutoInit m_Loaded
bool m_Dirty
Dirty flag indicates whether the project has unsaved changes.
const string & GetShortTitle(void) const
const CProjectFolder & GetData() const
retrieve our project's data, in the form of a project folder this may be a contrived entity,...
const IGBProject::TAnnot & GetAnnot() const
CProjectItem * FindProjectItemById(CProjectItem::TId id)
const CProjectDescr & GetDescr() const
retrieve our project's descriptor set
string m_Title
the Scope associated with the Project
const CProjectFolder & GetData() const
retrieve our project's data, in the form of a project folder this may be a contrived entity,...
static CGuiRegistry & GetInstance()
access the application-wide singleton
Definition: registry.cpp:400
bool GetBool(const string &key, bool default_val=false) const
Definition: registry.cpp:143
CLoaderDescriptor –.
CObjectIStream –.
Definition: objistr.hpp:93
CObjectInfo –.
Definition: objectinfo.hpp:597
CObjectTypeInfo –.
Definition: objectinfo.hpp:94
CObject –.
Definition: ncbiobj.hpp:180
const CProjectFolder * FindChildFolderById(TId id) const
CProjectItem * FindProjectItemById(CProjectItem::TId id)
CAtomicCounter::TValue TId
TId GetId() const
This class is intended to skip over plugin messages in gbench projects that do not meet the current s...
CReadHook_SkipError(const string &msg, bool discard=true)
virtual void ReadObject(CObjectIStream &in, const CObjectInfo &info)
This method will be called at approriate time when the object of requested type is to be read.
Read hook for a standalone object.
Definition: objhook.hpp:59
CScope –.
Definition: scope.hpp:92
Guard class for CObjectIStream::StartDelayBuffer/EndDelayBuffer.
Definition: objistr.hpp:1177
CTime –.
Definition: ncbitime.hpp:296
Template class for iteration on objects of class C (non-medifiable version)
Definition: iterator.hpp:767
CUniqueLabelGenerator Modifies the given label so that it becomes unique in the given set of labels b...
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
Return a field reference representing the tokenized key, or a NULL reference if the key doesn't exist...
Definition: User_field.cpp:226
CUser_field & SetField(const string &str, const string &delim=".", const string &obj_subtype=kEmptyStr, NStr::ECase use_case=NStr::eCase)
Access a named field in this user object.
Interface for testing cancellation request in a long lasting operation.
Definition: icanceled.hpp:51
IGBProject - abstract interface for a project used by CGBProjectHandle.
Definition: igbproject.hpp:57
virtual bool IsSetAnnot() const =0
retrieve a set of annotations for this project
virtual void SetModifiedDate(const CDate &date)=0
SetModifiedDate() will add a descriptor for the update date.
list< CRef< CLoaderDescriptor > > TDataLoaders
Definition: igbproject.hpp:70
virtual const CProjectDescr & GetDescr() const =0
virtual TAnnot & SetAnnot()=0
virtual CProjectDescr & SetDescr()=0
virtual const TAnnot & GetAnnot() const =0
virtual CProjectFolder & SetData()=0
virtual void SetCreateDate(const CDate &date)=0
SetCreateDate() will add a descriptor for creation date.
virtual EProjectVersion GetVersion() const =0
retrieve this project's version; this is fixed per subclass
list< CRef< CUser_object > > TViewSettings
Definition: igbproject.hpp:71
virtual const CProjectFolder & GetData() const =0
retrieve our project's data, in the form of a project folder this may be a contrived entity,...
list< CRef< CProjectAnnot > > TAnnot
Definition: igbproject.hpp:68
ILabelHandler interface.
Definition: label.hpp:136
#define true
Definition: bool.h:35
#define false
Definition: bool.h:36
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
Definition: dlist.tmpl.h:46
static const char * str(char *buf, int n)
Definition: stats.c:84
static char tmp[3200]
Definition: utf8.c:42
char data[12]
Definition: iconv.c:80
#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
void Set(TValue new_value) THROWS_NONE
Set atomic counter value.
Definition: ncbicntr.hpp:185
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
Definition: ncbicntr.hpp:278
TValue Get(void) const THROWS_NONE
Get atomic counter value.
Definition: ncbicntr.hpp:168
#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
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
Definition: ncbiexpt.hpp:580
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
static void RegisterLabelHandler(const string &type, ILabelHandler &handler)
Definition: label.cpp:229
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
Definition: label.cpp:140
string MakeUniqueLabel(const string &label) const
after considering all existing labels produces a modified unique version of the original label
static bool HasHandler(const CTypeInfo &type)
Definition: label.cpp:243
static void SetLabelByData(objects::CProjectItem &item, objects::CScope *scope=NULL)
Definition: label.cpp:121
void AddExistingLabel(const string &label)
adds an existing label
ELabelType
Definition: label.hpp:60
@ eType
Definition: label.hpp:65
@ eUserSubtype
Definition: label.hpp:64
@ eDefault
Definition: label.hpp:73
@ eUserTypeAndContent
Definition: label.hpp:66
@ eContent
Definition: label.hpp:62
@ eDescription
Definition: label.hpp:68
@ eUserType
Definition: label.hpp:63
@ eDescriptionBrief
Definition: label.hpp:67
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
CRef< CByteSource > EndDelayBuffer(void)
Redirect call to protected CObjectIStream After this call guarding is finished.
void SetLocalReadHook(CObjectIStream &stream, CReadObjectHook *hook) const
Set local (for the specified stream) read hook.
Definition: objectinfo.cpp:366
static CObjectIStream * Create(ESerialDataFormat format)
Create serial object reader.
Definition: objistr.cpp:144
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
TObjectType & GetObject(void)
Get object.
Definition: ncbiobj.hpp:1011
#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::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
@ eCurrent
Use current time. See also CCurrentTime.
Definition: ncbitime.hpp:300
static const char label[]
list< CRef< CProjectItem > > TItems
const TTitle & GetTitle(void) const
Get the Title member data.
TCounter GetCounter(void) const
Get the Counter member data.
TId GetId(void) const
Get the Id member data.
TFolders & SetFolders(void)
Assign a value to Folders data member.
void SetCounter(TCounter value)
Assign a value to Counter data member.
bool IsSetTitle(void) const
user-defined title for the workspace Check if a value has been assigned to Title data member.
const TFolders & GetFolders(void) const
Get the Folders member data.
list< CRef< CProjectFolder > > TFolders
bool CanGetItems(void) const
Check if it is safe to call GetItems method.
bool CanGetLabel(void) const
Check if it is safe to call GetLabel method.
bool CanGetFolders(void) const
Check if it is safe to call GetFolders method.
TItems & SetItems(void)
Assign a value to Items data member.
bool IsSetCounter(void) const
next counter for project items Check if a value has been assigned to Counter data member.
const TFilename & GetFilename(void) const
Get the Filename member data.
TFilename & SetFilename(void)
Assign a value to Filename data member.
const TData & GetData(void) const
Get the Data member data.
void SetType(TType &value)
Assign a value to Type data member.
void SetData(TData &value)
Assign a value to Data data member.
int i
static MDB_envinfo info
Definition: mdb_load.c:37
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
T max(T x_, T y_)
std::istream & in(std::istream &in_, double &x_)
Reader-writer based streams.
Definition: type.c:6
#define _ASSERT
Modified on Wed Apr 17 13:10:54 2024 by modify_doxy.py rev. 669887