PluginMessage.cpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:6k
- /*
- * ===========================================================================
- * PRODUCTION $Log: PluginMessage.cpp,v $
- * PRODUCTION Revision 1000.3 2004/06/01 20:53:46 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9
- * PRODUCTION
- * ===========================================================================
- */
- /* $Id: PluginMessage.cpp,v 1000.3 2004/06/01 20:53:46 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 data definition file
- * 'plugin.asn'.
- */
- // standard includes
- #include <ncbi_pch.hpp>
- #include <corelib/ncbistd.hpp>
- #include <corelib/ncbiatomic.hpp>
- #include <serial/enumvalues.hpp>
- #include <gui/plugin/AlgoCommand.hpp>
- #include <gui/plugin/DataCommand.hpp>
- #include <gui/plugin/ViewCommand.hpp>
- #include <gui/plugin/PluginCommand.hpp>
- #include <gui/plugin/PluginRequest.hpp>
- #include <gui/plugin/PluginReply.hpp>
- // generated includes
- #include <gui/plugin/PluginMessage.hpp>
- // generated classes
- BEGIN_NCBI_SCOPE
- BEGIN_objects_SCOPE // namespace ncbi::objects::
- // static members
- static CAtomicCounter s_PluginMsgCounter;
- // constructor
- CPluginMessage::CPluginMessage(void)
- : m_Id(s_PluginMsgCounter.Add(1))
- , m_Reporter(NULL)
- {
- }
- // destructor
- CPluginMessage::~CPluginMessage(void)
- {
- }
- void CPluginMessage::SetReporter(IReporter* reporter)
- {
- m_Reporter = reporter;
- }
- IReporter* CPluginMessage::SetReporter()
- {
- return m_Reporter;
- }
- const IReporter* CPluginMessage::GetReporter() const
- {
- return m_Reporter;
- }
- string CPluginMessage::ToString(void) const
- {
- static const string NA("N/A");
- string result;
- result = "ID: " + NStr::UIntToString(GetId()) + " ";
- result += "SOURCE: " + (IsSetSource() ? GetSource() : NA) + ", ";
- result += "DEST: " + (IsSetDestination() ? GetDestination() : NA);
- //
- // process the request portion
- //
- {{
- const TRequest& request = GetRequest();
- int cmd;
- const CEnumeratedTypeValues* ev = 0;
- switch ( request.Which() ) {
- case CPluginRequest::e_View:
- cmd = request.GetView().IsSetCommand() ?
- request.GetView().GetCommand() : eViewCommand_no_command;
- ev = GetTypeInfo_enum_EViewCommand();
- result += " COMMAND: eViewCommand_" + ev->FindName(cmd, true);
- break;
- case CPluginRequest::e_Algo:
- cmd = request.GetAlgo().IsSetCommand() ?
- request.GetAlgo().GetCommand() : eAlgoCommand_no_command;
- ev = GetTypeInfo_enum_EAlgoCommand();
- result += " COMMAND: eAlgoCommand_" + ev->FindName(cmd, true);
- break;
- case CPluginRequest::e_Data:
- cmd = request.GetData().IsSetCommand() ?
- request.GetData().GetCommand() : eDataCommand_no_command;
- ev = GetTypeInfo_enum_EDataCommand();
- result += " COMMAND: eDataCommand_" + ev->FindName(cmd, true);
- break;
- default:
- break;
- }
- }}
- //
- // process the reply portion
- //
- {{
- const CPluginReply& reply = GetReply();
- /** FIXME: replace with in-reply-to
- // reply-to
- if ( reply.IsSetRequest() ) {
- const CPluginReply::TRequest& request =
- reply.GetRequest();
-
- result += "REPLY TO: " +
- NStr::UIntToString(request.GetId()) + ", ";
- }
- **/
- // status
- EMessageStatus status = reply.IsSetStatus() ?
- reply.GetStatus() : eMessageStatus_failed;
- result += " STATUS: " +
- GetTypeInfo_enum_EMessageStatus()
- ->FindName(status, true);
- }}
- return result;
- }
- END_objects_SCOPE // namespace ncbi::objects::
- END_NCBI_SCOPE
- /*
- * ===========================================================================
- *
- * $Log: PluginMessage.cpp,v $
- * Revision 1000.3 2004/06/01 20:53:46 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.9
- *
- * Revision 1.9 2004/05/21 22:27:46 gorelenk
- * Added PCH ncbi_pch.hpp
- *
- * Revision 1.8 2004/03/31 15:25:12 dicuccio
- * Added IReporter interface
- *
- * Revision 1.7 2003/11/04 17:24:00 dicuccio
- * Changed ToString() to match new API.
- *
- * Revision 1.6 2003/10/27 17:41:12 dicuccio
- * Formatting changes
- *
- * Revision 1.5 2003/08/05 17:05:08 dicuccio
- * Removed statid mutex in favor of CAtomicCounter
- *
- * Revision 1.4 2003/07/23 19:14:08 dicuccio
- * Moved logic for validating plugin arguments into CPluginUtils.
- *
- * Revision 1.3 2003/07/15 13:54:51 shomrat
- * Reformating PluginMessage string representation
- *
- * Revision 1.2 2003/07/15 01:58:14 ucko
- * Make the guard for sm_NextId a static class member, since Darwin's
- * shared-library linker doesn't like inline functions with static locals.
- *
- * Revision 1.1 2003/07/14 11:08:22 shomrat
- * Initial Revision
- *
- *
- * ===========================================================================
- */
- /* Original file checksum: lines: 64, chars: 1889, CRC32: b0cc0767 */