libroadrunner C API
Functions | Variables
rrc_utilities.h File Reference

roadRunner C wrappers 2012 More...

#include "rrc_exporter.h"
#include "rrc_types.h"
#include "rrc_macros.h"

Go to the source code of this file.

Functions

C_DECL_SPEC char *rrcCallConv getFileContent (const char *fName)
 Retrieves the the content of a file. More...
 
C_DECL_SPEC char *rrcCallConv createText (const char *text)
 Creates memory for holding a string. More...
 
C_DECL_SPEC char *rrcCallConv createTextMemory (const int count)
 Creates memory for holding a string. More...
 
C_DECL_SPEC RRListPtr rrcCallConv createRRList (void)
 Create a new list. More...
 
C_DECL_SPEC void rrcCallConv freeRRList (RRListPtr list)
 Free RRListPtr structure, i.e destroy a list.
 
C_DECL_SPEC int rrcCallConv getListLength (RRListPtr myList)
 Returns the length of a given list. More...
 
C_DECL_SPEC RRListItemPtr rrcCallConv createIntegerItem (int value)
 Create a list item to store an integer. More...
 
C_DECL_SPEC RRListItemPtr rrcCallConv createDoubleItem (double value)
 Create a list item to store a double value. More...
 
C_DECL_SPEC RRListItemPtr rrcCallConv createStringItem (char *value)
 Create a list item to store a pointer to a char*. More...
 
C_DECL_SPEC RRListItemPtr rrcCallConv createListItem (struct RRList *value)
 Create a list item to store a list. More...
 
C_DECL_SPEC int rrcCallConv addItem (RRListPtr list, RRListItemPtr *item)
 Add a list item to a list and return index to the added item. More...
 
C_DECL_SPEC RRListItemPtr rrcCallConv getListItem (RRListPtr list, int index)
 Returns the index^th item from the list. More...
 
C_DECL_SPEC int rrcCallConv isListItemInteger (RRListItemPtr item)
 Returns true or false if the list item is an integer. More...
 
C_DECL_SPEC int rrcCallConv isListItemDouble (RRListItemPtr item)
 Returns true or false if the list item is a double. More...
 
C_DECL_SPEC int rrcCallConv isListItemString (RRListItemPtr item)
 Returns true or false if the list item is a character array. More...
 
C_DECL_SPEC int rrcCallConv isListItemList (RRListItemPtr item)
 Returns true or false if the list item is a list itself. More...
 
C_DECL_SPEC int rrcCallConv isListItem (RRListItemPtr item, enum ListItemType itemType)
 Returns true or false if the list item is the given itemType. More...
 
C_DECL_SPEC int rrcCallConv getIntegerListItem (RRListItemPtr item, int *value)
 Returns the integer from a list item. More...
 
C_DECL_SPEC int rrcCallConv getDoubleListItem (RRListItemPtr item, double *value)
 Returns the double from a list item. More...
 
C_DECL_SPEC char *rrcCallConv getStringListItem (RRListItemPtr item)
 Returns the string from a list item. More...
 
C_DECL_SPEC RRListPtr rrcCallConv getList (RRListItemPtr item)
 Returns a list from a list item if it contains a list. More...
 
C_DECL_SPEC int rrcCallConv freeRRCData (RRCDataPtr handle)
 Free the memory associated to a RRCData object.
 
C_DECL_SPEC int rrcCallConv freeText (char *text)
 Free char* generated by library routines.
 
C_DECL_SPEC int rrcCallConv freeStringArray (RRStringArrayPtr sl)
 Free RRStringListHandle structures. More...
 
C_DECL_SPEC int rrcCallConv freeVector (RRVectorPtr vector)
 Free RRVectorHandle structures.
 
C_DECL_SPEC int rrcCallConv freeMatrix (RRDoubleMatrixPtr matrix)
 Free RRDoubleMatrixPtr structures.
 
C_DECL_SPEC int rrcCallConv getVectorLength (RRVectorPtr vector)
 Get the number of elements in a vector type. More...
 
C_DECL_SPEC RRVectorPtr rrcCallConv createVector (int size)
 Create a new vector with a given size. More...
 
C_DECL_SPEC int rrcCallConv getVectorElement (RRVectorPtr vector, int index, double *value)
 Get a particular element from a vector. More...
 
C_DECL_SPEC int rrcCallConv setVectorElement (RRVectorPtr vector, int index, double value)
 Set a particular element in a vector. More...
 
C_DECL_SPEC RRDoubleMatrixPtr rrcCallConv createRRMatrix (int r, int c)
 Create an empty matrix of size r by c. More...
 
C_DECL_SPEC int rrcCallConv getMatrixNumRows (RRDoubleMatrixPtr m)
 Retrieve the number of rows in the given matrix. More...
 
C_DECL_SPEC int rrcCallConv getMatrixNumCols (RRDoubleMatrixPtr m)
 Retrieve the number of columns in the given matrix. More...
 
C_DECL_SPEC int rrcCallConv getMatrixElement (RRDoubleMatrixPtr m, int r, int c, double *value)
 Retrieve an element at a given row and column from a matrix type variable. More...
 
