Skip to content

Commit

Permalink
Call initialize in the Pipeline public constructor (#94)
Browse files Browse the repository at this point in the history
* Encapsulate init in the aux constructor

* Make pipeline.initialize() private
  • Loading branch information
pomadchin authored Mar 18, 2024
1 parent ee46645 commit 6dc0715
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ String json =
var pipeline = new Pipeline(json, LogLevel.Error());
pipeline.initialize(); // initialize the pipeline
pipeline.execute(); // execute the pipeline
var metadata = pipeline.getMetadata(); // retrieve metadata
Expand Down
11 changes: 6 additions & 5 deletions core/src/main/scala/io/pdal/Pipeline.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ import com.github.sbt.jni.syntax.NativeLoader
class Pipeline private (val json: String, val logLevel: Int) extends Native {
Pipeline // reference companion object so nativeLoader loads the JNI native libraries

def this(json: String, logLevel: LogLevel.Value = LogLevel.Error) = this(json, logLevel.id)
def this(json: String, logLevel: LogLevel.Value = LogLevel.Error) = {
this(json, logLevel.id); initialize()
}

@native def initialize(): Unit
@native private def initialize(): Unit
@native def execute(): Unit
@native def getPointViews(): PointViewIterator
@native def close(): Unit
Expand All @@ -46,7 +48,6 @@ class Pipeline private (val json: String, val logLevel: Int) extends Native {
}

object Pipeline extends NativeLoader("pdaljni.2.6") {
def apply(json: String, logLevel: LogLevel.Value = LogLevel.Error): Pipeline = {
val p = new Pipeline(json, logLevel); p.initialize(); p
}
def apply(json: String, logLevel: LogLevel.Value = LogLevel.Error): Pipeline =
new Pipeline(json, logLevel)
}

0 comments on commit 6dc0715

Please sign in to comment.