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_Kernel/FITKAppFramework/FITKComponents.h

99 lines
2.7 KiB
C

/**
*
* @file FITKComponents.h
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*
*/
#ifndef __FITK_COMPONENTS_H__
#define __FITK_COMPONENTS_H__
#include "FITKAppFrameworkAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractObject.hpp"
#include <QList>
namespace AppFrame
{
class FITKComponentFactory;
class FITKComponentInterface;
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
class FITKAppFrameworkAPI FITKCmponents : public Core::FITKAbstractObject
{
friend FITKComponentFactory;
public:
/**
* @brief Construct a new FITKCmponents object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
explicit FITKCmponents() = default;
/**
* @brief Destroy the FITKCmponents object
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
~FITKCmponents();
/**
* @brief
* @return int
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
int getComponentCount() const;
/**
* @brief
* @param[i] index
* @return FITKComponentInterface*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
FITKComponentInterface* getComponentAt(const int index);
/**
* @brief
* @param[i] compName
* @return FITKComponentInterface*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
FITKComponentInterface* getComponentByName(const QString& compName);
template<class T>
/**
* @brief
* @param[i] compName
* @return T*
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
T* getComponentTByName(const QString& compName)
{
return dynamic_cast<T*> (this->getComponentByName(compName));
}
private:
/**
* @brief
* @param[i] comp
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
void addComponent(FITKComponentInterface* comp);
private:
/**
* @brief
* @author LiBaojun (libaojunqd@foxmail.com)
* @date 2024-03-04
*/
QList<FITKComponentInterface*> _components;
};
}
#endif