我如何获得UVM工厂的处理?

时间:2016-01-05 14:36:57

标签: uvm

我想获得一个UVM工厂的句柄,以便使用set_type_override_by_name()等功能。

2 个答案:

答案 0 :(得分:1)

UVM工厂使用单件设计模式来提供手柄。你使用静态get()方法得到一个句柄。

CustomListWidgetItem::CustomListWidgetItem(const QIcon &icon, const QString &text, QListWidget *parent, int type) : QListWidgetItem(icon,text,parent,type)
{

}

CustomListWidgetItem::CustomListWidgetItem(const int& id,QString Name,QString Description,QString icon)
{
    this->Id = id;
    this->Name = Name;
    this->Description = Description;
    this->Icon = icon;

    QString iconPath = QCoreApplication::applicationDirPath() + "/" + icon + ".png";
    QIcon qIcon(iconPath);
    QListWidgetItem::QListWidgetItem(qIcon,Name);
}

答案 1 :(得分:1)

您可以直接使用set_type_override_by_name方法,而无需使用uvm_factory句柄。

对于uvm_factory句柄 -

但是,如果你想拥有uvm_factory类句柄,那么你可以使用uvm_coreservice_t类来获取uvm_factory句柄。

  

uvm_coreservice_t的单例实例提供了一个共同点   对于所有中央uvm服务,例如uvm_factory,uvm_report_server   等等。

     

服务类提供静态< :: get>返回   一个坚持uvm_coreservice_t的实例。剩下的   set_ get_ pairs提供对内部uvm的访问   服务

获取uvm_factory句柄:

uvm_coreservice_t cs = uvm_coreservice_t::get();                                                     
uvm_factory factory = cs.get_factory();
factory.set_type_override_by_name(original_type_name,override_type_name, replace);

有关详细信息,请访问http://sourceforge.net/p/uvm/code/ci/UVM_1_2_RELEASE/tree/distrib/src/base/uvm_coreservice.svh

相关问题