Institut de Robòtica i Informàtica Industrial
KRD Group

The CuikSuite Project

variable.c File Reference

Implementation of the functions operating on box Tvariable. More...

#include "variable.h"
#include "error.h"
#include "defines.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

void NewVariable (unsigned int type, char *name, Tvariable *v)
 Constructor.
void CopyVariable (Tvariable *v_dst, Tvariable *v_src)
 Copy constructor.
unsigned int GetVariableType (Tvariable *v)
 Gets the variable type.
char * GetVariableName (Tvariable *v)
 Gets the variable name.
void SetVariableInterval (Tinterval *i, Tvariable *v)
 Sets the new range for the variable.
TintervalGetVariableInterval (Tvariable *v)
 Gets the range of valid values for the variable.
void PrintVariable (FILE *f, Tvariable *v)
 Prints a variable.
void DeleteVariable (Tvariable *v)
 Destructor.

Detailed Description

Implementation of the functions operating on box Tvariable.

See also:
Tvariable, variable.h.

Definition in file variable.c.


Function Documentation

void NewVariable ( unsigned int  type,
char *  name,
Tvariable v 
)

Creates a new variable.

Parameters:
type Type for the new variable.
name Name for the new variable.
v The variable to create.

Definition at line 21 of file variable.c.

References INF, Tvariable::is, Tvariable::name, NEW, NewInterval(), and Tvariable::type.

Referenced by DummifyAndAddEquation(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointRangeEquations(), and GenerateLinkRot().

Here is the call graph for this function:

Here is the caller graph for this function:

void CopyVariable ( Tvariable v_dst,
Tvariable v_src 
)

Creates a new variable from another one.

Parameters:
v_dst The variable to create.
v_src The variable from where to copy.

Definition at line 32 of file variable.c.

References CopyInterval(), Tvariable::is, Tvariable::name, NEW, and Tvariable::type.

Referenced by AddVariable(), CopyVariables(), and GetCSVariable().

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int GetVariableType ( Tvariable v  ) 

Gets the variable type.

Parameters:
v The variable to query.
Returns:
The variable type.

Definition at line 42 of file variable.c.

References Tvariable::type.

Referenced by AddVariable(), GetVariableTypeN(), IsCartesianVariable(), IsDummyVariable(), IsSecondaryVariable(), IsSystemVariable(), PrintVariables(), and RemoveVariable().

Here is the caller graph for this function:

char* GetVariableName ( Tvariable v  ) 

Gets the variable name.

Parameters:
v The variable to query.
Returns:
The a pointer to the variable name.

Definition at line 47 of file variable.c.

References Tvariable::name.

Referenced by AddVariable(), AddVariable2CS(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), DummifyAndAddEquation(), GetVariableID(), GetVariableNames(), InitMapping(), and SimplifyCuikSystem().

Here is the caller graph for this function:

void SetVariableInterval ( Tinterval i,
Tvariable v 
)

Sets the new range for the variable.

Parameters:
i The new range for the variable.
v The variable to query.

Definition at line 52 of file variable.c.

References CopyInterval(), and Tvariable::is.

Referenced by DummifyAndAddEquation(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointRangeEquations(), GenerateLinkRot(), SampleCuikSystemInBox(), SetCSVariableRange(), and SimplifyCuikSystem().

Here is the call graph for this function:

Here is the caller graph for this function:

Tinterval* GetVariableInterval ( Tvariable v  ) 

Gets the range of valid values for the variable.

Parameters:
v The variable to query.
Returns:
A pointer to the range of valid values for the variable.

Definition at line 57 of file variable.c.

References Tvariable::is.

Referenced by BoxFromVariables(), and DummifyAndAddEquation().

Here is the caller graph for this function:

void PrintVariable ( FILE *  f,
Tvariable v 
)

Prints a variable (name plus valid range) to a stream that can be stdout.

Parameters:
f The file where to print.
v The variable to print.

Definition at line 62 of file variable.c.

References Tvariable::is, Tvariable::name, PRINT_VARIABLE_NAME, and PrintInterval().

Referenced by PrintVariables().

Here is the call graph for this function:

Here is the caller graph for this function:

void DeleteVariable ( Tvariable v  ) 

Deletes the Tvariable structure and frees the allocated memory.

Parameters:
v The variable to delete.

Definition at line 70 of file variable.c.

References Tvariable::name.

Referenced by DeleteVariables(), DummifyAndAddEquation(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointRangeEquations(), GenerateLinkRot(), and RemoveVariable().

Here is the caller graph for this function: