////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
// All Rights Reserved.
// Confidential and Proprietary - Qualcomm Technologies, Inc.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// THIS IS AUTO-GENERATED CODE.  PLEASE DO NOT EDIT (File bug reports against tools).
///
/// Auto-generated by: Parameter Parser V5.5.1 (2411131018)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @file  parametertypes.h
/// @brief Auto-generated Chromatix parameter file
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef PARAMETERTYPES_H
#define PARAMETERTYPES_H

#define MAX_UINT ((UINT32)0xFFFFFFFF)

#define PARAMETER_MALLOC(size)      malloc(size)
#define PARAMETER_REALLOC(ptr,size) realloc(ptr,size)
#define PARAMETER_FREE(ptr)         free(ptr)

#define PARAMETER_FSEEK(fp, offset, origin) fseek(fp, (INT32)(offset), origin)
#define PARAMETER_FTELL(fp, length) length = ftell(fp)
#define PARAMETER_FCLOSE(fp) (void)fclose(fp)

#ifdef _WIN32
// Fix for Visual Studio not allowing __FILE__ to be assigned to a constexpr value
#define __COMBINE__(a, b) a ## b
#define _COMBINE_(a, b)  __COMBINE__(a, b)
#define LINE_CONST long(_COMBINE_(__LINE__,U))
#define PARAMETER_FSTAT(filePtr, statPtr) fstat(_fileno(m_file), statPtr)
#else
// This works fine on GCC
#define LINE_CONST __LINE__
#define PARAMETER_FSTAT(filePtr, statPtr) fstat(fileno(m_file), statPtr)
#endif

#ifdef CAMX

#include <cstdio>
#include <cstring>
#include "camxtypes.h"
#include "camxmem.h"
#include "camxosutils.h"
#include "camxutils.h"

#define PARAMETER_NEW     CAMX_NEW
#define PARAMETER_DELETE  CAMX_DELETE
#define PARAMETER_FCREATE(fp, fileName) fp = fopen(fileName, "wb")
#define PARAMETER_FOPEN(fp, fileName) fp = fopen(fileName, "rb")
#define PARAMETER_FREAD(buffer, bufferSize, size, count, fp) fread(buffer, size, count, fp)
#define PARAMETER_FWRITE(buffer, size, count, fp) fwrite(buffer, size, count, fp)
#define PARAMETER_STRLEN  CamX::OsUtils::StrLen
#define PARAMETER_SPRINTF (void)CamX::OsUtils::SNPrintF
#define PARAMETER_VSPRINTF (void)CamX::OsUtils::VSNPrintF
#define PARAMETER_STRCMP  CamX::OsUtils::StrCmp
#define PARAMETER_STRCPY(dest, len, src)  (void)CamX::OsUtils::StrLCpy(dest, src, len)
#define PARAMETER_STRCAT(dest, len, src)  (void)CamX::OsUtils::StrLCat(dest, src, len)
#define PARAMETER_STRNICMP(str1, str2, nChars)  CamX::OsUtils::StrNICmp(str1, str2, nChars)
#define PARAMETER_MEMCPY(dest, len, src, count)  (void)CamX::Utils::Memcpy(dest, src, count)
#define PARAMETER_MEMMOVE(dest, len, src, count)  (void)memmove(dest, src, count)
#define PARAMETER_MEMCMP(dest, src, count)      CamX::Utils::Memcmp(dest, src, count)
#define PARAMETER_MEMSET(dest, value, count)  (void)CamX::Utils::Memset(dest, value, count)
#define PARAMETER_INITIALIZE(var)  (void)CamX::Utils::Memset(&var, 0, sizeof(var))
#define PARAMETER_INITIALIZE_PTR(ptr, count)  (void)CamX::Utils::Memset(ptr, 0, sizeof(*ptr) * count)
#define PARAMETER_INLINE CAMX_INLINE
#ifdef _WIN32
#define PARAMETER_PACK_BEGIN __pragma(pack(push,1))
#define PARAMETER_PACK_END   __pragma(pack(pop))
#define PARAMETER_LOCALTIME(now, t) localtime_s(now, t)
#else
#define PARAMETER_PACK_BEGIN _Pragma("pack(push,1)")
#define PARAMETER_PACK_END   _Pragma("pack(pop)")
#define PARAMETER_LOCALTIME(now, t) *now=*localtime(t)
#endif

#elif defined(_WIN32)

#define _WINSOCKAPI_
#include <Windows.h>
#include <cstring>
#include <cstdio>

#define PARAMETER_NEW     new
#define PARAMETER_DELETE  delete
#define PARAMETER_FCREATE(fp, fileName) fopen_s(&fp, fileName, "wb")
#define PARAMETER_FOPEN(fp, fileName) fopen_s(&fp, fileName, "rb")
#define PARAMETER_FREAD(buffer, bufferSize, size, count, fp) fread_s(buffer, bufferSize, size, count, fp)
#define PARAMETER_FWRITE(buffer, size, count, fp) fwrite(buffer, size, count, fp)
#define PARAMETER_STRLEN  strlen
#define PARAMETER_SPRINTF (void)sprintf_s
#define PARAMETER_VSPRINTF (void)vsprintf_s
#define PARAMETER_STRCMP  strcmp
#define PARAMETER_STRCPY(dest, len, src)  (void)strcpy_s(dest, len, src)
#define PARAMETER_STRCAT(dest, len, src)  (void)strcat_s(dest, len, src)
#define PARAMETER_STRNICMP(str1, str2, nChars)  _strnicmp(str1, str2, nChars)
#define PARAMETER_MEMCPY(dest, len, src, count)  (void)memcpy_s(dest, len, src, count)
#define PARAMETER_MEMMOVE(dest, len, src, count)  (void)memmove_s(dest, len, src, count)
#define PARAMETER_MEMCMP(dest, src, count)      memcmp(dest, src, count)
#define PARAMETER_MEMSET(dest, value, count)  (void)memset(dest, value, count)
#define PARAMETER_INITIALIZE(var)  (void)memset(&var, 0, sizeof(var))
#define PARAMETER_INITIALIZE_PTR(ptr, count)  (void)memset(ptr, 0, sizeof(*ptr) * count)
#define PARAMETER_INLINE inline
#define PARAMETER_PACK_BEGIN __pragma(pack(push,1))
#define PARAMETER_PACK_END   __pragma(pack(pop))
#define PARAMETER_LOCALTIME(now, t) localtime_s(now, t)


enum CamxResult
{
    CamxResultSuccess,
    CamxResultEFailed
};

#else // Linux without CamX

#include <cstdlib>
#include <cstddef>
#include <cstdio>
#include <cstdarg>
#include <cstring>
#include <climits>
#include <stdint.h>
#define PARAMETER_NEW     new
#define PARAMETER_DELETE  delete
#define PARAMETER_FCREATE(fp, fileName) fp = fopen(fileName, "wb")
#define PARAMETER_FOPEN(fp, fileName) fp = fopen(fileName, "rb")
#define PARAMETER_FREAD(buffer, bufferSize, size, count, fp) fread(buffer, size, count, fp)
#define PARAMETER_FWRITE(buffer, size, count, fp) fwrite(buffer, size, count, fp)
#define PARAMETER_STRLEN  strlen
#define PARAMETER_SPRINTF (void)snprintf
#define PARAMETER_VSPRINTF (void)vsnprintf
#define PARAMETER_STRCMP  strcmp
#define PARAMETER_STRCPY(dest, len, src)  (void)strcpy(dest, src)
#define PARAMETER_STRCAT(dest, len, src)  (void)strcat(dest, src)
#define PARAMETER_STRNICMP(str1, str2, nChars)  strncasecmp(str1, str2, nChars)
#define PARAMETER_MEMCPY(dest, len, src, count)  (void)memcpy(dest, src, count)
#define PARAMETER_MEMMOVE(dest, len, src, count)  (void)memmove(dest, src, count)
#define PARAMETER_MEMCMP(dest, src, count)      memcmp(dest, src, count)
#define PARAMETER_MEMSET(dest, value, count)  (void)memset(dest, value, count)
#define PARAMETER_INITIALIZE(var)  (void)memset(&var, 0, sizeof(var))
#define PARAMETER_INITIALIZE_PTR(ptr, count)  (void)memset(ptr, 0, sizeof(*ptr) * count)
#define PARAMETER_INLINE inline
#define PARAMETER_PACK_BEGIN _Pragma("pack(push,1)")
#define PARAMETER_PACK_END   _Pragma("pack(pop)")
#define PARAMETER_LOCALTIME(now, t) *now=*localtime(t)

