Main Page | Modules | Class Hierarchy | Data Structures | File List | Data Fields | Globals | Related Pages

omFunctions Class Reference
[GENERIC LIBRARY classes]

#include <omFunctions.h>


Static Public Member Functions

void InitializeSimulationChars (long *)
 This is a system dependent function.

wxString GetUnixString (wxString)
wxString GetWindowsString (wxString)
wxString ConvertToLower (wxString)
wxString ConvertToUpper (wxString)
int ArrayFind (wxArrayString *, wxString)
int ArrayFindNoCase (wxArrayString *, wxString)
void SetBasePath (wxString)
bool TestPersonalInstallation (wxString, wxString, wxString)
bool CreateDefaultInstallation (wxString, wxString)
bool TestFolder (wxString)
void CreateFolder (wxString, wxString)
bool TestFile (wxString)
wxString GetCurrentPath ()
wxString GetSharedPath (wxString)
wxString GetInstallationPath (wxString)
wxString GetUserDataPath (wxString)
void CopyFile (wxString, wxString, wxString)
wxString GetCurrentIP ()
wxString Encode (wxString)
wxString Decode (wxString)
int FindFirstNBChar (wxString, int t)
int FindLastNBChar (wxString)
int FindNotEncodedChar (wxString, char, int)
int Literal2Value (wxString)
long GetMaiaKeycodeFromXML (wxString)
wxArrayString SplitTextLine (wxString, wxString)
wxString Value2Literal (int)
bool String2Boolean (wxString)
wxString Boolean2String (bool)
wxString Boolean2String (int)
int String2Int (wxString)
bool IsBoolean (wxString)
bool IsInt (wxString)

Static Private Member Functions

void SetBasePathSD (wxString)
 Set base path in function of operating system.

bool CreateDefaultInstallationSD (wxString, wxString)
 Create installation sysyem dependent.

bool TestPersonalInstallationSD (wxString, wxString, wxString)
 GetPersonalInstallation system dependent part.

wxString GetSharedPathSD (wxString)
 GetSharedPath system dependent part.

wxString GetInstallationPathSD (wxString)
 GetInstallationPath system dependent part.

wxString GetUserDataPathSD (wxString)
 GetUserDataPath system dependent part.

void CopyFileSD (wxString, wxString, wxString)
 CopyFile system dependent part.

void CreateFolderSD (wxString, wxString)
 CreateFolder system dependent part.


Detailed Description

This class contains some static functions used by the maia api system.

Functions are called with omFunctions::function_name(...).


Member Function Documentation

int omFunctions::ArrayFind wxArrayString *  a,
wxString  s
[static]
 

Find a position af a string in an array conserving the case.

Parameters:
a Pointer to source array.
s String to find.
Returns:
Index of the string or -1 if not found.

int omFunctions::ArrayFindNoCase wxArrayString *  a,
wxString  s
[static]
 

Find a position af a string in an array ignoring the case.

Parameters:
a Pointer to source array.
s String to find.
Returns:
Index of the string or -1 if not found.

wxString omFunctions::Boolean2String int  b  )  [static]
 

Convert a boolean value into an uppercase string.

Parameters:
b Boolean value.
Returns:
String rapresentation of the boolean value as wxString.

wxString omFunctions::Boolean2String bool  b  )  [static]
 

Convert a boolean value into an uppercase string.

Parameters:
b Boolean value.
Returns:
String rapresentation of the boolean value as wxString.

wxString omFunctions::ConvertToLower wxString  s  )  [static]
 

convert a string to lowercase

Parameters:
s source string
Returns:
lowercase string

wxString omFunctions::ConvertToUpper wxString  s  )  [static]
 

convert a string to uppercase

Parameters:
s source string
Returns:
uppercase string

void omFunctions::CopyFile wxString  source,
wxString  destination,
wxString  binPath
[static]
 

Copy original file into destination using cp command. Under un*x systems this method uses system copy command, under Windows it uses cp.exe program provided with the openmaia suite.

