Program Listing for File functioncall.h

Return to documentation for file (include\serialization\functioncall.h)

/******************************************************************************
© Intel Corporation.

This software and the related documents are Intel copyrighted materials,
and your use of them is governed by the express license under which they
were provided to you ("License"). Unless the License provides otherwise,
you may not use, modify, copy, publish, distribute, disclose or transmit
this software or the related documents without Intel's prior written
permission.


 This software and the related documents are provided as is, with no express
or implied warranties, other than those that are expressly stated in the
License.

******************************************************************************/

#pragma once

#include <cstdint>

#include "ifunctioncall.h"
#include "serialization/apicallcontext.h"

namespace gpa {
namespace serialization {

class ArgsWriter;

using GPATimestamp = uint64_t;
using GPADataSizeType = uint64_t;

class IUserData;

struct FunctionCall : public IFunctionCall
{
    StreamPacketHeader mContext{};
    ArgsReader* mArgsReader{};
    ArgsWriter* mArgsWriter{};
    IUserData* mUserData{};
    IUserData* mAllocatedUserData{};
    size_t mDependencyCount{};
    uint64_t* mDependencies{};

    // Allow custom code to attach arbitrary data to the args (outside of the
    // IUserData structure above). This pointer is not managed, any code that
    // sets it to a heap-allocated object must also free that object.
    void* opaque{};

    FunctionCall(StreamPacketHeader const& context, ArgsReader* argsReader);

    FunctionCall(StreamPacketHeader const& context, ArgsWriter* argsWriter,
                 IUserData* userData = nullptr);

    ~FunctionCall();

    size_t DependencyCount();
    uint64_t* Dependencies();

    // IFunctionCall implementation
    StreamPacketHeader const& GetContext() const override;
    void Read(ArgsReader* reader = nullptr) override;
    char const* GetClass() const override;
    char const* GetAPI() const override;
    Argument const* GetParam(uint32_t index, void const** outValue, bool postExecute = false) const override;
    void* GetApiObjectPtr() const override;
    void PreWrite() override;
    void PostWrite() override;
    bool IsSuccessful() override;

    virtual void InitDependencies();
    virtual void InitDependencyCount();

private:
    FunctionCall(FunctionCall const&) = delete;
    FunctionCall& operator=(FunctionCall const&) = delete;
};

}  // namespace serialization
}  // namespace gpa