Object_id.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:4k
- /*
- * ===========================================================================
- * PRODUCTION $Log: Object_id.cpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 19:32:27 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R6.9
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: Object_id.cpp,v 1000.1 2004/06/01 19:32:27 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: .......
- *
- * File Description:
- * .......
- *
- * Remark:
- * This code was originally generated by application DATATOOL
- * using specifications from the ASN data definition file
- * 'general.asn'.
- *
- * ---------------------------------------------------------------------------
- * $Log: Object_id.cpp,v $
- * Revision 1000.1 2004/06/01 19:32:27 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R6.9
- *
- * Revision 6.9 2004/05/19 17:21:39 gorelenk
- * Added include of PCH - ncbi_pch.hpp
- *
- * Revision 6.8 2003/02/07 16:03:07 vasilche
- * Fixed CObject_id::Match().
- *
- * Revision 6.7 2003/02/06 22:25:25 vasilche
- * Added some Compare() methods.
- *
- * Revision 6.6 2001/08/31 16:05:54 clausen
- * Removed upper casing.
- *
- * Revision 6.5 2000/12/26 17:28:51 vasilche
- * Simplified and formatted code.
- *
- * Revision 6.4 2000/12/15 19:22:10 ostell
- * made AsString do Upcase, and switched to using PNocase().Equals()
- *
- * Revision 6.3 2000/12/08 21:49:29 ostell
- * changed MakeString to AsString and to use ostream instead of string
- *
- * Revision 6.2 2000/12/08 19:53:15 ostell
- * added MakeString()
- *
- * Revision 6.1 2000/11/21 18:58:21 vasilche
- * Added Match() methods for CSeq_id, CObject_id and CDbtag.
- *
- *
- * ===========================================================================
- */
- // standard includes
- // generated includes
- #include <ncbi_pch.hpp>
- #include <objects/general/Object_id.hpp>
- #include <corelib/ncbistd.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- // destructor
- CObject_id::~CObject_id(void)
- {
- return;
- }
- // match for identity
- bool CObject_id::Match(const CObject_id& oid2) const
- {
- E_Choice type = Which();
- if ( type != oid2.Which() )
- return false;
- switch ( type ) {
- case e_Id:
- return GetId() == oid2.GetId();
- case e_Str:
- return PNocase().Equals(GetStr(), oid2.GetStr());
- default:
- return this == &oid2;
- }
- }
- // match for identity
- int CObject_id::Compare(const CObject_id& oid2) const
- {
- E_Choice type = Which();
- E_Choice type2 = Which();
- if ( type != type2 )
- return type - type2;
- switch ( type ) {
- case e_Id:
- return GetId() - oid2.GetId();
- case e_Str:
- return PNocase().Compare(GetStr(), oid2.GetStr());
- default:
- return 0;
- }
- }
- // format contents into a stream
- ostream& CObject_id::AsString(ostream &s) const
- {
- switch ( Which() ) {
- case e_Id:
- s << GetId();
- break;
- case e_Str:
- s << GetStr(); // no Upcase() on output as per Ostell 7/2001 - Karl
- break;
- default:
- break;
- }
- return s;
- }
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE