Minor: add doxygen comments
This commit is contained in:
		@@ -4,12 +4,12 @@
 | 
				
			|||||||
#include <limits>
 | 
					#include <limits>
 | 
				
			||||||
#include <QDebug>
 | 
					#include <QDebug>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned WorkList::nextExecIndex() const {
 | 
					//unsigned WorkList::nextExecIndex() const {
 | 
				
			||||||
    if (m_workList.size() > 0 && m_workListIndex < (m_workList.size() - 1)) {
 | 
					//    if (m_workList.size() > 0 && m_workListIndex < (m_workList.size() - 1)) {
 | 
				
			||||||
        return m_workListIndex + 1;
 | 
					//        return m_workListIndex + 1;
 | 
				
			||||||
    }
 | 
					//    }
 | 
				
			||||||
    return std::numeric_limits<unsigned>::max();
 | 
					//    return std::numeric_limits<unsigned>::max();
 | 
				
			||||||
}
 | 
					//}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool WorkList::nextExec() const {
 | 
					bool WorkList::nextExec() const {
 | 
				
			||||||
    return m_workListIndex < m_workList.size();
 | 
					    return m_workListIndex < m_workList.size();
 | 
				
			||||||
@@ -17,12 +17,17 @@ bool WorkList::nextExec() const {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
bool WorkList::exec(bool last) {
 | 
					bool WorkList::exec(bool last) {
 | 
				
			||||||
    if (last == false) {
 | 
					    if (last == false) {
 | 
				
			||||||
 | 
					        // if not the last entry in the worklist
 | 
				
			||||||
        if (nextExec()) {
 | 
					        if (nextExec()) {
 | 
				
			||||||
 | 
					            // and there is a next entry (a binary) to execute, start the
 | 
				
			||||||
 | 
					            // binary if the specified working directory.
 | 
				
			||||||
            m_workList[m_workListIndex]->start("/opt/app/tools/atbupdate");
 | 
					            m_workList[m_workListIndex]->start("/opt/app/tools/atbupdate");
 | 
				
			||||||
 | 
					            // update to point to next entry
 | 
				
			||||||
            m_workListIndex += 1;
 | 
					            m_workListIndex += 1;
 | 
				
			||||||
            return true;
 | 
					            return true;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					        // start the last entry in the worklist
 | 
				
			||||||
        m_workList.back()->start("/opt/app/tools/atbupdate");
 | 
					        m_workList.back()->start("/opt/app/tools/atbupdate");
 | 
				
			||||||
        m_workListIndex = std::numeric_limits<unsigned>::max();
 | 
					        m_workListIndex = std::numeric_limits<unsigned>::max();
 | 
				
			||||||
        return true;
 | 
					        return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,18 +5,42 @@
 | 
				
			|||||||
#include <memory>
 | 
					#include <memory>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class UpdateCommand;
 | 
					class UpdateCommand;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * @brief This class is responsible for calling the several binaries
 | 
				
			||||||
 | 
					 * \ref ATBUpdateTool consists of.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * This class maintains a worklist, which conists of entries of type UpdateCommand.
 | 
				
			||||||
 | 
					 *
 | 
				
			||||||
 | 
					 * @see UpdateCommand
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
class WorkList {
 | 
					class WorkList {
 | 
				
			||||||
public:
 | 
					    /**
 | 
				
			||||||
 | 
					     * @brief Actual worklist of items to be eecuted.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    std::vector<std::unique_ptr<UpdateCommand>> m_workList;
 | 
					    std::vector<std::unique_ptr<UpdateCommand>> m_workList;
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
    unsigned m_workListIndex{0};
 | 
					    unsigned m_workListIndex{0};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    WorkList() = default;
 | 
					    WorkList() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * \brief Put new work item into worklist.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * \tparam arg Work item to be added to worklist.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    template<typename T>
 | 
					    template<typename T>
 | 
				
			||||||
    void push_back(T&& arg) {
 | 
					    void push_back(T&& arg) {
 | 
				
			||||||
        m_workList.push_back(std::forward<T>(arg));
 | 
					        m_workList.push_back(std::forward<T>(arg));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * \brief Check if worklist is empty.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * \retval true if worklist is empty.
 | 
				
			||||||
 | 
					     * \retval false otherwise.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    bool empty() const { return m_workList.empty(); }
 | 
					    bool empty() const { return m_workList.empty(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // move constructor: pass in classes derived from UpdateCommand
 | 
					    // move constructor: pass in classes derived from UpdateCommand
 | 
				
			||||||
@@ -28,10 +52,30 @@ public:
 | 
				
			|||||||
    //  , m_workListIndex(0) {
 | 
					    //  , m_workListIndex(0) {
 | 
				
			||||||
    //}
 | 
					    //}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    unsigned nextExecIndex() const;
 | 
					    ///**
 | 
				
			||||||
 | 
					    // * \brief Put new work item into worklist.
 | 
				
			||||||
 | 
					    // *
 | 
				
			||||||
 | 
					    // */
 | 
				
			||||||
 | 
					    //unsigned nextExecIndex() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * \brief Put new work item into worklist.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    bool nextExec() const;
 | 
					    bool nextExec() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * \brief Put new work item into worklist.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * \param last
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    bool exec(bool last=false);
 | 
					    bool exec(bool last=false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * \brief Get current size of worklist.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * \retval Current size of worklist.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
    unsigned size() { return m_workList.size(); }
 | 
					    unsigned size() { return m_workList.size(); }
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user