libRoadRunner C API  1.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
rrc_utilities.h File Reference

roadRunner C API 2012 More...

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

Go to the source code of this file.

Functions

char * getFileContent (const char *fName)
 Retrieves the the content of a file. More...
 
char * createText (const char *text)
 Creates memory for holding a string. More...
 
char * createTextMemory (const int count)
 Creates memory for holding a string. More...
 
RRListPtr createRRList (void)
 Create a new list. More...
 
void freeRRList (RRListPtr list)
 Free RRListPtr structure, i.e destroy a list.
 
int getListLength (RRListPtr myList)
 Returns the length of a given list. More...
 
RRListItemPtr createIntegerItem (int value)
 Create a list item to store an integer. More...
 
RRListItemPtr createDoubleItem (double value)
 Create a list item to store a double value. More...
 
RRListItemPtr createStringItem (char *value)
 Create a list item to store a pointer to a char*. More...
 
RRListItemPtr createListItem (struct RRList *value)
 Create a list item to store a list. More...
 
int addItem (RRListPtr list, RRListItemPtr *item)
 Add a list item to a list and return index to the added item. More...
 
RRListItemPtr getListItem (RRListPtr list, int index)
 Returns the index^th item from the list. More...
 
bool isListItemInteger (RRListItemPtr item)
 Returns true or false if the list item is an integer. More...
 
bool isListItemDouble (RRListItemPtr item)
 Returns true or false if the list item is a double. More...
 
bool isListItemString (RRListItemPtr item)
 Returns true or false if the list item is a character array. More...
 
bool isListItemList (RRListItemPtr item)
 Returns true or false if the list item is a list itself. More...
 
bool isListItem (RRListItemPtr item, enum ListItemType itemType)
 Returns true or false if the list item is the given itemType. More...
 
bool getIntegerListItem (RRListItemPtr item, int *value)
 Returns the integer from a list item. More...
 
bool getDoubleListItem (RRListItemPtr item, double *value)
 Returns the double from a list item. More...
 
char * getStringListItem (RRListItemPtr item)
 Returns the string from a list item. More...
 
RRListPtr getList (RRListItemPtr item)
 Returns a list from a list item if it contains a list. More...
 
bool freeRRCData (RRCDataPtr handle)
 Free the memory associated to a RRCData object.
 
bool freeText (char *text)
 Free char* generated by library routines.
 
bool freeStringArray (RRStringArrayPtr sl)
 Free RRStringListHandle structures. More...
 
bool freeVector (RRVectorPtr vector)
 Free RRVectorHandle structures.
 
bool freeMatrix (RRDoubleMatrixPtr matrix)
 Free RRDoubleMatrixPtr structures.
 
void pause (void)
 pause If your program is running in a console, pause() will stop execution and wait for one keybord stroke in order to continue. More...
 
int getVectorLength (RRVectorPtr vector)
 Get the number of elements in a vector type. More...
 
RRVectorPtr createVector (int size)
 Create a new vector with a given size. More...
 
bool getVectorElement (RRVectorPtr vector, int index, double *value)
 Get a particular element from a vector. More...
 
bool setVectorElement (RRVectorPtr vector, int index, double value)
 Set a particular element in a vector. More...
 
RRDoubleMatrixPtr createRRMatrix (int r, int c)
 Create an empty matrix of size r by c. More...
 
int getMatrixNumRows (RRDoubleMatrixPtr m)
 Retrieve the number of rows in the given matrix. More...
 
int getMatrixNumCols (RRDoubleMatrixPtr m)
 Retrieve the number of columns in the given matrix. More...
 
bool getMatrixElement (RRDoubleMatrixPtr m, int r, int c, double *value)
 Retrieve an element at a given row and column from a matrix type variable. More...
 
bool 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...
 
bool 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...
 
bool 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...
 
RRCDataPtr createRRCData (RRDataHandle rrData)
 Create a RoadRunner C data structure (RRCDataPtr) from RoadRunner data. More...
 
int getRRDataNumRows (RRCDataPtr rrData)
 Retrieve the number of rows in the given RoadRunner numberical data (returned from simulate(RRHandle handle)) More...
 
int getRRDataNumCols (RRCDataPtr rrData)
 Retrieve the number of columns in the given rrData data (returned form simulat(RRHandle handle)) More...
 
bool 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...
 
char * getRRDataColumnLabel (RRCDataPtr rrData, int column)
 Retrieves a label for a given column in a rrData type variable. More...
 
char * vectorToString (const RRVectorPtr vec)
 Returns a vector in string form. More...
 
char * complexVectorToString (const RRComplexVectorPtr vec)
 Returns a complex vector in string form. More...
 
char * rrDataToString (RRDataHandle rrData)
 Returns a rrData object in string form. More...
 
char * rrCDataToString (const RRCDataPtr rrData)
 Returns a rrCData struct in string form. More...
 
char * matrixToString (const RRDoubleMatrixPtr mat)
 Returns a matrix in string form. More...
 
char * complexMatrixToString (const RRComplexMatrixPtr mat)
 Returns a complex matrix in string form. More...
 
int getNumberOfStringElements (const RRStringArrayPtr list)
 Returns the length of a string array. More...
 
char * getStringElement (RRStringArrayPtr list, int index)
 Returns the indexth element from the string array in the argument value. More...
 
char * stringArrayToString (const RRStringArrayPtr list)
 Returns a string list in string form. More...
 
char * listToString (const RRListPtr list)
 Returns a list in string form. More...
 
bool writeRRData (RRHandle handle, const char *fileNameAndPath)
 Writes RoadRunner data to file. More...
 
bool 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 API install folder.
 
const char * ALLOCATE_API_ERROR_MSG
 Global parameter holding message for an un-allocated API.
 
const char * INVALID_HANDLE_ERROR_MSG
 Global parameter holding message when an invalid is handed to a function.
 

Detailed Description

roadRunner C API 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

char* 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
char* createTextMemory ( const int  count)

Creates memory for holding a string.

Parameters
[in]countinteger indicating number of elements to allocate
Returns
Pointer to string memory
char* 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
void pause ( void  )

pause If your program is running in a console, pause() will stop execution and wait for one keybord stroke in order to continue.

Returns
void