Why AutoSar defines new types(for intance, ara::core::Future
, ara::core::Vector
and so on) other than use the standard one(i.e. std::future
, std::vector
)?
What's the benefit?
You should read about the types in chapter 7 and 8 of the AUTOSAR_SWS_AdaptivePlatformCore.pdf.
7.2.4.2 Types derived from the base C++ standard
In addition to AUTOSAR-devised data types, which are mentioned in the previous sections, the Adaptive Platform also contains a number of generic data types and helper functions.
Some types are already contained in [4, the C++14 standard]; however, types with almost identical behavior are re-defined within the
ara::core
namespace. The reason for this is that the memory allocation behavior of thestd:: types
is often unsuitable for automotive purposes. Thus, theara::core
ones define their own memory allocation behavior, and perform some other necessary adaptions as well, including about the throwing of exceptions.[SWS_CORE_00040] DRAFTg Errors originating from C++ standard classes
For the classes in ara::core specified below in terms of the corresponding classes of the C++ standard, all functions that are specified by [4, the C++14 standard], [9, the C++17 standard], or [10, the draft C++20 standard] to throw any exceptions, are instead specified to be the cause of a Violation when they do so.c(RS_AP_00130)
Examples for such data types are: Array, Vector, Map, and String.
The reasons for ara::future
are described also in chapter 8.1.6. (I will not cite this here).
So, in the end, ara::core
is the place to define / configure the implementation specific details in order to use the same definition in the code base in AUTOSAR Adaptive SW, no matter if it is your own SW on top of ara
or within ara
service implementation itself.
This is like the Std_Types.h
/ Compiler.h
/ Platform_Types.h
is the place in AUTOSAR Classic to define / configure the basic primitive types of uint8
/ sint8
/ ... instead of using uint8_t
/ int8_t
/ ... from stdint.h
, which was introduced in C99, but was not available in C90.