Parameters:
source Source file.
destination Destination file or folder
binPath Path of the openmaia agent binary file. This parameter is used to find cp.exe program under Windows systems.

void omFunctions::CopyFileSD wxString  ,
wxString  ,
wxString 
[static, private]
 

CopyFile system dependent part.

bool omFunctions::CreateDefaultInstallation wxString  appName,
wxString  binPath
[static]
 

This function copy a default data installation from the template directory into the user personal directory.
The function is lounched the first time that an OpenMAIA application is lounched.

Parameters:
appName OpenMAIA application name.
binPath Path of binary (from argv)
Returns:
true if succeded, false if error.

bool omFunctions::CreateDefaultInstallationSD wxString  ,
wxString 
[static, private]
 

Create installation sysyem dependent.

void omFunctions::CreateFolder wxString  folder,
wxString  binPath
[static]
 

Create a new folder using mkdir command. Under Windows is used mkdir.exe provided with openmaia distribution

Parameters:
folder Folder to create
binPath Path of the folder contining binaries of mkdir (windows)

void omFunctions::CreateFolderSD wxString  ,
wxString 
[static, private]
 

CreateFolder system dependent part.

wxString omFunctions::Decode wxString  original  )  [static]
 

Decode a string encoded with omFunctions::Encode method.

Parameters:
original Original string to decode.
Returns:
Decoded string.

wxString omFunctions::Encode wxString  original  )  [static]
 

Encode a string for TCP trasmission according the protocol. In this encoding ; $ # and \ symbols are translated into escape sequences \; # $, and \. Carriege return is translated into \r symbol and New line in \n symbol.

Parameters:
original Original string to encode.
Returns:
Encoded string.

int omFunctions::FindFirstNBChar wxString  s,
int  sp
[static]
 

Find the first not blank position of a char in a string. Blank chars are spaces and
symbols.

Parameters:
s source string
sp start position
Returns:
position of not blank char after start position; -1 if not blank char is not found

int omFunctions::FindLastNBChar wxString  s  )  [static]
 

Find the last not blank position of a char in a string. Blank chars are spaces and
symbols.

Parameters:
s source string
Returns:
position of not blank char after start position; -1 if not blank char is not found

int omFunctions::FindNotEncodedChar wxString  s,
char  c,
int  sp
[static]
 

Find the position of the first not encoded char in a string

Parameters:
s source string
c char to find
sp start position
Returns:
position shearced char; -1 if not blank char is not found

wxString omFunctions::GetCurrentIP  )  [static]
 

Get Current IP of the computer connected to a network

Returns:
IP in dot format

wxString omFunctions::GetCurrentPath  )  [static]
 

Get current path. This method uses getcwd() C function and fix some problems in path returned from cygwin.

Returns:
current path in unix format.

wxString omFunctions::GetInstallationPath wxString  binPath  )  [static]
 

Return the path of the directory where openmaia is installed. This method is used in windows implementations beacuse those OS does't handle relative path well. The path is taken from the binary path of the binary file running at this time.

Parameters:
binPath Path of this binary file.

wxString omFunctions::GetInstallationPathSD wxString   )  [static, private]
 

GetInstallationPath system dependent part.

long omFunctions::GetMaiaKeycodeFromXML wxString  xmlCode  )  [static]
 

This function return the Maia Key code from its definition in the maia xml codify according omXMLTags.h header file

Parameters:
xmlCode xml codify of the key
Returns:
maia virtual code codify of the key, -1 if key code was not found

wxString omFunctions::GetSharedPath wxString  binPath  )  [static]
 

Return the path of shared part of the OpenMAIA application. OpenMAIA save some informations in a shared path.
Under Un*x system shared path is tipically /usr/local/share/openmaia or PREFIX/share/openmaia if the tarball was configured with --prefix options.
Under Windows shared path is INSTALLATION_PATH/share and is calculated using the path of the binary file.

Parameters:
binPath Path of the binary file.
Returns:
Shared path as wxString.

wxString omFunctions::GetSharedPathSD wxString   )  [static, private]
 

GetSharedPath system dependent part.

