set final draft for package
[epclust.git] / epclust / R / utils.R
diff --git a/epclust/R/utils.R b/epclust/R/utils.R
new file mode 100644 (file)
index 0000000..8f7da38
--- /dev/null
@@ -0,0 +1,44 @@
+toInteger <- function(x, condition)
+{
+       if (!is.integer(x))
+               tryCatch(
+                       {x = as.integer(x)[1]},
+                       error = function(e) paste("cannot convert argument",substitute(x),"to integer")
+               )
+       if (!condition(x))
+               stop(paste("argument",substitute(x),"does not verify condition",body(condition)))
+       x
+}
+
+#TODO: merge these 2 next ?!
+serialize = function(coeffs)
+{
+       #.........
+       #C function (from data.frame, type of IDs ??! force integers ? [yes])
+       #return raw vector
+}
+appendBinary = function(.......)
+{
+       #take raw vector, append it (binary mode) to a file
+}
+
+#finalizeSerialization = function(...)
+#{
+#      #write number of series, and length of each...
+#}
+
+deserialize = function(coeffs, range)
+{
+       #......
+       #C function (from file name)
+}
+
+getSeries(data, rank=NULL, id=NULL)
+{
+       #TODO:
+}
+
+getCoeffs(.....) #FROM BINARY FILE !!!
+{
+
+}