?? addtwo_impl_cb.cpp
字號:
/*
Created by eSoap Code Generator for C++, >>> DEMO <<< Version - 1.08
**** DO NOT EDIT THIS FILE. *****
Time: Mon Sep 17 19:55:10 2001
**** CODE CREATED USING AN UNREGISTERED VERSION OF ESOAPCG.
Please, after the initial testing, you *MUST* buy a
copy of this application to continue using it.
* Limits of this version:
+ 5 functions per interface
+ 5 User defined types( Complex Types )
*/
#include <assert.h>
#include "soap_server.h"
#include "soap_envelope.h"
#include "AddTwo_impl.h"
/* must be the last include */
#ifdef MEMWATCH
#include <memwatch.h>
#endif
namespace sample {
const char *AddTwo_Impl::NS_URI = "http://tempuri.com/";
AddTwo_Impl::AddTwo_Impl()
: __currentBlock( 0 )
{
}
AddTwo_Impl::~AddTwo_Impl()
{
}
void AddTwo_Impl::activate()
{
typedef MemberCallback< esoap::MethodDataBlock, AddTwo_Impl > AddTwo_CB;
struct AddTwo_MethodPair
{
const char *name;
int (AddTwo_Impl::*member )(esoap::MethodDataBlock *);
};
static AddTwo_MethodPair listMethods[] =
{
{ "add", &AddTwo_Impl::add_impl },
};
for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
{
AddTwo_CB *mc = new AddTwo_CB( listMethods[i].member, this );
esoap::Server::instance()->getRegistry().addMethod( listMethods[i].name, mc );
}
}
void AddTwo_Impl::deactivate()
{
typedef MemberCallback< esoap::MethodDataBlock, AddTwo_Impl > AddTwo_CB;
struct AddTwo_MethodPair
{
const char *name;
int (AddTwo_Impl::*member )(esoap::MethodDataBlock *);
};
static AddTwo_MethodPair listMethods[] =
{
{ "add", &AddTwo_Impl::add_impl },
};
for( int i = 0; i < sizeof( listMethods ) / sizeof( listMethods[ 0 ] ); i++ )
{
esoap::Server::instance()->getRegistry().removeMethod(listMethods[i].name );
}
}
int AddTwo_Impl::add_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_a = mdata->in()->getRealParameter( m->getParameter( "a" ) );
if( !l_a )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [a]" );
return 0;
}
int i_a = l_a->getInteger();
esoap::Parameter *l_b = mdata->in()->getRealParameter( m->getParameter( "b" ) );
if( !l_b )
{
mdata->out()->setFault( esoap::Fault::Server,
"Missing Parameter = [b]" );
return 0;
}
int i_b = l_b->getInteger();
int o_sum;
o_sum = add( i_a, i_b );
esoap::Method *resp = mdata->out()->setMethod( "m:addResponse", NS_URI );
resp->addInteger( "sum", o_sum );
return 0;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -