Skip to content

Commit

Permalink
Working basics
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanKierans committed Jan 16, 2024
1 parent 31fc101 commit a1c7e8d
Show file tree
Hide file tree
Showing 20 changed files with 336 additions and 157 deletions.
8 changes: 6 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Generated by roxygen2: do not edit by hand

export(rTest_evtWriter_Write)
export(rTest_finalize)
export(rTest_finalize_Archive)
export(rTest_finalize_EvtWriter)
export(rTest_globalDefWriter_WriteLocation)
export(rTest_globalDefWriter_WriteRegions)
export(rTest_globalDefWriter_WriteStrings)
export(rTest_globalDefWriter_WriteSystemTreeNode)
export(rTest_helloWorld)
export(rTest_init)
export(rTest_init_Archive)
export(rTest_init_EvtWriter)
export(rTest_init_GlobalDefWriter)
exportPattern("^[[:alpha:]]+")
importFrom(Rcpp,evalCpp)
Expand Down
1 change: 0 additions & 1 deletion R/Makefile.bak

This file was deleted.

67 changes: 63 additions & 4 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,30 +1,89 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

#' @file rTest.cpp
#' @brief Rcpp functions for underlying otf2 library
#' @date 2024-01-16
#' @version 0.01
#' @author D.Kierans ([email protected])
#' @todo Error checking
NULL

#' @brief This example uses a function delivering dummy timestamps
#' @return sequence - Next integer in sequence
NULL

#' @brief Simple hello world function streaming to Rcout
#' @return R_NilValue
helloWorld <- function() {
.Call('_rTest_helloWorld', PACKAGE = 'rTest')
}

init <- function() {
.Call('_rTest_init', PACKAGE = 'rTest')
#' @brief Initialize static otf2 {archive} objs
#' @return R_NilValue
init_Archive <- function() {
.Call('_rTest_init_Archive', PACKAGE = 'rTest')
}

#' @brief Close static otf2 {archive, evt_writer} objs
#' @return R_NilValue
finalize_Archive <- function() {
.Call('_rTest_finalize_Archive', PACKAGE = 'rTest')
}

#' @brief Initialize static otf2 {evt_writer} objs
#' @return R_NilValue
init_EvtWriter <- function() {
.Call('_rTest_init_EvtWriter', PACKAGE = 'rTest')
}

simple_finalize <- function() {
.Call('_rTest_simple_finalize', PACKAGE = 'rTest')
#' @brief Close static otf2 {evt_writer} objs
#' @return R_NilValue
finalize_EvtWriter <- function() {
.Call('_rTest_finalize_EvtWriter', PACKAGE = 'rTest')
}

#' @brief Init static otf2 {globaldefwriter} obj
#' @return R_NilValue
init_GlobalDefWriter <- function() {
.Call('_rTest_init_GlobalDefWriter', PACKAGE = 'rTest')
}

#' @brief Define new id-value pair in globaldefwriter
#' @param stringRef id/index for stringRef
#' @param stringRefValue String assigned to given id
#' @return R_NilValue
globalDefWriter_WriteString <- function(stringRef, stringRefValue) {
.Call('_rTest_globalDefWriter_WriteString', PACKAGE = 'rTest', stringRef, stringRefValue)
}

#' @brief Define new region description in global writer
#' @param regionRef id/index for string
#' @param stringRef_name Name to be associated with region
#' @return R_NilValue
globalDefWriter_WriteRegion <- function(regionRef, stringRef_name) {
.Call('_rTest_globalDefWriter_WriteRegion', PACKAGE = 'rTest', regionRef, stringRef_name)
}

#' @brief Write the system tree including a definition for the location group to the global definition writer.
#' @param stringRef_name Name to be associated with SystemTreeNode (eg MyHost)
#' @param stringRef_class Class to be associated with SystemTreeNode (eg node)
#' @return R_NilValue
globalDefWriter_WriteSystemTreeNode <- function(stringRef_name, stringRef_class) {
.Call('_rTest_globalDefWriter_WriteSystemTreeNode', PACKAGE = 'rTest', stringRef_name, stringRef_class)
}

#' @brief Write a definition for the location to the global definition writer.
#' @param stringRef_name Name to be associated with SystemTreeNode (eg MyHost)
#' @return R_NilValue
globalDefWriter_WriteLocation <- function(stringRef_name) {
.Call('_rTest_globalDefWriter_WriteLocation', PACKAGE = 'rTest', stringRef_name)
}

#' @brief Write event to evt_writer
#' @param regionRef Region id
#' @param event_type True for enter, False for leave region
#' @return R_NilValue
evtWriter_Write <- function(regionRef, event_type) {
.Call('_rTest_evtWriter_Write', PACKAGE = 'rTest', regionRef, event_type)
}
Expand Down
14 changes: 14 additions & 0 deletions R/helloWorld.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#' @file helloWorld.R
#' @brief Wrapper for simple helloWorld function
#' @version 0.01
#' @author D.Kierans ([email protected])
#' @date 2024-01-16

#' rTest_helloWorld - doxygen documentation
#' Simple wrapper for C++ hello world function
#' @export
rTest_helloWorld <- function() {
cat("Entering wrapper\n")
helloWorld()
cat("Finished function.\n")
}
25 changes: 25 additions & 0 deletions R/otf2_archive.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#' @file otf2_archive
#' @brief Wrapper for OTF2_Archive functions
#' @version 0.01
#' @author D.Kierans ([email protected])
#' @date 2024-01-16

#' rTest_init_Archive- doxygen documentation
#' Simple wrapper for C++ otf2 init function
#' @export
rTest_init_Archive <- function() {
cat("Entering wrapper\n")
init_Archive()
cat("Finished function.\n")
}

#' rTest_finalize_Archive- doxygen documentation
#' Simple wrapper for C++ otf2 init function
#' @export
rTest_finalize_Archive <- function() {
cat("Entering wrapper\n")
finalize_Archive()
cat("Finished function.\n")
}


35 changes: 35 additions & 0 deletions R/otf2_evtWriter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#' @file otf2_evtWriter.R
#' @brief Wrapper for OTF2_EvtWriter functions
#' @version 0.01
#' @author D.Kierans ([email protected])
#' @date 2024-01-16

#' rTest_init_ - doxygen documentation
#' Simple wrapper for C++ otf2 init function
#' @export
rTest_init_EvtWriter <- function() {
cat("Entering wrapper\n")
init_EvtWriter()
cat("Finished function.\n")
}

#' rTest_finalize_Archive- doxygen documentation
#' Simple wrapper for C++ otf2 init function
#' @export
rTest_finalize_EvtWriter <- function() {
cat("Entering wrapper\n")
finalize_EvtWriter()
cat("Finished function.\n")
}


#' rTest_evtWriter_Write - doxygen documentation
#' More info
#' @param regionRef Int - regionRef
#' @param event_type Bool - True if enter, False if exit
#' @export
rTest_evtWriter_Write <- function(regionRef, event_type) {
cat("Entering wrapper:\n")
evtWriter_Write(regionRef, event_type)
cat("Finished wrapper.\n")
}
70 changes: 70 additions & 0 deletions R/otf2_globalDefWriter.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#' @file OTF2_GlobalDefWriter.R
#' @brief Wrapper for OTF2_GlobalDefWriter functions
#' @version 0.01
#' @author D.Kierans ([email protected])
#' @date 2024-01-16

#' init_GlobalDefWriter - doxygen documentation
#' More info
#' @export
rTest_init_GlobalDefWriter <- function() {
cat("Entering wrapper\n")
init_GlobalDefWriter()
cat("Finished wrapper.\n")
}

#' globalDefWriter_WriteStrings - doxygen documentation
#' More info
#' @param stringRef_array Int[] - Index list for stringRef's
#' @param stringRefValue_array String[] - String list for globalDefWriter
#' @export
rTest_globalDefWriter_WriteStrings <- function(stringRef_array, stringRefValue_array) {
cat("Entering wrapper\n")
for ( i in 1:length(stringRef_array) ){
stringRef <- stringRef_array[i]
stringRefValue <- stringRefValue_array[i]
globalDefWriter_WriteString(stringRef, stringRefValue)
}
cat("Finished wrapper.\n")
}


#' globalDefWriter_WriteRegions - doxygen documentation
#' More info
#' @param regionRef_array Int[] - Index list for regionReg's
#' @param regionRefName_array Int[] - Index list for names, taken from stringRef's
#' @export
rTest_globalDefWriter_WriteRegions <- function(regionRef_array, regionRefName_array) {
cat("Entering wrapper\n")
for ( i in 1:length(regionRef_array) ){
regionRef <- regionRef_array[i]
regionRefName <- regionRefName_array[i]
globalDefWriter_WriteRegion(regionRef, regionRefName)
}
cat("Finished wrapper.\n")
}

#' globalDefWriter_WriteSystemTreeNode - doxygen documentation
#' More info
#' @param stringRef_name Int - Index for name of system tree
#' @param stringRef_class Int - Index for class of system tree
#' @export
rTest_globalDefWriter_WriteSystemTreeNode <- function(stringRef_name, stringRef_class) {
cat("Entering globalDefWriter_WriteSystemTreeNode\n")
globalDefWriter_WriteSystemTreeNode(stringRef_name, stringRef_class)
cat("Finished globalDefWriter_WriteSystemTreeNode.\n")
}



#' globalDefWriter_WriteLocation - doxygen documentation
#' @param stringRef_name Int - Index for name of location
#' More info
#' @export
rTest_globalDefWriter_WriteLocation <- function(stringRef_name) {
cat("Entering wrapper\n")
globalDefWriter_WriteLocation(stringRef_name)
cat("Finished wrapper.\n")
}


81 changes: 0 additions & 81 deletions R/rTest.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,84 +7,3 @@ library("Rcpp")

# Load cpp source files
#Rcpp::sourceCpp("src/test.cpp")

###
# SECTION - Functions
###
#' rTest_helloWorld - doxygen documentation
#' Simple wrapper for C++ hello world function
#' @export
rTest_helloWorld <- function() {
cat("Entering wrapper\n")
helloWorld()
cat("Finished function.\n")
}

#' rTest_init - doxygen documentation
#' Simple wrapper for C++ otf2 init function
#' @export
rTest_init <- function() {
cat("Entering wrapper\n")
init()
cat("Finished function.\n")
}

#' rTest_finalize - doxygen documentation
#' Simple wrapper for C++ otf2 finalize function
#' @export
rTest_finalize <- function() {
cat("Entering wrapper\n")
simple_finalize()
cat("Finished function.\n")
}


#' rTest_init_GlobalDefWriter - doxygen documentation
#' More info
#' @export
rTest_init_GlobalDefWriter <- function() {
cat("Entering wrapper\n")
init_GlobalDefWriter()
cat("Finished wrapper.\n")
}

#' rTest_globalDefWriter_WriteStrings - doxygen documentation
#' More info
#' @param stringRef_array Int[] - Index list for stringRef's
#' @param stringRefValue_array String[] - String list for globalDefWriter
#' @export
rTest_globalDefWriter_WriteStrings <- function(stringRef_array, stringRefValue_array) {
cat("Entering wrapper\n")
for ( i in 1:length(stringRef_array) ){
stringRef <- stringRef_array[i]
stringRefValue <- stringRefValue_array[i]
globalDefWriter_WriteString(stringRef, stringRefValue)
}
cat("Finished wrapper.\n")
}

#' rTest_globalDefWriter_WriteRegions - doxygen documentation
#' More info
#' @param regionRef_array Int[] - Index list for regionReg's
#' @param regionRefName_array Int[] - Index list for names, taken from stringRef's
#' @export
rTest_globalDefWriter_WriteRegions <- function(regionRef_array, regionRefName_array) {
cat("Entering wrapper\n")
for ( i in 1:length(regionRef_array) ){
regionRef <- regionRef_array[i]
regionRefName <- regionRefName_array[i]
globalDefWriter_WriteRegion(regionRef, regionRefName)
}
cat("Finished wrapper.\n")
}

#' rTest_evtWriter_Write - doxygen documentation
#' More info
#' @param regionRef Int - regionRef
#' @param event_type Bool - True if enter, False if exit
#' @export
rTest_evtWriter_Write <- function(regionRef, event_type) {
cat("Entering wrapper:\n")
evtWriter_Write(regionRef, event_type)
cat("Finished wrapper.\n")
}
2 changes: 1 addition & 1 deletion man/rTest_evtWriter_Write.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 0 additions & 13 deletions man/rTest_finalize.Rd

This file was deleted.

13 changes: 13 additions & 0 deletions man/rTest_finalize_Archive.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions man/rTest_finalize_EvtWriter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a1c7e8d

Please sign in to comment.