//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
//
// Ice version 3.7.10
//
// <auto-generated>
//
// Generated from file `UserAccountMapper.ice'
//
// Warning: do not edit this file.
//
// </auto-generated>
//

#ifndef ICEGRID_API_EXPORTS
#   define ICEGRID_API_EXPORTS
#endif
#include <IceGrid/UserAccountMapper.h>
#include <IceUtil/PushDisableWarnings.h>
#include <Ice/LocalException.h>
#include <Ice/ValueFactory.h>
#include <Ice/OutgoingAsync.h>
#include <Ice/InputStream.h>
#include <Ice/OutputStream.h>
#include <Ice/LocalException.h>
#include <IceUtil/PopDisableWarnings.h>

#if defined(_MSC_VER)
#   pragma warning(disable:4458) // declaration of ... hides class member
#elif defined(__clang__)
#   pragma clang diagnostic ignored "-Wshadow"
#elif defined(__GNUC__)
#   pragma GCC diagnostic ignored "-Wshadow"
#endif

#ifndef ICE_IGNORE_VERSION
#   if ICE_INT_VERSION / 100 != 307
#       error Ice version mismatch!
#   endif
#   if ICE_INT_VERSION % 100 >= 50
#       error Beta header file detected
#   endif
#   if ICE_INT_VERSION % 100 < 10
#       error Ice patch level mismatch!
#   endif
#endif

#ifdef ICE_CPP11_MAPPING // C++11 mapping

namespace
{

const ::IceInternal::DefaultUserExceptionFactoryInit<::IceGrid::UserAccountNotFoundException> iceC_IceGrid_UserAccountNotFoundException_init("::IceGrid::UserAccountNotFoundException");

const ::std::string iceC_IceGrid_UserAccountMapper_ids[2] =
{
    "::Ice::Object",
    "::IceGrid::UserAccountMapper"
};
const ::std::string iceC_IceGrid_UserAccountMapper_ops[] =
{
    "getUserAccount",
    "ice_id",
    "ice_ids",
    "ice_isA",
    "ice_ping"
};
const ::std::string iceC_IceGrid_UserAccountMapper_getUserAccount_name = "getUserAccount";

}

IceGrid::UserAccountNotFoundException::~UserAccountNotFoundException()
{
}

const ::std::string&
IceGrid::UserAccountNotFoundException::ice_staticId()
{
    static const ::std::string typeId = "::IceGrid::UserAccountNotFoundException";
    return typeId;
}

bool
IceGrid::UserAccountMapper::ice_isA(::std::string s, const ::Ice::Current&) const
{
    return ::std::binary_search(iceC_IceGrid_UserAccountMapper_ids, iceC_IceGrid_UserAccountMapper_ids + 2, s);
}

::std::vector<::std::string>
IceGrid::UserAccountMapper::ice_ids(const ::Ice::Current&) const
{
    return ::std::vector<::std::string>(&iceC_IceGrid_UserAccountMapper_ids[0], &iceC_IceGrid_UserAccountMapper_ids[2]);
}

::std::string
IceGrid::UserAccountMapper::ice_id(const ::Ice::Current&) const
{
    return ice_staticId();
}

const ::std::string&
IceGrid::UserAccountMapper::ice_staticId()
{
    static const ::std::string typeId = "::IceGrid::UserAccountMapper";
    return typeId;
}

/// \cond INTERNAL
bool
IceGrid::UserAccountMapper::_iceD_getUserAccount(::IceInternal::Incoming& inS, const ::Ice::Current& current)
{
    _iceCheckMode(::Ice::OperationMode::Normal, current.mode);
    auto istr = inS.startReadParams();
    ::std::string iceP_user;
    istr->readAll(iceP_user);
    inS.endReadParams();
    ::std::string ret = this->getUserAccount(::std::move(iceP_user), current);
    auto ostr = inS.startWriteParams();
    ostr->writeAll(ret);
    inS.endWriteParams();
    return true;
}
/// \endcond

/// \cond INTERNAL
bool
IceGrid::UserAccountMapper::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
{
    ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_IceGrid_UserAccountMapper_ops, iceC_IceGrid_UserAccountMapper_ops + 5, current.operation);
    if(r.first == r.second)
    {
        throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
    }

    switch(r.first - iceC_IceGrid_UserAccountMapper_ops)
    {
        case 0:
        {
            return _iceD_getUserAccount(in, current);
        }
        case 1:
        {
            return _iceD_ice_id(in, current);
        }
        case 2:
        {
            return _iceD_ice_ids(in, current);
        }
        case 3:
        {
            return _iceD_ice_isA(in, current);
        }
        case 4:
        {
            return _iceD_ice_ping(in, current);
        }
        default:
        {
            assert(false);
            throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
        }
    }
}
/// \endcond

/// \cond INTERNAL
void
IceGrid::UserAccountMapperPrx::_iceI_getUserAccount(const ::std::shared_ptr<::IceInternal::OutgoingAsyncT<::std::string>>& outAsync, const ::std::string& iceP_user, const ::Ice::Context& context)
{
    _checkTwowayOnly(iceC_IceGrid_UserAccountMapper_getUserAccount_name);
    outAsync->invoke(iceC_IceGrid_UserAccountMapper_getUserAccount_name, ::Ice::OperationMode::Normal, ::Ice::FormatType::DefaultFormat, context,
        [&](::Ice::OutputStream* ostr)
        {
            ostr->writeAll(iceP_user);
        },
        [](const ::Ice::UserException& ex)
        {
            try
            {
                ex.ice_throw();
            }
            catch(const UserAccountNotFoundException&)
            {
                throw;
            }
            catch(const ::Ice::UserException&)
            {
            }
        });
}
/// \endcond

/// \cond INTERNAL
::std::shared_ptr<::Ice::ObjectPrx>
IceGrid::UserAccountMapperPrx::_newInstance() const
{
    return ::IceInternal::createProxy<UserAccountMapperPrx>();
}
/// \endcond

const ::std::string&
IceGrid::UserAccountMapperPrx::ice_staticId()
{
    return UserAccountMapper::ice_staticId();
}

#else // C++98 mapping

namespace
{

const ::std::string iceC_IceGrid_UserAccountMapper_getUserAccount_name = "getUserAccount";

}

namespace
{

const ::IceInternal::DefaultUserExceptionFactoryInit< ::IceGrid::UserAccountNotFoundException> iceC_IceGrid_UserAccountNotFoundException_init("::IceGrid::UserAccountNotFoundException");

}

#ifdef ICE_CPP11_COMPILER
IceGrid::UserAccountNotFoundException::~UserAccountNotFoundException()
{
}
#else
IceGrid::UserAccountNotFoundException::~UserAccountNotFoundException() throw()
{
}
#endif

::std::string
IceGrid::UserAccountNotFoundException::ice_id() const
{
    return "::IceGrid::UserAccountNotFoundException";
}

IceGrid::UserAccountNotFoundException*
IceGrid::UserAccountNotFoundException::ice_clone() const
{
    return new UserAccountNotFoundException(*this);
}

void
IceGrid::UserAccountNotFoundException::ice_throw() const
{
    throw *this;
}

/// \cond STREAM
void
IceGrid::UserAccountNotFoundException::_writeImpl(::Ice::OutputStream* ostr) const
{
    ostr->startSlice("::IceGrid::UserAccountNotFoundException", -1, true);
    ::Ice::StreamWriter< UserAccountNotFoundException, ::Ice::OutputStream>::write(ostr, *this);
    ostr->endSlice();
}

void
IceGrid::UserAccountNotFoundException::_readImpl(::Ice::InputStream* istr)
{
    istr->startSlice();
    ::Ice::StreamReader< UserAccountNotFoundException, ::Ice::InputStream>::read(istr, *this);
    istr->endSlice();
}
/// \endcond

/// \cond INTERNAL
ICEGRID_API ::IceProxy::Ice::Object* ::IceProxy::IceGrid::upCast(UserAccountMapper* p) { return p; }

void
::IceProxy::IceGrid::_readProxy(::Ice::InputStream* istr, ::IceInternal::ProxyHandle< UserAccountMapper>& v)
{
    ::Ice::ObjectPrx proxy;
    istr->read(proxy);
    if(!proxy)
    {
        v = 0;
    }
    else
    {
        v = new UserAccountMapper;
        v->_copyFrom(proxy);
    }
}
/// \endcond

::Ice::AsyncResultPtr
IceProxy::IceGrid::UserAccountMapper::_iceI_begin_getUserAccount(const ::std::string& iceP_user, const ::Ice::Context& context, const ::IceInternal::CallbackBasePtr& del, const ::Ice::LocalObjectPtr& cookie, bool sync)
{
    _checkTwowayOnly(iceC_IceGrid_UserAccountMapper_getUserAccount_name, sync);
    ::IceInternal::OutgoingAsyncPtr result = new ::IceInternal::CallbackOutgoing(this, iceC_IceGrid_UserAccountMapper_getUserAccount_name, del, cookie, sync);
    try
    {
        result->prepare(iceC_IceGrid_UserAccountMapper_getUserAccount_name, ::Ice::Normal, context);
        ::Ice::OutputStream* ostr = result->startWriteParams(::Ice::DefaultFormat);
        ostr->write(iceP_user);
        result->endWriteParams();
        result->invoke(iceC_IceGrid_UserAccountMapper_getUserAccount_name);
    }
    catch(const ::Ice::Exception& ex)
    {
        result->abort(ex);
    }
    return result;
}

::std::string
IceProxy::IceGrid::UserAccountMapper::end_getUserAccount(const ::Ice::AsyncResultPtr& result)
{
    ::Ice::AsyncResult::_check(result, this, iceC_IceGrid_UserAccountMapper_getUserAccount_name);
    ::std::string ret;
    if(!result->_waitForResponse())
    {
        try
        {
            result->_throwUserException();
        }
        catch(const ::IceGrid::UserAccountNotFoundException&)
        {
            throw;
        }
        catch(const ::Ice::UserException& ex)
        {
            throw ::Ice::UnknownUserException(__FILE__, __LINE__, ex.ice_id());
        }
    }
    ::Ice::InputStream* istr = result->_startReadParams();
    istr->read(ret);
    result->_endReadParams();
    return ret;
}

/// \cond INTERNAL
::IceProxy::Ice::Object*
IceProxy::IceGrid::UserAccountMapper::_newInstance() const
{
    return new UserAccountMapper;
}
/// \endcond

const ::std::string&
IceProxy::IceGrid::UserAccountMapper::ice_staticId()
{
    return ::IceGrid::UserAccountMapper::ice_staticId();
}

IceGrid::UserAccountMapper::~UserAccountMapper()
{
}

/// \cond INTERNAL
ICEGRID_API ::Ice::Object* IceGrid::upCast(UserAccountMapper* p) { return p; }

/// \endcond

namespace
{
const ::std::string iceC_IceGrid_UserAccountMapper_ids[2] =
{
    "::Ice::Object",
    "::IceGrid::UserAccountMapper"
};

}

bool
IceGrid::UserAccountMapper::ice_isA(const ::std::string& s, const ::Ice::Current&) const
{
    return ::std::binary_search(iceC_IceGrid_UserAccountMapper_ids, iceC_IceGrid_UserAccountMapper_ids + 2, s);
}

::std::vector< ::std::string>
IceGrid::UserAccountMapper::ice_ids(const ::Ice::Current&) const
{
    return ::std::vector< ::std::string>(&iceC_IceGrid_UserAccountMapper_ids[0], &iceC_IceGrid_UserAccountMapper_ids[2]);
}

const ::std::string&
IceGrid::UserAccountMapper::ice_id(const ::Ice::Current&) const
{
    return ice_staticId();
}

const ::std::string&
IceGrid::UserAccountMapper::ice_staticId()
{
#ifdef ICE_HAS_THREAD_SAFE_LOCAL_STATIC
    static const ::std::string typeId = "::IceGrid::UserAccountMapper";
    return typeId;
#else
    return iceC_IceGrid_UserAccountMapper_ids[1];
#endif
}

/// \cond INTERNAL
bool
IceGrid::UserAccountMapper::_iceD_getUserAccount(::IceInternal::Incoming& inS, const ::Ice::Current& current)
{
    _iceCheckMode(::Ice::Normal, current.mode);
    ::Ice::InputStream* istr = inS.startReadParams();
    ::std::string iceP_user;
    istr->read(iceP_user);
    inS.endReadParams();
    ::std::string ret = this->getUserAccount(iceP_user, current);
    ::Ice::OutputStream* ostr = inS.startWriteParams();
    ostr->write(ret);
    inS.endWriteParams();
    return true;
}
/// \endcond

namespace
{
const ::std::string iceC_IceGrid_UserAccountMapper_all[] =
{
    "getUserAccount",
    "ice_id",
    "ice_ids",
    "ice_isA",
    "ice_ping"
};

}

/// \cond INTERNAL
bool
IceGrid::UserAccountMapper::_iceDispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
{
    ::std::pair<const ::std::string*, const ::std::string*> r = ::std::equal_range(iceC_IceGrid_UserAccountMapper_all, iceC_IceGrid_UserAccountMapper_all + 5, current.operation);
    if(r.first == r.second)
    {
        throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
    }

    switch(r.first - iceC_IceGrid_UserAccountMapper_all)
    {
        case 0:
        {
            return _iceD_getUserAccount(in, current);
        }
        case 1:
        {
            return _iceD_ice_id(in, current);
        }
        case 2:
        {
            return _iceD_ice_ids(in, current);
        }
        case 3:
        {
            return _iceD_ice_isA(in, current);
        }
        case 4:
        {
            return _iceD_ice_ping(in, current);
        }
        default:
        {
            assert(false);
            throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
        }
    }
}
/// \endcond

/// \cond STREAM
void
IceGrid::UserAccountMapper::_iceWriteImpl(::Ice::OutputStream* ostr) const
{
    ostr->startSlice(ice_staticId(), -1, true);
    ::Ice::StreamWriter< UserAccountMapper, ::Ice::OutputStream>::write(ostr, *this);
    ostr->endSlice();
}

void
IceGrid::UserAccountMapper::_iceReadImpl(::Ice::InputStream* istr)
{
    istr->startSlice();
    ::Ice::StreamReader< UserAccountMapper, ::Ice::InputStream>::read(istr, *this);
    istr->endSlice();
}
/// \endcond

/// \cond INTERNAL
void
IceGrid::_icePatchObjectPtr(UserAccountMapperPtr& handle, const ::Ice::ObjectPtr& v)
{
    handle = UserAccountMapperPtr::dynamicCast(v);
    if(v && !handle)
    {
        IceInternal::Ex::throwUOE(UserAccountMapper::ice_staticId(), v);
    }
}
/// \endcond

namespace Ice
{
}

#endif
