1

I have created a latex document from a c++ project using doxygen. After that, I have used pdflatex to convert the refman.tex document to pdf (I did this several times to ensure that all references were correctly completed).

My problem is that in 2 of my 24 classes, the constructor doesn´t appear with the brief information and params I wrote in my code, while the algorithm does.

I have looked for spelling mistakes but haven´t found any one.

This is the beginning of one of the classes:

/*
 * @brief This function implements the constructor of CStatusSender class
 * @details It adds a CoreTimer Listener with STATUSSENDER_BCAST_PERIOD period 
 *  of 1000 ms to send the status packet every time the timer is called
 * @param ip: IP address of the device
 * @param version: Firmware version
 * @param ctrlp: Object of CControlProtocol class
 */
CStatusSender::CStatusSender(const char* ip, const char* version,
        CControlProtocol* ctrlp)
{

This is the beginning of the second one (where CONTROL_PROTO_MCAST is 1). In this case the pdf created shows the declaration that follows the #else, but it doesn't make sense as CONTROL_PROTO_MCAST is 1 and whats more, in my editor the #else part is in grey (Meaning is not using that part):

 #if CONTROL_PROTO_MCAST
/**
 * @brief This function implements the constructor of CControlProtocol class.
 * @param element_type: New value for @link m_ElementType element type @endlink 
 * @param LocalIP: New value for @link m_LocalIP local IP @endlink
 * @param rx_port: New value for @link m_RXSocket RX socket @endlink
 * @param tx_port: New value for @link m_TXSocket TX socket @endlink
 * @param rx_mcast_addr: New value for @link m_RxMcastAddr RX multicast address @endlink
 * @param tx_mcast_addrs: New value for @link m_TxMcastAddrs TX multicast address @endlink
 * @param maxLocals: New value for @link m_MaxLocalAddressNum local IP address limit @endlink
 * @param MqxThreadId: New value for Mqx thread id
 */
CControlProtocol::CControlProtocol(EElementType element_type, uint_32 LocalIP, uint_16 rx_port,
        uint_16 tx_port, uint_32 rx_mcast_addr, const std::map<EElementType, uint32_t>& tx_mcast_addrs, int maxLocals, int MqxThreadId)
#else
CControlProtocol::CControlProtocol(EElementType element_type, uint_32 LocalIP,
        uint_16 rx_port, uint_16 tx_port, uint_32 broadcast_addr, int maxLocals,
        int MqxThreadId) 
#endif
: CThreaded(MqxThreadId) {
    /**
     * @b Algorithm
     * 
     * l. Update @link m_LastTXSQ last TX SQ @endlink 
     * 2. Initialize @link m_LastRXSQTable last RX sequence table @endlink with size @link MAX_EMITTERS @endlink
     * 3. For each element of @link m_LastRXSQTable last RX sequence table @endlink do
     *     1. Element IP is 0
     *     2. Element sequence is 0
     * 4. Set @link m_LocalIP local IP @endlink parameter's value
     * 5. Set @link m_Port port @endlink parameter's value
     * 6. Set @link m_ElementType element type @endlink parameter's value
     * 7. Set @link m_bFilterRemote filter remote flag @endlink to false
     * 8. Set @link m_MaxLocalAddressNum limit local address number @endlink parameter's value
     * 9. Initialize @link m_LocalAddrs local addresses @endlink of size @link m_MaxLocalAddressNum limit local address number @endlink 
     * 10. Get @link m_RXSocket RX socket @endlink
     * 11. Get @link m_TXSocket TX socket @endlink
     * 12. CONTROL_PROTO_MCAST
     *  -# True
     *      1. Set @link m_RxMcastAddr RX multicast address @endlink parameter's value
     *      2. @link m_RxMcastAddr multicast address @endlink is a valid multicast address
     *          -# Join multicast group
     *  -# Else
     *      1. Set @link m_BroadcastAddr broadcast address @endlink parameter´s value
     * 13. Set @link m_TxMcastAddr TX multicast address @endlink parameter's value
     * 14. Initialize @link m_TXBuf TX buffer @endlink
     * 15. Initialize @link m_RXBuf RX buffer @endlink 
marpe
  • 185
  • 2
  • 9
  • Which version of doxygen are you using? Do you see the constructor in the HTML output. Please also add the changes of the default doxygen configuration file to the quesition (`doxygen -x` for version 1.8.15 and up) and a complete small example showing the problem. – albert Dec 04 '19 at 11:35
  • The documentation here is inside the `#if` and when `CONTROL_PROTO_MCAST` is not set there is no documentation for `CControlProtocol::CControlProtocol` – albert Dec 04 '19 at 12:00
  • So should I put the documentation out of the #if, or add another documentation for when CONTROL_PROTO_MCAST is not set? What I don't get is why is it appearing the second declaration when is not being used – marpe Dec 04 '19 at 12:06
  • I would place the common part outside the `#if` and, when necessary, some special documentation just before the actual method. It might be necessary to use the `\fn` with the first documentation block (don't know it by head, so just test it). Where is the second declaration appearing (see also my first comment) – albert Dec 04 '19 at 12:17
  • I have already found the answer to the problem, which I posted below, but thank you @albert for you help – marpe Dec 04 '19 at 12:33
  • You only solved in case you have the define set. In case you want to document the part in the `#else` part you have not solved it yet, but here you can use probably use my suggested solution. – albert Dec 04 '19 at 12:37

2 Answers2

2

Perhaps this is a typo but, you start the constructor's documentation with /* instead of /**. So it is parsed as a simple comment, not as a comment.

I guess it should be the same mistake for the second constructor whose the documentation does not appear.

If it is a typo, let me know so that I'll remove this answer.

Fareanor
  • 5,900
  • 2
  • 11
  • 37
0

I have already solved the problem of the second class I posted.

In the expert tab of Doxywizard I had to go to Preprocessor and once there, add CONTROL_PROTO_MCAST to PREDEFINED.

After creating the latex document and converting it to pdf, the constructor showed was the one after the #if instead the one after the #else

marpe
  • 185
  • 2
  • 9