#pragma once
/***********************************************************
 Copyright (c) 2019-2020 Qualcomm Technologies, Inc.
 All Rights Reserved.
 Confidential and Proprietary - Qualcomm Technologies, Inc.
************************************************************/

/**
 * Interface to the SMCInvoke Example App functionality.
 */

/** @cond */

// AUTOGENERATED FILE: DO NOT EDIT

#include <cstdint>
#include "object.h"
#include "proxy_base.hpp"
#include "impl_base.hpp"
#include "ISMCIExampleApp.hpp"
#include "ICallbackObjectExample.hpp"

class ISMCIExampleAppImplBase : protected ImplBase, public IISMCIExampleApp {
   public:
    ISMCIExampleAppImplBase() {}
    virtual ~ISMCIExampleAppImplBase() {}

   protected:
    virtual int32_t invoke(ObjectOp op, ObjectArg* a, ObjectCounts k) {
        switch (ObjectOp_methodID(op)) {
            case OP_serviceExample: {
                if (k != ObjectCounts_pack(0, 0, 0, 0)) {
                    break;
                }
                return serviceExample();
            }
            case OP_computeHash: {
                if (k != ObjectCounts_pack(2, 1, 0, 0) ||
                    a[1].b.size != 4) {
                    break;
                }
                const void* input_ptr = (const void*)a[0].b.ptr;
                size_t input_len = a[0].b.size / 1;
                const uint32_t* algorithm_ptr = (const uint32_t*)a[1].b.ptr;
                void* hash_ptr = (void*)a[2].b.ptr;
                size_t hash_len = a[2].b.size / 1;
                int32_t r = computeHash(input_ptr, input_len, *algorithm_ptr, hash_ptr, hash_len, &hash_len);
                a[2].b.size = hash_len * 1;
                return r;
            }
            case OP_sharedMemoryExample: {
                if (k != ObjectCounts_pack(0, 0, 1, 0)) {
                    break;
                }
                ProxyBase p_memObj(a[0].o);
                int32_t r = sharedMemoryExample(p_memObj);
                p_memObj.extract();
                return r;
            }
            case OP_callbackObjectExample: {
                if (k != ObjectCounts_pack(0, 0, 1, 0)) {
                    break;
                }
                ICallbackObjectExample p_callbackObj(a[0].o);
                int32_t r = callbackObjectExample(p_callbackObj);
                p_callbackObj.extract();
                return r;
            }
            default: { return Object_ERROR_INVALID; }
        }
        return Object_ERROR_INVALID;
    }
};

