Skip to content

Commit

Permalink
Fixed whitespace and formatting of new code Fixed licence headers
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Wenzel <[email protected]>
  • Loading branch information
lhelwing authored and alexmucde committed Oct 7, 2015
1 parent e5ffa01 commit 4c8d433
Show file tree
Hide file tree
Showing 14 changed files with 923 additions and 858 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}.pc.in ${PROJECT_BINARY_DIR}/$
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT devel)

if(${WITH_DLT_CXX11_EXT})
configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}-c++.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-c++.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-c++.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT devel)
configure_file(${CMAKE_SOURCE_DIR}/${PROJECT_NAME}-c++.pc.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-c++.pc @ONLY)
install(FILES ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-c++.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT devel)
endif()

IF(${CMAKE_INSTALL_PREFIX} STREQUAL "/usr")
Expand Down
3 changes: 1 addition & 2 deletions automotive-dlt-c++.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ Name: DLT C++
Description: Diagnostic Log and Trace C++ extensions
Version: @DLTCPP_VERSION@
Requires: automotive-dlt
Cflags: -std=c++11

Cflags: -std=gnu++0x
177 changes: 86 additions & 91 deletions include/dlt/dlt_cpp_extension.hpp
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
/**
/*
* @licence app begin@
* Copyright (C) 2015 Intel Corporation
* SPDX license identifier: MPL-2.0
*
* This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
* Copyright (C) 2015 Intel Corporation
*
* Contributions are licensed to the GENIVI Alliance under one or more
* Contribution License Agreements.
* This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
*
* \copyright
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
* Mozilla Public License (MPL), v. 2.0.
* If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* \file dlt_cpp_extension.hpp
* For further information see http://www.genivi.org/.
* @licence end@
*/

/*!
* \author Stefan Vacek <[email protected]> Intel Corporation
*
* \copyright Copyright © 2015 Intel Corporation. \n
* License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
*
* \file dlt_cpp_extension.hpp
*/

#ifndef DLT_CPP_EXTENSION_HPP
#define DLT_CPP_EXTENSION_HPP
Expand All @@ -27,170 +33,158 @@
#include <list>
#include <map>


template<typename T>
int32_t logToDlt(DltContextData &log, T const &value) = delete;


