⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rec_base.cpp

📁 电能质量交换格式转换库
💻 CPP
字号:
/*
**  CPQDIF_R_DataSource class. Implements a PQDIF record "wrapper" for the
**  data source record. You can cast a standard record object to this class.
**  --------------------------------------------------------------------------
**
**  File name:          $Workfile: rec_base.cpp $
**  Last modified:      $Modtime: 11/14/00 3:36p $
**  Last modified by:   $Author: Bill $
**
**  VCS archive path:   $Archive: /Hank/DMM/FirmWare/Level3/ObDatMgr/rec_base.cpp $
**  VCS revision:       $Revision: 7 $ 
*/
#include "PQDIF_classes.h"


CPQDIF_E_Collection * CPQDIFRecord::FindCollectionInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag
            )
    {
    CPQDIF_E_Collection *   pcolReturn = NULL;

    if( pcoll )
        {
        pcolReturn = (CPQDIF_E_Collection *)pcoll->GetElement( tag, ID_ELEMENT_TYPE_COLLECTION );
        }

    return pcolReturn;
    }


CPQDIF_E_Scalar * CPQDIFRecord::FindScalarInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag
            )
    {
    CPQDIF_E_Scalar *   pscReturn = NULL;

    if( pcoll )
        {
        pscReturn = (CPQDIF_E_Scalar *)pcoll->GetElement( tag, ID_ELEMENT_TYPE_SCALAR );
        }

    return pscReturn;
    }


bool CPQDIFRecord::GetScalarValueInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag,
                    UINT4                   typePhysical,
                    PQDIFValue&             value
            )
    {
    bool                status = FALSE;
    long                typePhysicalThisItem;
    CPQDIF_E_Scalar *   pscReturn = NULL;

    if( pcoll )
        {
        pscReturn = (CPQDIF_E_Scalar *)pcoll->GetElement( tag, ID_ELEMENT_TYPE_SCALAR );
        if( pscReturn )
            {
                status = pscReturn->GetValue( typePhysicalThisItem, value )
                    && typePhysicalThisItem == (long)typePhysical;
            }
        }

    return status;
    }


CPQDIF_E_Scalar * CPQDIFRecord::FindOrCreateScalarInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag,
                    UINT4                   typePhysical
            )
    {
    CPQDIF_E_Scalar *       pscReturn = NULL;

    if( pcoll )
        {
        pscReturn = (CPQDIF_E_Scalar *)pcoll->GetElement( tag, ID_ELEMENT_TYPE_SCALAR );
        if( !pscReturn )
            {
            //  If it doesn't exist, create, initialize and add it
            pscReturn = (CPQDIF_E_Scalar *) theFactory.NewElement( ID_ELEMENT_TYPE_SCALAR );
            if( pscReturn )
                {
                pscReturn->SetTag( tag );
                pscReturn->SetPhysicalType( typePhysical );
                pcoll->Add( pscReturn );
                }
            }
        }
    return pscReturn;
    }


CPQDIF_E_Vector * CPQDIFRecord::FindVectorInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag
            )
    {
    CPQDIF_E_Vector *   pvectReturn = NULL;

    if( pcoll )
        {
        pvectReturn = (CPQDIF_E_Vector *)pcoll->GetElement( tag, ID_ELEMENT_TYPE_VECTOR );
        }

    return pvectReturn;
    }


CPQDIF_E_Vector * CPQDIFRecord::FindOrCreateVectorInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag,
                    UINT4                   typePhysical
            )
    {
    CPQDIF_E_Vector *       pvectReturn = NULL;

    if( pcoll )
        {
        pvectReturn = (CPQDIF_E_Vector *)pcoll->GetElement( tag, ID_ELEMENT_TYPE_VECTOR );
        if( !pvectReturn )
            {
            //  If it doesn't exist, create, initialize and add it
            pvectReturn = (CPQDIF_E_Vector *) theFactory.NewElement( ID_ELEMENT_TYPE_VECTOR );
            if( pvectReturn )
                {
                pvectReturn->SetTag( tag );
                pvectReturn->SetPhysicalType( typePhysical );
                pcoll->Add( pvectReturn );
                }
            }
        }

    return pvectReturn;
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -