Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
kazoo
Commits
62f1db01
Commit
62f1db01
authored
Nov 19, 2019
by
Maxime Perrotin
Browse files
Add function state for standard C++ too
parent
9022e6d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
templates/skeletons/cpp-body/function.tmplt
View file @
62f1db01
...
...
@@ -21,31 +21,34 @@
@@-- @_Is_Type_@ : Flag, True if function is a component type
@@-- @_Instance_Of_@ : Optional name of component type
@@IF@@ not @_Is_Type_@ and not @_EXIST:Instance_Of_@
@@INCLUDE@@ ../c-body/function.tmplt
@@ELSE@@
/* C++ Body file for function (type or instance) @_Name_@
* Generated by TASTE on @_NOW_@
* You can edit this file, it will not be overwritten
* Provided interfaces : @_List_Of_PIs_@
* Required interfaces : @_List_Of_RIs_@
* User-defined properties for this function:
// Body file for function @_Name_@
// Generated by TASTE on @_NOW_@
// You can edit this file, it will not be overwritten
// Provided interfaces : @_List_Of_PIs_@
// Required interfaces : @_List_Of_RIs_@
// User-defined properties for this function:
@@TABLE@@
*
|_ @_Property_Names_@ = @_Property_Values_@
//
|_ @_Property_Names_@ = @_Property_Values_@
@@END_TABLE@@
* Timers : @_Timers_@
*/
// Timers : @_Timers_@
#include "@_LOWER:Name_@.h"
#include "@_LOWER:Name_@_state.h"
//#include <iostream>
// Define and use function state inside this context structure
// avoid defining global/static variable elsewhere
@_LOWER:Name_@_state ctxt;
@@IF@@ @_Has_Context_@
/
/
Include Context Parameters (constants defined in the Interface View)
/
*
Include Context Parameters (constants defined in the Interface View)
*/
#include "Context-@_REPLACE_ALL(_/-):LOWER:Name_@.h"
@@END_IF@@
void @_LOWER:Name_@_startup()
void @_LOWER:Name_@_startup(
void
)
{
// Write your initialisation code, but DO NOT CALL REQUIRED INTERFACES
//
puts (
"[@_Name_@] Startup"
)
;
//
std::cout <<
"[@_Name_@] Startup"
<< std::endl
;
}
@@TABLE@@
...
...
@@ -54,8 +57,9 @@ void @_LOWER:Name_@_startup()
@@END_TABLE@@
@@TABLE@@
//
void @_LOWER:Name_@_PI_@_Timers_@()
//
{
void @_LOWER:Name_@_PI_@_Timers_@(
void
)
{
// This function is called when the timer @_Timers_@ expires
//
}
}
@@END_TABLE@@
@@END_IF@@
templates/skeletons/cpp-context/function.tmplt
View file @
62f1db01
...
...
@@ -25,7 +25,8 @@
#include "dataview-uniq.h"
class @_LOWER:Name_@_state {
public:
// Add your members here
// int counter;
};
templates/skeletons/cpp-header/function.tmplt
View file @
62f1db01
...
...
@@ -22,51 +22,4 @@
@@-- @_Instance_Of_@ : Optional name of component type
@@IF@@ not @_Is_Type_@ and not @_EXIST:Instance_Of_@
@@INCLUDE@@ ../c-header/function.tmplt
@@ELSE@@
/* C++ Type or Instance
* (Full template to to be completed)
* Header file for function @_Name_@ in @_Language_@ language
* Generated by TASTE on @_NOW_@
* Context Parameters present : @_YES_NO:Has_Context_@
* Provided interfaces : @_List_Of_PIs_@
* Required interfaces : @_List_Of_RIs_@
* User-defined properties for this function:
@@TABLE@@
* |_ @_Property_Names_@ = @_Property_Values_@
@@END_TABLE@@
* DO NOT EDIT THIS FILE, IT WILL BE OVERWRITTEN DURING THE BUILD
*/
#pragma once
#include "dataview-uniq.h"
#ifdef __cplusplus
extern "C" {
#endif
class @_LOWER:Name_@
{
void startup();
/* Provided interfaces */
@@TABLE@@
@_Provided_Interfaces_@
@@END_TABLE@@
/* Required interfaces */
@@TABLE@@
@_Required_Interfaces_@
@@END_TABLE@@
@@TABLE@@
// void @_Timers_@(void);
/* Call these functions to set/reset @_Timers_@ (value in milliseconds)*/
void @_LOWER:Name_@_RI_SET_@_Timers_@(asn1SccT_UInt32 *);
void @_LOWER:Name_@_RI_RESET_@_Timers_@();
@@END_TABLE@@
}
#ifdef __cplusplus
}
#endif
@@END_IF@@
test/Demo_CPP/Makefile
View file @
62f1db01
...
...
@@ -3,18 +3,17 @@ KAZOO=../../kazoo
all
:
c
ada
:
test-parse-ada
make
-C
output.ada
cp
function1/function1.c output.pohic/function1/C/src
cp
function2/function2.cc output.pohic/function2/CPP/src
cd
output.ada/build
&&
\
ocarina
-x
main.aadl
&&
\
make
-f
Makefile.taste
cp
function1/function1.c work/function1/C/src
cp
function2/function2.cc work/function2/CPP/src
cp
function2/function2_state.h work/function2/CPP/src
$(MAKE)
-C
output.ada
c
:
test-parse-c
#
Polyorb_HI_C output
cp
function1/function1.c output.pohic/function1/C/src
cp
function2/function2.cc output.pohic/function2/CPP/src
$(MAKE)
-C
output.pohic
$(MAKE)
-C
output.pohic build-rtems-ada
cp
function1/function1.c work/function1/C/src
cp
function2/function2.cc work/function2/CPP/src
cp
function2/function2_state.h work/function2/CPP/src
$(MAKE)
-C
work
$(MAKE)
-C
work build-rtems-ada
test-parse-ada
:
clean-ada
$(KAZOO)
--gw
\
...
...
@@ -24,7 +23,7 @@ test-parse-ada: clean-ada
test-parse-c
:
clean-c
$(KAZOO)
-p
--gw
\
-o
output.pohic
\
-o
work
\
--glue
-g
buildsupport_pohic
:
buildsupport
-o
output.buildsupport.pohic
-p
--aadlv2
--glue
-i
InterfaceView.aadl
-c
DeploymentView.aadl
-d
DataView.aadl ../common/ocarina_components.aadl ../common/TASTE_IV_Properties.aadl ../common/TASTE_DV_Properties.aadl
...
...
@@ -34,7 +33,7 @@ buildsupport_pohiada:
gdb
:
clean
gdb
--args
$(KAZOO)
--gw
\
-o
output.pohic
\
-o
work
\
--glue
\
--debug
...
...
@@ -42,13 +41,13 @@ clean-ada:
rm
-rf
output.ada
clean-c
:
rm
-rf
output.pohic
rm
-rf
work
skeletons
:
$(KAZOO)
-p
--gw
--glue
-o
code
&&
make
-C
code
dataview
$(KAZOO)
-p
--gw
--glue
-o
work
&&
make
-C
work
dataview
clean-skeletons
:
rm
-rf
code
rm
-rf
work
clean
:
clean-ada clean-c clean-skeletons
...
...
test/Demo_CPP/function1/function1.c
View file @
62f1db01
...
...
@@ -16,5 +16,6 @@ void function1_PI_pulse()
function1_RI_doSomethingInCPP
(
&
i
,
&
o
);
printf
(
"Send %lld, got %lld
\n
"
,
i
,
o
);
i
++
;
}
test/Demo_CPP/function2/function2.cc
View file @
62f1db01
/* User code: This file will not be overwritten by TASTE. */
// Body file for function Function2
// Generated by TASTE on 2019-11-19 15:29:01
// You can edit this file, it will not be overwritten
// Provided interfaces : doSomethingInCPP
// Required interfaces :
// User-defined properties for this function:
// |_ Taste::Active_Interfaces = any
// |_ Taste::coordinates = 151807 59211 191176 105981
// Timers :
#include
"function2.h"
#include
"function2_state.h"
#include
<iostream>
#include
"function2.h"
// Define and use function state inside this context structure
// avoid defining global/static variable elsewhere
function2_state
ctxt
;
void
function2_startup
()
void
function2_startup
(
void
)
{
/*
Write your initiali
z
ation code
here,
but do not make any call to a required interface. */
//
Write your initiali
s
ation code
, but DO NOT CALL REQUIRED INTERFACES
// puts ("[Function2] Startup");
}
void
function2_PI_doSomethingInCPP
(
const
asn1SccT_Int32
*
IN_in1
,
asn1SccT_Int32
*
OUT_out1
)
void
function2_PI_doSomethingInCPP
(
const
asn1SccT_Int32
*
IN_in1
,
asn1SccT_Int32
*
OUT_out1
)
{
/* Write your code here! */
std
::
cout
<<
*
IN_in1
<<
std
::
endl
;
*
OUT_out1
=
*
IN_in1
+
1
;
*
OUT_out1
=
*
IN_in1
+
ctxt
.
counter
;
}
test/Demo_CPP/function2/function2_state.h
0 → 100644
View file @
62f1db01
// Fill in this class with your context data (internal state):
// list all the variables you want global (per function instance)
#include
"dataview-uniq.h"
class
function2_state
{
public:
int
counter
=
1
;
};
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment