-4

我应该如何定义FundamentalOperationalData?是什么FundamentalOperationalData_MarkXTransponder m_FODSystemMarkTransponder;?是要填充其他数据FundamentalOperationalData还是不同的数据?正如我所看到的,这里是父亲。

我想将一些东西声明为 FundamentalOperationalData Mydata(1,2,3...

来源在这里

namespace KDIS {
namespace DATA_TYPE {

class KDIS_EXPORT FundamentalOperationalData : public DataTypeBase
{
protected:

    union
    {
        struct
        {
            KUINT8 m_ui8SystemStatus;
            KUINT8 m_ui8AltParam4;
            KUINT8 m_ui8InfoLayers;
            KUINT8 m_ui8Modifier;
            KUINT16 m_ui16Param1;
            KUINT16 m_ui16Param2;
            KUINT16 m_ui16Param3;
            KUINT16 m_ui16Param4;
            KUINT16 m_ui16Param5;
            KUINT16 m_ui16Param6;
        };

        FundamentalOperationalData_MarkXTransponder m_FODSystemMarkTransponder;
        FundamentalOperationalData_MarkXInterrogator m_FODSystemMarkInterrogator;
        FundamentalOperationalData_Soviet m_FODSystemSoviet;
        FundamentalOperationalData_RRB m_FODSystemRRB;
    };

public:

    static const KUINT16 FUNDAMENTAL_OPERATIONAL_DATA_SIZE = 16;

    FundamentalOperationalData( void );

    FundamentalOperationalData( KDataStream & stream ) throw( KException );

    FundamentalOperationalData( const FundamentalOperationalData_MarkXTransponder & FOD );

    FundamentalOperationalData( const FundamentalOperationalData_MarkXInterrogator & FOD );

    FundamentalOperationalData( const FundamentalOperationalData_Soviet & FOD );

    FundamentalOperationalData( const FundamentalOperationalData_RRB & FOD );

    virtual ~FundamentalOperationalData( void );

    //************************************
    // FullName:    KDIS::DATA_TYPE::FundamentalOperationalData::SetFundamentalOperationalData
    //              KDIS::DATA_TYPE::FundamentalOperationalData::GetFundamentalOperationalData
    // Description: Sets/Gets Fundamental Operational Data for a specific system.
    // Parameter:   FundamentalOperationalData_X FOD
    //************************************
    void SetFundamentalOperationalData_MarkXTransponder( const FundamentalOperationalData_MarkXTransponder & FOD );
    void SetFundamentalOperationalData_MarkXInterrogator( const FundamentalOperationalData_MarkXInterrogator & FOD );
    void SetFundamentalOperationalData_Soviet( const FundamentalOperationalData_Soviet & FOD );
    void SetFundamentalOperationalData_RRB( const FundamentalOperationalData_RRB & FOD );
    const FundamentalOperationalData_MarkXTransponder & GetSetFundamentalOperationalData_MarkXTransponder() const;
    FundamentalOperationalData_MarkXTransponder & GetSetFundamentalOperationalData_MarkXTransponder();
    const FundamentalOperationalData_MarkXInterrogator & GetFundamentalOperationalData_MarkXInterrogator() const;
    FundamentalOperationalData_MarkXInterrogator & GetFundamentalOperationalData_MarkXInterrogator();
    const FundamentalOperationalData_Soviet & GetFundamentalOperationalData_Soviet() const;
    FundamentalOperationalData_Soviet & GetFundamentalOperationalData_Soviet();
    const FundamentalOperationalData_RRB & GetFundamentalOperationalData_RRB() const;
    FundamentalOperationalData_RRB & GetFundamentalOperationalData_RRB();

    //************************************
    // FullName:    KDIS::DATA_TYPE::FundamentalOperationalData::GetAsString
    // Description: Returns a string representation
    //************************************
    virtual KString GetAsString() const;

    //************************************
    // FullName:    KDIS::DATA_TYPE::FundamentalOperationalData::Decode
    // Description: Convert From Network Data.
    // Parameter:   KDataStream & stream
    //************************************
    virtual void Decode( KDataStream & stream ) throw( KException );

    //************************************
    // FullName:    KDIS::DATA_TYPE::FundamentalOperationalData::Encode
    // Description: Convert To Network Data.
    // Parameter:   KDataStream & stream
    //************************************
    virtual KDataStream Encode() const;
    virtual void Encode( KDataStream & stream ) const;

    KBOOL operator == ( const FundamentalOperationalData & Value ) const;
    KBOOL operator != ( const FundamentalOperationalData & Value ) const;
};

}; // END namespace DATA_TYPES
}; // END namespace KDIS
4

1 回答 1

1

FundamentalOperationalData没有构造函数(1,2,3..

您可以使用以下方法初始化此类:

  • 默认构造函数
  • FundamentalOperationalData_MarkXTransponder参考
  • FundamentalOperationalData_MarkXInterrogator参考
  • FundamentalOperationalData_Soviet参考
  • FundamentalOperationalData_RRB参考
  • KDataStream参考

FundamentalOperationalData_MarkXTransponderFundamentalOperationalData该类的受保护成员。

这里union是授予对这些成员的访问权限:

    struct
    {
        KUINT8 m_ui8SystemStatus;
        KUINT8 m_ui8AltParam4;
        KUINT8 m_ui8InfoLayers;
        KUINT8 m_ui8Modifier;
        KUINT16 m_ui16Param1;
        KUINT16 m_ui16Param2;
        KUINT16 m_ui16Param3;
        KUINT16 m_ui16Param4;
        KUINT16 m_ui16Param5;
        KUINT16 m_ui16Param6;
    };

通过这些成员

    FundamentalOperationalData_MarkXTransponder m_FODSystemMarkTransponder;
    FundamentalOperationalData_MarkXInterrogator m_FODSystemMarkInterrogator;
    FundamentalOperationalData_Soviet m_FODSystemSoviet;
    FundamentalOperationalData_RRB m_FODSystemRRB;

因为工会只有足够的存储空间来容纳其成员列表中最大的成员。

于 2012-08-06T09:53:26.437 回答