wxString omFunctions::GetUnixString wxString  gs  )  [static]
 

Get a unix style string from a generic string. This means that all \ chars are converted into / chars

Parameters:
gs general string
Returns:
unix style string

wxString omFunctions::GetUserDataPath wxString  binPath  )  [static]
 

Return the path of the directory where user data is stored.

Parameters:
binPath Path of the binary file.
Returns:
user data path as wxString

wxString omFunctions::GetUserDataPathSD wxString   )  [static, private]
 

GetUserDataPath system dependent part.

wxString omFunctions::GetWindowsString wxString  gs  )  [static]
 

Get a windows style string from a generic string. This means that all / chars are converted into \ chars

Parameters:
gs general string
Returns:
unix style string

void omFunctions::InitializeSimulationChars long *   )  [static]
 

This is a system dependent function.

bool omFunctions::IsBoolean wxString  s  )  [static]
 

Check if string format is compatible with boolean type. A string compatible with boolean type may contain false,true, FALSE, TRUE, 0, 1 values.

Parameters:
s Source String.
Returns:
true if string is compatible, false if not

bool omFunctions::IsInt wxString  s  )  [static]
 

Check if string format is compatible with integer type.

Parameters:
s Source String.
Returns:
true if string is compatible, false if not

int omFunctions::Literal2Value wxString  literal  )  [static]
 

Return OpenMAIA constant value given its literal.

Parameters:
literal Literal value.
Returns:
Constant value as integer or -1 if litaral was not found.
See also:
omemukeys.h

void omFunctions::SetBasePath wxString  binPath  )  [static]
 

Sets the path of the application moving to the top of the user data dir

Parameters:
binPath - path of binary file, from argv

void omFunctions::SetBasePathSD wxString   )  [static, private]
 

Set base path in function of operating system.

wxArrayString omFunctions::SplitTextLine wxString  str,
wxString  sep
[static]
 

Split a line of text composed by elements and separator and return an array containing all the elements without white spaces.

Parameters:
str string to split
sep separator
Returns:
an array containing all components of the string

bool omFunctions::String2Boolean wxString  s  )  [static]
 

Convert a string that spacifies a boolean value into a boolean type. String may contain 0,1, false, true, FALSE, true values.

Parameters:
s String.
Returns:
boolean rapresentation of the string.
See also:
IsBoolean() method to test if the format of string is correct.

int omFunctions::String2Int wxString  s  )  [static]
 

Convert a string that spacifies an integer value into an integer type.

Parameters:
s String.
Returns:
integer rapresentation of the string.
See also:
IsInt() method to test if the format of string is correct.

bool omFunctions::TestFile wxString  fname  )  [static]
 

Test for file presence.

Parameters:
fname File name.
Returns:
True if file is present

bool omFunctions::TestFolder wxString  folder  )  [static]
 

This function test for folder existence

Parameters:
folder folder name
Returns:
true if folder exist.

bool omFunctions::TestPersonalInstallation wxString  profile,
wxString  appname,
wxString  binPath
[static]
 

Test for data installation path.
The position of the user data files is different if you are using windows or un*x system.

  • Under Windows systems data files are installed in folder PROFILE_NAME\openmaia\openmaia_profile\application\ if windows profiles are activated
    If profiles are not activated data files are stored in OPENMAIA_INSTALLATION_PATH\profiles\openmaia_profile\application.
    PROFILE_NAME folder is found by HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\AppData registry key.

  • Under Un*x system data files are stored in ~/.openmaia/openmaia_profile/application

Parameters:
profile OpenMAIA profile name.
appname OpenMAIA application name.
binPath Path of binary file
Returns:
true if data path is found, false otherwhise.

bool omFunctions::TestPersonalInstallationSD wxString  ,
wxString  ,
wxString 
[static, private]
 

GetPersonalInstallation system dependent part.

wxString omFunctions::Value2Literal int  value  )  [static]
 

Return OpenMAIA constant literal given its value.

Parameters:
value Constant value.
Returns:
Constant literal as integer.
See also:
omemukeys.h


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