首页 > 解决方案 > 如何用 doxygen 提取私有类成员?

问题描述

我想使用 doxygen 记录一个包含其私有成员的类。这是我的类定义“AshtechAsioNode.h”

    /** @file AshtechAsioNode.h  */

/*

#ifndef CATKIN_WS_ASHTECHASIONODE_H
#define CATKIN_WS_ASHTECHASIONODE_H

//some generically useful stuff to include...
#include <math.h>
#include <stdlib.h>
#include <std_msgs/String.h>
#include <std_msgs/Empty.h>
#include <sensor_msgs/NavSatFix.h>
#include <medusa_msgs/mLatLonPos.h>
#include <diagnostic_msgs/DiagnosticArray.h>
#include <medusa_gimmicks_library/MedusaGimmicks.h>
#include <nmeaSerial.h>
#include <map>
#include <vector>
#include <std_msgs/Int8.h>
#include <std_msgs/Bool.h>

#include <ros/ros.h> //ALWAYS need to include this 

/**
* \class AshtechAsioNode
* \brief This class represents a GPS.
* \details Add class description. Control 0.
*/
class AshtechAsioNode {

    // #############################
    // @.@ Public methods
    // #############################
    public:
        
        // #############################
        // @.@ Constructor
        // #############################
        // "main" will need to instantiate two ROS nodehandles, then pass it to the constructor
        AshtechAsioNode(ros::NodeHandle* nodehandle, ros::NodeHandle *nodehandle_private);

        // #############################
        // @.@ Destructor
        // #############################
        ~AshtechAsioNode();

        
        /// Set frequency of the node. The frequency is defined by a ROS parameter.
        double nodeFrequency();

    // #############################
    // @.@ Private methods
    // #############################
    
    private:
        
        /// Node handler for node management.
        ros::NodeHandle nh_; ///< we will need this, to pass between "main" and constructor

        /// Node handler for extra layer of namespace resolution. Initialized with '~' parameter.
        ros::NodeHandle nh_p_; ///< we will need this, to pass between "main" and constructor

        // some objects to support subscriber and publishers, these will be set up within the class constructor, hiding the ugly details

        /// Subscribers
        // #####################
        // @.@ Subscribers
        // #####################
        
        ros::Subscriber sub_corrections_; ///< Subscribes to reconfiguration commands.
        ros::Subscriber sub_conf_; ///< Subscribes to $PASHR strings used to write to the device.
        ros::Subscriber sub_reset_; ///< Subscribes to the 'reset' topic.

        ///Publishers
        // #####################
        // @.@ Publishers
        // #####################
        ros::Publisher pub_corrections_;
        ros::Publisher pub_raw_;
        ros::Publisher pub_gps_;
        ros::Publisher pub_diag_;
        ros::Publisher pub_gps_NavSat_;

        std::vector<std::string> p_config_list_;

        nmeaSerial serial_port_;

        std::string p_sPORT_;
        int p_BAUDRATE_;
        int p_RTK_port_;
        int fd_udp_socket_;
        bool rtk_flag_;

        std::map<int, int> baudrate_table_;


        // #######################
        // @.@ Timer
        // #######################
        ros::Timer timer_;

        // ####################################################################################################################
        // member variable: better than using globals; convenient way to pass data from a subscriber to other member functions
        // member variables will retain their values even as callbacks come and go
        // ####################################################################################################################

        // +.+ Parameters from Yaml
        // always p_paraName -> Example: double p_ku;

        // +.+ Handy variables
        // Example double var_temp_x, var_temp_y;

        // +.+ Problem variables
        // Example: double x_state, y_state;


        // #######################################################################################
        // @.@ Encapsulation the gory details of initializing subscribers, publishers and services
        // #######################################################################################
        void initializeSubscribers(); ///< hhhhhhh;
        void initializePublishers();
        void initializeTimer();
        void loadParams();

        void reporting(const ros::Time t);
        void initializeBaudrateTable();
        void configureGPS();
        int openGPS();
        int UDPSocket(unsigned port);


        // #######################################################################################
        // @.@ Callbacks declaration
        // #######################################################################################
        void dropoutCallback(const ros::TimerEvent& event);
        void rawCallback(const std::string& msg);
        void resetCallback(const std_msgs::Empty& msg);
        void confCallback(const std_msgs::String& str);
        void pashrCallback(const std::vector<std::string>& tokens);
        void correctionsCallback(const std_msgs::String& ptr);
};
#endif //CATKIN_WS_ASHTECHASIONODE_H
    

这是我的 doxygen 配置文件的一部分

    EXTRACT_ALL            = NO
    
    # If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
    # be included in the documentation.
    # The default value is: NO.
    
    EXTRACT_PRIVATE        = YES
    
    # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
    # scope will be included in the documentation.
    # The default value is: NO.
    
    EXTRACT_PACKAGE        = YES
    
    # If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
    # included in the documentation.
    # The default value is: NO.
    
    EXTRACT_STATIC         = YES
    
    # If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
    # locally in source files will be included in the documentation. If set to NO,
    # only classes defined in header files are included. Does not have any effect
    # for Java sources.
    # The default value is: YES.
    
    EXTRACT_LOCAL_CLASSES  = YES
    
    # This flag is only useful for Objective-C code. If set to YES, local methods,
    # which are defined in the implementation section but not in the interface are
    # included in the documentation. If set to NO, only methods in the interface are
    # included.
    # The default value is: NO.

注意我是如何包含/** @file AshtechAsioNode.h */在文件开头并将 extract_private 设置为 yes 的。但它只将公共成员输出到文档中。不关心评论本身或缩进。它只是虚假的评论,只是用于试验 doxygen 的副本(第一次)。

标签: xmldoxygen

解决方案


推荐阅读