serialobj_doc.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: serialobj_doc.cpp,v $
- * PRODUCTION Revision 1000.4 2004/06/01 20:44:42 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: serialobj_doc.cpp,v 1000.4 2004/06/01 20:44:42 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: Mike DiCuccio
- *
- * File Description:
- * CSerialObjDocument -- document specific for sequence annotment data
- */
- #include <ncbi_pch.hpp>
- #include "serialobj_doc.hpp"
- #include <serial/serial.hpp>
- #include <serial/objostrasn.hpp>
- #include <gui/core/plugin_utils.hpp>
- BEGIN_NCBI_SCOPE
- USING_SCOPE(objects);
- CSerialObjDocument::CSerialObjDocument(CScope& scope,
- const CSerialObject& obj)
- {
- _TRACE("CSerialObjDocument(" << obj.GetThisTypeInfo()->GetName() << ")");
- m_Scope.Reset(&scope);
- m_Object.Reset(const_cast<CSerialObject*> (&obj));
- m_Title = x_GetTitle();
- m_ShortTitle = x_GetShortTitle();
- }
- CSerialObjDocument::~CSerialObjDocument()
- {
- }
- //
- // retrieve a full title describing our object
- //
- string CSerialObjDocument::x_GetTitle(void) const
- {
- if ( !m_Object ) {
- return string("empty document");
- }
- return CPluginUtils::GetLabel(*m_Object, m_Scope);
- }
- string CSerialObjDocument::x_GetShortTitle(void) const
- {
- if ( !m_Object ) {
- return string("empty document");
- }
- return m_Object->GetThisTypeInfo()->GetName();
- }
- // serialization: write our contents to a stream
- void CSerialObjDocument::Write(CObjectOStream& os) const
- {
- if ( !m_Scope || !m_Object ) {
- return;
- }
- os.Write(m_Object.GetPointer(), m_Object->GetThisTypeInfo());
- }
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- * $Log: serialobj_doc.cpp,v $
- * Revision 1000.4 2004/06/01 20:44:42 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.5
- *
- * Revision 1.5 2004/05/21 22:27:40 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.4 2004/01/07 15:49:32 dicuccio
- * Adjusted for API change in CPluginUtils::GetLabel()
- *
- * Revision 1.3 2003/11/06 20:06:29 dicuccio
- * Moved USING_SCOPE(objects) to implementation files
- *
- * Revision 1.2 2003/11/04 12:44:09 friedman
- * Explicit destructor added
- *
- * Revision 1.1 2003/09/16 14:00:31 dicuccio
- * Initial revision
- *
- * Revision 1.7 2003/07/25 14:57:53 kuznets
- * Added m_Object->CanGetDesc() protection (x_GetShortTitle)
- *
- * Revision 1.6 2003/06/25 17:02:54 dicuccio
- * Split CPluginHandle into a handle (pointer-to-implementation) and
- * implementation file. Lots of #include file clean-ups.
- *
- * Revision 1.5 2003/06/17 15:35:42 kuznets
- * Added checking if annotation has the valid description
- * CSerialObjDocument::x_GetTitle(void)
- *
- * Revision 1.4 2003/06/02 16:06:18 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.3 2003/05/19 13:35:59 dicuccio
- * Moved gui/core/plugin/ -> gui/plugin/. Merged gui/core/algo, gui/core/doc/,
- * and gui/core/view/ into one library (gui/core/)
- *
- * Revision 1.2 2003/04/29 14:46:09 dicuccio
- * Removed last vestiges of old typing system
- *
- * Revision 1.1 2003/04/24 16:25:00 dicuccio
- * Initial revision
- *
- * ===========================================================================
- */