LifeV
FortranCharacterString Class Reference

F77 compatible character class. More...

#include <FortranWrapper.hpp>

+ Collaboration diagram for FortranCharacterString:

Data Fields

char * M_representation
 
size_t M_length
 

Constructors and destructor

 FortranCharacterString ()
 
 FortranCharacterString (char *cstring)
 
 FortranCharacterString (char *cstring, const size_t stringLength)
 
virtual ~FortranCharacterString ()
 

Operators

FortranCharacterString operator() (size_t index)
 
void operator= (char *str)
 
 operator char * ()
 

Methods

void pad (size_t first, size_t paddingSize=1)
 

Detailed Description

F77 compatible character class.

A minimal class used when passing string arguments from C++ to FORTRAN 77 (received as FORTRAN 77 FortranCharacterString strings), and subsequently returned back to C++ as properly zero terminated strings.

When the FortranCharacterString destructor is activated the zero-termination of the c-string is automatically managed. Zero termination is also done each time a string array is subscripted using

    FortranCharacterString::operator()(size_t index)
(1) F77 truncates strings when FortranCharacterString variable is short

(2) F77 pads variable with blanks when assigned string is short

(3) F77 represents a string as a pointer followed by a length

(4) A string array is stored in contiguous memory

\author: Carsten A. Arnholm, 20-AUG-1995

Definition at line 152 of file FortranWrapper.hpp.

Constructor & Destructor Documentation

◆ FortranCharacterString() [1/3]

Definition at line 157 of file FortranWrapper.hpp.

◆ FortranCharacterString() [2/3]

FortranCharacterString ( char *  cstring)
inline

Definition at line 277 of file FortranWrapper.hpp.

◆ FortranCharacterString() [3/3]

FortranCharacterString ( char *  cstring,
const size_t  stringLength 
)
inline

Definition at line 282 of file FortranWrapper.hpp.

◆ ~FortranCharacterString()

~FortranCharacterString ( )
inlinevirtual

Definition at line 295 of file FortranWrapper.hpp.

Member Function Documentation

◆ operator()()

FortranCharacterString operator() ( size_t  index)
inline

Definition at line 320 of file FortranWrapper.hpp.

◆ operator=()

void operator= ( char *  str)
inline

Definition at line 329 of file FortranWrapper.hpp.

◆ operator char *()

operator char * ( )
inline

Definition at line 341 of file FortranWrapper.hpp.

◆ pad()

void pad ( size_t  first,
size_t  paddingSize = 1 
)
inline

Definition at line 350 of file FortranWrapper.hpp.

Field Documentation

◆ M_representation

char* M_representation

Definition at line 176 of file FortranWrapper.hpp.

◆ M_length

size_t M_length

Definition at line 177 of file FortranWrapper.hpp.


The documentation for this class was generated from the following file: