reactor-c
C Runtime for Lingua Franca
Loading...
Searching...
No Matches
type_converter.h File Reference

Go to the source code of this file.

Macros

#define PASTE(x, y)
 
#define RESOLVE(i, o, in)
 
DO_CONVERT

This macro to enable user to provide their own converter libraries as long as they follow the convention for naming their conversion functions this macro will work

Parameters
fromTypeTypename of value field
toTypeTypename of desired type
valueActual value of type fromType
Attention
Converter library functions must follow this convention
toType convert__fromType_to__toType(fromType x)
#define DO_CONVERT(fromType, toType, value)
 

Detailed Description

Author
Muhammad Khubaib Umer (khuba.nosp@m.ib@m.nosp@m.agnit.nosp@m.ion..nosp@m.io)

LICENSE

Copyright (c) 2023, MagnitionIO

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

DESCRIPTION

This file provides macro DO_CONVERT(fromType, toType, value) Sometimes the generic Reactor can work as a connector between two reactors We provide this macro to enable user to provide their own converter libraries as long as they follow the convention for naming their conversion functions this macro will work

Convention: toType convert__fromType_to__toType(fromType x)

Macro Definition Documentation

◆ DO_CONVERT

#define DO_CONVERT ( fromType,
toType,
value )
Value:
RESOLVE(fromType, toType, value)
#define RESOLVE(i, o, in)
Definition type_converter.h:42

◆ PASTE

#define PASTE ( x,
y )
Value:
x##y

◆ RESOLVE

#define RESOLVE ( i,
o,
in )
Value:
PASTE(convert__##i, _to__##o)(in)
#define PASTE(x, y)
Definition type_converter.h:40