87 in.SkipAnyContentObject();
90 unique_ptr<CObjectIStream>
tmp
97 in.SetDiscardCurrObject();
115 template <
class ProjectType>
129 reg.
GetBool(
"GBENCH.Application.IO.UseMempool", use_mempool);
133 reg.
GetBool(
"GBENCH.Application.IO.PackStrings",
true);
145 string errMsg =
"ReadProject<";
147 errMsg +=
">() : failed to read ";
154 unique_ptr<CObjectIStream> obj_istr
157 if (canceledCallback)
158 obj_istr->SetCanceledCallback(canceledCallback);
166 info.FindVariant(
"str")
170 info.FindMember(
"key")
174 info.FindMember(
"db")
178 info.FindMember(
"qual")
182 obj_istr->UseMemoryPool();
200 *obj_istr >> *project;
224 *
str +=
"CGBDocument - must not be shown";
253 if ( !title.empty() ) {
259 if ( ! fname.empty() ) {
262 *
str +=
"(empty project)";
276 if ( !type_str.empty() && !content_str.empty() ) {
279 if ( !content_str.empty() ) {
369 LOG_POST(
Info <<
"CGBProjectHandle::GetNextId() " <<
id);
468 CRef<CGBProject_ver2> ver2 = ReadProject<CGBProject_ver2>(istr,
"CGBProject_ver2", canceledCallback);
480 CRef<CGBProject> ver1 = ReadProject<CGBProject>(istr,
"CGBProject", canceledCallback);
485 ver2->SetCounter(ver1->GetCounter());
486 ver2->SetDescr(ver1->SetDescr());
487 ver2->SetData().SetItems()
489 if (ver1->IsSetExtra()) {
490 if (ver1->GetExtra().IsSetFolders()) {
492 ver2->SetData().SetFolders().push_back(*iter);
496 if (ver1->GetExtra().IsSetItems()) {
498 ver2->SetData().SetItems().push_back(*iter);
502 if (ver1->IsSetOrig_message()) {
507 if (ver1->IsSetHistory()) {
508 ver2->SetHistory().swap(ver1->SetHistory());
510 if (ver1->IsSetData_plugin()) {
511 ver2->SetData_plugin(ver1->SetData_plugin());
513 if (ver1->IsSetPlugin_param()) {
514 ver2->SetPlugin_param(ver1->SetPlugin_param());
516 if (ver1->IsSetAnnot()) {
517 ver2->SetAnnot().swap(ver1->SetAnnot());
538 *os << dynamic_cast<const CGBProject&>(project);
542 *os << dynamic_cast<const CGBProject_ver2&>(project);
577 const string& s = it->GetLabel();
591 const string& s = it->GetLabel();
606 const string& s = (*it)->GetInfo().GetTitle();
619 const string& s = (*iter)->GetLabel();
660 if ((*iter)->GetLabel() ==
label) {
672 if (data_folder.
GetId() ==
id)
683 const string& view_ins_id)
const
688 if ((*iter)->GetType().IsStr() &&
689 (*iter)->GetType().GetStr() == view_type) {
692 settings = field->
GetData().GetStr();
703 const string& view_ins_id,
704 const string& settings)
710 if ((*iter)->GetType().IsStr() &&
711 (*iter)->GetType().GetStr() == view_type) {
719 obj->
SetType().SetStr(view_type);
720 m_Project->SetViewSettings().push_back(obj);
724 field.
SetData().SetStr(settings);
805 for (; item_iter; ++item_iter) {
807 counter =
max(counter, item.
GetId());
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.
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)
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
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
bool GetBool(const string &key, bool default_val=false) const
const CProjectFolder * FindChildFolderById(TId id) const
CProjectItem * FindProjectItemById(CProjectItem::TId id)
CAtomicCounter::TValue TId
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.
Guard class for CObjectIStream::StartDelayBuffer/EndDelayBuffer.
Template class for iteration on objects of class C (non-medifiable version)
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...
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.
IGBProject - abstract interface for a project used by CGBProjectHandle.
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
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
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
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
void Set(TValue new_value) THROWS_NONE
Set atomic counter value.
TValue Add(int delta) THROWS_NONE
Atomically add value (=delta), and return new counter value.
TValue Get(void) const THROWS_NONE
Get atomic counter value.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
static void RegisterLabelHandler(const string &type, ILabelHandler &handler)
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
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)
static void SetLabelByData(objects::CProjectItem &item, objects::CScope *scope=NULL)
void AddExistingLabel(const string &label)
adds an existing label
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
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.
static CObjectIStream * Create(ESerialDataFormat format)
Create serial object reader.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
TObjectType & GetObject(void)
Get object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
@ eCurrent
Use current time. See also CCurrentTime.
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.
Defines classes: CDirEntry, CFile, CDir, CSymLink, CMemoryFile, CFileUtil, CFileLock,...
std::istream & in(std::istream &in_, double &x_)
Reader-writer based streams.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)