77 #include <wx/filename.h>
133 : m_AsnTextData(asnTextData)
144 return "Loading NCBI ASN.1 Files";
169 const wxString& fn = *it;
190 wxFileName::SplitPath(fn,
nullptr,
nullptr,
nullptr, &ext);
191 if (ext.IsSameAs(
wxT(
"asn"),
false)) {
192 LOG_POST(
Info <<
"Format Guess failed, format assumed to be BinaryASN, based on file extension");
211 string err_msg = e.
what();
212 vector<string> phrases;
216 catch (
const exception& e) {
235 string err_msg = e.
what();
236 vector<string> phrases;
240 catch (
const exception& e) {
257 unique_ptr<CObjectIStream>
266 info.FindVariant(
"str")
270 info.FindMember(
"key")
274 info.FindMember(
"db")
278 info.FindMember(
"qual")
281 sinput->UseMemoryPool();
286 sniffer.
AddCandidate(ncbi::objects::CSeq_table::GetTypeInfo());
291 sniffer.
Probe(*sinput);
303 if (
dynamic_cast<CSeq_align*
>(iter->GetPointer())) {
304 align_objs.push_back(*iter);
306 else if (
dynamic_cast<CSeq_feat*
>(iter->GetPointer())) {
307 feat_objs.push_back(*iter);
310 other_objs.push_back(*iter);
322 const size_t max_obj_prj = 10;
323 if (align_objs.size() > max_obj_prj) {
331 aligns.push_back(align);
336 else if (!align_objs.empty()) {
337 std::copy(align_objs.begin(), align_objs.end(), back_inserter(other_objs));
340 if (feat_objs.size() > max_obj_prj) {
348 feats.push_back(feat);
353 else if (!feat_objs.empty()) {
354 std::copy(feat_objs.begin(), feat_objs.end(), back_inserter(other_objs));
358 string annot_name = annot_title.empty() ?
"Undefined" : annot_title;
366 if (it->IsName() && it->GetName().empty())
367 it->SetName(annot_name);
401 object.SetFileName(filePath);
431 : m_ObjLevel(0), m_Loader(loader), m_ObjectLoaded(
false)
472 types.insert(cand->type_info.GetTypeInfo()->GetName());
476 vector<string> modules;
479 modules.push_back(
"NCBI-Sequence");
482 modules.push_back(
"NCBI-Seqloc");
485 modules.push_back(
"NCBI-Seqalign");
488 modules.push_back(
"NCBI-Seqfeat");
491 modules.push_back(
"NCBI-Seqset");
494 modules.push_back(
"NCBI-Submit");
497 modules.push_back(
"NCBI-BioTree");
500 modules.push_back(
"NCBI-Entrezgene");
503 modules.push_back(
"NCBI-GUI-Project");
506 modules.push_back(
"NCBI-PubMed");
509 ITERATE (vector<string>, module, modules) {
521 vector<IAsnLoadExtension*> extensions;
524 ITERATE(vector<IAsnLoadExtension*>, it, extensions)
525 (*it)->RegisterAsnTypes(*
this);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void NCBI_BioTree_RegisterModuleClasses(void)
void NCBI_Entrezgene_RegisterModuleClasses(void)
void NCBI_GUI_Project_RegisterModuleClasses(void)
void NCBI_PubMed_RegisterModuleClasses(void)
void NCBI_Seqalign_RegisterModuleClasses(void)
void NCBI_Seqfeat_RegisterModuleClasses(void)
void NCBI_Seqloc_RegisterModuleClasses(void)
void NCBI_Seqset_RegisterModuleClasses(void)
void NCBI_Sequence_RegisterModuleClasses(void)
void NCBI_Submit_RegisterModuleClasses(void)
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
#define EXT_POINT__ASN_LOAD_EXTENSION
static const wxChar * kMemoryObject
Serialized objects sniffer.
const TCandidates & GetCandidates() const
Return reference on the internal vector of object candidates.
vector< SCandidateInfo > TCandidates
void SetReportDataErrors(bool report=true)
Report syntax errors to client (as an exception)
void AddCandidate(CObjectTypeInfo ti, EEventCallBackMode emode=eCallAlways)
Add new possible type to the recognition list.
void Probe(CObjectIStream &input)
The main worker function.
void x_ShowErrorsDlg(const wxString &title)
void x_UpdateHTMLResults(const wxString &object, objects::ILineErrorListener *errCont, const string &exception="", const string &error_msg="", const wxString &objectName=wxT("File:"))
void SetNameDesc(const string &name)
void SetTitleDesc(const string &title)
namespace ncbi::objects::
Base class for all serializable objects.
Class CSniffReader reads NCBI object files in number of different formats.
virtual void OnTopObjectFoundPre(const CObjectInfo &object, CNcbiStreampos stream_pos)
virtual void OnObjectFoundPost(const CObjectInfo &object)
Event handling virtual function, called when candidate is found and deserialized.
bool ObjectLoaded() const
virtual void OnTopObjectFoundPre(const CObjectInfo &object, CNcbiStreampos stream_pos)
CAsnObjectLoader & m_Loader
virtual void Register(CObjectTypeInfo ti)
IAsnLoadRegister implementation.
virtual void OnObjectFoundPre(const CObjectInfo &object, CNcbiStreampos stream_pos)
Event handling virtual function, called when candidate is found but before deserialization.
virtual void OnTopObjectFoundPost(const CObjectInfo &object)
virtual void OnTopObjectFoundPost(const CObjectInfo &object)
virtual void OnObjectFoundPost(const CObjectInfo &object)
Event handling virtual function, called when candidate is found and deserialized.
virtual void Reset()
Event indicates that sniffer objects needs to reset it's status and get ready for the next probing.
virtual void Reset()
Event indicates that sniffer objects needs to reset it's status and get ready for the next probing.
virtual void OnObjectFoundPre(const CObjectInfo &object, CNcbiStreampos stream_pos)
Event handling virtual function, called when candidate is found but before deserialization.
CSniffReader(list< CRef< CSerialObject > > &Results)
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
Template class for iteration on objects of class C.
IAsnLoadRegister - interface to register ASN types that could be loaded by ASN loader.
Interface for testing cancellation request in a long lasting operation.
vector< SObject > TObjects
static const struct type types[]
#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.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
virtual bool Execute(ICanceled &canceled)
wxString m_CurrentFileName
bool x_OnTopObjectFound(const CObjectInfo &objInfo)
virtual bool PostExecute()
virtual bool PreExecute()
const string m_AsnTextData
vector< wxString > m_FileNames
TOrigObjects m_OrigObjects
Original object list for current file.
CRef< objects::CScope > m_Scope
virtual TObjects & GetObjects()
void LoadFromStream(CNcbiIstream &istr, TObjects &objects, ESerialDataFormat fmt, ICanceled *canceled=0)
vector< CRef< CObject > > TOrigObjects
virtual string GetDescription() const
TObjects m_Objects
Final complete object list with description set.
static void GetLabel(const CObject &obj, string *label, ELabelType type=eDefault)
void GetExtensionAsInterface(const string &ext_point_id, vector< CIRef< I > > &interfaces)
GetExtensionAsInterface() is a helper function that extracts all extensions implementing the specifie...
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
TObjectPtr GetObjectPtr(void) const
Get pointer to object.
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
ETypeFamily GetTypeFamily(void) const
Get data type family.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
virtual bool IsCanceled(void) const =0
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::streampos CNcbiStreampos
Portable alias for streampos.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static void GetRegisteredClassNames(const string &module, TRegClasses &names)
static TTypeInfo GetClassInfoByName(const string &name)
static const char label[]
void SetLabel(const TLabel &value)
Assign a value to Label data member.
bool IsSetLabel(void) const
bio-tree label (short name) Check if a value has been assigned to Label data member.
const TLabel & GetLabel(void) const
Get the Label member data.
TSet & SetSet(void)
Select the variant.
TSeq & SetSeq(void)
Select the variant.
void SetData(TData &value)
Assign a value to Data data member.
list< CRef< CSeq_align > > TAlign
list< CRef< CSeq_feat > > TFtable
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static const char * type_name(CS_INT value)
string ToStdString(const wxString &s)