// **********************************************************************
//
// Copyright (c) 2003-2010 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
// Ice version 3.4.1
// <auto-generated>
//
// Generated from file `Printer.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
#include <Printer.h>
#include <Ice/LocalException.h>
#include <Ice/ObjectFactory.h>
#include <Ice/BasicStream.h>
#include <IceUtil/Iterator.h>
#ifndef ICE_IGNORE_VERSION
# if ICE_INT_VERSION / 100 != 304
# error Ice version mismatch!
# endif
# if ICE_INT_VERSION % 100 > 50
# error Beta header file detected
# endif
# if ICE_INT_VERSION % 100 < 1
# error Ice patch level mismatch!
# endif
#endif
static const ::std::string __demo__Printer__printString_name = "printString";
::Ice::Object* IceInternal::upCast(::demo::Printer* p) { return p; }
::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy::demo::Printer* p) { return p; }
void
demo::__read(::IceInternal::BasicStream* __is, ::demo::PrinterPrx& v)
{
::Ice::ObjectPrx proxy;
__is->read(proxy);
if(!proxy)
{
v = 0;
}
else
{
v = new ::IceProxy::demo::Printer;
v->__copyFrom(proxy);
}
}
void
IceProxy::demo::Printer::printString(const ::std::string& s, const ::Ice::Context* __ctx)
{
int __cnt = 0;
while(true)
{
::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
try
{
__delBase = __getDelegate(false);
::IceDelegate::demo::Printer* __del = dynamic_cast< ::IceDelegate::demo::Printer*>(__delBase.get());
__del->printString(s, __ctx);
return;
}
catch(const ::IceInternal::LocalExceptionWrapper& __ex)
{
__handleExceptionWrapper(__delBase, __ex);
}
catch(const ::Ice::LocalException& __ex)
{
__handleException(__delBase, __ex, true, __cnt);
}
}
}
::Ice::AsyncResultPtr
IceProxy::demo::Printer::begin_printString(const ::std::string& s, const ::Ice::Context* __ctx, const ::IceInternal::CallbackBasePtr& __del, const ::Ice::LocalObjectPtr& __cookie)
{
::IceInternal::OutgoingAsyncPtr __result = new ::IceInternal::OutgoingAsync(this, __demo__Printer__printString_name, __del, __cookie);
try
{
__result->__prepare(__demo__Printer__printString_name, ::Ice::Normal, __ctx);
::IceInternal::BasicStream* __os = __result->__getOs();
__os->write(s);
__os->endWriteEncaps();
__result->__send(true);
}
catch(const ::Ice::LocalException& __ex)
{
__result->__exceptionAsync(__ex);
}
return __result;
}
void
IceProxy::demo::Printer::end_printString(const ::Ice::AsyncResultPtr& __result)
{
__end(__result, __demo__Printer__printString_name);
}
const ::std::string&
IceProxy::demo::Printer::ice_staticId()
{
return ::demo::Printer::ice_staticId();
}
::IceInternal::Handle< ::IceDelegateM::Ice::Object>
IceProxy::demo::Printer::__createDelegateM()
{
return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::demo::Printer);
}
::IceInternal::Handle< ::IceDelegateD::Ice::Object>
IceProxy::demo::Printer::__createDelegateD()
{
return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::demo::Printer);
}
::IceProxy::Ice::Object*
IceProxy::demo::Printer::__newInstance() const
{
return new Printer;
}
void
IceDelegateM::demo::Printer::printString(const ::std::string& s, const ::Ice::Context* __context)
{
::IceInternal::Outgoing __og(__handler.get(), __demo__Printer__printString_name, ::Ice::Normal, __context);
try
{
::IceInternal::BasicStream* __os = __og.os();
__os->write(s);
}
catch(const ::Ice::LocalException& __ex)
{
__og.abort(__ex);
}
bool __ok = __og.invoke();
if(!__og.is()->b.empty())
{
try
{
if(!__ok)
{
try
{
__og.throwUserException();
}
catch(const ::Ice::UserException& __ex)
{
::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name());
throw __uue;
}
}
__og.is()->skipEmptyEncaps();
}
catch(const ::Ice::LocalException& __ex)
{
throw ::IceInternal::LocalExceptionWrapper(__ex, false);
}
}
}
void
IceDelegateD::demo::Printer::printString(const ::std::string& s, const ::Ice::Context* __context)
{
class _DirectI : public ::IceInternal::Direct
{
public:
_DirectI(const ::std::string& s, const ::Ice::Current& __current) :
::IceInternal::Direct(__current),
_m_s(s)
{
}
virtual ::Ice::DispatchStatus
run(::Ice::Object* object)
{
::demo::Printer* servant = dynamic_cast< ::demo::Printer*>(object);
if(!servant)
{
throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation);
}
servant->printString(_m_s, _current);
return ::Ice::DispatchOK;
}
private:
const ::std::string& _m_s;
};
::Ice::Current __current;
__initCurrent(__current, __demo__Printer__printString_name, ::Ice::Normal, __context);
try
{
_DirectI __direct(s, __current);
try
{
__direct.servant()->__collocDispatch(__direct);
}
catch(...)
{
__direct.destroy();
throw;
}
__direct.destroy();
}
catch(const ::Ice::SystemException&)
{
throw;
}
catch(const ::IceInternal::LocalExceptionWrapper&)
{
throw;
}
catch(const ::std::exception& __ex)
{
::IceInternal::LocalExceptionWrapper::throwWrapper(__ex);
}
catch(...)
{
throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false);
}
}
::Ice::ObjectPtr
demo::Printer::ice_clone() const
{
throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);
return 0; // to avoid a warning with some compilers
}
static const ::std::string __demo__Printer_ids[2] =
{
"::Ice::Object",
"::demo::Printer"
};
bool
demo::Printer::ice_isA(const ::std::string& _s, const ::Ice::Current&) const
{
return ::std::binary_search(__demo__Printer_ids, __demo__Printer_ids + 2, _s);
}
::std::vector< ::std::string>
demo::Printer::ice_ids(const ::Ice::Current&) const
{
return ::std::vector< ::std::string>(&__demo__Printer_ids[0], &__demo__Printer_ids[2]);
}
const ::std::string&
demo::Printer::ice_id(const ::Ice::Current&) const
{
return __demo__Printer_ids[1];
}
const ::std::string&
demo::Printer::ice_staticId()
{
return __demo__Printer_ids[1];
}
::Ice::DispatchStatus
demo::Printer::___printString(::IceInternal::Incoming& __inS, const ::Ice::Current& __current)
{
__checkMode(::Ice::Normal, __current.mode);
::IceInternal::BasicStream* __is = __inS.is();
__is->startReadEncaps();
::std::string s;
__is->read(s);
__is->endReadEncaps();
printString(s, __current);
return ::Ice::DispatchOK;
}
static ::std::string __demo__Printer_all[] =
{
"ice_id",
"ice_ids",
"ice_isA",
"ice_ping",
"printString"
};
::Ice::DispatchStatus
demo::Printer::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
{
::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__demo__Printer_all, __demo__Printer_all + 5, current.operation);
if(r.first == r.second)
{