etk Namespace Reference

Namespaces

 archive
 
 color
 
 tool
 

Classes

class  Archive
 
class  ArchiveContent
 
class  BaseNoise
 
class  Color
 
class  Fifo
 
class  FSNode
 
class  FSNodeRight
 
class  Hash
 
class  HashData
 
class  Matrix
 
class  Matrix2
 
class  Matrix4
 
class  Noise
 
class  Plane
 
class  Vector2D
 
class  Vector3D
 
class  Vector4D
 

Enumerations

enum  noiseType {
  noiseType_base, noiseType_smooth, noiseType_turbulence, noiseType_turbulenceNoSmooth,
  noiseType_cloud, noiseType_marble, noiseType_wood
}
 
enum  typeNode {
  typeNode_unknow, typeNode_block, typeNode_character, typeNode_folder,
  typeNode_fifo, typeNode_link, typeNode_file, typeNode_socket
}
 
enum  seekNode { seekNode_start, seekNode_end, seekNode_current }
 
enum  FSNType {
  FSNType_unknow, FSNType_direct, FSNType_relatif, FSNType_home,
  FSNType_data, FSNType_userData, FSNType_cache, FSNType_theme,
  FSNType_themeData
}
 

Functions

etk::Color< uint8_t, 4 > parseStringStartWithSharp (const std::string &_input)
 
etk::Color< uint8_t, 4 > parseStringStartWithRGBGen (const std::string &_input)
 
etk::Color< double, 4 > parseStringStartWithRGB (const std::string &_input)
 
etk::Color< uint32_t, 4 > parseStringStartWithRGBUnsigned32 (const std::string &_input)
 
etk::Color< uint16_t, 4 > parseStringStartWithRGBUnsigned16 (const std::string &_input)
 
etk::Color< uint8_t, 4 > parseStringStartWithRGBUnsigned8 (const std::string &_input)
 
etk::Color< uint8_t, 4 > parseStringColorNamed (const std::string &_input)
 
void init (int _argc, const char **_argv)
 
std::string getApplicationName ()
 
void clearLowerTriangle ()
 
Matrix2 mat2Rotate (float _angleRad)
 
Matrix2 mat2Scale (const vec2 &_scale)
 
Matrix2 mat2Scale (float _scale)
 
Matrix2 mat2Translate (const vec2 &_translate)
 
Matrix2 mat2Skew (const vec2 &_skew)
 
template<class T >
degreeToRadian (T _val)
 
template<class T >
radianToDegree (T _val)
 
Matrix4 matFrustum (float _xmin, float _xmax, float _ymin, float _ymax, float _zNear, float _zFar)
 
Matrix4 matPerspective (float _foxy, float _aspect, float _zNear, float _zFar)
 
Matrix4 matOrtho (float _left, float _right, float _bottom, float _top, float _nearVal, float _farVal)
 
Matrix4 matTranslate (vec3 _translate)
 
Matrix4 matScale (vec3 _scale)
 
Matrix4 matRotate (vec3 _normal, float _angleRad=0.0)
 
Matrix4 matLookAt (const vec3 &_eye, const vec3 &_target, const vec3 &_up)
 
void setArgZero (const std::string &_val)
 
std::string simplifyPath (std::string _input)
 
std::string FSNodeGetApplicationName ()
 
void setBaseFolderData (const char *_folder, const char *_applName=nullptr)
 
void setBaseFolderDataUser (const char *_folder)
 
void setBaseFolderCache (const char *_folder)
 
void initDefaultFolder (const char *_applName)
 
std::string getUserHomeFolder ()
 
std::string getUserRunFolder ()
 
bool FSNodeRemove (const std::string &_path)
 
int64_t FSNodeGetCount (const std::string &_path)
 
bool FSNodeCreate (const std::string &_path, etk::FSNodeRight _right, enum etk::typeNode _type=etk::typeNode_folder)
 
bool FSNodeExist (const std::string &_path)
 
bool FSNodeMove (const std::string &_path1, const std::string &_path2)
 
etk::FSNodeRight FSNodeGetRight (const std::string &_path)
 
enum etk::typeNode FSNodeGetType (const std::string &_path)
 
uint64_t FSNodeGetTimeCreated (const std::string &_path)
 
uint64_t FSNodeGetTimeModified (const std::string &_path)
 
uint64_t FSNodeGetTimeAccessed (const std::string &_path)
 
bool FSNodeTouch (const std::string &_path)
 
bool FSNodeEcho (const std::string &_path, const std::string &_dataTowrite)
 
bool FSNodeEchoAdd (const std::string &_path, const std::string &_dataTowrite)
 
void FSNodeHistory (const std::string &_path, int32_t _historyCount)
 
std::string FSNodeReadAllData (const std::string &_path)
 
void FSNodeWriteAllData (const std::string &_path, const std::string &_data)
 
template<typename TTT >
std::vector< TTT > FSNodeReadAllDataType (const std::string &_path)
 
template<typename TTT >
void FSNodeWriteAllDataType (const std::string &_path, const std::vector< TTT > &_data)
 
std::string FSNodeGetRealName (const std::string &_path)
 
std::vector< std::string > FSNodeExplodeMultiplePath (const std::string &_path)
 
template<class TYPE >
std::string to_string (const TYPE &_variable)
 
template<class TYPE >
std::string to_string (const std::vector< TYPE > &_list)
 
template<class TYPE >
bool from_string (TYPE &_variableRet, const std::string &_value)
 
template<class TYPE >
const TYPE & avg (const TYPE &_min, const TYPE &_val, const TYPE &_max)
 

Detailed Description

basic namespace of the etk library. (it might contain all the etk fuctions/class/structures without macro)

Enumeration Type Documentation

§ FSNType

Type of the file/folder/... accessible in the Node.

Enumerator
FSNType_unknow 

Unknow type of the node (many time no file name seted)

FSNType_direct 

Access at the file System with a direct naming like "/home/plop/xxx.txt".

FSNType_relatif 

Access at the file System with a relative naming like "../plop/xxx.txt".

FSNType_home 

acces at the home path of the system (with name of the current user)

FSNType_data 

Access on the application data (internal application data are the one provided with the binary)

FSNType_userData 

Access on the user application data (where the data are stored when the application stop)

FSNType_cache 

Access on the application temporary path (remove when user want and whe the compter restart or have not enought memory)

FSNType_theme 

Theme area.

FSNType_themeData 

Theme data area.

§ noiseType

List of noise type supported.

Todo:
Remove this from ETK
Enumerator
noiseType_base 

basic random noise

noiseType_smooth 

Noise smoothed.

noiseType_turbulence 

Noise in turbulence mode.

noiseType_turbulenceNoSmooth 

Noise Turbulence with no smooth apply.

noiseType_cloud 

Noise like a cloud.

noiseType_marble 

Noise like marble.

noiseType_wood 

Noise like wood.

§ seekNode

Seek mode availlable (just to wrap it ...)

Enumerator
seekNode_start 

request seek position start at the START of the file

seekNode_end 

request seek position start at the END of the file

seekNode_current 

request seek position start at the CURRENT position in the file

§ typeNode

List of Type that a node can have (this wrap some type that not exist on Windows)

Enumerator
typeNode_unknow 

Type of the node is not known.

typeNode_block 

The node is a block aceess device (Not availlable on Windows)

typeNode_character 

The node is a Char device type (Not availlable on Windows)

typeNode_folder 

The node is a folder.

typeNode_fifo 

The node is a Fifo (Not availlable on Windows)

typeNode_link 

The node is a Link.

typeNode_file 

The node is a File.

typeNode_socket 

The node is a socket.

Function Documentation

§ avg()

template<class TYPE >
const TYPE& etk::avg ( const TYPE &  _min,
const TYPE &  _val,
const TYPE &  _max 
)

in std, we have min, max but not avg ==> it is missing... the Defineing avg template.

Parameters
[in]_minMinimum value of the range
[in]_valThe value that we want a min/max
[in]_maxMaximum value of the range
Returns
Value that min/max applied

§ clearLowerTriangle()

void etk::clearLowerTriangle ( )

Clear the Lower triangle of the current Matrix.

  x x x x x
  0 x x x x
  0 0 x x x
  0 0 0 x x
  0 0 0 0 x

§ degreeToRadian()

template<class T >
T etk::degreeToRadian ( _val)

Convert degree in radian.

Parameters
[in]_valValue to converted in degree
Returns
Angle in radian

§ from_string()

template<class TYPE >
bool etk::from_string ( TYPE &  _variableRet,
const std::string &  _value 
)

Template to declare convertion from string to anything.

Parameters
[out]_variableRetOutput value
[in]_valueinput property
Returns
true if the can be converted.

§ FSNodeCreate()

bool etk::FSNodeCreate ( const std::string &  _path,
etk::FSNodeRight  _right,
enum etk::typeNode  _type = etk::typeNode_folder 
)

Simple access for : Create a file or a folder depending of the request.

Parameters
[in]_pathFolder/File/Pipe path of the node
[in]_rightRight of the creation
[in]_typeType of the element that might be created
Returns
true : Action done corectly
false : An error occured

§ FSNodeEcho()

bool etk::FSNodeEcho ( const std::string &  _path,
const std::string &  _dataTowrite 
)

Simple access for : Basic write on the node (like console echo)

Parameters
[in]_pathFolder/File/Pipe path of the node
[in]_dataTowritewrite data in the Node
Returns
true : Action done corectly
false : An error occured

§ FSNodeEchoAdd()

bool etk::FSNodeEchoAdd ( const std::string &  _path,
const std::string &  _dataTowrite 
)

Simple access for : Basic write on the node (like console echo) in adding mode (>>)

Parameters
[in]_pathFolder/File/Pipe path of the node
[in]_dataTowritewrite data in the Node
Returns
true : Action done corectly
false : An error occured

§ FSNodeExist()

bool etk::FSNodeExist ( const std::string &  _path)

Simple access for : chexk the exestance of an element.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeExplodeMultiplePath()

std::vector<std::string> etk::FSNodeExplodeMultiplePath ( const std::string &  _path)

Get all the Path contain in the specidy path:

Parameters
[in]_pathGeneric path to parse ...
Returns
The list of path found
auto out = etk::FSNodeExplodeMultiplePath("{ewol}DATA:font");
// out contain: {"DATA:font", "{@ewol}DATA:font"}
auto out = etk::FSNodeExplodeMultiplePath("{@ewol}DATA:font");
// out contain: {"{@ewol}DATA:font"}

§ FSNodeGetApplicationName()

std::string etk::FSNodeGetApplicationName ( )

Get application name.

Returns
The application name

§ FSNodeGetCount()

int64_t etk::FSNodeGetCount ( const std::string &  _path)

Simple access for : count the number of element in a path (if it is not a path ==> return -1)

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
number of File inside
-1 : An error occured

§ FSNodeGetRealName()

std::string etk::FSNodeGetRealName ( const std::string &  _path)

get the system name of the current path

Parameters
[in]_path"DATA:xxx" etk file name.
Returns
return real file name "/aaa/bbb/ccc/xxx"

§ FSNodeGetRight()

etk::FSNodeRight etk::FSNodeGetRight ( const std::string &  _path)

Simple access for : Get right of the current Node.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeGetTimeAccessed()

uint64_t etk::FSNodeGetTimeAccessed ( const std::string &  _path)

Simple access for : Getting Accessing time of the current node.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeGetTimeCreated()

uint64_t etk::FSNodeGetTimeCreated ( const std::string &  _path)

Simple access for : Getting creation time of the current node.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeGetTimeModified()

uint64_t etk::FSNodeGetTimeModified ( const std::string &  _path)

Simple access for : Getting Modification time of the current node.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeGetType()

enum etk::typeNode etk::FSNodeGetType ( const std::string &  _path)

Simple access for : Get type of the current node.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeHistory()

void etk::FSNodeHistory ( const std::string &  _path,
int32_t  _historyCount 
)

move file to generate an history of the current file

Parameters
[in]_pathFolder/File/Pipe path of the node
[in]_historyCountnumber of saved file in the history (-xxx)

§ FSNodeMove()

bool etk::FSNodeMove ( const std::string &  _path1,
const std::string &  _path2 
)

Simple access for : chexk the exestance of an element.

Parameters
[in]_path1Folder/File/Pipe path of the node sources
[in]_path2Folder/File/Pipe path of the node destination
Returns
true : Action done corectly
false : An error occured

§ FSNodeReadAllData()

std::string etk::FSNodeReadAllData ( const std::string &  _path)

Read all the data from a file.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
all the data of the file in a string

§ FSNodeReadAllDataType()

template<typename TTT >
std::vector<TTT> etk::FSNodeReadAllDataType ( const std::string &  _path)

Read all the data from a file.

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
all the data of the file in a typed vector

§ FSNodeRemove()

bool etk::FSNodeRemove ( const std::string &  _path)

Simple access for : Remove folder and subFolder, files pipes ...

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeTouch()

bool etk::FSNodeTouch ( const std::string &  _path)

Simple access for : Update Modification time with the current time of the node (>)

Parameters
[in]_pathFolder/File/Pipe path of the node
Returns
true : Action done corectly
false : An error occured

§ FSNodeWriteAllData()

