Skip to content

Commit

Permalink
stringify reference count
Browse files Browse the repository at this point in the history
  • Loading branch information
FerroO2000 committed May 29, 2024
1 parent 94fc0af commit 555925e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions canid_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ func (b *CANIDBuilder) stringify(builder *strings.Builder, tabs int) {
for _, op := range b.operations {
op.stringify(builder, tabs+1)
}

refCount := b.ReferenceCount()
if refCount > 0 {
builder.WriteString(fmt.Sprintf("%sreference_count: %d\n", tabStr, refCount))
}
}

func (b *CANIDBuilder) String() string {
Expand Down
5 changes: 5 additions & 0 deletions signal_enum.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ func (se *SignalEnum) stringify(b *strings.Builder, tabs int) {
enumVal.stringify(b, tabs+1)
b.WriteRune('\n')
}

refCount := se.ReferenceCount()
if refCount > 0 {
b.WriteString(fmt.Sprintf("%sreference_count: %d\n", tabStr, refCount))
}
}

func (se *SignalEnum) String() string {
Expand Down
5 changes: 5 additions & 0 deletions signal_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ func (st *SignalType) stringify(b *strings.Builder, tabs int) {

b.WriteString(fmt.Sprintf("%skind: %s\n", tabStr, st.kind))
b.WriteString(fmt.Sprintf("%ssize: %d; signed: %t; min: %g; max: %g; scale: %g; offset: %g\n", tabStr, st.size, st.signed, st.min, st.max, st.scale, st.offset))

refCount := st.ReferenceCount()
if refCount > 0 {
b.WriteString(fmt.Sprintf("%sreference_count: %d\n", tabStr, refCount))
}
}

func (st *SignalType) String() string {
Expand Down
5 changes: 5 additions & 0 deletions signal_unit.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ func (su *SignalUnit) stringify(b *strings.Builder, tabs int) {

b.WriteString(fmt.Sprintf("%skind: %s\n", tabStr, su.kind))
b.WriteString(fmt.Sprintf("%ssymbol: %s\n", tabStr, su.symbol))

refCount := su.ReferenceCount()
if refCount > 0 {
b.WriteString(fmt.Sprintf("%sreference_count: %d\n", tabStr, refCount))
}
}

func (su *SignalUnit) String() string {
Expand Down

0 comments on commit 555925e

Please sign in to comment.