Hello,
since I've been given documentation a free pass until now, I just started to using doxygen to properly document my engine. However, since I've been really really lazy about documentation before, I'm kind of unsure, especially about the amount of documentation/comments necessary. Since I've read a few articles/post specially on stackoverflow, I got a little worried that my documentation might be a bit over the top. Consider this example:
/// Handles registration to and dispatching of messages and queries.
/** The MessageManager is responsible for allowing systems to
* subscribe to messages and queries, as well as recieve any
* such unit and dispatch it to the previously subscribed systems. */
class MessageManager
{
typedef std::vector<const BaseSystem*> QueryVector; ///< Typedef for vector of query registrations
typedef std::vector<std::vector<BaseSystem*>> SubscriptVector; ///< Typedef for vector of message subscripts
public:
MessageManager(void);
/** Subscribe system to message.
* This method allows systems to subscribe themselfs to the templated message
* type. This is necessary for them to recieve any message via the manager.
*
* @param[in] system Reference to the system that wants to subscribe to the message.
*
* @tparam M The type of the message that should be subscribed to.
*/
template<typename M>
void Subscribe(BaseSystem& system);
/** Register system to query.
* This method allows systems to register themselfs to the templated query
* type. This is necessary for them to recieve any query via the manager.
* Only one system can be registered to a query at a time. Latter registrations
* will override earlier ones.
*
* @param[in] system Reference to the system that wants to register to the query.
*
* @tparam M The type of the query that should be registered to.
*/
template<typename Q>
void RegisterQuery(const BaseSystem& system);
/** Delivers a message to all subscribed systems.
* This method constructs a message and delivers it to all previously subscribed
* systems.
*
* @param[in] args Constructor arguments for the message to being created.
*
* @tparam M The type of message that should be delivered.
*/
template<typename M, typename ... Args>
void DeliverMessage(Args&& ... args) const;
/** Performs a query.
* This method looks whether a system is registered to the query
* passed, and if so, it passes the query on for the system to handle.
* Returns false if no system is registered to the query. Otherwise,
* it returns the systems response to the query, which can indeed also
* be false, if the queries condition wasn't met by the system.
*
* @param[in,out] query Reference to the query that should be delivered
*
* @tparam M The type of message that should be delivered.
*
* @return Indicates whether the queries condition was fullfilled or not.
*/
template<typename Q>
bool Query(Q& query) const;
/** Clears all registrations.
* This method removes all subscriptions and registrations of any
* system to any message or query. */
void Clear(void);
private:
QueryVector m_vQueries; ///< Vector for query registrations
SubscriptVector m_vSubscript; /**< Vector for message subscriptions. */
};
This is in fact the first time I've ever placed descriptive comments in a header file (yeah, I'm lazy as ass, especially concerning documentation, I know). Without seeing the function definition itself, and without talking about whether my terminology used is correct, what do you say about the amount of documentation for each function? Is it too much, too less, or just about enough? Do you have any other hints what I should do/not do when documenting my code (specially when using doxygen)?