void etk::FSNodeWriteAllData ( const std::string &  _path,
const std::string &  _data 
)

Write all the data in a file.

Parameters
[in]_pathFolder/File/Pipe path of the node
[in]_dataAll the data of the file in a string

§ FSNodeWriteAllDataType()

template<typename TTT >
void etk::FSNodeWriteAllDataType ( const std::string &  _path,
const std::vector< TTT > &  _data 
)

Write all the data in a file.

Parameters
[in]_pathFolder/File/Pipe path of the node
[in]_dataAll the data of the file in a vector Typed bits ...

§ getApplicationName()

std::string etk::getApplicationName ( )

Get application name.

Returns
The application name

§ getUserHomeFolder()

std::string etk::getUserHomeFolder ( )

Get the home folder of the user.

Returns
the home folder : like : "/home/machin/"

§ getUserRunFolder()

std::string etk::getUserRunFolder ( )

Get the folder of the Program is running.

Returns
the basic folder name (ex : run ./appl in the pwd=/home/machin/sousFolder ==> this return the pwd folder)

§ init()

void etk::init ( int  _argc,
const char **  _argv 
)

Initialize etk.

Parameters
[in]_argcNumber of argument list
[in]_argvList of arguments

§ initDefaultFolder()

void etk::initDefaultFolder ( const char *  _applName)

Initialyse all the subFolder usable by the user like DATA/HOME/CACHE/USERDATA.

Parameters
[in]_applNamethe name of the application

§ mat2Rotate()

Matrix2 etk::mat2Rotate ( float  _angleRad)

Create a matrix 2D with a simple rotation.

Parameters
[in]_angleRadRadian angle to set at the matrix
Returns
New matrix of the transformation requested

§ mat2Scale() [1/2]

Matrix2 etk::mat2Scale ( const vec2 _scale)

Create a matrix 2D with a simple scale.

Parameters
[in]_scale2 dimention scale
Returns
New matrix of the transformation requested

§ mat2Scale() [2/2]

Matrix2 etk::mat2Scale ( float  _scale)

Create a matrix 2D with a simple scale.

Parameters
[in]_scalesame scale in 2 and Y
Returns
New matrix of the transformation requested

§ mat2Skew()

Matrix2 etk::mat2Skew ( const vec2 _skew)

Create a matrix 2D with a simple skew.

Parameters
[in]_skew2 dimention skew
Returns
New matrix of the transformation requested

§ mat2Translate()

Matrix2 etk::mat2Translate ( const vec2 _translate)

Create a matrix 2D with a simple translation.

Parameters
[in]_translate2 dimention translation
Returns
New matrix of the transformation requested

§ matFrustum()

Matrix4 etk::matFrustum ( float  _xmin,
float  _xmax,
float  _ymin,
float  _ymax,
float  _zNear,
float  _zFar 
)

Create projection matrix with the box parameter (camera view in -z axis)

Parameters
[in]_xminX minimum size of the frustum
[in]_xmaxX maximum size of the frustum
[in]_yminY minimum size of the frustum
[in]_ymaxY maximum size of the frustum
[in]_zNearZ minimum size of the frustum
[in]_zFarZ maximum size of the frustum
Returns
New matrix of the transformation requested

§ matLookAt()

Matrix4 etk::matLookAt ( const vec3 _eye,
const vec3 _target,
const vec3 _up 
)

Create projection matrix with camera property (camera view in -z axis)

Parameters
[in]_eyeOptical center of the camera
[in]_targetPoint of where the camera is showing
[in]_upUp vector of the camera
Returns
New matrix of the transformation requested

§ matOrtho()

Matrix4 etk::matOrtho ( float  _left,
float  _right,
float  _bottom,
float  _top,
float  _nearVal,
float  _farVal 
)

Create orthogonal projection matrix with the box parameter (camera view in -z axis)

Parameters
[in]_leftleft size of the camera
[in]_rightRight size of the camera
[in]_bottomButtom size of the camera
[in]_topTop Size of the camera
[in]_nearValZ near size of the camera
[in]_farValZ far size of the camera
Returns
New matrix of the transformation requested

§ matPerspective()

Matrix4 etk::matPerspective ( float  _foxy,
float  _aspect,
float  _zNear,
float  _zFar 
)

Create projection matrix with human repensentation view (camera view in -z axis)

Parameters
[in]_foxyFocal in radian of the camera
[in]_aspectaspect ratio of the camera
[in]_zNearZ near size of the camera
[in]_zFarZ far size of the camera
Returns
New matrix of the transformation requested