C_DECL_SPEC int rrcCallConv setMatrixElement (RRDoubleMatrixPtr m, int r, int c, double value)
 Set an element at a given row and column with a given value in a matrix type variable. More...
 
C_DECL_SPEC int rrcCallConv getComplexMatrixElement (RRComplexMatrixPtr m, int r, int c, RRComplexPtr value)
 Retrieve an element at a given row and column from a complex matrix type variable. More...
 
C_DECL_SPEC int rrcCallConv setComplexMatrixElement (RRComplexMatrixPtr m, int r, int c, RRComplexPtr value)
 Set an element at a given row and column with a given value in a complex matrix type variable. More...
 
C_DECL_SPEC int rrcCallConv getRRDataNumRows (RRCDataPtr rrData)
 Retrieve the number of rows in the given RoadRunner numerical data (returned from simulate(RRHandle handle)) More...
 
C_DECL_SPEC int rrcCallConv getRRDataNumCols (RRCDataPtr rrData)
 Retrieve the number of columns in the given rrData data (returned form simulate(RRHandle handle)) More...
 
C_DECL_SPEC int rrcCallConv getRRCDataElement (RRCDataPtr rrData, int r, int c, double *value)
 Retrieves an element at a given row and column from a RoadRunner data type variable. More...
 
C_DECL_SPEC char *rrcCallConv getRRDataColumnLabel (RRCDataPtr rrData, int column)
 Retrieves a label for a given column in a rrData type variable. More...
 
C_DECL_SPEC char *rrcCallConv vectorToString (const RRVectorPtr vec)
 Returns a vector in string form. More...
 
C_DECL_SPEC char *rrcCallConv complexVectorToString (const RRComplexVectorPtr vec)
 Returns a complex vector in string form. More...
 
C_DECL_SPEC char *rrcCallConv rrCDataToString (const RRCDataPtr rrData)
 Returns a rrCData struct in string form. More...
 
C_DECL_SPEC char *rrcCallConv matrixToString (const RRDoubleMatrixPtr mat)
 Returns a matrix in string form. More...
 
C_DECL_SPEC char *rrcCallConv complexMatrixToString (const RRComplexMatrixPtr mat)
 Returns a complex matrix in string form. More...
 
C_DECL_SPEC int rrcCallConv getNumberOfStringElements (const RRStringArrayPtr list)
 Returns the length of a string array. More...
 
C_DECL_SPEC char *rrcCallConv getStringElement (RRStringArrayPtr list, int index)
 Returns the indexth element from the string array in the argument value. More...
 
C_DECL_SPEC char *rrcCallConv stringArrayToString (const RRStringArrayPtr list)
 Returns a string list in string form. More...
 
C_DECL_SPEC char *rrcCallConv listToString (const RRListPtr list)
 Returns a list in string form. More...
 
C_DECL_SPEC int rrcCallConv writeRRData (RRHandle handle, const char *fileNameAndPath)
 Writes RoadRunner data to file. More...
 
C_DECL_SPEC int rrcCallConv compileSource (RRHandle handle, const char *sourceFileNameAndPath)
 Compiles source code. More...
 

Variables

char * gLastError
 Global parameter holding last error, if any.
 
char * gInstallFolder
 Global parameter holding C wrappers install folder.
 
const char * ALLOCATE_API_ERROR_MSG
 Global parameter holding message for an un-allocated wrappers.
 
const char * INVALID_HANDLE_ERROR_MSG
 Global parameter holding message when an invalid is handed to a function.
 

Detailed Description

roadRunner C wrappers 2012

Author
Totte Karlsson & Herbert M Sauro

<-----------------------------------------------------------— This file is part of cRoadRunner. See http://code.google.com/p/roadrunnerlib for more details.

Copyright (C) 2012-2013 University of Washington, Seattle, WA, USA

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

In plain english this means:

You CAN freely download and use this software, in whole or in part, for personal, company internal, or commercial purposes;

You CAN use the software in packages or distributions that you create.

You SHOULD include a copy of the license in any redistribution you may make;

You are NOT required include the source of software, or of any modifications you may have made to it, in any redistribution you may assemble that includes it.

YOU CANNOT:

redistribute any piece of this software without proper attribution;

Function Documentation

◆ createText()

C_DECL_SPEC char* rrcCallConv createText ( const char *  text)

Creates memory for holding a string.

Parameters
[in]textPointer to a string
Returns
Pointer to a memory holding a copy of the input string

◆ createTextMemory()

C_DECL_SPEC char* rrcCallConv createTextMemory ( const int  count)

Creates memory for holding a string.

Parameters
[in]countinteger indicating number of elements to allocate
Returns
Pointer to string memory

◆ getFileContent()

C_DECL_SPEC char* rrcCallConv getFileContent ( const char *  fName)

Retrieves the the content of a file.

Parameters
[in]fNamePointer to a string holding the name and optionla path to a file
Returns
Content of file as a string, returns null if it fails