From 3f8d62ebc483eebc11cbb95afc0f94b5a7371e8f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Thu, 27 Aug 2020 21:43:56 +0300 Subject: [PATCH] internal api refactoring --- dataforge-device-core/build.gradle.kts | 1 + .../commonMain/kotlin/hep/dataforge/control/base/Action.kt | 2 +- .../kotlin/hep/dataforge/control/base/DeviceBase.kt | 4 ++-- .../hep/dataforge/control/base/IsolatedDeviceProperty.kt | 4 ++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dataforge-device-core/build.gradle.kts b/dataforge-device-core/build.gradle.kts index af4a5ab..5d1a507 100644 --- a/dataforge-device-core/build.gradle.kts +++ b/dataforge-device-core/build.gradle.kts @@ -28,5 +28,6 @@ kotlin { dependencies{ } } + val nativeMain by getting{} } } \ No newline at end of file diff --git a/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/Action.kt b/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/Action.kt index 7b6099b..1c85dc8 100644 --- a/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/Action.kt +++ b/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/Action.kt @@ -28,7 +28,7 @@ class ActionDelegate( ) : ReadOnlyProperty { override fun getValue(thisRef: D, property: KProperty<*>): Action { val name = property.name - return owner.resolveAction(name) { + return owner.registerAction(name) { SimpleAction(name, ActionDescriptor(name).apply(descriptorBuilder), block) } } diff --git a/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/DeviceBase.kt b/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/DeviceBase.kt index 16a2ff5..a92a131 100644 --- a/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/DeviceBase.kt +++ b/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/DeviceBase.kt @@ -33,11 +33,11 @@ abstract class DeviceBase : Device { override val actionDescriptors: Collection get() = actions.values.map { it.descriptor } - internal fun resolveProperty(name: String, builder: () -> ReadOnlyDeviceProperty): ReadOnlyDeviceProperty { + internal fun registerProperty(name: String, builder: () -> ReadOnlyDeviceProperty): ReadOnlyDeviceProperty { return properties.getOrPut(name, builder) } - internal fun resolveAction(name: String, builder: () -> Action): Action { + internal fun registerAction(name: String, builder: () -> Action): Action { return actions.getOrPut(name, builder) } diff --git a/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/IsolatedDeviceProperty.kt b/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/IsolatedDeviceProperty.kt index e24ac17..eb8b8f4 100644 --- a/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/IsolatedDeviceProperty.kt +++ b/dataforge-device-core/src/commonMain/kotlin/hep/dataforge/control/base/IsolatedDeviceProperty.kt @@ -72,7 +72,7 @@ private class ReadOnlyDevicePropertyDelegate( override fun getValue(thisRef: D, property: KProperty<*>): IsolatedReadOnlyDeviceProperty { val name = property.name - return owner.resolveProperty(name) { + return owner.registerProperty(name) { @OptIn(ExperimentalCoroutinesApi::class) IsolatedReadOnlyDeviceProperty( name, @@ -186,7 +186,7 @@ private class DevicePropertyDelegate( override fun getValue(thisRef: D, property: KProperty<*>): IsolatedDeviceProperty { val name = property.name - return owner.resolveProperty(name) { + return owner.registerProperty(name) { @OptIn(ExperimentalCoroutinesApi::class) IsolatedDeviceProperty( name,