////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 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 V7.4.1 (8cca6579792b9fcef3bc725ff070c5ec453c7c85)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

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

#ifndef PARAMETERTYPES_H
#define PARAMETERTYPES_H

#define PARAMETER_USE_MUTEX
// #define PARAMETER_USE_UNIQUE
#ifndef PARAMETER_USE_UNIQUE // The Update function requires a shared mutex
// #define PARAMETER_UPDATE_FUNTION
#endif

#define MAX_UINT ((UINT32)0xFFFFFFFF)

#ifdef PARSER_UNIT_TEST
void* malloc(size_t size, const char* filename, int line);
void* realloc(void* inPtr, size_t size, const char* filename, int line);
void free(void* ptr, const char* filename, int line);
#define PARAMETER_MALLOC(size)      malloc(size, __FILE__, __LINE__)
#define PARAMETER_REALLOC(ptr,size) realloc(ptr,size, __FILE__, __LINE__)
#define PARAMETER_FREE(ptr)         free(ptr, __FILE__, __LINE__)
void* operator new[](size_t size, const char* filename, int line);
void* operator new (size_t size, const char* filename, int line);
void operator delete (void* ptr, const char* filename, int line);
void operator delete[](void* ptr, const char* filename, int line);
#define PARAMETER_NEW     new(__FILE__, __LINE__)
#else
#define PARAMETER_MALLOC(size)      malloc(size)
#define PARAMETER_REALLOC(ptr,size) realloc(ptr,size)
#define PARAMETER_FREE(ptr)         free(ptr)
#define PARAMETER_NEW               new
#endif
#define PARAMETER_DELETE            delete

#define PARAMETER_FSEEK(fp, offset, origin) fseek(fp, (INT32)(offset), origin)
#define PARAMETER_FTELL(fp, length) length = (UINT32)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_FOPEN(fp, fileName) fopen_s(&fp, fileName, "rb")
#define PARAMETER_FSTAT(filePtr, statPtr) fstat(_fileno(m_file), statPtr)
#else
// This works fine on GCC
#define LINE_CONST __LINE__
#define PARAMETER_FOPEN(fp, fileName) fp = fopen(fileName, "rb")
#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_FCREATE(fp, fileName) fp = fopen(fileName, "wb")
#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)
#define PARAMETER_EXPORT
#else
#define PARAMETER_PACK_BEGIN _Pragma("pack(push,1)")
#define PARAMETER_PACK_END   _Pragma("pack(pop)")
#define PARAMETER_LOCALTIME(now, t) *now=*localtime(t)
#define PARAMETER_EXPORT CAMX_VISIBILITY_PUBLIC
#endif

#elif defined(_WIN32)

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

#define PARAMETER_FCREATE(fp, fileName) fopen_s(&fp, fileName, "wb")
#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)
#define PARAMETER_EXPORT

#else // Linux without CamX

#include <cstdlib>
#include <cstddef>
#include <cstdio>
#include <cstdarg>
#include <cstring>
#include <climits>
#include <stdint.h>

#define PARAMETER_FCREATE(fp, fileName) fp = fopen(fileName, "wb")
#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)
#define PARAMETER_EXPORT __attribute__ ((visibility ("default")))

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

#ifdef CAMX_CUSTOM_ALLOCATOR
#define PARAMETER_STD_STRING       CamxString
#define PARAMETER_STD_STRINGSTREAM CamxStream
#else
#define PARAMETER_STD_STRING       std::string
#define PARAMETER_STD_STRINGSTREAM std::stringstream
#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;
        UINT32 Group;
    };
    ModeStruct Mode;
};
class ModeEntryInfo;
class IModeTable
{
public:
    virtual ModeEntryInfo* GetModeEntry(
        UINT32 const modeID) = 0;
    virtual ~IModeTable(){}
};

PARAMETER_PACK_END
#endif
