.packageName <- "sg"
# The purpose of this file is to supply no functionality
# except easier access functions in R for external C 
# function calls. 
#
# For example instead of typing
#
#     > .External("sg", "send_command", "blah")
#
# one can simply type
#
#     > send_command(blah)
#
# where > is the R prompt.

# interface sg(arg1,arg2,...) as w/ matlab/octave/python
#
sg <- function(...) .External("sg",...,PACKAGE="sg")


# R specific interface

# Generic functions
#
send_command <- function(x) .External("sg","send_command",x,PACKAGE="sg")
set_features <- function(x,y) .External("sg","set_features",x,y,PACKAGE="sg")
add_features <- function(x,y) .External("sg","add_features",x,y,PACKAGE="sg")
set_labels <- function(x,y) .External("sg","set_labels", x,y,PACKAGE="sg")
get_kernel_matrix <- function() .External("sg","get_kernel_matrix",PACKAGE="sg")

# SVM functions
#
svm_classify <- function() .External("sg","svm_classify",PACKAGE="sg")
get_svm <- function() .External("sg","get_svm",PACKAGE="sg")
get_subkernel_weights <- function() .External("sg","get_subkernel_weights",PACKAGE="sg") 

# HMM functions
#
get_hmm <- function() .External("sg","get_hmm",PACKAGE="sg")

# Load the shogun dynamic library at startup.
#
.First.lib <- function(lib,pkg)
{
	cat(paste("\nWelcome! This is SHOGUN version 0.6.3\n"))
	library.dynam("sg",pkg,lib)
}

# Unload the library.
#
.Last.lib <- function(lib) library.dynam.unload("sg", libpath=lib) 

# Because in packages with namespaces .First.lib will not be loaded
# one needs another functions called .onLoad resp. .onUnload
#

.onLoad <- function(lib, pkg) .First.lib(lib,pkg)
.onUnload <- function(lib) .Last.lib(lib)

# a nice banner
#
.onAttach <- function(lib, pkg) cat(paste("\nWelcome! This is SHOGUN version 0.6.3\n"))
