AbstractComponent
Architecture blocks are modelled as a subtype of AbstractComponent
. There are two main subtypes: Component
, which represents all blocks that are not at the top level of an architecture model, and TopLevel
. There is only TopLevel
per architecture model.
Mapper2.MapperCore.getaddress
— Function.getaddress(item)
Single argument version: Return an address encapsulated in item
.
getaddress(item, index)
Get an address from item
referenced by index
.
Method List
getaddress(toplevel, path)
defined at /home/travis/build/hildebrandmw/Mapper2.jl/src/Architecture/Architecture.jl:324
.
getaddress(toplevel, str)
defined at /home/travis/build/hildebrandmw/Mapper2.jl/src/Architecture/Architecture.jl:325
.
getaddress(map, nodename)
defined at /home/travis/build/hildebrandmw/Mapper2.jl/src/Map/Map.jl:87
.
Mapper2.MapperCore.check
— Function.check(c::AbstractComponent)
Check a component for ports that are not connected to any link. Only applies to ports visible to the level of hierarchy of c
. That is, children of c
will not be checked.
Returns a Vector{PortPath}
of unused ports.
Mapper2.MapperCore.children
— Function.Return an iterator for the children within a component.
Base.getindex
— Function.getindex(component, path::Path{T})::T where T <: Union{Port,Link,Component}
Return the architecture type referenced by path
. Error horribly if path
does not exist.
getindex(toplevel, address)::Component
Return the top level component of toplevel
at address
.
Mapper2.MapperCore.links
— Function.Return an iterator for links within the component.
Mapper2.MapperCore.walk_children
— Function.walk_children(component::AbstractComponent, [address]) :: Vector{Path{Component}}
Return relative paths to all the children of component
. If address
is given return relative paths to all components at address
.
Mapper2.MapperCore.search_metadata
— Function.search_metadata(c::AbstractComponent, key, value, f::Function = ==)
Search the metadata of field of c
for key
. If c.metadata[key]
does not exist, return false
. Otherwise, return f(value, c.metadata[key])
.
Mapper2.MapperCore.search_metadata!
— Function.search_metadata!(c::AbstractComponent, key, value, f::Function = ==)
Call search_metadata
on each subcomponent of c
. Return true
if function call return true
for any subcomponent.
Mapper2.MapperCore.visible_ports
— Function.visible_ports(component::AbstractComponent)
Return Vector{PortPath}
of the ports of component
and the ports of the children of component
.
Component
Mapper2.MapperCore.Component
— Type.struct Component <: AbstractComponent
Fields
name
primitive
children
Sub-components of this component. Indexed by instance name.
ports
Ports instantiated directly by this component. Indexed by instance name.
links
Links instantiated directly by this component. Indexed by instance name.
portlink
Record of the
Link
(by name) attached to aPort
, keyed byPath{Port}
. Length of eachPath{Port}
must be 1 or 2, to reference ports either instantiated by this component directly, or by one of this component's immediate children.j
metadata
Dict{String,Any}
for holding any extra data needed by the user.
Documentation
Basic building block of architecture models. Can be used to construct hierarchical models.
Method List
Component(name, primitive, children, ports, links, portlink, metadata)
Component(name, primitive, children, ports, links, portlink, metadata)
defined at /home/travis/build/hildebrandmw/Mapper2.jl/src/Architecture/Architecture.jl:126
.
Component(name; primitive, metadata)
defined at /home/travis/build/hildebrandmw/Mapper2.jl/src/Architecture/Architecture.jl:154
.
The following methods apply only to concrete [Component
] types:
Mapper2.MapperCore.ports
— Function.ports(component, [classes])
Return an iterator for all the ports of the given component. Ports of children are not given. If classes
are provided, only ports matching the specified classes will be returned.
Mapper2.MapperCore.portpaths
— Function.portpaths(component, [classes])::Vector{Path{Port}}
Return Path
s to all ports immediately instantiated in component
.
TopLevel
Mapper2.MapperCore.TopLevel
— Type.struct TopLevel{D} <: AbstractComponent
Fields
name
children
Direct children of the
TopLevel
, indexed by instance name.child_to_address
Translation from child instance name to the
Address
that child occupies.address_to_child
Translation from
Address
to theComponent
at that address.links
Link
s instantiated directly by theTopLevel
.portlink
Record of which
Link
s are attached to whichPort
s. Indexed by `Path{Port}.metadata
Documentation
Top level component for an architecture mode. Main difference is between a TopLevel
and a Component
is that children of a TopLevel
are accessed via address instead of instance name. A TopLevel
also does not have any ports of its own.
Parameter D
is the dimensionality of the TopLevel
.
Method List
The following methods apply only TopLevel
types:
Mapper2.MapperCore.addresses
— Function.addresses(toplevel)
Return an iterator of all addresses with subcomponents in toplevel
.
Mapper2.MapperCore.hasaddress
— Function.hasaddress(toplevel, path)
Return true
if the item referenced by path
has an Address
.
Mapper2.MapperCore.isaddress
— Function.isaddress(toplevel, address)
Return true
if address
exists in toplevel
.
Mapper2.MapperCore.connected_components
— Function.connected_components(toplevel::TopLevel{A,D})::Dict{Address{D}, Set{Address{D}}
Return d
where key k
is a valid address of tl
and where d[k]
is the set of valid addresses of tl
whose components are the destinations of links originating at address k
.
Mapper2.MapperCore.mappables
— Function.mappables(a::TopLevel{D}, address::Address{D})
Return a Vector{Path{Component}}
of paths to mappable components at address
.
Mapper2.MapperCore.isconnected
— Function.isconnected(toplevel, a::AbstractPath, b::AbstractPath)
Return true
if architectural component referenced by path a
is architecturally connected to that referenced by path b
.
The order of the arguments is important for directed components. For example, if a
references a port that is a source for link b
in toplevel
, then
julia> isconnected(toplevel, a, b)
true
julia> isconnected(toplevel, b, a)
false
If one of a
or b
is of type ComponentPath
, then only ports are considered connected.