You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/FITK_Interface/FITKInterfaceModel/FITKElementList.h

166 lines
4.7 KiB
C

/**
*
* @file FITKElementList.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*
*/
#ifndef __FITK_ELEMENTLIST_H__
#define __FITK_ELEMENTLIST_H__
#include "FITKInterfaceModelAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractObject.hpp"
#include <QList>
#include <QMap>
namespace Interface
{
class FITKAbstractElement;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
class FITKInerfaceModelAPI FITKElementList //: public Core::FITKAbstractObject
{
public:
/**
* @brief Construct a new FITKElementList object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
explicit FITKElementList() = default;
/**
* @brief Destroy the FITKElementList object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
virtual ~FITKElementList() = 0;
/**
* @brief
* @param[i] element
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
virtual void appendElement(FITKAbstractElement* element);
/**
* @brief ID
* @param[i] index
* @return int
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
int getEleIDByIndex(const int index);
/**
* @brief ID
* @param[i] id ID
* @return int
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
int getEleIndexByID(const int id) const;
/**
* @brief index
* @param[i] index
* @return FITKAbstractElement*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
FITKAbstractElement* getElementAt(const int index);
/**
* @brief ID
* @param[i] id ID
* @return FITKAbstractElement*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
FITKAbstractElement* getElementByID(const int id);
/**
* @brief
* @return int
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
int getElementCount();
/**
* @brief
* @param id ID
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-03
*/
virtual void reverseEleByID(const int id);
/**
* @brief
* @param index
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-04-03
*/
virtual void reverseEleByIndex(const int index);
template<class T>
/**
* @brief indexT
* @param[i] index
* @return T*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
T* getTElementAt(const int index)
{
return dynamic_cast<T*>(this->getElementAt(index));
}
template<class T>
/**
* @brief IDT
* @param[i] id id
* @return T*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
T* getTElementByID(const int id)
{
return dynamic_cast<T*>(this->getElementAt(id));
}
/**
* @brief id
* @return int
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-28
*/
int getElementMaxID();
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-28
*/
void removeAllElement();
protected:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
QList<FITKAbstractElement*> _elementList{};
/**
* @brief id
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-02-28
*/
QMap <int, int> _idIndexMap{};
/**
* @brief ID
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-22
*/
int _eleMaxID = 0;
};
}
#endif //