Home

Resume

Blog

Teikitu


/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
/*  »Project«   Teikitu Gaming System (TgS) (∂)
    »File«      TgS Common - Util SP - Array.h
    »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
    »Version«   4.51 / »GUID« A9981407-3EC9-42AF-8B6F-8BE6DD919615                                                                                                        */
/*   -------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
/*  Copyright: © 2002-2017, Andrew Aye.  All Rights Reserved.
    This software is free for non-commercial use.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
      following conditions are met:
        Redistribution of source code must retain this copyright notice, this list of conditions and the following disclaimers.
        Redistribution in binary form must reproduce this copyright notice, this list of conditions and the following disclaimers in the documentation and other materials
          provided with the distribution.
    The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
    The intellectual property rights of the algorithms used reside with Andrew Aye.
    You may not use this software, in whole or in part, in support of any commercial product without the express written consent of the author.
    There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".                                                   */
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */
#if !defined(TGS_COMMON_UTIL_SP_ARRAY_H)
#define TGS_COMMON_UTIL_SP_ARRAY_H
#pragma once


/* == Common ============================================================================================================================================================ */

/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Types                                                                                                                                                          */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgTYPE_STRUCT(STg2_UTS_AR,)
{
    /* Setup Data */
    TgSIZE                                      m_uiStride;
    TgBOOL                                      m_bFixed;
    TgUINT32                                    m_uiPad0;

    TgVOID                                      (*m_pInitCopy)( P_TgVOID, P_TgVOID );
    TgVOID                                      (*m_pAssignment)( P_TgVOID, P_TgVOID );
    TgVOID                                      (*m_pFree)( P_TgVOID );

    /* Internal Data */
    P_TgUINT08                                  m_puiStart; /*« Start of the Buffer */
    P_TgUINT08                                  m_puiLast; /*« The first invalid element */
    P_TgUINT08                                  m_puiEnd; /*« End of the Buffer */
};


/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */
/*  Public Functions                                                                                                                                                      */
/* -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. */

TgINLINE TgRESULT                                    tgCM_UTS_AR_Init( PCU_STg2_UTS_AR );
TgINLINE TgVOID                                      tgCM_UTS_AR_Free( PCU_STg2_UTS_AR );

TgEXTN TgRESULT                                      tgCM_UTS_AR_Assign_ElementN( PCU_STg2_UTS_AR, P_TgVOID, C_TgSIZE );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Copy( PCU_STg2_UTS_AR, CPCU_STg2_UTS_AR );
TgEXTN TgRESULT                                      tgCM_UTS_AR_Assign_Range( PCU_STg2_UTS_AR, P_TgVOID, P_TgVOID );

TgINLINE TgRESULT                                    tgCM_UTS_AR_Push_Back( PCU_STg2_UTS_AR, P_TgVOID );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Insert_Element( PCU_STg2_UTS_AR, C_TgSIZE, P_TgVOID );
TgEXTN TgRESULT                                      tgCM_UTS_AR_Insert_ElementN( PCU_STg2_UTS_AR, C_TgSIZE, P_TgVOID, C_TgSIZE );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Insert_Copy( PCU_STg2_UTS_AR, C_TgSIZE, CPCU_STg2_UTS_AR );
TgEXTN TgRESULT                                      tgCM_UTS_AR_Insert_Range( PCU_STg2_UTS_AR, C_TgSIZE, P_TgVOID, P_TgVOID );

TgINLINE TgVOID                                      tgCM_UTS_AR_Pop_Back( PCU_STg2_UTS_AR );
TgINLINE TgVOID                                      tgCM_UTS_AR_Erase_Element( PCU_STg2_UTS_AR, C_TgSIZE );
TgEXTN TgVOID                                        tgCM_UTS_AR_Erase_Range( PCU_STg2_UTS_AR, C_TgSIZE, C_TgSIZE ); /*« erase [itStart, itLast) */ 
TgINLINE TgVOID                                      tgCM_UTS_AR_Clear( PCU_STg2_UTS_AR );

TgINLINE P_TgVOID                                    tgCM_UTS_AR_Get_Data( PCU_STg2_UTS_AR );
TgINLINE P_TgVOID                                    tgCM_UTS_AR_Get_Index( PCU_STg2_UTS_AR, C_TgSIZE );
TgINLINE P_TgVOID                                    tgCM_UTS_AR_Get_Front( PCU_STg2_UTS_AR );
TgINLINE P_TgVOID                                    tgCM_UTS_AR_Get_Back( PCU_STg2_UTS_AR );

TgINLINE TgRESULT                                    tgCM_UTS_AR_Query_Index( P_TgVOID, C_TgSIZE, PCU_STg2_UTS_AR, C_TgSIZE );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Query_Front( P_TgVOID, C_TgSIZE, PCU_STg2_UTS_AR );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Query_Back( P_TgVOID, C_TgSIZE, PCU_STg2_UTS_AR );

TgINLINE TgBOOL                                      tgCM_UTS_AR_Empty( PCU_STg2_UTS_AR );
TgINLINE TgSIZE                                      tgCM_UTS_AR_Capacity( PCU_STg2_UTS_AR );
TgINLINE TgSIZE                                      tgCM_UTS_AR_Count( PCU_STg2_UTS_AR );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Resize( PCU_STg2_UTS_AR, C_TgSIZE, P_TgVOID );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Reserve( PCU_STg2_UTS_AR, C_TgSIZE );
TgINLINE TgRESULT                                    tgCM_UTS_AR_Shrink( PCU_STg2_UTS_AR, C_TgSIZE );


/* ====================================================================================================================================================================== */
#endif