前处理条基截面定义 Struct TI_TiaoJiSect_D 数据项 类型 编码 默认值 截面编号 _T_KEY mNo 0 截面类型 _T_KEY mType 0 基础底面宽度 double mB 0 基础高度 double mH 0 基础底面挑出宽度 double mTCWidth 0 参考墙厚 double mWallTh1 0 第二墙厚 double mWallTh2 0 墙净距 double mWallRDis 0 基础相对墙体偏心 double mEcc 0 无砂浆缝时放脚宽 double mFeetWidth0 0 有砂浆缝时放脚宽 double mFeetWidth1 0 混凝土条基端部高-左端 double mEndH_L 0 混凝土条基端部高-左端 double mEndH_R 0 转换成c++结构体 并给出注释和初始化函数,构造函数,析构函数;构造调用初始化函数,拷贝构造函数,重载=号,分h和cpp实现
时间: 2024-02-04 11:01:59 浏览: 77
datastruct1_C语言_SHORTEST-PATHS_shortest path_哈夫曼编码_数据结构算法
下面是转换成C++结构体的代码:
```c++
struct TI_TiaoJiSect_D {
string mNo; // 截面编号
string mType; // 截面类型
double mB; // 基础底面宽度
double mH; // 基础高度
double mTCWidth; // 基础底面挑出宽度
double mWallTh1; // 参考墙厚
double mWallTh2; // 第二墙厚
double mWallRDis; // 墙净距
double mEcc; // 基础相对墙体偏心
double mFeetWidth0; // 无砂浆缝时放脚宽
double mFeetWidth1; // 有砂浆缝时放脚宽
double mEndH_L; // 混凝土条基端部高-左端
double mEndH_R; // 混凝土条基端部高-右端
// 初始化函数
void init(string No, string Type, double B, double H, double TCWidth, double WallTh1, double WallTh2, double WallRDis,
double Ecc, double FeetWidth0, double FeetWidth1, double EndH_L, double EndH_R) {
mNo = No;
mType = Type;
mB = B;
mH = H;
mTCWidth = TCWidth;
mWallTh1 = WallTh1;
mWallTh2 = WallTh2;
mWallRDis = WallRDis;
mEcc = Ecc;
mFeetWidth0 = FeetWidth0;
mFeetWidth1 = FeetWidth1;
mEndH_L = EndH_L;
mEndH_R = EndH_R;
}
// 构造函数
TI_TiaoJiSect_D() {
init("", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
// 析构函数
~TI_TiaoJiSect_D() {}
// 拷贝构造函数
TI_TiaoJiSect_D(const TI_TiaoJiSect_D& other) {
init(other.mNo, other.mType, other.mB, other.mH, other.mTCWidth, other.mWallTh1, other.mWallTh2, other.mWallRDis,
other.mEcc, other.mFeetWidth0, other.mFeetWidth1, other.mEndH_L, other.mEndH_R);
}
// 重载=号
TI_TiaoJiSect_D& operator=(const TI_TiaoJiSect_D& other) {
if (this != &other) {
init(other.mNo, other.mType, other.mB, other.mH, other.mTCWidth, other.mWallTh1, other.mWallTh2, other.mWallRDis,
other.mEcc, other.mFeetWidth0, other.mFeetWidth1, other.mEndH_L, other.mEndH_R);
}
return *this;
}
};
```
下面是分h和cpp实现的代码:
```c++
// TI_TiaoJiSect_D.h
#ifndef TI_TiaoJiSect_D_h
#define TI_TiaoJiSect_D_h
#include <string>
using namespace std;
struct TI_TiaoJiSect_D {
string mNo; // 截面编号
string mType; // 截面类型
double mB; // 基础底面宽度
double mH; // 基础高度
double mTCWidth; // 基础底面挑出宽度
double mWallTh1; // 参考墙厚
double mWallTh2; // 第二墙厚
double mWallRDis; // 墙净距
double mEcc; // 基础相对墙体偏心
double mFeetWidth0; // 无砂浆缝时放脚宽
double mFeetWidth1; // 有砂浆缝时放脚宽
double mEndH_L; // 混凝土条基端部高-左端
double mEndH_R; // 混凝土条基端部高-右端
void init(string No, string Type, double B, double H, double TCWidth, double WallTh1, double WallTh2, double WallRDis,
double Ecc, double FeetWidth0, double FeetWidth1, double EndH_L, double EndH_R);
TI_TiaoJiSect_D();
TI_TiaoJiSect_D(const TI_TiaoJiSect_D& other);
TI_TiaoJiSect_D& operator=(const TI_TiaoJiSect_D& other);
~TI_TiaoJiSect_D();
};
#endif /* TI_TiaoJiSect_D_h */
// TI_TiaoJiSect_D.cpp
#include "TI_TiaoJiSect_D.h"
void TI_TiaoJiSect_D::init(string No, string Type, double B, double H, double TCWidth, double WallTh1, double WallTh2, double WallRDis,
double Ecc, double FeetWidth0, double FeetWidth1, double EndH_L, double EndH_R) {
mNo = No;
mType = Type;
mB = B;
mH = H;
mTCWidth = TCWidth;
mWallTh1 = WallTh1;
mWallTh2 = WallTh2;
mWallRDis = WallRDis;
mEcc = Ecc;
mFeetWidth0 = FeetWidth0;
mFeetWidth1 = FeetWidth1;
mEndH_L = EndH_L;
mEndH_R = EndH_R;
}
TI_TiaoJiSect_D::TI_TiaoJiSect_D() {
init("", "", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
TI_TiaoJiSect_D::TI_TiaoJiSect_D(const TI_TiaoJiSect_D& other) {
init(other.mNo, other.mType, other.mB, other.mH, other.mTCWidth, other.mWallTh1, other.mWallTh2, other.mWallRDis,
other.mEcc, other.mFeetWidth0, other.mFeetWidth1, other.mEndH_L, other.mEndH_R);
}
TI_TiaoJiSect_D& TI_TiaoJiSect_D::operator=(const TI_TiaoJiSect_D& other) {
if (this != &other) {
init(other.mNo, other.mType, other.mB, other.mH, other.mTCWidth, other.mWallTh1, other.mWallTh2, other.mWallRDis,
other.mEcc, other.mFeetWidth0, other.mFeetWidth1, other.mEndH_L, other.mEndH_R);
}
return *this;
}
TI_TiaoJiSect_D::~TI_TiaoJiSect_D() {}
```
阅读全文