Sha256: 7c99fff866873c7f909bd7a116b2b233998ed8d2a15f5e19ff98cd39768c7774

Contents?: true

Size: 1.62 KB

Versions: 20

Compression:

Stored size: 1.62 KB

Contents

/*
 *     Copyright 2016 Couchbase, Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 */

#ifndef LCB_MCTX_HELPER_H
#define LCB_MCTX_HELPER_H
#include <libcouchbase/couchbase.h>

namespace lcb {

class MultiCmdContext : public lcb_MULTICMD_CTX {
protected:
    virtual lcb_error_t MCTX_addcmd(const lcb_CMDBASE* cmd) = 0;
    virtual lcb_error_t MCTX_done(const void *cookie) = 0;
    virtual void MCTX_fail() = 0;

    MultiCmdContext() {
        lcb_MULTICMD_CTX::addcmd = dispatch_mctx_addcmd;
        lcb_MULTICMD_CTX::done = dispatch_mctx_done;
        lcb_MULTICMD_CTX::fail = dispatch_mctx_fail;
    }

    virtual ~MultiCmdContext() {}

private:
    static lcb_error_t dispatch_mctx_addcmd(lcb_MULTICMD_CTX* ctx, const lcb_CMDBASE * cmd) {
        return static_cast<MultiCmdContext*>(ctx)->MCTX_addcmd(cmd);
    }
    static lcb_error_t dispatch_mctx_done(lcb_MULTICMD_CTX* ctx, const void *cookie) {
        return static_cast<MultiCmdContext*>(ctx)->MCTX_done(cookie);
    }
    static void dispatch_mctx_fail(lcb_MULTICMD_CTX* ctx) {
        static_cast<MultiCmdContext*>(ctx)->MCTX_fail();
    }
};

}

#endif

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
libcouchbase-1.2.8 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.7 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.6 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.5 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.4 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.3 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.2 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.1 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.2.0 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.1.1 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.1.0 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.0.4 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.0.3 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.0.2 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.0.1 ext/libcouchbase/src/mctx-helper.h
libcouchbase-1.0.0 ext/libcouchbase/src/mctx-helper.h
libcouchbase-0.2.0 ext/libcouchbase/src/mctx-helper.h
libcouchbase-0.1.0 ext/libcouchbase/src/mctx-helper.h
libcouchbase-0.0.9 ext/libcouchbase/src/mctx-helper.h
libcouchbase-0.0.8 ext/libcouchbase/src/mctx-helper.h