📄 asn2asn.cpp
字号:
/* * =========================================================================== * PRODUCTION $Log: asn2asn.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 18:27:12 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.46 * PRODUCTION * =========================================================================== *//* $Id: asn2asn.cpp,v 1000.1 2004/06/01 18:27:12 gouriano Exp $* ===========================================================================** PUBLIC DOMAIN NOTICE* National Center for Biotechnology Information** This software/database is a "United States Government Work" under the* terms of the United States Copyright Act. It was written as part of* the author's official duties as a United States Government employee and* thus cannot be copyrighted. This software/database is freely available* to the public for use. The National Library of Medicine and the U.S.* Government have not placed any restriction on its use or reproduction.** Although all reasonable efforts have been taken to ensure the accuracy* and reliability of the software and data, the NLM and the U.S.* Government do not and cannot warrant the performance or results that* may be obtained by using this software or data. The NLM and the U.S.* Government disclaim all warranties, express or implied, including* warranties of performance, merchantability or fitness for any particular* purpose.** Please cite the author in any work or product based on this material.** ===========================================================================** Author: Eugene Vasilchenko** File Description:* asn2asn test program** ---------------------------------------------------------------------------* $Log: asn2asn.cpp,v $* Revision 1000.1 2004/06/01 18:27:12 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.46** Revision 1.46 2004/05/21 21:41:38 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.45 2003/03/11 15:30:29 kuznets* iterate -> ITERATE** Revision 1.44 2002/09/19 20:05:44 vasilche* Safe initialization of static mutexes** Revision 1.43 2002/09/17 22:27:09 grichenk* Type<> -> CType<>** Revision 1.42 2002/09/05 21:23:22 vasilche* Added mutex for arguments** Revision 1.41 2002/08/30 16:22:47 vasilche* Added MT mode to asn2asn** Revision 1.40 2001/08/31 20:05:44 ucko* Fix ICC build.** Revision 1.39 2001/05/17 15:05:45 lavr* Typos corrected** Revision 1.38 2001/02/01 19:53:17 vasilche* Reading program arguments from file moved to CNcbiApplication::AppMain.** Revision 1.37 2001/01/30 21:42:29 vasilche* Added passing arguments via file.** Revision 1.36 2001/01/23 00:12:02 vakatov* Added comments and usage directions** Revision 1.35 2000/12/24 00:14:16 vakatov* Minor fix due to the changed NCBIARGS API** Revision 1.34 2000/12/12 14:28:31 vasilche* Changed the way arguments are processed.** Revision 1.33 2000/11/17 22:04:33 vakatov* CArgDescriptions:: Switch the order of optional args in methods* AddOptionalKey() and AddPlain(). Also, enforce the default value to* match arg. description (and constraints, if any) at all times.** Revision 1.32 2000/11/14 21:40:08 vasilche* New NCBIArgs API.** Revision 1.31 2000/11/01 20:38:28 vasilche* Removed ECanDelete enum and related constructors.** Revision 1.30 2000/10/27 14:42:59 ostell* removed extra CreateArguments call so that usage shows properly** Revision 1.29 2000/10/20 19:29:52 vasilche* Adapted for MSVC which doesn't like explicit operator templates.** Revision 1.28 2000/10/20 15:51:52 vasilche* Fixed data error processing.* Added interface for constructing container objects directly into output stream.* object.hpp, object.inl and object.cpp were split to* objectinfo.*, objecttype.*, objectiter.* and objectio.*.** Revision 1.27 2000/10/18 13:07:17 ostell* added proper program name to usage** Revision 1.26 2000/10/17 18:46:25 vasilche* Added print usage to asn2asn* Remove unnecessary warning about missing config file.** Revision 1.25 2000/10/13 16:29:40 vasilche* Fixed processing of optional -o argument.** Revision 1.24 2000/10/03 17:23:50 vasilche* Added code for CSeq_entry as choice pointer.** Revision 1.23 2000/09/29 14:38:54 vasilche* Updated for changes in library.** Revision 1.22 2000/09/26 19:29:17 vasilche* Removed experimental choice pointer stuff.** Revision 1.21 2000/09/26 17:39:02 vasilche* Updated hooks implementation.** Revision 1.20 2000/09/18 20:47:27 vasilche* Updated to new headers.** Revision 1.19 2000/09/01 13:16:41 vasilche* Implemented class/container/choice iterators.* Implemented CObjectStreamCopier for copying data without loading into memory.** Revision 1.18 2000/08/15 19:46:57 vasilche* Added Read/Write hooks.** Revision 1.17 2000/06/16 16:32:06 vasilche* Fixed 'unused variable' warnings.** Revision 1.16 2000/06/01 19:07:08 vasilche* Added parsing of XML data.** Revision 1.15 2000/05/24 20:09:54 vasilche* Implemented XML dump.** Revision 1.14 2000/04/28 16:59:39 vasilche* Fixed call to CObjectIStream::Open().** Revision 1.13 2000/04/13 14:50:59 vasilche* Added CObjectIStream::Open() and CObjectOStream::Open() for easier use.** Revision 1.12 2000/04/07 19:27:34 vasilche* Generated objects now are placed in NCBI_NS_NCBI::objects namespace.** Revision 1.11 2000/04/06 16:12:14 vasilche* Added -c option.** Revision 1.10 2000/03/17 16:47:48 vasilche* Added copyright message to generated files.* All objects pointers in choices now share the only CObject pointer.** Revision 1.9 2000/03/07 14:10:52 vasilche* Fixed for reference counting.** Revision 1.8 2000/02/17 20:07:18 vasilche* Generated class names now have 'C' prefix.** Revision 1.7 2000/02/04 18:09:57 vasilche* Added binary option to files.** Revision 1.6 2000/02/04 17:57:45 vasilche* Fixed for new generated classes interface.** Revision 1.5 2000/01/20 21:51:28 vakatov* Fixed to follow changes of the "CNcbiApplication" interface** Revision 1.4 2000/01/10 19:47:20 vasilche* Member type typedef now generated in _Base class.** Revision 1.3 2000/01/10 14:17:47 vasilche* Fixed usage of different types in ?: statement.** Revision 1.2 2000/01/06 21:28:04 vasilche* Fixed for variable scope.** Revision 1.1 2000/01/05 19:46:58 vasilche* Added asn2asn test application.** ===========================================================================*/#include <ncbi_pch.hpp>#include <corelib/ncbistd.hpp>#include <corelib/ncbienv.hpp>#include <corelib/ncbithr.hpp>#include <objects/seqset/Seq_entry.hpp>#include <objects/seqset/Bioseq_set.hpp>#include <memory>BEGIN_NCBI_SCOPE// CSEQ_ENTRY_REF_CHOICE macro to switch implementation of CSeq_entry choice// as choice class or virtual base class.// 0 -> generated choice class// 1 -> virtual base class#define CSEQ_ENTRY_REF_CHOICE 0#if CSEQ_ENTRY_REF_CHOICEtemplate<typename T> const CTypeInfo* (*GetTypeRef(const T* object))(void);template<typename T> pair<void*, const CTypeInfo*> ObjectInfo(T& object);template<typename T> pair<const void*, const CTypeInfo*> ConstObjectInfo(const T& object);EMPTY_TEMPLATEinlineconst CTypeInfo* (*GetTypeRef< CRef<NCBI_NS_NCBI::objects::CSeq_entry> >(const CRef<NCBI_NS_NCBI::objects::CSeq_entry>* object))(void){ return &NCBI_NS_NCBI::objects::CSeq_entry::GetRefChoiceTypeInfo;}EMPTY_TEMPLATEinlinepair<void*, const CTypeInfo*> ObjectInfo< CRef<NCBI_NS_NCBI::objects::CSeq_entry> >(CRef<NCBI_NS_NCBI::objects::CSeq_entry>& object){ return make_pair((void*)&object, GetTypeRef(&object)());}EMPTY_TEMPLATEinlinepair<const void*, const CTypeInfo*> ConstObjectInfo< CRef<NCBI_NS_NCBI::objects::CSeq_entry> >(const CRef<NCBI_NS_NCBI::objects::CSeq_entry>& object){ return make_pair((const void*)&object, GetTypeRef(&object)());}#endifEND_NCBI_SCOPE#include "asn2asn.hpp"#include <corelib/ncbiutil.hpp>#include <corelib/ncbiargs.hpp>#include <objects/seq/Bioseq.hpp>#include <serial/object.hpp>#include <serial/objistr.hpp>#include <serial/objostr.hpp>#include <serial/objcopy.hpp>#include <serial/serial.hpp>#include <serial/objhook.hpp>#include <serial/iterator.hpp>USING_NCBI_SCOPE;using namespace NCBI_NS_NCBI::objects;#if CSEQ_ENTRY_REF_CHOICEtypedef CRef<CSeq_entry> TSeqEntry;#elsetypedef CSeq_entry TSeqEntry;#endifint main(int argc, char** argv){ return CAsn2Asn().AppMain(argc, argv, 0, eDS_Default, 0, "asn2asn");}staticvoid SeqEntryProcess(CSeq_entry& entry); /* dummy function */#if CSEQ_ENTRY_REF_CHOICEstaticvoid SeqEntryProcess(CRef<CSeq_entry>& entry){ SeqEntryProcess(*entry);}#endifclass CCounter{public: CCounter(void) : m_Counter(0) { } ~CCounter(void) { _ASSERT(m_Counter == 0); } operator int(void) const { return m_Counter; }private: friend class CInc; int m_Counter;};class CInc{public: CInc(CCounter& counter) : m_Counter(counter) { ++counter.m_Counter; } ~CInc(void) { --m_Counter.m_Counter; }private: CCounter& m_Counter;};class CReadSeqSetHook : public CReadClassMemberHook{public: void ReadClassMember(CObjectIStream& in, const CObjectInfo::CMemberIterator& member); CCounter m_Level;};class CWriteSeqSetHook : public CWriteClassMemberHook{public: void WriteClassMember(CObjectOStream& out, const CConstObjectInfo::CMemberIterator& member); CCounter m_Level;};class CWriteSeqEntryHook : public CWriteObjectHook{public: void WriteObject(CObjectOStream& out, const CConstObjectInfo& object); CCounter m_Level;};/******************************************************************************* Main program loop to read, process, write SeqEntrys******************************************************************************/void CAsn2Asn::Init(void){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -