The above two diagrams are contradicting. Can someone please clarify what is the correct class inheritence for this class? Below mentioned is the link for both in the sequential order
https://www.dvteclipse.com/uvm-1.2_Public_API/uvm_pkg-uvm_port_base.html
It is a little sneaky because both are true. Looking at the source, the first line declare uvm_port_base
virtual class uvm_port_base #(type IF=uvm_void) extends IF;
uvm_port_base inherits from IF, which is a parameter. Default value of IF is uvm_void.
For example, many TLM classes override the parameter with another class to extend from. For Example:
class uvm_blocking_put_export #(type T=int)
extends uvm_port_base #(uvm_tlm_if_base #(T,T));
uvm_tlm_if_base extends form uvm_if_base_abstract, which extends from uvm_report_object, which extends from uvm_object, which extends from uvm_void. Basically uvm_blocking_put_export still has uvm_void as a parent but it also got all the added functionality added by all the other parents. This redirected inheritance is a work around to multiple inheritance challenge for a language that can only support single inheritance*.
*As of the 2012 release, SystemVerilog added a multiple inheritance approach inspired/borrowed/similar-to Java's approach to the issue, by adding interface class and implements. However not all the major simulator vendor haven't implemented the improvement. I'm guessing UVM will eventually be overhauled and utilizes these features after simulator support for this feature is mainstream.
Related
One thing that always confuses me: is whether add uvm_component parent in the class constructor of UVM objects or not.
As I understood for all items inherited from uvm_component, they all need uvm_component parent as part of constructor input argument.
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction
But all classes inheretied from uvm_object, they dont need.
My question is why?
Per my understanding we are providing uvm_component parent for factory can replace these objects, why uvm_object inherited class dont need to be replaced by factory?
And one more interesting fact I noticed for uvm_sequence: so uvm_sequence constructor does nor require uvm_component parent attribute, but when we create the sequence by factory we provide the parent argument.
The reason why the constructor of a class derived from uvm_component needs to know its parent is because classes derived from uvm_component are part of the infrastructure of your test environment; that test environment has hierarchy and each component needs to know where it sits in that hierarchy. (For example, the configuration database uses the component hierarchy.)
Classes derived from uvm_object are not part of the the infrastructure of your test environment; they are data that flows through it.
In UVM, there are mainly 3 types of classes.
uvm_component - For class based hierarchical testbench structure
uvm_object - Data structures for testbench configuration
uvm_transaction - Stimulus generation & analysis
The values of the arguments of new method are used to create an entry in a linked list which the UVM uses to locate uvm_components in a pseudo hierarchy, this list is used in the messaging and configuration mechanisms. So ideally, while creating the components through create methods, the name argument string should be the same as the declaration handle of the component and the parent argument should be the keyword "this" so that it refers to the uvm_component in which the component is being created.
uvm_object class does not require such things, because it is not used to make the hierarchy of the testbench. And uvm_sequence is also derived from uvm_object only.
uvm_object -> uvm_transaction -> uvm_sequence_item ->
uvm_sequence_base -> uvm_sequence
Per my understanding we are providing uvm_component parent for factory
can replace these objects, why uvm_object inherited class dont need to
be replaced by factory?
I think you are a little confused about parent and base classes.
In the UVM test hierarchy, a parent class is the class that is one level above in the test heirarchy. For example:
uvm_test is the parent of uvm_env
uvm_env is the parent of uvm_agent
uvm_agent is the parent of uvm_driver, uvm_sequencer, uvm_monitor
This is the parent you specify when instantiating child uvm components. It is needed for the config db, build phasing, check phasing, etc etc.
Now, on the other hand, base classes are an OOP concept. You can extend a base class and add on functionality to it. So for example, you may have something like:
my_agent_base extends uvm_agent (uvm_agent is base class, my_agent_base is derived)
my_agent_derived1 extends my_agent_base
my_agent_derived2 extends my_agent_base
If you register all these components with the factory, it allows you to override my_agent_base with my_agent_derived1. This allows for swapping-in-and-out of components with different behaviour in your testbench.
You can do this with uvm_components and uvm_objects, no problem. The only requisite is your register them with the factory.
Normally, uvm_objects are dynamic objects created and destroyed during a test multiple times.
uvm_components persist for the entire duration of the test and have phases of execution.
Hope this helps
Whenever I extend two interfaces from the same interface, in the diagram, it creates separate arrows. I just want a single arrow with branching like this.
Is there any script in PlantUML to do this?
The set of tools - GraphViz - used by PlantUML is primarily for drawing graphs (i.e. nodes and edges); hence the individual realization relationships.
While showing realizations as such is useful at times for depicting interface hierarchies, diagrams can quickly become a "rat's nest" of relationships, potentially obscuring the bigger picture.
You might consider preferring the use of the short-hand "Lollipop" notation to indicate realizations of an interface. For example,
Layout can be a bit tricky at times if you want to show interface details in the same diagram. The script to produce the above is as follows:
#startuml
together {
interface Widget {
callFred()
callBarney()
}
class A
class B
class C
}
Widget ()- A
Widget ()- B
Widget ()- C
#enduml
If you just want two inheriting entities to share an arrow, you can connect the second to the line connecting the first entity to its generalization:
class Entity
class Generalization
class OtherEntity
Generalization <|-- Entity
(Entity, Generalization) -- OtherEntity
Unfortunately if you try this for more it generates more lines so doesn't work. Eg.
class Entity
class Generalization
class OtherEntity
Generalization <|-- Entity
(Entity, Generalization) -- OtherEntity
class AnotherEntity
(Entity, Generalization) -- AnotherEntity
gives this:
which isn't what we want.
I am working on a ClojureScript wrapper for qx.mobile and would like to programmatically build a cljs type hierarchy mirroring the qx class hierarchy.
Is there a way to get all the subclasses of a qooxdoo class?
How about a programmatic way to query the superclass of a class?
I am already putting qx.Class.getProperties to good use.
Thx, kt
The programmatic way of getting the superclass of a given class is documented at http://demo.qooxdoo.org/current/apiviewer/#qx.Class
<classname>.superclass
or getting the name of the superclass as a string
<classname>.superclass.classname
which means that e.g.
qx.ui.core.Widget.superclass.classname
will return the string "qx.ui.core.LayoutItem".
Regarding the programmatic way to retreive all subclasses of a class:
This is currently not possible without iterating the whole class hierarchy/tree and testing the objects against being subclasses of the given class.
We discussed at https://gitter.im/qooxdoo/qooxdoo that it maybe would be usefull to create an array for each class holding the subclasses. This could be added to the code of the private method __createClass in qx.Class.
We would like to encourage everyone who needs this (or other) functionalities to join us on https://github.com/qooxdoo/qooxdoo/ and help extending qooxdoo by creating a pull requests. Thank you.
After digging arround a bit in qx.Class we decided to implement a method qx.Class.getSubclasses which returns a hash object with all subclasses of a given class.
var subclasses = qx.Class.getSubclasses(qx.ui.core.Widget);
gets all subclasses of qx.ui.core.Widget.
Landed in qooxdoo master with commit https://github.com/qooxdoo/qooxdoo/pull/9037
I want to know what is wrapper class in salesforce and a scenario of using wrapper class with simple exapmle.??
I would say check it here and RTFM:
http://wiki.developerforce.com/page/Wrapper_Class
A wrapper or container class is a class, a data structure, or an
abstract data type whose instances are collections of other objects.
In Apex and Visualforce this type of class can be extremely useful but
to a new developer the talk of wrapper classes may fly right over your
head, it definitely did for me. Here I will supply a simple demo of
how wrapper classes can be used.
When using FxCop 1.36 for a WPF application with a single window that has yet to be modified, I get the InterfaceMethodsShouldBeCallableByChildTypes error with the following details:
Target : #System.Windows.Markup.IComponentConnector.Connect(System.Int32,System.Object) (IntrospectionTargetMember)
Resolution : "Make 'MainWindow' sealed (a breaking change if
this class has previously shipped), implement the method
non-explicitly, or implement a new method that exposes
the functionality of 'IComponentConnector.Connect(int,
object)' and is visible to derived classes."
Help : http://msdn2.microsoft.com/library/ms182153(VS.90).aspx (String)
Category : Microsoft.Design (String)
CheckId : CA1033 (String)
RuleFile : Design Rules (String)
Info : "Explicit method implementations are defined with private
accessibility. Classes that derive from classes with
explicit method implementations and choose to re-declare
them on the class will not be able to call into the
base class implementation unless the base class has
provided an alternate method with appropriate accessibility.
When overriding a base class method that has been hidden
by explicit interface implementation, in order to call
into the base class implementation, a derived class
must cast the base pointer to the relevant interface.
When calling through this reference, however, the
derived class implementation will actually be invoked,
resulting in recursion and an eventual stack overflow."
Created : 08/12/2008 22:26:37 (DateTime)
LastSeen : 08/12/2008 22:41:05 (DateTime)
Status : Active (MessageStatus)
Fix Category : NonBreaking (FixCategories)
}
Should this simply be ignored?
Ignore it, this is standard code that is in every WPF application and you don't see people complaining about net being able to call IComponentConnector.Connect from derived classes - so it's probably safe.
In general I think you should handle FxCop output as suggestions that have to be considered carefully, I've got a lot of bad advice from FxCop in the past.
Depends on what you expect an inheriter to do.
If you are not expecting this class to be inherited then it should be sealed and the problem goes away.
If you are expecting it to be inherited then you are taking the ability of the inheriting class to override the interface methods and still call them (i.e. base.methodname()). If that is your intent then you can ignore the warning.
However, that is not expected behaviour for inheritable classes so you should expose the interface publicly (i.e. An implicit interface instead of an explicit interface).