HFileTemplate
/****************************************************************************/
// Eclipse SUMO, Simulation of Urban MObility; see <https://eclipse.dev/sumo>
// Copyright (C) <YEAR OF CREATION>-<CURRENT YEAR> German Aerospace Center (DLR) and others.
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License 2.0 which is available at
// https://www.eclipse.org/legal/epl-2.0/
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the Eclipse
// Public License 2.0 are satisfied: GNU General Public License, version 2
// or later which is available at
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
/****************************************************************************/
/// @file <FILENAME>
/// @author <AUTHOR'S NAME, ONE SEPARATE LINE FOR EACH AUTHOR>
/// @author <AUTHOR'S NAME 2>
/// @author <AUTHOR'S NAME 3>
/// @date <FILE CREATION DATE>
///
// <文件内容的简要描述>
/****************************************************************************/
#pragma once
#include <config.h> // 如果不需要 config.h 中的任何定义(尤其是在 libsumo / utils 中),可以省略此行
#include <somewhere/otherClass1.h>
#include "myOtherClass2.h"
// ===========================================================================
// 类声明
// ===========================================================================
class myOwnClass1; // 始终优先使用声明而不是包含
class myOwnClass2;
// ===========================================================================
// 类定义
// ===========================================================================
/**
* @class OwnClass (可根据项目在前面加上 GNE、MS、NB 等前缀)
* 类的简要描述
*/
class OwnClass : public ParentClass {
public:
/**
* @class InnerClass
* 内部类的简要描述
*/
class InnerClass {
public:
/// @brief 构造函数
InnerClass();
/// @brief 析构函数
~InnerClass();
private:
/// @brief 参数描述
<parameterType> myPrivateParameter;
};
/** @brief 构造函数
* @param[in] parameter1 每个参数都必须有文档说明
* @param[in] parameter2 每个参数都必须有文档说明
...
*/
OwnClass(<parameterType> parameter1, <parameterType> parameter2,... <parameterType> parametern);
/// @brief 析构函数(不需要文档说明)
~OwnClass();
/// @brief 返回 parameter1(简单函数应用一行文档说明)
<parameterType> getParameter1() const;
/** @brief 某些函数可能会抛出异常,但不要使用 throw 声明
* @param[in] parameter1 参数描述
* @throw <exceptionName> 引发异常的情况描述
* @return 返回值描述
*/
bool setParameter1(<type> parameter1) const;
/// @brief 如果类是抽象类,应包含纯虚函数 (virtual .... = 0;)
// @note: 关于函数的额外信息应使用 @note 书写
virtual void pureVirtualFunction() = 0;
protected:
/// @brief 参数描述
<parameterType> myProtectedParameter1;
private:
/// @brief 每个私有参数必须以 "my" 开头
<parameterType> myPrivateParameter2;
/// @brief C++ 标准库类必须以 std:: 开头
std::vector<std::string> myPrivateParameter3;
};