Differences

This shows you the differences between two versions of the page.

Link to this comparison view

gnucap:manual:tech:plugins:devices:allocation_and_setup [2023/01/05 14:48]
felixs wording
gnucap:manual:tech:plugins:devices:allocation_and_setup [2026/02/09 09:55] (current)
felixs common comparison operators
Line 56: Line 56:
 Map the user node names to internal node numbers.  Almost always, the inherited function does what is needed, which is to loop over all nodes (both ports and internal) and call their "map" function, and recursively map subcircuits. Map the user node names to internal node numbers.  Almost always, the inherited function does what is needed, which is to loop over all nodes (both ports and internal) and call their "map" function, and recursively map subcircuits.
  
 +===== Shared Data =====
 +
 +Similar devices (of type derived from COMPONENT) may share data in a container derived from COMMON_COMPONENT. Generally, a COMMON_COMPONENT consists of the data that two devices have "in common". This includes parameters and device independent evaluation data or caches. The COMPONENT class forwards relevant calls to the common attached to the instance, and overrides are not always needed.
 +
 +==== COMPONENT interface ====
 +
 +== COMPONENT::COMPONENT(COMMON_COMPONENT* c) ==
 +
 +Construct a device with a COMMON_COMPONENT attached to it. This should only be used to create static instances or primary copies.
 +
 +== COMPONENT::attach_common(COMMON_COMPONENT*) ==
 +
 +Set or replace the shared data attached to a device instance. Also, takes care of deleting unused COMMON_COMPONENTS, in particular, a call may destroy the object pointed to by the argument.
 +
 +== COMPONENT::detach_common() ==
 +
 +Shorthand for attach_common(nullptr). May destroy the COMMON_COMPONENT previously attached, unless used elsewhere.
 +
 +==== COMMON_COMPONENT interface ====
 +
 +== COMMON_COMPONENT::COMMON_COMPONENT(int i=0) ==
 +
 +Construct a COMMON_COMPONENT. Pass i = CC_STATIC when creating a static object. Static objects won't be deleted when they are not used. NB: deleting a static instance is not possible.
 +
 +== COMMON_COMPONENT::attach_next(COMMON_COMPONENT*), detach_next() ==
 +
 +COMMON_COMPONENTS may share data. The attach/detach mechanism is identical to the one in COMPONENT.
 +
 +== virtual bool COMMON_COMPONENT::operator==(COMMON_COMPONENT const& X) ==
 +
 +Return ''true'' if ''*this'' is indistinguishable from the argument ''X''. When overloading, do not forget to query the base class.
 +
 +== virtual bool COMMON_COMPONENT::has_less()const ==
 +
 +Indicate whether this class provides ''operator<'' to find the unique memory location for each object (or an equivalent copy). Leave alone unless ''operator<'' is actually implemented.
 +
 +== virtual int COMMON_COMPONENT::compare(COMMON_COMPONENT const& X)const ==
 +
 +Compare ''*this'' with ''X''. A negative value indicates ''<'', a positive means ''>''. This is semantically equivalent to three-way-comparison ''operator<=>'' introduced in C++20. We only support total (aka. strong) ordering.
 +
 +== virtual bool COMMON_COMPONENT::operator<(COMMON_COMPONENT const&)const ==
 +
 +Return ''true'' if callee is "smaller" than the argument. Here, "smaller" refers to the storage location e.g. in an std::set. When overloading, do not forget to query "compare" of the respective base class.
gnucap/manual/tech/plugins/devices/allocation_and_setup.1672951711.txt.gz · Last modified: 2023/01/05 14:48 by felixs
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Run by Debian Driven by DokuWiki