typedef int                BOOL;
typedef char               CHAR;
typedef unsigned char      BYTE;
typedef unsigned char      UCHAR;
typedef short              SHORT;
typedef unsigned short     USHORT;
typedef int                INT;
typedef unsigned int       UINT;
typedef float              FLOAT;
typedef double             DOUBLE;

typedef unsigned char      UINT8;
typedef char               INT8;
typedef unsigned short     UINT16;
typedef short              INT16;
typedef unsigned int       UINT32;
typedef int                INT32;
typedef unsigned long long UINT64;
typedef long long          INT64;

typedef max_align_t        MAXALIGN_T;
typedef size_t             SIZE_T;

#endif

PARAMETER_PACK_BEGIN
union VersionUnion
{
    VersionUnion();

    VersionUnion(
        UINT64 const value);

    VersionUnion(
        UINT16 const major,
        UINT16 const minor,
        UINT32 const patch);

    UINT64 Value;

    struct VersionStruct
    {
        UINT16 Major;
        UINT16 Minor;
        UINT32 Patch;
    };
    VersionStruct Version;

    bool operator ==(const VersionUnion& rhs);
    bool operator !=(const VersionUnion& rhs);
    bool operator >(const VersionUnion& rhs);
    bool operator >=(const VersionUnion& rhs);
    bool operator <(const VersionUnion& rhs);
    bool operator <=(const VersionUnion& rhs);
    INT32 Compare(const VersionUnion& rhs) const;
};

#define MAX_MODE_PATH 128
#define MAX_BINARY_TAG 65

union ModeUnion
{
public:
    ModeUnion();

    ModeUnion(
        UINT64 const value);

    ModeUnion(
        UINT16 const mode,
        UINT16 const subMode);

    // The IsModeMatch function returns true if Mode and SubMode are the same, ignoring Group.
    // For comparison including group, just use lhs.Value == rhs.Value
    PARAMETER_INLINE bool IsModeMatch(const ModeUnion& rhs)
    {
        return Mode.Mode == rhs.Mode.Mode && Mode.SubMode == rhs.Mode.SubMode;
    }

    UINT64 Value;

    struct ModeStruct
    {
        UINT16 Mode;
        UINT16 SubMode;
    };
    ModeStruct Mode;
};
class ModeEntry;
class IModeTable
{
public:
    virtual ModeEntry* GetModeEntry(
        UINT32 const modeID) = 0;
    virtual ~IModeTable(){}
};

class ParameterSetManager;
class ParameterFileSymbolTable;
class ModuleData
{
public:
    static constexpr INT32 TYPE_LEN = 32;

    ModuleData(
        UINT32 const               id,
        UINT32 const               duplicateID,
        IModeTable* const          modeTable,
        const CHAR* const          type,
        UINT64                     versionValue,
        UINT32                     modeId,
        ParameterSetManager* const setManager);

    ~ModuleData();

    static CHAR* GetType(
        CHAR* const outputType,
        const CHAR* const moduleName);

    UINT32                    ID;
    UINT32                    DuplicateID;
    CHAR*                     Type;
    VersionUnion              Version;
    UINT32                    ModeId;
    ModeEntry*                Mode;
    CHAR*                     ModePath;
    ParameterSetManager*      SetManager;
    ParameterFileSymbolTable* SymbolTable;
};
PARAMETER_PACK_END
#endif
