Skip to content

Commit cda5aec

Browse files
committed
OSCSerialization: Renamed oscValueType nomenclature to concreteType
1 parent ce56413 commit cda5aec

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

Sources/OSCKitCore/OSCSerialization/OSCSerialization.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,32 @@ public final class OSCSerialization {
1616

1717
/// Internal:
1818
/// Registered tag identities repository.
19-
var tagIdentities: [(identity: OSCValueTagIdentity, oscValueType: any OSCValueCodable.Type)] = []
19+
var tagIdentities: [(identity: OSCValueTagIdentity, concreteType: any OSCValueCodable.Type)] = []
2020

2121
/// Singleton init.
2222
private init() {
2323
// register default types synchronously so they are available immediately
24-
for oscValueType in Self.standardTypes {
24+
for concreteType in Self.standardTypes {
2525
tagIdentities.append(
26-
(oscValueType.oscTagIdentity, oscValueType: oscValueType.self)
26+
(concreteType.oscTagIdentity, concreteType: concreteType.self)
2727
)
2828
}
2929
}
3030

3131
/// Register a concrete type that conforms to ``OSCValueCodable`` to make it available for OSC
32-
/// encoding and decoding.
33-
public func registerType(_ oscValueType: any OSCValueCodable.Type) throws {
32+
/// encoding, decoding and value masking.
33+
public func registerType(_ concreteType: any OSCValueCodable.Type) throws {
3434
// throw an error if user attempts to register an already existing type tag
35-
try canRegisterType(oscValueType)
35+
try canRegisterType(concreteType)
3636

3737
// add type's tag identity
3838
tagIdentities.append(
39-
(oscValueType.oscTagIdentity, oscValueType.self)
39+
(concreteType.oscTagIdentity, concreteType.self)
4040
)
4141
}
4242

43-
private func canRegisterType(_ oscValueType: any OSCValueCodable.Type) throws {
44-
let staticTags = oscValueType
43+
private func canRegisterType(_ concreteType: any OSCValueCodable.Type) throws {
44+
let staticTags = concreteType
4545
.oscTagIdentity
4646
.staticTags()
4747

@@ -80,8 +80,8 @@ extension OSCSerialization {
8080
]
8181

8282
/// Internal:
83-
/// Returns tag identities for a given OSC-type tag character.
84-
func tagIdentities(for character: Character) -> [any OSCValueCodable.Type] {
83+
/// Returns concrete type(s) for a given OSC-type tag character.
84+
func concreteTypes(for character: Character) -> [any OSCValueCodable.Type] {
8585
tagIdentities
8686
.filter {
8787
switch $0.identity {
@@ -93,7 +93,7 @@ extension OSCSerialization {
9393
true
9494
}
9595
}
96-
.map { $0.oscValueType }
96+
.map { $0.concreteType }
9797
}
9898

9999
/// Internal:

Sources/OSCKitCore/OSCValueCodable/OSCMessageDecoder.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ enum OSCMessageDecoder {
8282
extractedValues: inout OSCValues,
8383
decoder: inout OSCValueDecoder
8484
) throws -> Int {
85-
let types = OSCSerialization.shared.tagIdentities(for: initialChar)
85+
let concreteTypes = OSCSerialization.shared.concreteTypes(for: initialChar)
8686
.compactMap { $0 as? (any OSCValue.Type) }
8787

88-
guard !types.isEmpty else {
88+
guard !concreteTypes.isEmpty else {
8989
throw OSCDecodeError.malformed(
9090
"No concrete type found to decode OSC type tag: \(initialChar)"
9191
)
@@ -94,11 +94,11 @@ enum OSCMessageDecoder {
9494
var tagsToAdvance = 0
9595

9696
var isTypeDecoded = false
97-
for type in types {
97+
for concreteType in concreteTypes {
9898
guard !isTypeDecoded else { continue }
9999

100100
if let decoded = try Self.decode(
101-
forType: type,
101+
forType: concreteType,
102102
char: initialChar,
103103
charStream: tags[currentTagIndex...],
104104
decoder: &decoder

0 commit comments

Comments
 (0)