Commit 14d6030e by Michael Schmid

added missing files

parent 74cbc558
*.sh binary
# The following files are ignored by Git
*.TMP
*.o
*.exe
build*
*~
*#
# Eclipse CDT project files
.project
.cproject
.settings/
# Latex output files
*.aux
*.bbl
*.blg
*.log
*.out
*.pdf
*.toc
*.synctex.gz
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause
language: cpp
compiler:
- gcc
- clang
install:
- sudo apt-get install -qq cppcheck
- sudo add-apt-repository --yes ppa:kalakris/cmake
- sudo apt-get update -qq
- sudo apt-get install cmake
script:
- cppcheck -q --enable=all *_c*
- mkdir build && cd build
- cmake ..
- make
- chmod a+x binaries/run_tests.sh
- ./binaries/run_tests.sh
This diff is collapsed. Click to expand it.
Embedded Multicore Building Blocks (EMB²)
=========================================
Overview
--------
This project is licensed under the BSD 2-clause license given below.
The MTAPI header file is copyrighted by the Multicore Association
(http://www.multicore-association.org/) and licensed under the BSD 3-clause
license (see file include\embb\mtapi\c\mtapi.h).
License
-------
Copyright (c) 2014-2016, Siemens AG. All rights reserved.
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.
This diff is collapsed. Click to expand it.
cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=TC_Toolchain.cmake
\ No newline at end of file
div.image img[src="embb.png"]{
width:500px;
}
<doxygenlayout version="1.0">
<!-- Generated by doxygen 1.8.6 -->
<!-- Navigation index tabs for HTML output -->
<navindex>
<tab type="mainpage" visible="yes" title=""/>
<tab type="pages" visible="no" title="" intro=""/> <!-- Set visibility to no to hide related pages -->
<tab type="modules" visible="yes" title="API" intro=""/>
<tab type="namespaces" visible="no" title="C++ Namespaces">
<tab type="namespacelist" visible="yes" title="" intro=""/>
<tab type="namespacemembers" visible="yes" title="" intro=""/>
</tab>
<tab type="classes" visible="yes" title="Type Reference">
<tab type="classlist" visible="yes" title="" intro=""/>
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
<tab type="hierarchy" visible="yes" title="" intro=""/>
<tab type="classmembers" visible="yes" title="" intro=""/>
</tab>
<tab type="files" visible="no" title="">
<tab type="filelist" visible="yes" title="" intro=""/>
<tab type="globals" visible="yes" title="" intro=""/>
</tab>
<tab type="examples" visible="yes" title="" intro=""/>
</navindex>
<!-- Layout definition for a class page -->
<class>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<inheritancegraph visible="$CLASS_GRAPH"/>
<collaborationgraph visible="$COLLABORATION_GRAPH"/>
<memberdecl>
<nestedclasses visible="yes" title=""/>
<publictypes title=""/>
<services title=""/>
<interfaces title=""/>
<publicslots title=""/>
<signals title=""/>
<publicmethods title=""/>
<publicstaticmethods title=""/>
<publicattributes title=""/>
<publicstaticattributes title=""/>
<protectedtypes title=""/>
<protectedslots title=""/>
<protectedmethods title=""/>
<protectedstaticmethods title=""/>
<protectedattributes title=""/>
<protectedstaticattributes title=""/>
<packagetypes title=""/>
<packagemethods title=""/>
<packagestaticmethods title=""/>
<packageattributes title=""/>
<packagestaticattributes title=""/>
<properties title=""/>
<events title=""/>
<privatetypes title=""/>
<privateslots title=""/>
<privatemethods title=""/>
<privatestaticmethods title=""/>
<privateattributes title=""/>
<privatestaticattributes title=""/>
<friends title=""/>
<related title="" subtitle=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<services title=""/>
<interfaces title=""/>
<constructors title=""/>
<functions title=""/>
<related title=""/>
<variables title=""/>
<properties title=""/>
<events title=""/>
</memberdef>
<allmemberslink visible="yes"/>
<usedfiles visible="$SHOW_USED_FILES"/>
<authorsection visible="yes"/>
</class>
<!-- Layout definition for a namespace page -->
<namespace>
<briefdescription visible="yes"/>
<memberdecl>
<nestednamespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<classes visible="yes" title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection visible="yes"/>
</namespace>
<!-- Layout definition for a file page -->
<file>
<briefdescription visible="yes"/>
<includes visible="$SHOW_INCLUDE_FILES"/>
<includegraph visible="$INCLUDE_GRAPH"/>
<includedbygraph visible="$INCLUDED_BY_GRAPH"/>
<sourcelink visible="yes"/>
<memberdecl>
<classes visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<constantgroups visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<functions title=""/>
<variables title=""/>
</memberdef>
<authorsection/>
</file>
<!-- Layout definition for a group page -->
<group>
<briefdescription visible="yes"/>
<groupgraph visible="$GROUP_GRAPHS"/>
<memberdecl>
<nestedgroups visible="yes" title=""/>
<dirs visible="yes" title=""/>
<files visible="yes" title=""/>
<namespaces visible="yes" title=""/>
<classes visible="yes" title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
<membergroups visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
<memberdef>
<pagedocs/>
<inlineclasses title=""/>
<defines title=""/>
<typedefs title=""/>
<enums title=""/>
<enumvalues title=""/>
<functions title=""/>
<variables title=""/>
<signals title=""/>
<publicslots title=""/>
<protectedslots title=""/>
<privateslots title=""/>
<events title=""/>
<properties title=""/>
<friends title=""/>
</memberdef>
<authorsection visible="yes"/>
</group>
<!-- Layout definition for a directory page -->
<directory>
<briefdescription visible="yes"/>
<directorygraph visible="yes"/>
<memberdecl>
<dirs visible="yes"/>
<files visible="yes"/>
</memberdecl>
<detaileddescription title=""/>
</directory>
</doxygenlayout>
/**
\mainpage Overview
The Embedded Multicore Building Blocks (EMB<sup>2</sup>) are an easy to
use yet powerful and efficient C/C++ library for the development of
parallel applications. EMB<sup>2</sup> has been specifically designed
for embedded systems and the typical requirements that accompany them,
such as real-time capability and constraints on memory consumption. As a
major advantage, low-level operations are hidden in the library which
relieves software developers from the burden of thread management and
synchronization. This not only improves productivity of parallel
software development, but also results in increased reliability and
performance of the applications.
EMB<sup>2</sup> is independent of the hardware architecture (x86, ARM,
...) and runs on various platforms, from small devices to large systems
containing numerous processor cores. It builds on MTAPI, a standardized
programming interface for leveraging task parallelism in embedded
systems containing symmetric or asymmetric multicore processors. A core
feature of MTAPI is low-overhead scheduling of fine-grained tasks among
the available cores during runtime. Unlike existing libraries,
EMB<sup>2</sup> supports task priorities and affinities, which allows
the creation of soft real-time systems. Additionally, the scheduling
strategy can be optimized for non-functional requirements such as minimal
latency and fairness.
Besides the task scheduler, EMB<sup>2</sup> provides basic parallel
algorithms, concurrent data structures, and skeletons for implementing
stream processing applications (see figure below). These building blocks
are largely implemented in a non-blocking fashion, thus preventing
frequently encountered pitfalls like lock contention, deadlocks, and
priority inversion. As another advantage in real-time systems, the
algorithms and data structures give certain progress guarantees. For
example, wait-free data structures guarantee system-wide progress which
means that every operation completes within a finite number of steps
independently of any other concurrent operations on the same
data structure.
\image html ./images/embb.png
*/
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="1;url=./doxygen_html_generated/index.html">
<script type="text/javascript">
window.location.href = "./doxygen_html_generated/index.html"
</script>
<title>Page Redirection</title>
</head>
<body>
If you are not redirected automatically, follow the <a href='./doxygen_html_generated/index.html'>link</a>
</body>
</html>
\chapter{Containers}
\label{cha:containers}
Containers are essential for storing objects in an organized way. Unfortunately, the containers provided by the C++ Standard Library are not thread-safe. Attempts to read and write elements concurrently may corrupt the stored data. While such undefined behavior can be avoided by synchronizing all accesses using a mutex, this essentially eliminates any parallelism.
The containers provided by \embb enable a high degree of parallelism by design. They are implemented in a lock-free or wait-free fashion, thus avoiding any blocking operations. This way, multiple threads or tasks may access a container concurrently without suffering from typical side effects like convoying. Wait-free algorithms even guarantee that an operation completes within a bounded number of steps. Consequently, threads are immune to starvation which is critical for real-time systems.
In embedded systems, memory is often preallocated in the initialization phase to minimize the effort for memory management during operation and to prevent unpredictable out-of-memory errors. \embb containers have a fixed capacity and allocate the required memory at construction time. Consequently, they can be used in safety-critical application, where dynamic memory allocation after initialization is forbidden.
\section{Object Pools}
\label{sec:containers_object_pools}
An object pool allocates a fixed number of objects at construction. Objects can then be allocated from the pool and returned for later reuse. When implementing lock-free or wait-free algorithms, the underlying memory allocation scheme also to be lock-free or wait-free, respectively. However, memory allocation functions such as \lstinline|new| and \lstinline|delete| usually do not give any progress guarantees. To solve this problem, \embb provides lock-free and wait-free object pools.
Listing~\ref{lst:object_pool_lst1} shows an example, where we create in Line~\ref{lst:object_pool_lst1:line_create} an object pool with five objects of type \lstinline|int|. If nothing else is specified, the object-pool uses a wait-free implementation. Then, we allocate five objects from the object pool and store the obtained pointers in a temporary array. The actual allocation takes place in Line~\ref{lst:object_pool_lst1:line_allocate}. After that, we deallocate them in the second loop be calling \lstinline|FreeObject| on each pointer (see Line~\ref{lst:object_pool_lst1:line_free}).
\lstinputlisting[caption={Object pool -- initialization, allocation and
deallocation},label={lst:object_pool_lst1}]{../examples/containers/object_pool-snippet.h}
For actually allocating and deallocating objects, the object pool's implementation relies on a value pool which keeps track of the objects in use. If the value pool is implemented in a lock-free manner, the object pool is lock-free as well (analogously for wait-free pools). Currently, \embb provides two value pools: \lstinline|WaitFreeArrayValuePool| and \lstinline|LockFreeTreeValuePool|. Normally (if nothing is specified), the wait-free pool is used. For having a lock-free object pool instead, one has to specify the corresponding value pool to use as additional template parameter. If we replace Line~\ref{lst:object_pool_lst1:line_create} of the previous example with the following lines, the object pool is not wait-free anymore but lock-free (the values are of type
\lstinline|int| and initialized to \lstinline|0|):
%
\lstinputlisting{../examples/containers/object_pool_2-snippet.h}
%
This will result in a speed-up for most applications, but progress guarantees are weaker.
\section{Stacks}
\label{sec:containers_stacks}
As the name indicates, the class template \lstinline|LockFreeStack| implements a lock-free stack which stores elements according to the LIFO (Last-In, First-Out) principle. Listing~\ref{lst:stack_lst1} shows a simple example. In Line~\ref{lst:stack_lst1:line_create}, we create a stack of integers with a capacity of 10 elements.\footnote{Due to the necessary over-provisioning of memory in thread-safe memory management, the stack might be able to hold more than 10 elements, but is guaranteed to be able to hold at least 10 elements.} The stack provides two methods, \lstinline|TryPush| and \lstinline|TryPop|, both returning a Boolean value indicating success of the operation: \lstinline|TryPop| returns \lstinline|false| if the stack is empty, and \lstinline|TryPush| returns false if the stack is full. \lstinline|TryPop| returns the element removed from the stack via reference.
\lstinputlisting[caption={Stack -- initialization, push and
pop},label={lst:stack_lst1}]{../examples/containers/stack-snippet.h}
In Line~\ref{lst:stack_lst1:fail_pop} of Listing~\ref{lst:stack_lst1}, we try to pop an element from the empty stack, which has to fail. In the for-loop in Line \ref{lst:stack_lst1:loop1}, we fill the stack with \lstinline|int| values 0 $\ldots$ 4. Afterwards, in the loop in Line~\ref{lst:stack_lst1:loop2}, we pop five values (Line~\ref{lst:stack_lst1:pop}) from the stack into variable \lstinline|j|. According to the LIFO semantics, the values are popped in reverse order, i.e., we get the sequence 4 $\ldots$ 0. This is checked by the assertion in Line~\ref{lst:stack_lst1:assert}.
\section{Queues}
\label{sec:containers_queues}
There are two FIFO (First-In, First-Out) queue implementations in \embb, \lstinline|LockFreeMPMCQueue| and \lstinline|WaitFreeSPSCQueue|. The former permits multiple producers and multiple consumers (MPMC), whereas the latter is restricted to a single producer and a single consumer (SPSC). The interfaces are the same for both queues.
Listing~\ref{lst:queue_lst1} shows an example for the \lstinline|LockFreeMPMCQueue|. In Line~\ref{lst:queue_lst1:line_create}, we create a queue with element type \lstinline|int| and a capacity of 10 elements.\footnote{As in case of stacks, the queue may actually hold more than 10 elements.} The Boolean return value of the methods \lstinline|TryEnqueue| and \lstinline|TryDequeue| indicates success (\lstinline|false| if the queue is full or empty, respectively).
\lstinputlisting[caption={Queue -- initialization, enqueue and dequeue},label={lst:queue_lst1}]{../examples/containers/queues-snippet.h}
In Line~\ref{lst:queue_lst1:fail_pop} of Listing~\ref{lst:queue_lst1}, we try to dequeue an element from the empty queue, which has to fail. In the for-loop in Line~\ref{lst:queue_lst1:loop1}, we fill the queue with \lstinline|int| values 0 $\ldots$ 4. Afterwards, in the loop in Line~\ref{lst:queue_lst1:loop2}, we dequeue five values (Line~\ref{lst:queue_lst1:pop}) from the queue into variable \lstinline|j|. According to the FIFO semantics, the values are dequeued in the same order as they were enqueued, i.e., we get the sequence 0 $\ldots$ 4. This is checked by the assertion in Line~\ref{lst:queue_lst1:assert}.
\chapter{Introduction}
\section{Overview}
The Embedded Multicore Building Blocks (\embb) are an easy to use yet powerful and efficient C/C++ library for the development of parallel applications. \embb has been specifically designed for embedded systems and the typical requirements that accompany them, such as real-time capability and constraints on memory consumption. As a major advantage, low-level operations are hidden in the library which relieves software developers from the burden of thread management and synchronization. This not only improves productivity of parallel software development, but also results in increased reliability and performance of the applications.
\embb is independent of the hardware architecture (x86, ARM, ...) and runs on various platforms, from small devices to large systems containing numerous processor cores. It builds on MTAPI, a standardized programming interface for leveraging task parallelism in embedded systems containing symmetric or asymmetric multicore processors. A core feature of MTAPI is low-overhead scheduling of fine-grained tasks among the available cores during runtime. Unlike existing libraries, \embb supports task priorities, which allows the creation of soft real-time systems. Additionally, the scheduling strategy can be optimized for non-functional requirements such as minimal latency and fairness.
Besides the task scheduler, \embb provides basic parallel algorithms, concurrent data structures, and skeletons for implementing stream processing applications (see Figure~\ref{fig:introduction_embb_components}). These building blocks are largely implemented in a non-blocking fashion, thus preventing frequently encountered pitfalls like lock contention, deadlocks, and priority inversion. As another advantage in real-time systems, the algorithms and data structures give certain progress guarantees. For example, wait-free data structures guarantee system-wide progress which means that every operation completes within a finite number of steps independently of any other concurrent operations on the same data structure.
\begin{figure}[H]
\centering
\includegraphics[width=0.75\columnwidth]{../images/embb.pdf}
\label{fig:embb_components}
\caption{Main building blocks of \embb}
\label{fig:introduction_embb_components}
\end{figure}
% TODO
%\section{Key Features and Requirements}
\section{Outline}
The purpose of this tutorial is to introduce the basic concepts of \embb and to demonstrate typical application scenarios by means of simple examples. The tutorial is not intended to be complete in the sense that it describes every feature of \embb. For a detailed description of the API, please see the HTML documentation.
In the next subsection, we briefly describe the concept of function objects which is essential for using \embb. In Chapter~\ref{cha:mtapi}, we then present the task management features of MTAPI. These provide the basis for the algorithms outlined in Chapter~\ref{cha:algorithms} and the dataflow framework presented in Chapter~\ref{cha:dataflow}.
\section{Functions, Functors, and Lambdas}
\label{sec:introduction_function_objects}
Throughout this tutorial, we will encounter C++ types which model the C++ concept\footnote{In this context, the term \emph{concept} refers to a named set of requirements on a type.} \lstinline|FunctionObject|. The function object concept comprises function pointer, functor, and lambda types that are callable with suitable arguments by the function call syntax. Given a function object \lstinline|f| and arguments \lstinline|arg1|, \lstinline|arg2|, \lstinline|...|, the expression \lstinline|f(arg1, arg2, ...)| is a valid function invocation. If you are already familiar with function objects, you can safely skip the rest of this section. Otherwise, it might be worth reading it to get an idea of what is meant when talking about a function objects.
Consider, for example, the transformation of an iterable range of data values. Specifically, consider a vector of integers initialized as follows:
%
\\\inputlisting{../examples/stl_for_each/setup-snippet.h}
%
The range consists of the values (\lstinline|1, 2, 3, 4, 5|) and we now want to double each of them. We could simply get an iterator from the container holding the range, iterate over every element, and multiply it by two:
%
\\\inputlisting{../examples/stl_for_each/manual-snippet.h}
%
The range then contains the values (\lstinline|2, 4, 6, 8, 10|). In order to demonstrate the concept of function objects, we are now going to use the \lstinline|std::for_each| function defined in the \lstinline|algorithm| header of the C++ Standard Library. This function accepts as argument a \lstinline|UnaryFunction|, that is, a function object which takes only one argument. In case of \lstinline|std::for_each|, the argument has to have the same type as the elements in the range, as these are passed to the unary function. In our example, the unary function's task is to double the incoming value. We could define a function for that purpose:
%
\\\inputlisting{../examples/stl_for_each/function_define-snippet.h}
%
Since a function pointer models the concept of function objects, we can simply pass \lstinline|&DoubleFunction| to \lstinline|std::for_each|:
%
\\\inputlisting{../examples/stl_for_each/function-snippet.h}
%
Another possibility is to define a functor
%
\\\inputlisting{../examples/stl_for_each/functor_define-snippet.h}
%
and to pass an instance of this class to \lstinline|std::for_each|:
%
\\\inputlisting{../examples/stl_for_each/functor-snippet.h}
%
Functors as well as the function pointers separate the actual implementation from its place of usage which can be useful if the functionality is needed at different places. In many cases, however, it is advantageous to have the implementation of the function object at the same place as it is used. C++11 provides lambda expressions for that purpose which make our example more concise:
%
\\\inputlisting{../examples/stl_for_each/lambda-snippet.h}
%
Of course, this example is too simple to really benefit from function objects and the algorithms contained in the C++ Standard Library. However, in combination with the parallelization features provided by \embb, function objects are a helpful mechanism to boost productivity. Within this document, whenever a function object or one of its subtypes is required, one can use a function pointer, a functor, or a lambda. For simplicity, we will restrict ourselves to lambdas in subsequent examples, as they are most suitable for this kind of tutorial.
\sectionnonum{Intended Audience}
This document is intended for software developers who want to get an introduction to \embb and an idea on how to use its functionalities. It is not an API reference.
\sectionnonum{Objectives}
The objective of this document is to give an idea on how to use the functionalities of the \embb to solve simple programming problems.
\sectionnonum{Structure}
Structure
\ No newline at end of file
\chapter{Tasks}
\label{cha:tasks}
\embb provides a simple task management wrapper for the MTAPI interface. Using the example from the previous section, the signature of the action function for the tasks interface looks like this:
%
\\\inputlisting{../examples/tasks/tasks_cpp_action_signature-snippet.h}
%
First, the node instance needs to be obtained. If the node is not initialized yet, this function will do it.
%
\\\inputlisting{../examples/tasks/tasks_cpp_get_node-snippet.h}
%
\emph{\textbf{Note:} Automatic initialization allows for easy usage of the \emph{Algorithms} and \emph{Dataflow} building blocks. For performance measurements however, explicit initialization by calling \lstinline|embb::tasks::Node::Initialize| is imperative since the measurements will otherwise include the initialization time of MTAPI.}
Checking the arguments and the result buffer is not necessary, since everything is safely typed. However, the terminating condition of the recursion still needs to be checked:
%
\\\inputlisting{../examples/mtapi/mtapi_terminating_condition-snippet.h}
%
After that, the first part of the computation is launched as an MTAPI task using \lstinline|embb::tasks::Node::Spawn()| (registering an action function with a job is done automatically):
%
\\\inputlisting{../examples/tasks/tasks_cpp_calc_task-snippet.h}
%
The second part can be executed directly:
%
\\\inputlisting{../examples/tasks/tasks_cpp_calc_direct-snippet.h}
%
Then, completion of the MTAPI task has to be waited for using \lstinline|embb::tasks::Task::Wait()|:
%
\\\inputlisting{../examples/tasks/tasks_cpp_wait_task-snippet.h}
%
Finally, the two parts can be added and written into the result buffer:
%
\\\inputlisting{../examples/mtapi/mtapi_write_back-snippet.h}
%
The \lstinline|fibonacci()| function also gets simpler compared to the C version. The MTAPI runtime is initialized automatically, only the node instance has to be fetched:
%
\\\inputlisting{../examples/tasks/tasks_cpp_get_node-snippet.h}
%
The root task can be started using \lstinline|embb::tasks::Node::Spawn()| directly, registering with a job is done automatically:
%
\\\inputlisting{../examples/tasks/tasks_cpp_start_task-snippet.h}
%
Again, the started task has to be waited for (using \lstinline|embb::tasks::Task::Wait()|) before the result can be returned. The runtime is shut down automatically in an \lstinline|atexit()| handler.
\emph{\textbf{Note:} If the node was initialized explicitly by calling \lstinline|embb::tasks::Node::Initialize|, the runtime must also be shut down explicitly by calling \lstinline|embb::tasks::Node::Finalize|.}
% ===================================
% document formatting refinement
% ===================================
% No indents for whole text
\setlength{\parindent}{0pt}
% improve the line breaking
\setlength{\emergencystretch}{1em}
% pic width = \textwidth - \chapterpicwidth
\def\chapterpicwidth{0.43}
% line breaks for URLs
\renewcommand{\UrlBreaks}{\do\/}
%
% custom hyphenation
%
\hyphenation{in-stru-men-ta-tion analy-sis con-cur-ren-cy}
% ===================================
% settings for the listings package
% ===================================
\definecolor{lightGray}{RGB}{242,242,242}
\lstset{
language=C++,
basicstyle=\ttfamily,
columns=fullflexible,
keepspaces=true, % To have spaces monsized
tabsize=2,
frame=none, % = single
breaklines=true,
numbers=left,
numberstyle=\tiny,
escapeinside={//@}{@},
showstringspaces=false,
resetmargins=true,
xleftmargin=18pt,
xrightmargin=0pt,
%resetmargins=true,
%framextopmargin=0pt
backgroundcolor=\color{lightGray},
captionpos=b,
%abovecaptionskip=0pt,
%belowcaptionskip=0pt,
%aboveskip=3pt,
%belowskip=0pt,
%framesep=1pt,
numberbychapter=false,
}
% coloring for listings
\lstdefinestyle{colored}{
moredelim=[is][\color{blue}]{@}{@},
moredelim=[is][\color{red}]{|}{|},
}
%
% Counter and caption for listings
%
%\newcounter{lstlisting} % already defined by pkg listing at \begin{document}
\counterwithout{lstlisting}{chapter}
\newcommand{\inputlisting}[1]{
\begin{minipage}{\columnwidth}
\lstinputlisting{#1}
\end{minipage}
}
\newcommand{\lstgname}{Listing}
\newcommand{\listingcaption}[1]%
{%
{%
\refstepcounter{lstlisting}
\noindent\footnotesize{\lstgname~\thelstlisting{:}~#1\hfill}
}%
}%
% ===========================
% cover generation commands
% ===========================
\def\backcover{
\genbackpage{
\textbf{Siemens AG}\newline
Corporate Technology\newline
Multicore Expert Center\newline
\newline
Otto-Hahn-Ring 6\newline
81739 Muenchen\newline
Germany\newline
\newline
{http://multicore.ct.siemens.de}
}
}
% ======================
% convenience commands
% ======================
\def\chaptername{Chapter}
\def\algname{Algorithm}
\def\sectionname{Section}
%
% Programming languages and frameworks
%
\def\qt{Qt}
\def\cE{C11}
\def\cpp{C\raisebox{0.17ex}{\small\textbf{++}}}
\def\cppFootnote{C\raisebox{0.08ex}{\small{++}}}
\def\cppE{{\cpp}11}
\newcommand{\csharp}{%
{\settoheight{\dimen0}{C}C\kern-.05em\hspace{0.5pt}\resizebox{!}{\dimen0}{\raisebox{\depth}{\#}}}}
\def\dotnet{.NET}
%
% Special characters
%
\def\myCheck{\ding{51}} % check
\def\myCross{\ding{55}} % cross
%
% Various stuff
%
\def\time#1{#1}
\def\markup#1{{\color{NavyBlue}#1}}
\newcommand{\toolcard}[9]{
\begin{table}
\caption{Quick card for {#2}}
{\small
\begin{tabular}{>{\bfseries}p{0.295\columnwidth}p{0.605\columnwidth}}
\thickhline
{Tool} & #2 \\
{Detectable bugs} & #3 \\
{License} & #4 \\
{Platforms} & #5 \\
{Operating systems} & #6 \\
{\mbox{Languages}} & #7 \\
{Threading libraries} & {#8} \\
{Additional facts} & {#9} \\
\thickhline
\end{tabular}
}
\label{qc:#1}
\end{table}
}
% table cell that allows line breaks (e.g., for toolcard)
% first (optional) parameter defines alignment (l,c,r)
% second parameter is the content
\def\lbcell[#1]#2{\rule{0pt}{4ex}\shortstack[#1]{#2}}
% =======================
% other (various) stuff
% =======================
%
% very custom stuff
%
\def\hb#1{\hbImpl(#1)}
\def\hbRel{\rightarrow}
\def\hbImpl(#1,#2){$#1 \hbRel #2$}
@manual{MTAPI,
title = {Multicore Task Management API (MTAPI) Specification V1.0},
organization = {The Multicore Association},
year = 2013,
month = mar
}
Copyright (C) nemadesign GbR
$Rev: 80 $
$Date: 2014-09-08 21:22:10 +0200 (Mo, 08. Sep 2014) $
Things to consider
==================
In case of a wrong linf for the 'Bilbiography'
entry, add this before the '\addcontentsline{toc}{...}{...}:
Example:
-------- BEGIN ---------
\cleardoublepage
\phantomsection
% generate TOC
\addcontentsline{toc}{chapter}{Bibliography}
--------- END ----------
New macros
==========
\chapterpictopnum{_TEXT_}{_PIC_}{_WIDTH_}{_LABEL_}
\chapterpictopnonum{_TEXT_}{_PIC_}{_WIDTH_}{_LABEL_}
Add picture above chapter title
_TEXT_ : title for the chapter
_PIC_ : image file
_WIDTH_ : relative width of text (1.0 equals text width)
_LABEL_ : name for the label of the chapter
Examples:
\chapterpicnum{Das Kapitel}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.5}
\chapterpicnonum{text text text}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.3}
______________________________________________________________________________________
\chapterpicrightnum{_TEXT_}{_PIC_}{_WIDTH_}{_LABEL_}
\chapterpicrightnonum{_TEXT_}{_PIC_}{_WIDTH_}{_LABEL_}
Add picture right to chapter title
_TEXT_ : title for the chapter
_PIC_ : image file
_WIDTH_ : relative width of text (1.0 equals text width)
_LABEL_ : name for the label of the chapter
Examples:
\chapterpicrightnum{Chapter with Picture}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.5}
\chapterpicrightnonum{Chapter* with Picture}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.4}
______________________________________________________________________________________
\chapterpicteasernum{_TEXT_}{_PIC_}{_WIDTH_}{_LABEL_}{_TEASE_}
\chapterpicteasernonum{_TEXT_}{_PIC_}{_WIDTH_}{_LABEL_}{_TEASE_}
Chapter title with picture and teaser text.
In single column layout: white teaser text in grey box.
In double column layout: grey teaser text in white box.
_TEXT_ : title for the chapter
_PIC_ : image file
_WIDTH_ : relative width of text (1.0 equals text width)
_LABEL_ : name for the label of the chapter
_TEASE_ : teaser text
Examples:
\chapterpicteasernum{Chapter \& Picture \& Teaser}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.5}{Text}
\chapterpicteasernonum{Chapter* \& Picture \& Teaser}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.4}{Text}
______________________________________________________________________________________
\tableofcontentspic{_TEXT_}{_PIC_}{_WIDTH_}
Add table of contents with picture
_TEXT_ : title for the chapter
_PIC_ : tmage file
_WIDTH_ : relative width of text (1.0 equals text width)
Example:
\tableofcontentspic{Contents}{gfx/siemens-logo-wallpaper-1024x597.jpg}{0.5}
______________________________________________________________________________________
\gentitlepage{_PIC_}{_TEXT1_}{_TEXT2_}
Generate a titlepage
_PIC_ : image file (must be of square dimensions!)
_TEXT1_ : text above title
_TEXT2_ : text for title
Example:
\gentitlepage{gfx/Infineon-Baseband-Chip-X618.jpg}{Some text here}{Very long title for this Document Over Two Lines}
______________________________________________________________________________________
\gentitlepagenopic{_TEXT1_}{_TEXT2_}
Generate a titlepage without a picture
_TEXT1_ : text above title
_TEXT2_ : text for title
Example:
\gentitlepagenopic{Some text here}{Very long title for this Document Over Two Lines}
______________________________________________________________________________________
\genbackpage{_TEXT_}
Generate a backpage
_TEXT_ : white text
Example:
\genbackpage{Siemens AG}
______________________________________________________________________________________
\renewcommand{\shorttitle}{_TEXT_}
Set short title in header
_TEXT_ : text for short title
Example:
\renewcommand{\shorttitle}{Short title for paper}
______________________________________________________________________________________
\renewcommand{\shortdate}{_TEXT_}
Set date in short title
_TEXT_ : text for date in short title, default is \today
Example:
\renewcommand{\shortdate}{\today}
\renewcommand{\shortdate}{11.09.2011}
______________________________________________________________________________________
\renewcommand{\copyrightdate}{_TEXT_}
Set date in short title
_TEXT_ : text for date in copyright line on last page ,default is \today
Example:
\renewcommand{\copyrightdate}{\today}
\renewcommand{\copyrightdate}{11.09.2011}
______________________________________________________________________________________
Used LaTeX packages
===================
\usepackage[colorlinks=true, bookmarks=false]{hyperref}
\usepackage[scaled]{uarial}
\usepackage[T1]{fontenc}
%\usepackage[ngerman]{babel}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[pdftex]{graphicx}
\usepackage{multirow}
\usepackage{subfigure}
\usepackage{listings}
\usepackage{courier}
\usepackage{titlesec}
\usepackage{scrpage2}
\usepackage{chngcntr}
\usepackage[table,usenames,dvipsnames]{xcolor}
\usepackage{booktabs}
\usepackage{color}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{fp}
\usepackage{eso-pic,picture}
\usepackage[absolute]{textpos}
\usepackage{multicol}
\usepackage{titletoc}
\usepackage{moresize}
\usepackage{printlen}
\usepackage{setspace}
\usepackage[colorlinks=true, bookmarks=false]{hyperref}
These packages are only used in the demo documents:
\usepackage{layout}
\usepackage{lipsum}
% Copyright (C) nemadesign GbR
% $Rev: 56 $:
% $Date: 2014-09-20 13:52:19 +0200 (Sa, 20. Sep 2014) $:
% This file contains settings and macros which are used in
% all variants for the siemens stylesheets
\usepackage[scaled]{uarial} % Font is Arial
\fontfamily{phv}\fontseries{m}\fontshape{n}\selectfont % Arial for Headings
\setkomafont{sectioning}{\sffamily\bfseries}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[T1]{fontenc}
%\usepackage[ngerman]{babel}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage[pdftex]{rotating,graphicx}
\usepackage{multirow}
\usepackage{layout}
\usepackage{lipsum}
\usepackage{subfigure}
\usepackage{multicol,listings}
\usepackage{courier}
\usepackage[automark]{scrpage2}
\usepackage{titlesec}
\usepackage{scrpage2}
\usepackage{chngcntr}
\usepackage[table,usenames,dvipsnames]{xcolor}
\usepackage{booktabs}
\usepackage{color}
\usepackage{longtable}
\usepackage{colortbl}
\usepackage{fp}
\usepackage{eso-pic,picture}
\usepackage[absolute]{textpos}
\usepackage{multicol}
\usepackage{cite}
\usepackage{titletoc}
\usepackage{moresize}
\usepackage{printlen}
\usepackage{setspace}
% Siemens specific packages
\usepackage[plain]{algorithm}
\usepackage{algorithmic}
\usepackage{array} % for tabular
\usepackage{pifont} % for \myCheck, \myCross
\usepackage[hyphens]{url}
\usepackage[hidelinks]{hyperref} % hyperref without colored links
\usepackage{balance} % for balancing the bibliography
\usepackage{ifthen}
% set title and date in headline
\newcommand{\shorttitle}{Default short title}
\newcommand{\shortdate}{\today}
\newcommand{\copyrightdate}{\today}
% nobody likes Hurenkinder und Schusterjungen
\hyphenpenalty = 500
\tolerance = 800
\widowpenalty = 300
\clubpenalty = 300
\displaywidowpenalty = 10000
% change table background colors
\definecolor{lightgray}{gray}{0.9}
\let\oldtabular\tabular
\let\endoldtabular\endtabular
\renewenvironment{tabular}{\rowcolors{2}{white}{lightgray}\oldtabular}{\endoldtabular}
% thick hline in tables
\newcommand{\thickhline}{%
\noalign {\ifnum 0=`}\fi \hrule height 1pt
\futurelet \reserved@a \@xhline
}
% global counters for tables and figures
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{footnote}{chapter}
% left align captions
\usepackage[
singlelinecheck=false % <-- important
]{caption}
% No title for TOC
\renewcommand*{\tocbasic@listhead}[1]{%
\typeout{Ueberschrift ``#1'' nicht ausgeben}%
}
\pagestyle{scrheadings}
% set headline and footline
\lehead{}
\lohead{}
\cehead{}
\cohead{}
\rehead{\shorttitle \;| \shortdate}
\rohead{\shorttitle \;| \shortdate}
\lefoot{Unrestricted \copyright \; Siemens AG \the\year. All rights reserved.}
\lofoot{Unrestricted \copyright \; Siemens AG \the\year. All rights reserved.}
\cefoot{}
\cofoot{}
\refoot{\thepage}
\rofoot{\thepage}
%\pagestyle{scrheadings}
\deftripstyle{myemptypage}{}{}{}{\thepage}{}{}
\KOMAoptions{cleardoublepage=myemptypage}
% headings and footings for chapter
\renewcommand{\chapterpagestyle}{scrheadings}
% no gap at beginning of chapter
\renewcommand*{\chapterheadstartvskip}{\vspace*{-\topskip}}
% small gap at the end of chapter
\renewcommand*{\chapterheadendvskip}{\vspace{3.0\baselineskip}}
% color definition
\definecolor{orange}{rgb}{0.92,0.47,0.04} % HEX 235 120 10
\definecolor{grey1}{rgb}{0.53,0.61,0.67} % HEX 135 155 170
\definecolor{grey2}{rgb}{0.31,0.39,0.45} % HEX 80 100 115
% font style for listings
\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true}
\lstset{framextopmargin=0pt,frame=single}
% stripped pagewidth for title page
\newcommand{\Pw}{\strip@pt\paperwidth}
% sytle for LOF
\addtocontents{lof}{\protect\vspace{0pt}}
\renewcommand*\l@figure{\mdseries\bprot@dottedtocline{1}{0em}{3.0em}}
% shift everything up
\newcommand{\squeezeup}{\vspace{-5mm}}
\titlespacing*{\chapter}{0pt}{0pt}{40pt}
\addtokomafont{sectioning}{\color{orange}}
\def\thespread{30}
\addtokomafont{chapter}{\fontsize{28pt}{1.0}\linespread{\thespread}\selectfont}
\setkomafont{pagehead}{
\normalfont\sffamily}
\setkomafont{pagefoot}{
\normalfont\sffamily}
\setkomafont{pagenumber}{
\normalfont\sffamily}
\addtokomafont{pagenumber}{\color{grey1}}
\addtokomafont{pagefoot}{\color{grey1}}
\addtokomafont{pagehead}{\color{grey1}}
% Make nicer table and figure captions
\setkomafont{captionlabel}{\sffamily\bfseries}
\setkomafont{caption}{\sffamily}
% same identation for all lines in footnotes
\deffootnote{1em}{1em}{\thefootnotemark\ }
% Set first row for tables to bold text
\newcolumntype{$}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
#1\ignorespaces
}
% Macros by nemadesign
\setlength{\fboxsep}{0pt}
\setlength\fboxrule{0.1pt}
\newcommand{\moveup}{\vspace{-7mm}}
\newcommand{\movedown}{\vspace{10mm}}
\newcommand{\picgap}{\vspace{8mm}}
\newcommand{\picgapsmall}{\vspace{0mm}}
% Macros by Siemens
\newcommand{\printAuthors}[2][\empty]
{
\clearpage % this is important
\begin{minipage}[b][\textheight]{\textwidth}
\begin{oldtabular}{rp{0.8\columnwidth}}
\multicolumn{2}{l}{Authors} \\
& #2
\end{oldtabular}
\ifthenelse{\equal{#1}{\empty}}
{\empty}
{
\begin{oldtabular}{rp{0.8\columnwidth}}
\\
\multicolumn{2}{l}{Contributors} \\
& #1
\end{oldtabular}
} \\
\end{minipage}
\clearpage % this is important
}
% Copyright (C) nemadesign GbR
% $Rev: 56 $:
% $Date: 2014-09-02 21:28:49 +0200 (Di, 02. Sep 2014) $:
% definitions for two column style sheet
\makeatletter
\usepackage{sty/siemens_core}
\usepackage{geometry}
\geometry
{
left=1.8cm, %linker Seitenrand
right=1.8cm, %rechter Seitenrand
top=25mm, %oben der Abstand
bottom=28mm %Unten der Abstand
}
\renewcommand\section{\@startsection
{section}{1}{0mm} % name, ebene, einzug
{1.5\baselineskip} % vor-abstand
{0.3\baselineskip} % nach-abstand
{\bfseries\sffamily\Large\color{orange}} % layout
}
\renewcommand\subsection{\@startsection
{subsection}{2}{0mm}
{1.0\baselineskip}
{0.2\baselineskip}
{\bfseries\sffamily\Large\color{grey1}}
}
\newcommand\sectionnonum{\@startsection
{section}{1}{0mm}
{1.5\baselineskip}
{0.3\baselineskip}
{\normalfont\Large\bfseries\color{orange}}*}
\newcommand\subsectionnonum{\@startsection
{subsection}{2}{0mm}
{1.0\baselineskip}
{0.2\baselineskip}
{\bfseries\sffamily\Large\color{grey1}}*}
% TOC without indents
% add space before TOC
\addtocontents{toc}{\protect\vspace{100pt}}
\renewcommand*{\@dotsep}{0.5}
\renewcommand*\l@chapter{\bfseries\bprot@dottedtocline{1}{6em}{3.0em}}
\renewcommand*\l@section{\mdseries\bprot@dottedtocline{2}{6em}{3.0em}}
\renewcommand*\l@subsection{\mdseries\bprot@dottedtocline{3}{6em}{3.0em}}
\renewcommand*\l@subsubsection{\mdseries\bprot@dottedtocline{4}{6em}{3.0em}}
% gap between columns
\setlength{\columnsep}{12mm}
% gap between paragraphs
\setlength{\parskip}{0pt}
\def\chapterpictopnum#1#2#3#4{
\cleardoublepage
\twocolumn[{
\begin{@twocolumnfalse}
\includegraphics[width=#3\textwidth]{#2}
\chapter{#1}\label{#4}
\end{@twocolumnfalse}
}]
\squeezeup
}
\def\chapterpictopnonum#1#2#3#4{
\cleardoublepage
\twocolumn[{
\begin{@twocolumnfalse}
\includegraphics[width=#3\textwidth]{#2}
\chapter*{#1}\label{#4}
\end{@twocolumnfalse}
}]
\squeezeup
}
\def\chapterpicrightnum#1#2#3#4{
\cleardoublepage
\twocolumn[{
\moveup
\begin{@twocolumnfalse}
\begin{minipage}[t]{#3\textwidth}
\vspace{0pt}\raggedright
\chapter{#1}\label{#4}
\end{minipage}
\hspace{0.04\textwidth}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgap
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\end{@twocolumnfalse}
\movedown
}]
}
\def\chapterpicrightnonum#1#2#3#4{
\cleardoublepage
\twocolumn[{
\moveup
\begin{@twocolumnfalse}
\begin{minipage}[t]{#3\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}\label{#4}
\end{minipage}
\hspace{0.04\textwidth}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgap
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\end{@twocolumnfalse}
\movedown
}]
}
\def\chapterpicteasernum#1#2#3#4#5{
\cleardoublepage
\twocolumn[{
\moveup
\begin{@twocolumnfalse}
\begin{minipage}[t]{\textwidth}
\vspace{0pt}\raggedright
\chapter{#1}\label{#4}
\end{minipage}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgapsmall
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\hspace{0.04\textwidth}
\begin{minipage}[t]{#3\textwidth}
\picgapsmall
\LARGE
\raggedright
\textcolor{grey1}{\textbf{#5}}
\end{minipage}
\end{@twocolumnfalse}
\movedown
}]
}
\def\chapterpicteasernonum#1#2#3#4#5{
\cleardoublepage
\twocolumn[{
\moveup
\begin{@twocolumnfalse}
\begin{minipage}[t]{\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}\label{#4}
\end{minipage}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgapsmall
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\hspace{0.04\textwidth}
\begin{minipage}[t]{#3\textwidth}
\picgapsmall
\LARGE
\raggedright
\textcolor{grey1}{\textbf{#5}}
\end{minipage}
\end{@twocolumnfalse}
\movedown
}]
}
\def\gentitlepagenopic#1#2{
\fboxrule 0.0pt
\begin{titlepage}
\phantom{Die Titelseite}
\lefoot{\copyright \; Siemens AG \the\year. All rights reserved.}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageUpperLeft{%
\put(1.3cm,0cm){%
\makebox(0,0)[lt]{\includegraphics[width=4cm]{pics/cover/sie_logo_layer_petrol_rgb2.png}}%
}%
}%
}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageLowerLeft{%
\put(1.3cm,3cm){%
\makebox(0,0)[lt]{\includegraphics[width=3cm]{pics/cover/logo_multicore_expert-center_siemens.png}}%
}%
}%
}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-1.0cm}
\fcolorbox{black}{grey2}{
\begin{minipage}[c][1cm]{\paperwidth}
\hspace{0.8cm}
\fontsize{16}{20}\selectfont
\textcolor{white}{#1}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
% \vspace{-0.2cm}
\fcolorbox{black}{grey1}{
\begin{minipage}[c][4cm]{\paperwidth}
\textcolor{white}{}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
% \vspace{-0.2cm}
\hspace{0.8cm}
\begin{minipage}[c][4cm]{0.8\paperwidth}
\fontsize{36}{44}\selectfont
\textcolor{white}{#2}
\end{minipage}
\end{textblock}
\end{titlepage}
\ClearShipoutPicture
}
\def\gentitlepage#1#2#3{
\fboxrule 0.0pt
\begin{titlepage}
\phantom{Die Titelseite}
\lefoot{\copyright \; Siemens AG \the\year. All rights reserved.}
\AddToShipoutPictureBG{
\AtPageUpperLeft{\raisebox{-\height}
{\includegraphics[width=\paperwidth]{#1}}}
}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageUpperLeft{%
\put(1.3cm,0cm){%
\makebox(0,0)[lt]{\includegraphics[width=4cm]{pics/cover/sie_logo_layer_petrol_rgb.png}}%
}%
}%
}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageLowerLeft{%
\put(1.3cm,3cm){%
\makebox(0,0)[lt]{\includegraphics[width=3cm]{pics/cover/logo_multicore_expert-center_siemens.png}}%
}%
}%
}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-1.0cm}
\fcolorbox{black}{grey2}{
\begin{minipage}[c][1cm]{\paperwidth}
\hspace{0.8cm}
\fontsize{16}{20}\selectfont
\textcolor{white}{#2}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
% \vspace{-0.2cm}
\fcolorbox{black}{grey1}{
\begin{minipage}[c][4cm]{\paperwidth}
\textcolor{white}{}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
% \vspace{-0.2cm}
\hspace{0.8cm}
\begin{minipage}[c][4cm]{0.8\paperwidth}
\fontsize{36}{44}\selectfont
\textcolor{white}{#3}
\end{minipage}
\end{textblock}
\end{titlepage}
\ClearShipoutPicture
}
\def\genbackpage#1{
\pagebreak
\cleardoubleevenemptypage
\thispagestyle{empty}
\renewcommand{\baselinestretch}{1.1}\normalsize
\begin{textblock}{4}[0.0,0.0](0,0)
\fcolorbox{black}{grey1}{
\begin{minipage}[c][0.9\paperwidth]{\paperwidth}
\textcolor{white}{}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](0,0)
\vspace{0.44\paperheight}
\hspace{1.8cm}
\begin{minipage}[t][\paperwidth]{\paperwidth}
\textcolor{white}{#1}
\end{minipage}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](0,0)
\vspace{\paperwidth}
\vspace{-3.6cm}
\begin{minipage}[c][1cm]{\paperwidth}
\hspace{1.8cm}
\textcolor{black}{Printed in Germany\;|\;\copyright\;\copyrightdate \;Siemens AG}
\end{minipage}
\end{textblock}
}
\def\tableofcontentspic#1#2#3{
\cleardoublepage
\twocolumn[{
\moveup
\begin{@twocolumnfalse}
\begin{minipage}[t]{#3\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}
\end{minipage}
\hspace{0.04\textwidth}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgap
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\begin{minipage}[t]{0.2\textwidth}
\vspace{0pt}\raggedright
\hspace{15mm}
\end{minipage}
\begin{minipage}[t]{0.8\textwidth}
\phantomsection
\tableofcontents
\end{minipage}
\end{@twocolumnfalse}
\movedown
}]
}
\def\genlistoffigures#1{
\cleardoublepage
\onecolumn{
\chapter*{#1}
\vspace{1.5cm}
\begin{addmargin}[0.3\textwidth]{0cm}
\listoffigures
\end{addmargin}
}
}
\makeatother
% Copyright (C) nemadesign GbR
% $Rev: 56 $:
% $Date: 2014-09-02 21:55:06 +0200 (Di, 02. Sep 2014) $:
% definitions for single column style sheet
\usepackage{sty/siemens_core}
\usepackage{geometry}
\geometry
{
left=2.3cm, %linker Seitenrand
right=2.3cm, %rechter Seitenrand
top=25mm, %oben der Abstand
bottom=32mm %Unten der Abstand
}
% gap between columns
\setlength{\columnsep}{12mm}
% gap between paragraphs
\setlength{\parskip}{1ex}
\renewcommand\section{\@startsection
{section}{1}{0mm} % name, ebene, einzug
{1.3\baselineskip} % vor-abstand
{0.1\baselineskip} % nach-abstand
{\bfseries\sffamily\fontsize{13pt}{1.0}\color{orange}} % layout
}
\renewcommand\subsection{\@startsection
{subsection}{2}{0mm}
{0.8\baselineskip}
{0.1\baselineskip}
{\bfseries\sffamily\fontsize{13pt}{1.0}\color{grey1}}
}
\newcommand\sectionnonum{\@startsection
{section}{1}{0mm}
{1.3\baselineskip}
{0.1\baselineskip}
{\normalfont\fontsize{13pt}{1.0}\bfseries\color{orange}}*}
\newcommand\subsectionnonum{\@startsection
{subsection}{2}{0mm}
{0.8\baselineskip}
{0.01\baselineskip}
{\bfseries\sffamily\fontsize{13pt}{1.0}\color{grey1}}*}
% TOC without indents
% add space before TOC
\addtocontents{toc}{\protect\vspace{100pt}}
\renewcommand*{\@dotsep}{0.5}
\renewcommand*\l@chapter{\bfseries\bprot@dottedtocline{1}{0em}{3.0em}}
\renewcommand*\l@section{\mdseries\bprot@dottedtocline{2}{0em}{3.0em}}
\renewcommand*\l@subsection{\mdseries\bprot@dottedtocline{3}{0em}{3.0em}}
\renewcommand*\l@subsubsection{\mdseries\bprot@dottedtocline{4}{0em}{3.0em}}
\def\chapterpictopnum#1#2#3#4{
\cleardoublepage
\begin{minipage}[t]{\textwidth}
\picgap
\includegraphics[width=#3\textwidth]{#2}
\end{minipage}
\begin{minipage}[t]{\textwidth}
\vspace{0pt}\raggedright
\chapter{#1}\label{#4}
\end{minipage}
}
\def\chapterpictopnonum#1#2#3#4{
\cleardoublepage
\begin{minipage}[t]{\textwidth}
\picgap
\includegraphics[width=#3\textwidth]{#2}
\end{minipage}
\begin{minipage}[t]{\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}\label{#4}
\end{minipage}
}
\def\chapterpicrightnum#1#2#3#4{
\cleardoublepage
\begin{minipage}[t]{#3\textwidth}
\vspace{0pt}\raggedright
\chapter{#1}\label{#4}
\end{minipage}
\hspace{0.04\textwidth}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgap
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\vspace{2em}
}
\def\chapterpicrightnonum#1#2#3#4{
\cleardoublepage
\begin{minipage}[t]{#3\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}\label{#4}
\end{minipage}
\hspace{0.04\textwidth}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgap
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\vspace{2em}
}
\newcolumntype{a}[1]{>{\LARGE\raggedright\color{white}\columncolor{grey1}}p{#1}}
\newcolumntype{b}[1]{>{\columncolor{white}}p{#1}}
%\renewcommand*{\arraystretch}{0.0}
%\setlength{\arrayrulewidth}{0pt}
\arrayrulecolor{grey1}
\def\chapterpicteasernum#1#2#3#4#5{
\cleardoublepage
\setlength{\tabcolsep}{0mm}
\begin{minipage}[t]{\textwidth}
\vspace{0pt}\raggedright
\chapter{#1}\label{#4}
\end{minipage}
\begin{table}[ht]
\FPsub{\blah}{0.96}{#3}
\FPsub{\blub}{#3}{0.1}
\begin{tabular}[m]{b{\blah\textwidth} b{.05\textwidth} a{20pt} a{\blub\textwidth} a{19pt} }
\raisebox{-.92\totalheight}{\includegraphics[width=\blah\textwidth]{#2}} & & & #5 & \\
\end{tabular}
\end{table}
\setlength{\tabcolsep}{6pt}
}
\def\chapterpicteasernonum#1#2#3#4#5{
\cleardoublepage
\setlength{\tabcolsep}{0mm}
\begin{minipage}[t]{\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}\label{#4}
\end{minipage}
\begin{table}[ht]
\FPsub{\blah}{0.96}{#3}
\FPsub{\blub}{#3}{0.1}
\begin{tabular}[m]{b{\blah\textwidth} b{.05\textwidth} a{20pt} a{\blub\textwidth} a{19pt} }
\raisebox{-.92\totalheight}{\includegraphics[width=\blah\textwidth]{#2}} & & & #5 & \\
\end{tabular}
\end{table}
\setlength{\tabcolsep}{6pt}
}
\def\gentitlepagenopic#1#2{
\fboxrule 0.0pt
\begin{titlepage}
\phantom{Die Titelseite}
\lefoot{\copyright \; Siemens AG \the\year. All rights reserved.}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageUpperLeft{%
\put(1.3cm,0cm){%
\makebox(0,0)[lt]{\includegraphics[width=4cm]{pics/cover/sie_logo_layer_petrol_rgb2.png}}%
}%
}%
}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageLowerLeft{%
\put(1.3cm,3cm){%
\makebox(0,0)[lt]{\includegraphics[width=3cm]{pics/cover/logo_multicore_expert-center_siemens.png}}%
}%
}%
}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-1.2cm}
\fcolorbox{black}{grey2}{
\begin{minipage}[c][1cm]{\paperwidth}
\hspace{0.8cm}
\fontsize{16}{20}\selectfont
\textcolor{white}{#1}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-0.2cm}
\fcolorbox{black}{grey1}{
\begin{minipage}[c][4cm]{\paperwidth}
\textcolor{white}{}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-0.2cm}
\hspace{0.8cm}
\begin{minipage}[c][4cm]{0.8\paperwidth}
\fontsize{36}{44}\selectfont
\textcolor{white}{#2}
\end{minipage}
\end{textblock}
\end{titlepage}
\ClearShipoutPicture
}
\def\gentitlepage#1#2#3{
\fboxrule 0.0pt
\begin{titlepage}
\phantom{Die Titelseite}
\lefoot{\copyright \; Siemens AG \the\year. All rights reserved.}
\AddToShipoutPictureBG{
\AtPageUpperLeft{\raisebox{-\height}
{\includegraphics[width=\paperwidth]{#1}}}
}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageUpperLeft{%
\put(1.3cm,0cm){%
\makebox(0,0)[lt]{\includegraphics[width=4cm]{pics/cover/sie_logo_layer_petrol_rgb.png}}%
}%
}%
}
% Siemens Logo 4cm width, 1.5cm from left corner
\AddToShipoutPictureFG*{
\AtPageLowerLeft{%
\put(1.3cm,3cm){%
\makebox(0,0)[lt]{\includegraphics[width=3cm]{pics/cover/logo_multicore_expert-center_siemens.png}}%
}%
}%
}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-1.2cm}
\fcolorbox{black}{grey2}{
\begin{minipage}[c][1cm]{\paperwidth}
\hspace{0.8cm}
\fontsize{16}{20}\selectfont
\textcolor{white}{#2}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-0.2cm}
\fcolorbox{black}{grey1}{
\begin{minipage}[c][4cm]{\paperwidth}
\textcolor{white}{}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](1,0)
\vspace{\paperwidth}
\vspace{-0.2cm}
\hspace{0.8cm}
\begin{minipage}[c][4cm]{0.8\paperwidth}
\fontsize{36}{44}\selectfont
\textcolor{white}{#3}
\end{minipage}
\end{textblock}
\end{titlepage}
\ClearShipoutPicture
}
\def\genbackpage#1{
\pagebreak
\cleardoubleevenemptypage
\thispagestyle{empty}
\renewcommand{\baselinestretch}{1.1}\normalsize
\begin{textblock}{4}[0.0,0.0](0,0)
\fcolorbox{black}{grey1}{
\begin{minipage}[c][0.9\paperwidth]{\paperwidth}
\textcolor{white}{}
\end{minipage}
}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](0,0)
\vspace{0.38\paperheight}
\hspace{1.8cm}
\begin{minipage}[t][\paperwidth]{\paperwidth}
\textcolor{white}{#1}
\end{minipage}
\end{textblock}
\begin{textblock}{4}[0.0,0.0](0,0)
\vspace{\paperwidth}
\vspace{-4.0cm}
\begin{minipage}[c][1cm]{\paperwidth}
\hspace{1.8cm}
\textcolor{black}{Printed in Germany\;|\;\copyright\;\copyrightdate \;Siemens AG}
\end{minipage}
\end{textblock}
}
\def\tableofcontentspic#1#2#3{
\cleardoublepage
\onecolumn
\begin{minipage}[t]{\textwidth}
\begin{minipage}[t]{#3\textwidth}
\vspace{0pt}\raggedright
\chapter*{#1}
\end{minipage}
\hspace{0.04\textwidth}
\FPsub{\bla}{0.95}{#3}
\begin{minipage}[t]{\bla\textwidth}
\picgap
\includegraphics[width=\textwidth]{#2}
\end{minipage}
\end{minipage}
\tableofcontents
}
\def\genlistoffigures#1{
\cleardoublepage
\onecolumn{
\chapter*{#1}
\vspace{1.5cm}
\begin{addmargin}[0cm]{0cm}
\listoffigures
\end{addmargin}
}
}
% ----------------------------------------------------------------------
% Document class
% ----------------------------------------------------------------------
\documentclass[a4paper, 11pt, twoside, openright, footinclude, headinclude]{scrbook}
% ----------------------------------------------------------------------
% Packages
% ----------------------------------------------------------------------
\usepackage{sty/siemens_single}
\usepackage{amsmath}
\usepackage{listing}
\usepackage{array} % for tabular
\usepackage{pifont} % for \myCheck, \myCross
\usepackage[hyphens]{url}
\usepackage[hidelinks]{hyperref} % hyperref without colored links
\usepackage{draftwatermark}
\usepackage{xspace}
\usepackage{pgf}
\usepackage{tikz}
% ----------------------------------------------------------------------
% TikZ
% ----------------------------------------------------------------------
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{matrix}
\usetikzlibrary{patterns}
\usetikzlibrary{positioning}
% ----------------------------------------------------------------------
% Document specific macros and settings
% ----------------------------------------------------------------------
\def\lstwidth{0.8\columnwidth}
\def\embb{EMB$^\mathsf{2}$\xspace}
\SetWatermarkColor[gray]{0.95}
\newcommand{\leadingzero}[1]{\ifnum #1<10 0\the#1\else\the#1\fi}
\newcommand{\monthword}[1]{\ifcase#1\or January\or February\or March\or April\or May\or June\or July\or August\or September\or October\or November\or December\fi}
% ----------------------------------------------------------------------
% Dataflow process networks
% ----------------------------------------------------------------------
\newlength{\dpnunit}
\setlength{\dpnunit}{5mm}
\tikzstyle{nodestyle}=[draw, semithick, minimum size=\dpnunit, anchor=center, minimum height=2\dpnunit]
\tikzstyle{edgestyle}=[draw, thick, ->, >=stealth']
\tikzstyle{function}=[rectangle, nodestyle, inner sep=2pt, minimum width=2\dpnunit, minimum height=1.5\dpnunit]
\tikzstyle{invisible}=[anchor=center]
\tikzstyle{selector}=[trapezium, nodestyle, trapezium angle=-70, trapezium stretches=true, minimum width=2\dpnunit, minimum height=\dpnunit]
\tikzstyle{switch}=[trapezium, nodestyle, trapezium angle=70, trapezium stretches=true, minimum width=2\dpnunit, minimum height=\dpnunit]
\tikzstyle{junction}=[circle, draw, fill, inner sep=0pt, minimum size=1mm, anchor=center]
\newcommand{\dpninv}[1]{\node [invisible, inner sep=2pt, minimum size=0pt] (#1) {};}
\newcommand{\dpnsrc}[2]{\node [function] (#1) {#2};}
\newcommand{\dpnsnk}[2]{\node [function] (#1) {#2};}
\newcommand{\dpnser}[2]{\node [function] (#1) {#2};}
\newcommand{\dpnpar}[2]{\node [function, double] (#1) {#2};}
\newcommand{\dpnsel}[1]{\node [selector] (#1) {}; \draw (#1.north west) [yshift=-4.5pt] node {\ttrue}; \draw (#1.north east) [yshift=-4.5pt] node {\tfalse};}
\newcommand{\dpnswi}[1]{\node [switch] (#1) {}; \draw (#1.south west) [yshift=4.5pt] node {\ttrue}; \draw (#1.south east) [yshift=4.5pt] node {\tfalse};}
\newcommand{\dpnjun}[1]{\node [junction] (#1) {};}
% ----------------------------------------------------------------------
\begin{document}
% ----------------------------------------------------------------------
\input{customize} % To get template specific stuff
% Set title and author
% short title is used on the front cover and on each page header
\renewcommand{\shorttitle}{\embb Introduction and Tutorial}
% short date is printed on each page header, right next to short title
\renewcommand{\shortdate}{\monthword{\month} \the\year}
% copyright date is printed on the back cover
\renewcommand{\copyrightdate}{\leadingzero{\month}.\the\year}
% 1st paramter: a square(!) picture
% 2nd parameter: short tile (one line)
% 3rd parameter: long title (up to two lines)
\gentitlepage{pics/chicago-square.jpg}{\LARGE Siemens Corporate Technology | \monthword{\month} 2016}{\scalebox{0.9}{Embedded Multicore Building Blocks}\\\scalebox{0.9}{Introduction and Tutorial}}
% List the authors and contributors on the second page, right after the cover page
% 1st parameter: contributors (optional)
% 2nd parameter: author(s)
\printAuthors{
Bernhard Gatzhammer, bernhard.gatzhammer@siemens.com \newline
Christian Kern, christian.kern@siemens.com \newline
Tobias Sch\"ule, tobias.schuele@siemens.com \newline
Marcus Winter, marcus.winter.ext@siemens.com \newline
\newline
Siemens AG \newline
Corporate Technology \newline
Research \& Technology Center \newline
CT RTC ITP SES-DE \newline
Otto-Hahn-Ring 6 \newline
81739 M\"unchen \newline
Germany
}
% This is from the template:
% \tableofcontentspic{Contents}{pics/chapter/Fotolia_43587256_X.jpg}{\chapterpicwidth}
% And this is our custom toc
\chapter*{Contents}
\tableofcontents
% ----------------------------------------------------------------------
% Content
% ----------------------------------------------------------------------
% \input{content/preface}
\input{content/introduction}
\input{content/mtapi}
\input{content/tasks}
\input{content/algorithms}
\input{content/dataflow}
\input{content/containers}
% ----------------------------------------------------------------------
% References
% ----------------------------------------------------------------------
% the following two macros fix the problem of the incorrect ToC pointer to the bibliography.
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\bibliographystyle{IEEEtran}
% balance the columns at the last page of the bibliography
\balance
\bibliography{references}
% ----------------------------------------------------------------------
% Back Cover
% ----------------------------------------------------------------------
\backcover
\end{document}
File added
create_tarball.sh diff
#!/usr/bin/env bash
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
#
# 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.
usage() {
echo "Specify license file to add to each source file";
echo "and directory where to start to find files.";
echo "Example call:";
echo "./insert_license.sh -d ../ -l license.txt";
echo "";
echo "Usage: $0 [-d directory] [-l license_file]" 1>&2; exit 1;
}
while getopts ":d:l:" o; do
case "${o}" in
d)
d=${OPTARG}
;;
l)
l=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${d}" ] || [ -z "${l}" ]; then
usage
fi
if [ ! -d "$d" ]; then
echo "Error, directory $d does not exist or is not a directory!"
echo ""
usage
fi
if [ ! -f "$l" ]; then
echo "Error, license file $l does not exist or is not a file!"
echo ""
usage
fi
for FILE in `find ${d} -name "*.h" -o -name "*.cc" -o -name "*.c" -o -name "*.h.in" -type f`
do
if ! grep -q COPYRIGHT $FILE
then
echo "Inserting license to: $FILE"
cat ${l} $FILE > $FILE.new && mv $FILE.new $FILE
fi
done
/*
* Copyright (c) 2014-2016, Siemens AG. All rights reserved.
*
* 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.
*/
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
#
# 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.
#!/usr/bin/env bash
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
#
# 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.
usage() {
echo "Specify license file to remove from each source file";
echo "and directory where to start to find files.";
echo "License is only removed if existing.";
echo "";
echo "Example call:";
echo "./remove_license.sh -d ../ -l license.txt";
echo "";
echo "Usage: $0 [-d directory] [-l license_file]" 1>&2; exit 1;
}
while getopts ":d:l:" o; do
case "${o}" in
d)
d=${OPTARG}
;;
l)
l=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${d}" ] || [ -z "${l}" ]; then
usage
fi
if [ ! -d "$d" ]; then
echo "Error, directory $d does not exist or is not a directory!"
echo ""
usage
fi
if [ ! -f "$l" ]; then
echo "Error, license file $l does not exist or is not a file!"
echo ""
usage
fi
LINES=`cat ${l} | wc -l`
LINESP1=$(($LINES + 1))
for FILE in `find ${d} -name "*.h" -o -name "*.cc" -o -name "*.c" -o -name "*.h.in" -type f`
do
if grep -q COPYRIGHT $FILE
then
echo "Processing: $FILE"
TEMP=$(mktemp /tmp/temporary-file.XXXXXXXX)
head -n $LINES $FILE > ${TEMP}
if [[ ! `diff ${TEMP} ${l}` ]]; then
echo "Strip license from file: $FILE"
tail -n +$LINESP1 $FILE > ${FILE}.new && mv ${FILE}.new ${FILE}
fi
fi
done
#!/usr/bin/env bash
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
#
# 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.
usage() {
echo "Run Google C++ Style Guide checking on project.";
echo "Specify EMBB root directory with -d and the";
echo "cpplint executable with -c. If not specified";
echo "it is assumed the cpplint binary is contained";
echo "in the current working directory.";
echo "";
echo "Usage: $0 [-d directory] [-c cpplint_executable] " 1>&2; exit 1;
}
while getopts ":d:c:" o; do
case "${o}" in
d)
d=${OPTARG}
;;
c)
c=${OPTARG}
;;
*)
usage
;;
esac
done
shift $((OPTIND-1))
if [ -z "${d}" ]; then
usage
fi
if [ ! -d "$d" ]; then
echo "Error: directory $d does not exist or is not a directory!"
echo ""
usage
fi
if [ -z "${c}" ]; then
echo "cpplint binary not specified, assuming to be contained in the current working directory!"
c="./cpplint.py"
fi
if [ ! -f "${c}" ]; then
echo "Error: cannot find cpplint script (Location: ${c})"
echo
usage
fi
##Excluded Rules
EXCLUDED_RULES="-runtime/references,-runtime/int,-build/include_order,-readability/multiline_comment,-readability/streams,-readability/alt_tokens,-whitespace/comments"
PARENTHESIS_RULE=",-whitespace/parens"
C_CAST_RULE=",-readability/casting"
LONG_LINES_RULE=",-whitespace/line_length"
retval=0
##Excluded files
RAND_FILES=( embb_mtapi_test_group.cc embb_mtapi_test_queue.cc embb_mtapi_test_task.cc queue_test-inl.h )
for project in base_c mtapi_c mtapi_plugins_c/mtapi_network_c mtapi_plugins_c/mtapi_opencl_c base_cpp mtapi_cpp tasks_cpp algorithms_cpp containers_cpp dataflow_cpp
do
echo "-> Doing project: $project"
dir=$d/$project
if [ ! -d "$dir" ]; then
echo "Error: cannot find directory $dir for project $project"
echo
usage
fi
for file in `find $dir \( -name "*.cc" -o -name "*.h" -o -name "*inl.h" -o -name "*.c" \) -and -not -path "*/src/CL/*"`
do
echo "--> Run cpplint on file $file"
current_rules=$EXCLUDED_RULES
if [[ $file =~ \.h$ ]]; then
current_rules+=$PARENTHESIS_RULE
fi
if [[ $file =~ \.c$ ]] || [[ $file =~ \mtapi.h$ ]]; then
current_rules+=$C_CAST_RULE
fi
if [[ $file == *atomic* ]]; then
current_rules+=$LONG_LINES_RULE
fi
############
#Per file exclusion rules
if [[ $file == *generate_atomic_implementation_template.h ]]; then
current_rules+=",-build/header_guard" # This file needs to be included multiple times
fi
if [[ $file == *atomic.h ]]; then
current_rules+=",-whitespace/indent" # indention is misinterpreted for this file
fi
if [[ $file == *atomic_arithmetic.h ]]; then
current_rules+=",-readability/function" # All parameters should be named in a function
fi
if [[ $file == *object_pool-inl.h ]]; then
current_rules+=",-readability/function" # All parameters should be named in a function (triggers error with clang if named...)
fi
for filename in "${RAND_FILES[@]}"; do
if [[ $file =~ $filename ]]; then
current_rules+=",-runtime/threadsafe_fn" # These tests are allowed to use the thread unsafe rand()
fi
done
python ${c} --filter=$current_rules --root="$project/include" --output=vs7 $file
if [[ ! $? -eq 0 ]]; then
retval=$((retval+1))
fi
done
done
echo "$retval files contained errors."
exit $retval
#!/bin/sh
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
#
# 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.
#
# Needs to be located in the folder containing the tests!!
# Is copied automatically there when generating build files with cmake.
EMBB_TEST_EXECUTABLES="@EXPECTED_EMBB_TEST_EXECUTABLES@"
SCRIPT_LOCATION="$0"
# case we have symlinks...
while [ -h "$SCRIPT_LOCATION" ] ; do
SCRIPT_LOCATION=`readlink "$SCRIPT_LOCATION"`
done
DIR=`dirname "$SCRIPT_LOCATION"`
for TEST in $(echo $EMBB_TEST_EXECUTABLES | tr ";" " "); do
"$DIR/$TEST".exe;
done
#!/bin/sh
# Copyright (c) 2014-2016, Siemens AG. All rights reserved.
#
# 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.
# Needs to be located in the folder containing the tests!!
# Is copied automatically there when generating build files with cmake.
EMBB_TEST_EXECUTABLES="@EXPECTED_EMBB_TEST_EXECUTABLES@"
SCRIPT_LOCATION="$0"
# case we have symlinks...
while [ -h "$SCRIPT_LOCATION" ] ; do
SCRIPT_LOCATION=`readlink "$SCRIPT_LOCATION"`
done
DIR=`dirname "$SCRIPT_LOCATION"`
for TEST in $(echo $EMBB_TEST_EXECUTABLES | tr ";" " "); do
$DIR/$TEST;
done
:: Copyright (c) 2014-2016, Siemens AG. All rights reserved.
::
:: 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.
:: Needs to be located in the folder containing the tests!!
:: Is copied automatically there when generating build files with cmake.
@echo off
setlocal EnableDelayedExpansion
SET NUM_ERRORS=0
SET DIR=%~dp0
SET EMBB_EXECUTABLES=@EXPECTED_EMBB_TEST_EXECUTABLES@
call :parse "%EMBB_EXECUTABLES%"
goto :end
:parse
set list=%1
set list=%list:"=%
FOR /f "tokens=1* delims=;" %%a IN ("%list%") DO (
if not "%%a" == "" call :sub %%a
if not "%%b" == "" call :parse "%%b"
)
exit /b
:sub
call "%DIR:~0,-1%\%1.exe"
if not !ERRORLEVEL! ==0 set /a NUM_ERRORS=!NUM_ERRORS!+1
exit /b
:end
if not !NUM_ERRORS! ==0 (
echo.
SET ERRORLEVEL=1
echo "Number of failed tests: !NUM_ERRORS!"
exit /b !NUM_ERRORS!
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment