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

📄 rec_base.cpp

📁 PQDIF软件包(SDK,Software Development Kit),它能转换、生成并且显示PQDIF文件.对于开发电力系统的数据输出非常有用。
💻 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: 2/11/98 9:36a $
**  Last modified by:   $Author: Rob $
**
**  VCS archive path:   $Archive: /Hank/DMM/FirmWare/Level3/ObDatMgr/rec_base.cpp $
**  VCS revision:       $Revision: 5 $ 
*/
#include "PQDIF_classes.h"


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

    if( pcoll )
        {
        //  Traverse down the collection until we find the tag.
        for( idx = 0; idx < pcoll->GetCount(); idx++ )
            {
            pel = pcoll->GetElement( idx );
            if( pel )
                {
                if( pel->GetElementType() == ID_ELEMENT_TYPE_COLLECTION
                    && PQDIF_IsEqualGUID( pel->GetTag(), tag ) )
                    {
                    pcolReturn = (CPQDIF_E_Collection *) pel;
                    }
                }
            }
        }

    return pcolReturn;
    }


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

    if( pcoll )
        {
        //  Traverse down the collection until we find the tag.
        for( idx = 0; idx < pcoll->GetCount(); idx++ )
            {
            pel = pcoll->GetElement( idx );
            if( pel )
                {
                if( pel->GetElementType() == ID_ELEMENT_TYPE_SCALAR
                    && PQDIF_IsEqualGUID( pel->GetTag(), tag ) )
                    {
                    pscReturn = (CPQDIF_E_Scalar *) pel;
                    }
                }
            }
        }

    return pscReturn;
    }


bool CPQDIFRecord::GetScalarValueInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag,
                    UINT4                   typePhysical,
                    PQDIFValue&             value
            )
    {
    bool        status = FALSE;
    int         idx;

    bool        found;
    long        typePhysicalThisItem;

    CPQDIF_Element *        pel;
    CPQDIF_E_Scalar *       psc = NULL;

    if( pcoll )
        {
        //  Traverse down the collection until we find the tag.
        for( idx = 0; idx < pcoll->GetCount(); idx++ )
            {
            pel = pcoll->GetElement( idx );
            if( pel )
                {
                if( pel->GetElementType() == ID_ELEMENT_TYPE_SCALAR
                    && PQDIF_IsEqualGUID( pel->GetTag(), tag ) )
                    {
                    psc = (CPQDIF_E_Scalar *) pel;

                    //  Verify that it's the correct physical type
                    found = psc->GetValue( typePhysicalThisItem, value );
                    if( found && typePhysicalThisItem == (long) typePhysical )
                        {
                        status = TRUE;
                        }
                    }
                }
            }
        }

    return status;
    }


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

    pscReturn = FindScalarInCollection( pcoll, tag );
    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::FindOrCreateVectorInCollection
            ( 
                    CPQDIF_E_Collection *   pcoll,
            const   GUID&                   tag,
                    UINT4                   typePhysical
            )
    {
    CPQDIF_E_Vector *       pvectReturn = NULL;

    pvectReturn = FindVectorInCollection( pcoll, tag );
    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;
    }


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

    if( pcoll )
        {
        //  Traverse down the collection until we find the tag.
        for( idx = 0; idx < pcoll->GetCount(); idx++ )
            {
            pel = pcoll->GetElement( idx );
            if( pel )
                {
                if( pel->GetElementType() == ID_ELEMENT_TYPE_VECTOR
                    && PQDIF_IsEqualGUID( pel->GetTag(), tag ) )
                    {
                    pvectReturn = (CPQDIF_E_Vector *) pel;
                    }
                }
            }
        }

    return pvectReturn;
    }

⌨️ 快捷键说明

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