⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 echocallback_impl_cb.cpp

📁 ESOAP是一款专注于嵌入式web service开发的工具 压缩包里提供了基本的例子
💻 CPP
字号:
/*
 Created by eSoap Code Generator for C++, Version - 1.08
 **** DO NOT EDIT THIS FILE.  *****
 Time: Tue Sep 11 10:13:49 2001
*/

#include <assert.h>
#include "soap_server.h"
#include "soap_envelope.h"
#include "EchoCallback_impl.h"


/* must be the last include */
#ifdef MEMWATCH
#include <memwatch.h>
#endif

namespace echo {

const char *EchoCallback_Impl::NS_URI = "http://tempuri.com/";

EchoCallback_Impl::EchoCallback_Impl()
 : __currentBlock( 0 )
{
}

EchoCallback_Impl::~EchoCallback_Impl()
{
}

void EchoCallback_Impl::activate()
{
  typedef MemberCallback< esoap::MethodDataBlock, EchoCallback_Impl > EchoCallback_CB;
  struct EchoCallback_MethodPair
  {
     const char *name;
     int (EchoCallback_Impl::*member )(esoap::MethodDataBlock *);
  };

    static EchoCallback_MethodPair listMethods[] =
  {
    { "callback", &EchoCallback_Impl::callback_impl },
   };

  
  for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
  {
     EchoCallback_CB *mc = new EchoCallback_CB( listMethods[i].member, this );
     esoap::Server::instance()->getRegistry().addMethod( listMethods[i].name, mc );
  }

}

void EchoCallback_Impl::deactivate()
{
  typedef MemberCallback< esoap::MethodDataBlock, EchoCallback_Impl > EchoCallback_CB;
  struct EchoCallback_MethodPair
  {
     const char *name;
     int (EchoCallback_Impl::*member )(esoap::MethodDataBlock *);
  };

    static EchoCallback_MethodPair listMethods[] =
  {
    { "callback", &EchoCallback_Impl::callback_impl },
   };



  for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
  {
     esoap::Server::instance()->getRegistry().removeMethod(listMethods[i].name );
  }
}

int EchoCallback_Impl::callback_impl( esoap::MethodDataBlock *mdata )
{
  __currentBlock   = mdata;
  esoap::Method *m = mdata->in()->getMethod();
  if( !m )
  {
    mdata->out()->setFault( esoap::Fault::Server,
                            "Missing method element" );
    return 0;
  }

  esoap::Parameter *l_count = mdata->in()->getRealParameter( m->getParameter( "count" ) );
  if( !l_count )
  {
    mdata->out()->setFault( esoap::Fault::Server,
                            "Missing Parameter = [count]" );
    return 0;
  }
  int i_count = l_count->getInteger();
  callback( i_count );
  esoap::Method *resp = mdata->out()->setMethod( "m:callbackResponse", NS_URI );
  return 0;
}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -