# Copyright (C) 2007 Tomash Brechko.  All rights reserved.
#
# This file is part of free software; you can redistribute it and/or
# modify it under the same terms as Perl itself, either Perl version
# 5.8.8 or, at your option, any later version of Perl 5 you may have
# available.
#


TYPEMAP
Cache_Memcached_Fast *      T_CACHE_MEMCACHED_FAST
Ref_SV                      T_REF_SV


INPUT
T_CACHE_MEMCACHED_FAST
        if (sv_derived_from($arg, \"Cache::Memcached::Fast::_xs\"))
          {
            IV tmp = SvIV((SV *) SvRV($arg));
            $var = INT2PTR(Cache_Memcached_Fast *, tmp);
          }
        else
          croak(\"$var is not of type Cache::Memcached::Fast::_xs\");
T_REF_SV
        if (SvROK($arg))
          $var = (SV *) SvRV($arg);
        else
          croak(\"$var is not a reference\")


OUTPUT
T_CACHE_MEMCACHED_FAST
        sv_setref_pv($arg, class, (void*) $var);
T_REF_SV
        $arg = newRV((SV *) $var);
