m_EventMode(event_mode)
77 classCCallStackGuard {
83m_Stack.push_back(&
object);
85~CCallStackGuard(
void)
113 in.SetDiscardCurrObject(discard);
127: m_TopLevelObjectCount(0),
129m_DiscardCurrObj(
false),
130m_DiscardObjInfo(
false),
131m_ReportErrors(
false)
165vector<CRef<COffsetReadHook> > hooks;
172it->type_info.SetLocalReadHook(
input, &(*h));
196it->type_info.ResetLocalReadHook(
input);
235format_name =
"ASN.1 text";
238format_name =
"XML";
242TCandidates::const_iterator last_cand =
m_Candidates.end();
245 stringheader =
input.ReadFileHeader();
248header == last_cand->type_info.GetName() ) {
253<< format_name <<
" top level object found:" 254<< last_cand->type_info.GetName());
261 if( header == it->type_info.GetName() ) {
265 _TRACE_X(2, format_name <<
" top level object found:" 266<< it->type_info.GetName());
280 catch( bad_alloc&
) {
288<< format_name <<
" "<< e.what());
296TCandidates::const_iterator last_cand =
m_Candidates.end();
304 _TRACE(
"Same type ASN.1 binary top level object found:" 305<< last_cand->type_info.GetName());
313 if( it == last_cand ) {
320 _TRACE_X( 2,
"ASN.1 binary top level object found:" 321<< it->type_info.GetName());
339 stringformat_name(
"Unknown format");
340 switch(
input.GetDataFormat())
350known_types.
insert( c.type_info.GetTypeInfo());
355 for( ; !
input.EndOfData(); ) {
359 input.ReadFileHeader();
363 for(
const TTypeInfo& type_info : candidates) {
364tname = type_info->GetName();
368 _TRACE_X(2, format_name <<
" top level object found: " 369<< type_info->GetName());
383 catch( bad_alloc&
) {
391<< format_name <<
" "<< e.what());
Serialized objects sniffer.
virtual void OnObjectFoundPre(const CObjectInfo &object, CNcbiStreampos stream_pos)
Event handling virtual function, called when candidate is found but before deserialization.
CNcbiStreampos m_StreamPos
Stream offset of the top level object.
bool x_ReadObject(CObjectIStream &input, CObjectTypeInfo object_info)
friend class COffsetReadHook
vector< SCandidateInfo > TCandidates
virtual void OnObjectFoundPost(const CObjectInfo &object)
Event handling virtual function, called when candidate is found and deserialized.
bool m_ReportErrors
Report data errors.
bool x_TryReadObject(CObjectIStream &input, CObjectTypeInfo object_info)
void AddCandidate(CObjectTypeInfo ti, EEventCallBackMode emode=eCallAlways)
Add new possible type to the recognition list.
list< const CObjectInfo * > TObjectStack
bool GetDiscardObjectInfo() const
void Probe(CObjectIStream &input)
The main worker function.
void ProbeAny(CObjectIStream &input)
virtual ~CObjectsSniffer()
Uint8 m_TopLevelObjectCount
Count of objects found.
void SetDiscardCurrObject(bool discard=true)
Set the discard flag.
virtual void Reset()
Event indicates that sniffer objects needs to reset it's status and get ready for the next probing.
TTopLevelMapVector m_TopLevelMap
Vector of level object descriptions.
TCandidates m_Candidates
Possible candidates for type probing.
bool GetDiscardCurrObject() const
void ProbeText(CObjectIStream &input)
void ProbeASN1_Bin(CObjectIStream &input)
virtual void ReadObject(CObjectIStream &in, const CObjectInfo &object)
This method will be called at approriate time when the object of requested type is to be read.
CObjectsSniffer * m_Sniffer
COffsetReadHook(CObjectsSniffer *sniffer, CObjectsSniffer::EEventCallBackMode event_mode)
CObjectsSniffer::EEventCallBackMode m_EventMode
Read hook for a standalone object.
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
iterator_bool insert(const value_type &val)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define _TRACE_X(err_subcode, message)
CNcbiIstream & ReadObject(CNcbiIstream &str, TObjectPtr ptr, TTypeInfo info)
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
void DefaultRead(CObjectIStream &in, const CObjectInfo &object)
Default read.
void DefaultSkip(CObjectIStream &in, const CObjectTypeInfo &object)
Default skip.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define BEGIN_SCOPE(ns)
Define a new scope.
IO_PREFIX::streampos CNcbiStreampos
Portable alias for streampos.
Definition of all error codes used in objmgr libraries (xobjmgr.lib, xobjutil.lib and others).
std::istream & in(std::istream &in_, double &x_)
NCBI_DEFINE_ERR_SUBCODE_X(5)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4