LCOV - code coverage report
Current view: top level - src - vattr.jl (source / functions) Hit Total Coverage
Test: on branch nothing Lines: 6 6 100.0 %
Date: 2025-07-10 13:12:25 Functions: 0 0 -

          Line data    Source code
       1             : # TODO "cache type" w/ update (in case of Dict)
       2             : # define update_cache! ...
       3             : #
       4             : # mutable struct VAttrDict <: AbstractVAttr
       5             : #     attr::Attributes
       6             : #     flags::Attribute{FlagsType, VHnd}
       7             : #     rnk::Attribute{Int, VHnd}
       8             : #     idx::Attribute{Int, VHnd}
       9             : #     n_used::Int
      10             : # end
      11             : 
      12             : """
      13             : Abstract vertex attributes.
      14             : 
      15             : Vertex attributes like [`VAttr`](@ref) are declared a a subtype.
      16             : """
      17             : abstract type AbstractVAttr <: ManagedAttributes{VHnd}; end
      18             : 
      19             : """
      20             : Vertex attributes consisting of  managed attributes `P` plus cached state.
      21             : """
      22             : mutable struct VAttr{P} <: AbstractVAttr
      23             :     const attrs::P
      24             :     n_used::Int
      25          65 :     VAttr{P}(attrs::P, n = 0) where {P} = new(attrs, n)
      26             : end
      27             : 
      28         122 : _newvattr(va::P, n = 0) where {P} = VAttr{P}(va, n)
      29             : 
      30             : 
      31             : # #  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      32             : # attrs(va::VAttr{P}) where {P} = va.attrs
      33             : # attrs(va::VAttr{P}, name::Symbol) where {P} = va.attrs[name]
      34             : # # attrs(va::VAttr{P}, name::Val{S}) where {P, S} = va.attrs[S]
      35             : 
      36             : # TODO: Val(...), Symbol -> ...., ... wrap for dynamic ...
      37             : 
      38             : 
      39             : 
      40             : """
      41             :     va2 = similar(va::VAttr)
      42             : 
      43             : Create same attribute list as `va` but empty: without entries.
      44             : """
      45          91 : Base.similar(va::VAttr) =
      46             :     _newvattr(createattributes(attrspecs(attrs(va)); htyp=VHnd))
      47             : 
      48             : 
      49             : const VertexAttributesSpecs = (ManagedAttributesSpecs...,
      50             :                                :_link => specifyattr(HHnd, enabled=true, x0=NoH))
      51             : 
      52           4 : createvattr(list...) =
      53             :     _newvattr(createattributes((VertexAttributesSpecs..., list...); htyp=VHnd))
      54             : 
      55           1 : createvattr(list::Tuple) = createvattr(list...)
      56             : 
      57             : """
      58             :     createvattr(key => value, ...)
      59             :     createvattr((key => value, ...))
      60             : 
      61             : Create vertex attribute list from `key => value` pairs, where `key` is a `Symbol` and
      62             : `value` either a type or the result from `specifyattr`.
      63             : 
      64             : Example:
      65             : 
      66             :     va = createvattr(:x => SVector{3, Float64}, :n => SVector{3, Float64})
      67             : 
      68             : See also [`similar`](@ref)
      69             : """ createvattr
      70             : 
      71             : """
      72             :     vc = clone(va::VAttr)
      73             : 
      74             : Deep copy of attribute list but don't copy disabled attributes.
      75             : """
      76           4 : clone(va::VAttr{P}) where {P} = VAttr{P}(clone(va.attrs), va.n_used)
      77             : 
      78             : 
      79             : # TODO ma[name] short for attrs(ma, name)
      80             : 
      81             : # other attr
      82             : 
      83             : 
      84             : # TODO: same (cache) for others
      85             : 
      86             : # TODO: compact, compact! (gc) -- mesh

Generated by: LCOV version 1.16