§ matRotate()

Matrix4 etk::matRotate ( vec3  _normal,
float  _angleRad = 0.0 
)

Create a matrix 3D with a simple rotation.

Parameters
[in]_normalvector aroud witch apply the rotation
[in]_angleRadRadian angle to set at the matrix
Returns
New matrix of the transformation requested

§ matScale()

Matrix4 etk::matScale ( vec3  _scale)

Create a matrix 3D with a simple scale.

Parameters
[in]_scale3 dimention scale
Returns
New matrix of the transformation requested

§ matTranslate()

Matrix4 etk::matTranslate ( vec3  _translate)

Create a matrix 3D with a simple translation.

Parameters
[in]_translate3 dimention translation
Returns
New matrix of the transformation requested

§ parseStringColorNamed()

etk::Color<uint8_t, 4> etk::parseStringColorNamed ( const std::string &  _input)

Get a color value started with a "named" converted in uint8 like red, geen ...

Parameters
[in]_inputString to parse
Returns
Value parsed

§ parseStringStartWithRGB()

etk::Color<double, 4> etk::parseStringStartWithRGB ( const std::string &  _input)

Get a color value started with a "rgb()" keep in double.

Parameters
[in]_inputString to parse
Returns
Value parsed

§ parseStringStartWithRGBGen()

etk::Color<uint8_t, 4> etk::parseStringStartWithRGBGen ( const std::string &  _input)

Get a color value started with a "rgb()" converted in uint8.

Parameters
[in]_inputString to parse
Returns
Value parsed

§ parseStringStartWithRGBUnsigned16()

etk::Color<uint16_t, 4> etk::parseStringStartWithRGBUnsigned16 ( const std::string &  _input)

Get a color value started with a "rgb()" converted in uint16.

Parameters
[in]_inputString to parse
Returns
Value parsed

§ parseStringStartWithRGBUnsigned32()

etk::Color<uint32_t, 4> etk::parseStringStartWithRGBUnsigned32 ( const std::string &  _input)

Get a color value started with a "rgb()" converted in uint32.

Parameters
[in]_inputString to parse
Returns
Value parsed

§ parseStringStartWithRGBUnsigned8()

etk::Color<uint8_t, 4> etk::parseStringStartWithRGBUnsigned8 ( const std::string &  _input)

Get a color value started with a "rgb()" converted in uint6.

Parameters
[in]_inputString to parse
Returns
Value parsed

§ parseStringStartWithSharp()

etk::Color<uint8_t, 4> etk::parseStringStartWithSharp ( const std::string &  _input)

Get a color value started with a "#".

Parameters
[in]_inputString to parse
Returns
Value parsed

§ radianToDegree()

template<class T >
T etk::radianToDegree ( _val)

Convert radian in degree.

Parameters
[in]_valValue to converted in radian
Returns
Angle in degree

§ setArgZero()

void etk::setArgZero ( const std::string &  _val)

Set the firt argument of the application start (this permit to get the real position of the execution path and executable position.

Parameters
[in]_valFirst parameter.

§ setBaseFolderCache()

void etk::setBaseFolderCache ( const char *  _folder)

Set the Cach folder for the application (like /tmp)

Parameters
[in]_folderfolder path of the cathegorie

§ setBaseFolderData()

void etk::setBaseFolderData ( const char *  _folder,
const char *  _applName = nullptr 
)

Set manualy the folder of the Data.(like /usr/shared/applName/ for linux)

Parameters
[in]_folderfolder path of the cathegorie
[in]_applNameBase name of the application

§ setBaseFolderDataUser()

void etk::setBaseFolderDataUser ( const char *  _folder)

Set the user data folder (like /home/machin/.local/applName/ for linux)

Parameters
[in]_folderfolder path of the cathegorie

§ simplifyPath()

std::string etk::simplifyPath ( std::string  _input)

Simplify a path with all the complication that mean ".." or "///\//".

Parameters
[in]_inputParth to simplify
Returns
the simplified path.

§ to_string() [1/2]

template<class TYPE >
std::string etk::to_string ( const TYPE &  _variable)

Template to declare convertion from anything in std::string.

Parameters
[in]_variableVariable to convert
Returns
String of the value

§ to_string() [2/2]

template<class TYPE >
std::string etk::to_string ( const std::vector< TYPE > &  _list)

Template to declare convertion from std::vector<anything> in std::string.

Parameters
[in]_listVariable to convert
Returns
String of the value: {...,...,...}