test_objmgr_data.cpp
来自「ncbi源码」· C++ 代码 · 共 506 行 · 第 1/2 页
CPP
506 行
/* * =========================================================================== * PRODUCTION $Log: test_objmgr_data.cpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 19:47:10 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5 * PRODUCTION * =========================================================================== *//* $Id: test_objmgr_data.cpp,v 1000.2 2004/06/01 19:47:10 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.** ===========================================================================** Authors: Andrei Gourianov** File Description:* Object Manager test: multiple threads working with annotations** ---------------------------------------------------------------------------* $Log: test_objmgr_data.cpp,v $* Revision 1000.2 2004/06/01 19:47:10 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5** Revision 1.5 2004/05/21 21:42:55 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.4 2004/04/19 14:53:31 grichenk* Added prefetching test (-prefetch argument)** Revision 1.3 2004/04/16 13:31:47 grichenk* Added data pre-fetching functions.** Revision 1.2 2004/04/05 17:00:55 grichenk* Fixed iterator flags** Revision 1.1 2003/12/16 17:51:17 kuznets* Code reorganization** Revision 1.12 2003/11/26 17:56:03 vasilche* Implemented ID2 split in ID1 cache.* Fixed loading of splitted annotations.** Revision 1.11 2003/11/03 21:21:20 vasilche* Limit amount of exceptions to catch while testing.** Revision 1.10 2003/10/22 17:58:10 vasilche* Do not catch CLoaderException::eNoConnection.** Revision 1.9 2003/09/30 16:22:05 vasilche* Updated internal object manager classes to be able to load ID2 data.* SNP blobs are loaded as ID2 split blobs - readers convert them automatically.* Scope caches results of requests for data to data loaders.* Optimized CSeq_id_Handle for gis.* Optimized bioseq lookup in scope.* Reduced object allocations in annotation iterators.* CScope is allowed to be destroyed before other objects using this scope are* deleted (feature iterators, bioseq handles etc).* Optimized lookup for matching Seq-ids in CSeq_id_Mapper.* Added 'adaptive' option to objmgr_demo application.** Revision 1.8 2003/06/02 16:06:39 dicuccio* Rearranged src/objects/ subtree. This includes the following shifts:* - src/objects/asn2asn --> arc/app/asn2asn* - src/objects/testmedline --> src/objects/ncbimime/test* - src/objects/objmgr --> src/objmgr* - src/objects/util --> src/objmgr/util* - src/objects/alnmgr --> src/objtools/alnmgr* - src/objects/flat --> src/objtools/flat* - src/objects/validator --> src/objtools/validator* - src/objects/cddalignview --> src/objtools/cddalignview* In addition, libseq now includes six of the objects/seq... libs, and libmmdb* replaces the three libmmdb? libs.** Revision 1.7 2003/05/20 15:44:39 vasilche* Fixed interaction of CDataSource and CDataLoader in multithreaded app.* Fixed some warnings on WorkShop.* Added workaround for memory leak on WorkShop.** Revision 1.6 2003/05/06 16:52:55 vasilche* Added 'pause' argument.** Revision 1.5 2003/04/24 16:12:39 vasilche* Object manager internal structures are splitted more straightforward.* Removed excessive header dependencies.** Revision 1.4 2003/04/15 14:23:11 vasilche* Added missing includes.** Revision 1.3 2003/03/18 21:48:33 grichenk* Removed obsolete class CAnnot_CI** Revision 1.2 2003/01/29 17:34:18 vasilche* Added test code for negative strand CSeqVector.** Revision 1.1 2002/12/26 16:39:24 vasilche* Object manager class CSeqMap rewritten.** Revision 1.4 2002/12/06 15:36:03 grichenk* Added overlap type for annot-iterators** Revision 1.3 2002/07/22 22:49:05 kimelman* test fixes for confidential data retrieval** Revision 1.2 2002/05/06 03:28:53 vakatov* OM/OM1 renaming** Revision 1.1 2002/04/30 19:04:05 gouriano* multi-threaded data retrieval test*** ===========================================================================*/#include <ncbi_pch.hpp>#include <corelib/ncbiapp.hpp>#include <corelib/ncbi_system.hpp>#include <connect/ncbi_util.h>#include <objects/seqloc/Seq_id.hpp>#include <objects/seqloc/Seq_loc.hpp>#include <objmgr/object_manager.hpp>#include <objmgr/objmgr_exception.hpp>#include <objmgr/scope.hpp>#include <objmgr/seq_vector.hpp>#include <objmgr/seqdesc_ci.hpp>#include <objmgr/feat_ci.hpp>#include <objmgr/align_ci.hpp>#include <objmgr/prefetch.hpp>#include <objtools/data_loaders/genbank/gbloader.hpp>#include <connect/ncbi_core_cxx.hpp>#include <connect/ncbi_util.h>#include <test/test_assert.h> /* This header must go last */BEGIN_NCBI_SCOPEusing namespace objects;static CFastMutex s_GlobalLock;// GIs to process#if 0 const int g_gi_from = 156894; const int g_gi_to = 156896;#elif 0 const int g_gi_from = 156201; const int g_gi_to = 156203;#else const int g_gi_from = 156000; const int g_gi_to = 157000;#endif///////////////////////////////////////////////////////////////////////////////// Test application//class CTestOM : public CNcbiApplication{protected: virtual int Run(void); virtual void Init(void); virtual void Exit(void); virtual bool Thread_Run(int idx); virtual bool TestApp_Args( CArgDescriptions& args); virtual bool TestApp_Init(void); virtual bool TestApp_Exit(void); CRef<CScope> m_Scope; CRef<CObjectManager> m_ObjMgr; map<int, int> m_mapGiToDesc; map<int, int> m_mapGiToFeat0; map<int, int> m_mapGiToFeat1; int m_gi_from; int m_gi_to; int m_pause; bool m_prefetch;};/////////////////////////////////////////////////////////////////////////////int CTestOM::Run(void){ if ( !Thread_Run(0) ) return 1; else return 0;}void CTestOM::Init(void){ // Prepare command line descriptions auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions); // Let test application add its own arguments TestApp_Args(*arg_desc); string prog_description = "test"; arg_desc->SetUsageContext(GetArguments().GetProgramBasename(), prog_description, false); SetupArgDescriptions(arg_desc.release()); if ( !TestApp_Init() ) THROW1_TRACE(runtime_error, "Cannot init test application");}void CTestOM::Exit(void){ if ( !TestApp_Exit() ) THROW1_TRACE(runtime_error, "Cannot exit test application");}bool CTestOM::Thread_Run(int idx){// initialize scope CScope scope(*m_ObjMgr); scope.AddDefaults(); int from, to; // make them go in opposite directions if (idx % 2 == 0) { from = m_gi_from; to = m_gi_to; } else { from = m_gi_to;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?