template<>
inline int32_t logToDlt(DltContextData &log, int8_t const &value)
{
return dlt_user_log_write_int8(&log, value);
return dlt_user_log_write_int8(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, int16_t const &value)
{
return dlt_user_log_write_int16(&log, value);
return dlt_user_log_write_int16(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, int32_t const &value)
{
return dlt_user_log_write_int32(&log, value);
return dlt_user_log_write_int32(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, int64_t const &value)
{
return dlt_user_log_write_int64(&log, value);
return dlt_user_log_write_int64(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, uint8_t const &value)
{
return dlt_user_log_write_uint8(&log, value);
return dlt_user_log_write_uint8(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, uint16_t const &value)
{
return dlt_user_log_write_uint16(&log, value);
return dlt_user_log_write_uint16(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, uint32_t const &value)
{
return dlt_user_log_write_uint32(&log, value);
return dlt_user_log_write_uint32(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, uint64_t const &value)
{
return dlt_user_log_write_uint64(&log, value);
return dlt_user_log_write_uint64(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, float32_t const &value)
{
return dlt_user_log_write_float32(&log, value);
return dlt_user_log_write_float32(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, double const &value)
{
return dlt_user_log_write_float64(&log, value);
return dlt_user_log_write_float64(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, bool const &value)
{
return dlt_user_log_write_bool(&log, value);
return dlt_user_log_write_bool(&log, value);
}

static inline int32_t logToDlt(DltContextData &log, char const * const value)
{
return dlt_user_log_write_utf8_string(&log, value);
return dlt_user_log_write_utf8_string(&log, value);
}

static inline int32_t logToDlt(DltContextData &log, char * const value)
{
return dlt_user_log_write_utf8_string(&log, value);
return dlt_user_log_write_utf8_string(&log, value);
}

template<>
inline int32_t logToDlt(DltContextData &log, std::string const &value)
{
return dlt_user_log_write_utf8_string(&log, value.c_str());
return dlt_user_log_write_utf8_string(&log, value.c_str());
}


/* stl types */
template<>
int32_t logToDlt(DltContextData &log, std::string const &value);

template<typename _Tp, typename _Alloc = std::allocator<_Tp>>
static inline int32_t logToDlt(DltContextData &log, std::vector<_Tp, _Alloc > const & value)
static inline int32_t logToDlt(DltContextData &log, std::vector<_Tp, _Alloc> const & value)
{
int result = 0;
int result = 0;

for (auto elem: value)
{
result += logToDlt(log, elem);
}
for (auto elem : value)
result += logToDlt(log, elem);

if (result != 0)
{
result = -1;
}
return result;
if (result != 0)
result = -1;

return result;
}

template<typename _Tp, typename _Alloc = std::allocator<_Tp>>
static inline int32_t logToDlt(DltContextData &log, std::list<_Tp, _Alloc > const & value)
static inline int32_t logToDlt(DltContextData &log, std::list<_Tp, _Alloc> const & value)
{
int result = 0;
int result = 0;

for (auto elem : value)
result += logToDlt(log, elem);

for (auto elem: value)
{
result += logToDlt(log, elem);
}
if (result != 0)
result = -1;

if (result != 0)
{
result = -1;
}
return result;
return result;
}

template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
static inline int32_t logToDlt(DltContextData &log, std::map<_Key, _Tp, _Compare, _Alloc > const & value)
typename _Alloc = std::allocator<std::pair<const _Key, _Tp>>>
static inline int32_t logToDlt(DltContextData &log, std::map<_Key, _Tp, _Compare, _Alloc> const & value)
{
int result = 0;
int result = 0;

for (auto elem: value)
{
result += logToDlt(log, elem.first);
result += logToDlt(log, elem.second);
}
for (auto elem : value)
{
result += logToDlt(log, elem.first);
result += logToDlt(log, elem.second);
}

if (result != 0)
{
result = -1;
}
return result;
}
if (result != 0)
result = -1;

return result;
}

//variadic functions using C11 standard
template<typename First>
static inline int32_t logToDltVariadic(DltContextData &log, First const &valueA)
{
return logToDlt(log, valueA);
return logToDlt(log, valueA);
}

template<typename First, typename... Rest>
template<typename First, typename ... Rest>
static inline int32_t logToDltVariadic(DltContextData &log, First const &valueA, const Rest&... valueB)
{
int result = logToDlt(log, valueA) + logToDltVariadic(log, valueB...);
if ( result != 0 )
{
result = -1;
}
return result;
}
int result = logToDlt(log, valueA) + logToDltVariadic(log, valueB...);

if (result != 0)
result = -1;

return result;
}

/**
* @brief macro to write a log message with variable number of arguments and without the need to specify the type of log data
Expand All @@ -201,14 +195,16 @@ static inline int32_t logToDltVariadic(DltContextData &log, First const &valueA,
* DLT_LOG_CXX(dltContext, DLT_LV_X, "text", valueA, valueB, ...)
*/
#define DLT_LOG_CXX(CONTEXT, LOGLEVEL, ...)\
do{ \
DltContextData log; \
if (dlt_user_log_write_start(&CONTEXT,&log,LOGLEVEL)>0) \
{ \
logToDltVariadic(log, ##__VA_ARGS__); \
dlt_user_log_write_finish(&log); \
} \
} while(0)
do\
{\
DltContextData log;\
if (dlt_user_log_write_start(&CONTEXT,&log,LOGLEVEL)>0)\
{\
logToDltVariadic(log, ##__VA_ARGS__);\
dlt_user_log_write_finish(&log);\
}\
}\
while(0)

/**
* @brief macro to write a log message with variable number of arguments and without the need to specify the type of log data.
Expand All @@ -222,17 +218,16 @@ static inline int32_t logToDltVariadic(DltContextData &log, First const &valueA,
* DLT_LOG_FCN_CXX(dltContext, DLT_LV_X, "text", valueA, valueB, ...)
*/
#define DLT_LOG_FCN_CXX(CONTEXT, LOGLEVEL, ...) \
do { \
DltContextData log; \
if (dlt_user_log_write_start(&CONTEXT, &log, LOGLEVEL) > 0) \
{ \
dlt_user_log_write_string(&log, __PRETTY_FUNCTION__); \
logToDltVariadic(log, ##__VA_ARGS__); \
dlt_user_log_write_finish(&log); \
} \
} while(0)

do\
{\
DltContextData log;\
if (dlt_user_log_write_start(&CONTEXT, &log, LOGLEVEL) > 0)\
{\
dlt_user_log_write_string(&log, __PRETTY_FUNCTION__);\
logToDltVariadic(log, ##__VA_ARGS__);\
dlt_user_log_write_finish(&log);\
}\
}\
while(0)

#endif /* DLT_CPP_EXTENSION_HPP */


12 changes: 6 additions & 6 deletions include/dlt/dlt_user.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ typedef enum
*/
typedef struct
{
char contextID[DLT_ID_SIZE]; /**< context id */
int32_t log_level_pos; /**< offset in user-application context field */
int8_t *log_level_ptr; /**< pointer to the log level */
int8_t *trace_status_ptr; /**< pointer to the trace status */
uint8_t mcnt; /**< message counter */
char contextID[DLT_ID_SIZE]; /**< context id */
int32_t log_level_pos; /**< offset in user-application context field */
int8_t *log_level_ptr; /**< pointer to the log level */
int8_t *trace_status_ptr; /**< pointer to the trace status */
uint8_t mcnt; /**< message counter */
} DltContext;

/**
Expand Down Expand Up @@ -582,7 +582,7 @@ int dlt_register_context(DltContext *handle, const char *contextid, const char *
* @param loglevel This is the log level to be pre-set for this context
(DLT_LOG_DEFAULT is not allowed here)
* @param tracestatus This is the trace status to be pre-set for this context
(DLT_TRACE_STATUS_DEFAULT is not allowed here)
(DLT_TRACE_STATUS_DEFAULT is not allowed here)
* @return negative value if there was an error
*/
int dlt_register_context_ll_ts(DltContext *handle, const char *contextid, const char * description, int loglevel, int tracestatus);
Expand Down
28 changes: 17 additions & 11 deletions src/console/dlt-logstorage-ctrl.c
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
/**
/*
* @licence app begin@
* SPDX license identifier: MPL-2.0
*
* Copyright (C) 2013 - 2015 Advanced Driver Information Technology.
* This code is developed by Advanced Driver Information Technology.
* Copyright of Advanced Driver Information Technology, Bosch and DENSO.
*
* This file is part of GENIVI Project Dlt - Diagnostic Log and Trace console apps.
* Copyright of Advanced Driver Information Technology, Bosch and DENSO
*
* This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
*
* \copyright
* This Source Code Form is subject to the terms of the
* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
* this file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Mozilla Public License (MPL), v. 2.0.
* If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* For further information see http://www.genivi.org/.
* @licence end@
*/

/*!
* \author Syed Hameed <[email protected]> ADIT 2013 - 2015
* \author Christoph Lipka <[email protected]> ADIT 2015
*
* \copyright Copyright © 2013-2015 Advanced Driver Information Technology. \n
* License MPL-2.0: Mozilla Public License version 2.0 http://mozilla.org/MPL/2.0/.
*
* \file dlt-logstorage-ctrl.c
* For further information see http://www.genivi.org/.
* @licence end@
*/
*/

/*******************************************************************************
** **
Expand Down
Loading

0 comments on commit 4c8d433

Please sign in to comment.