[ignition-msgs] 01/02: Imported Upstream version 0.4.0
Jose Luis Rivero
jrivero-guest at moszumanska.debian.org
Wed Jul 27 22:37:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
jrivero-guest pushed a commit to branch master
in repository ignition-msgs.
commit e56eafb95381500700addca945ba186cdf055494
Author: Jose Luis Rivero <jrivero at osrfoundation.org>
Date: Wed Jul 27 22:29:15 2016 +0000
Imported Upstream version 0.4.0
---
.hg_archival.txt | 6 +
.hgignore | 6 +
AUTHORS | 1 +
CMakeLists.txt | 347 ++
COPYING | 178 +
LICENSE | 15 +
NEWS | 1 +
README.md | 25 +
cmake/CodeCoverage.cmake | 132 +
cmake/DefaultCFlags.cmake | 42 +
cmake/DissectVersion.cmake | 5 +
cmake/FindOS.cmake | 55 +
cmake/FindSSE.cmake | 113 +
cmake/HostCFlags.cmake | 27 +
cmake/Ronn2Man.cmake | 59 +
cmake/SearchForStuff.cmake | 71 +
cmake/TargetArch.cmake | 158 +
cmake/TestUtils.cmake | 55 +
cmake/Utils.cmake | 181 +
cmake/cmake_uninstall.cmake.in | 21 +
cmake/config.hh.in | 15 +
cmake/cpack.cmake | 25 +
cmake/cpack_options.cmake.in | 28 +
cmake/ignition-config.cmake.in | 48 +
cmake/pkgconfig/ignition-msgs.in | 10 +
cmake/upload_doc.sh.in | 29 +
conf/CMakeLists.txt | 23 +
conf/msgs.yaml.in | 8 +
configure.bat | 16 +
doc/CMakeLists.txt | 14 +
doc/doxygen.css | 775 ++++
doc/footer.html | 1 +
doc/header.html | 65 +
doc/ignition.in | 2305 +++++++++++
doc/ignition_logo.png | Bin 0 -> 14266 bytes
doc/ignition_logo.svg | 249 ++
doc/mainpage.html | 15 +
doc/search.js | 817 ++++
doc/style.css | 107 +
ignition/msgs/CMakeLists.txt | 278 ++
ignition/msgs/altimeter.proto | 25 +
ignition/msgs/any.proto | 82 +
ignition/msgs/atmosphere.proto | 33 +
ignition/msgs/axis.proto | 21 +
ignition/msgs/battery.proto | 16 +
ignition/msgs/boolean.proto | 13 +
ignition/msgs/boxgeom.proto | 14 +
ignition/msgs/bytes.proto | 13 +
ignition/msgs/camera_cmd.proto | 12 +
ignition/msgs/camera_lens.proto | 48 +
ignition/msgs/camerasensor.proto | 22 +
ignition/msgs/cessna.proto | 52 +
ignition/msgs/clock.proto | 16 +
ignition/msgs/cmd_vel2d.proto | 13 +
ignition/msgs/collision.proto | 26 +
ignition/msgs/color.proto | 16 +
ignition/msgs/contact.proto | 25 +
ignition/msgs/contacts.proto | 17 +
ignition/msgs/contactsensor.proto | 12 +
ignition/msgs/cylindergeom.proto | 13 +
ignition/msgs/density.proto | 12 +
ignition/msgs/diagnostics.proto | 25 +
ignition/msgs/distortion.proto | 19 +
ignition/msgs/double.proto | 13 +
ignition/msgs/double_v.proto | 13 +
ignition/msgs/duration.proto | 16 +
ignition/msgs/empty.proto | 13 +
ignition/msgs/entity_factory.proto | 48 +
ignition/msgs/float.proto | 13 +
ignition/msgs/float_v.proto | 13 +
ignition/msgs/fluid.proto | 18 +
ignition/msgs/fog.proto | 25 +
ignition/msgs/friction.proto | 62 +
ignition/msgs/geometry.proto | 47 +
ignition/msgs/gps.proto | 21 +
ignition/msgs/gps_sensor.proto | 30 +
ignition/msgs/gui.proto | 17 +
ignition/msgs/gui_camera.proto | 21 +
ignition/msgs/header.proto | 16 +
ignition/msgs/heightmapgeom.proto | 40 +
ignition/msgs/hydra.proto | 54 +
ignition/msgs/ign_auto_headers.hh.in | 2 +
ignition/msgs/image.proto | 17 +
ignition/msgs/image_stamped.proto | 17 +
ignition/msgs/imagegeom.proto | 16 +
ignition/msgs/images_stamped.proto | 17 +
ignition/msgs/imu.proto | 20 +
ignition/msgs/imu_sensor.proto | 44 +
ignition/msgs/inertial.proto | 21 +
ignition/msgs/int32.proto | 13 +
ignition/msgs/int32_v.proto | 13 +
ignition/msgs/int64.proto | 13 +
ignition/msgs/int64_v.proto | 13 +
ignition/msgs/joint.proto | 68 +
ignition/msgs/joint_animation.proto | 23 +
ignition/msgs/joint_cmd.proto | 20 +
ignition/msgs/joint_wrench.proto | 20 +
ignition/msgs/joint_wrench_stamped.proto | 18 +
ignition/msgs/joystick.proto | 25 +
ignition/msgs/laserscan.proto | 28 +
ignition/msgs/laserscan_stamped.proto | 17 +
ignition/msgs/light.proto | 36 +
ignition/msgs/link.proto | 37 +
ignition/msgs/link_data.proto | 18 +
ignition/msgs/log_control.proto | 16 +
ignition/msgs/log_playback_control.proto | 31 +
ignition/msgs/log_playback_stats.proto | 18 +
ignition/msgs/log_status.proto | 32 +
ignition/msgs/logical_camera_image.proto | 30 +
ignition/msgs/logical_camera_sensor.proto | 22 +
ignition/msgs/magnetometer.proto | 20 +
ignition/msgs/marker.proto | 133 +
ignition/msgs/marker_v.proto | 15 +
ignition/msgs/material.proto | 35 +
ignition/msgs/meshgeom.proto | 17 +
ignition/msgs/model.proto | 30 +
ignition/msgs/model_configuration.proto | 24 +
ignition/msgs/model_v.proto | 14 +
ignition/msgs/packet.proto | 16 +
ignition/msgs/param.proto | 21 +
ignition/msgs/param_v.proto | 15 +
ignition/msgs/physics.proto | 41 +
ignition/msgs/pid.proto | 18 +
ignition/msgs/planegeom.proto | 17 +
ignition/msgs/plugin.proto | 14 +
ignition/msgs/plugin_v.proto | 15 +
ignition/msgs/pointcloud.proto | 14 +
ignition/msgs/polylinegeom.proto | 15 +
ignition/msgs/pose.proto | 18 +
ignition/msgs/pose_animation.proto | 18 +
ignition/msgs/pose_stamped.proto | 16 +
ignition/msgs/pose_trajectory.proto | 16 +
ignition/msgs/pose_v.proto | 14 +
ignition/msgs/poses_stamped.proto | 16 +
ignition/msgs/projector.proto | 20 +
ignition/msgs/propagation_grid.proto | 14 +
ignition/msgs/propagation_particle.proto | 14 +
ignition/msgs/publish.proto | 15 +
ignition/msgs/publishers.proto | 14 +
ignition/msgs/quaternion.proto | 15 +
ignition/msgs/raysensor.proto | 25 +
ignition/msgs/request.proto | 15 +
ignition/msgs/response.proto | 16 +
ignition/msgs/rest_login.proto | 22 +
ignition/msgs/rest_logout.proto | 16 +
ignition/msgs/rest_post.proto | 20 +
ignition/msgs/rest_response.proto | 34 +
ignition/msgs/road.proto | 18 +
ignition/msgs/scene.proto | 32 +
ignition/msgs/selection.proto | 14 +
ignition/msgs/sensor.proto | 69 +
ignition/msgs/sensor_noise.proto | 46 +
ignition/msgs/server_control.proto | 18 +
ignition/msgs/shadows.proto | 22 +
ignition/msgs/sim_event.proto | 26 +
ignition/msgs/sky.proto | 22 +
ignition/msgs/sonar.proto | 23 +
ignition/msgs/sonar_stamped.proto | 17 +
ignition/msgs/spheregeom.proto | 13 +
ignition/msgs/spherical_coordinates.proto | 21 +
ignition/msgs/stringmsg.proto | 12 +
ignition/msgs/stringmsg_v.proto | 12 +
ignition/msgs/subscribe.proto | 16 +
ignition/msgs/surface.proto | 26 +
ignition/msgs/tactile.proto | 17 +
ignition/msgs/test.proto | 14 +
ignition/msgs/time.proto | 16 +
ignition/msgs/topic_info.proto | 17 +
ignition/msgs/track_visual.proto | 41 +
ignition/msgs/uint32.proto | 13 +
ignition/msgs/uint32_v.proto | 13 +
ignition/msgs/uint64.proto | 13 +
ignition/msgs/uint64_v.proto | 13 +
ignition/msgs/undo_redo.proto | 17 +
ignition/msgs/user_cmd.proto | 55 +
ignition/msgs/user_cmd_stats.proto | 18 +
ignition/msgs/vector2d.proto | 13 +
ignition/msgs/vector3d.proto | 14 +
ignition/msgs/visual.proto | 70 +
ignition/msgs/web_request.proto | 16 +
ignition/msgs/wind.proto | 15 +
ignition/msgs/wireless_node.proto | 14 +
ignition/msgs/wireless_nodes.proto | 14 +
ignition/msgs/world_control.proto | 18 +
ignition/msgs/world_modify.proto | 16 +
ignition/msgs/world_reset.proto | 14 +
ignition/msgs/world_stats.proto | 21 +
ignition/msgs/wrench.proto | 16 +
ignition/msgs/wrench_stamped.proto | 17 +
include/CMakeLists.txt | 1 +
include/ignition/CMakeLists.txt | 1 +
include/ignition/msgs/CMakeLists.txt | 24 +
include/ignition/msgs/Factory.hh | 116 +
include/ignition/msgs/Generator.hh | 57 +
include/ignition/msgs/System.hh | 62 +
include/ignition/msgs/Utility.hh | 121 +
include/ignition/msgs/ign.hh | 35 +
include/ignition/msgs/ign_auto_headers.hh.in | 4 +
src/CMakeLists.txt | 29 +
src/Factory.cc | 93 +
src/Factory_TEST.cc | 54 +
src/Generator.cc | 183 +
src/Utility.cc | 146 +
src/Utility_TEST.cc | 220 +
src/cmd/CMakeLists.txt | 16 +
src/cmd/cmdmsgs.rb.in | 152 +
src/generator_main.cc | 31 +
src/ign.cc | 71 +
test/CMakeLists.txt | 22 +
test/integration/CMakeLists.txt | 8 +
test/performance/CMakeLists.txt | 8 +
test/regression/CMakeLists.txt | 8 +
test/test_config.h.in | 1 +
tools/check_test_ran.py | 79 +
tools/code_check.sh | 141 +
tools/cpplint.py | 5622 ++++++++++++++++++++++++++
216 files changed, 17045 insertions(+)
diff --git a/.hg_archival.txt b/.hg_archival.txt
new file mode 100644
index 0000000..27b65bf
--- /dev/null
+++ b/.hg_archival.txt
@@ -0,0 +1,6 @@
+repo: 09899cf26f5e06885063b2cb0d8aa98e97759255
+node: fda992ef7b59a68a93c86257ee57b424d446049a
+branch: default
+latesttag: ignition-msgs_0.3.1
+latesttagdistance: 6
+changessincelatesttag: 6
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..ebd4abe
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,6 @@
+syntax: glob
+
+build
+build_*
+.DS_Store
+*.swp
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..65032b7
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+OSRFoundation
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..4f8602d
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,347 @@
+cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
+
+set(IGN_PROJECT_NAME "msgs")
+
+set (PROJECT_MAJOR_VERSION 0)
+set (PROJECT_MINOR_VERSION 4)
+set (PROJECT_PATCH_VERSION 0)
+
+project (ignition-${IGN_PROJECT_NAME}${PROJECT_MAJOR_VERSION})
+set(PROJECT_NAME_NO_VERSION "ignition-${IGN_PROJECT_NAME}")
+string (TOLOWER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_LOWER)
+string (TOUPPER ${PROJECT_NAME_NO_VERSION} PROJECT_NAME_NO_VERSION_UPPER)
+string (TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
+string (TOUPPER ${PROJECT_NAME} PROJECT_NAME_UPPER)
+set(PROJECT_EXPORT_NAME ${PROJECT_NAME_LOWER})
+set(PROJECT_LIBRARY_TARGET_NAME ${PROJECT_NAME_LOWER})
+
+set (PROJECT_VERSION ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION})
+set (PROJECT_VERSION_FULL
+ ${PROJECT_MAJOR_VERSION}.${PROJECT_MINOR_VERSION}.${PROJECT_PATCH_VERSION})
+
+
+message (STATUS "${PROJECT_NAME_NO_VERSION} version ${PROJECT_VERSION_FULL}")
+
+set (project_cmake_dir ${PROJECT_SOURCE_DIR}/cmake
+ CACHE PATH "Location of CMake scripts")
+
+include (${project_cmake_dir}/Utils.cmake)
+include (CMakePackageConfigHelpers)
+
+########################################
+# Package Creation:
+include (${project_cmake_dir}/cpack.cmake)
+set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION_FULL}")
+set (CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_MAJOR_VERSION}")
+set (CPACK_PACKAGE_VERSION_MINOR "${PROJECT_MINOR_VERSION}")
+set (CPACK_PACKAGE_VERSION_PATCH "${PROJECT_PATCH_VERSION}")
+
+if (CPACK_GENERATOR)
+ message(STATUS "Found CPack generators: ${CPACK_GENERATOR}")
+
+ configure_file("${project_cmake_dir}/cpack_options.cmake.in"
+ ${PROJECT_CPACK_CFG_FILE} @ONLY)
+
+ set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_CPACK_CFG_FILE})
+ include (CPack)
+endif()
+
+# If we're configuring only to package source, stop here
+if (PACKAGE_SOURCE_ONLY)
+ message(WARNING "Configuration was done in PACKAGE_SOURCE_ONLY mode."
+ "You can build a tarball (make package_source), but nothing else.")
+ return()
+endif()
+
+#################################################
+# Documentation:
+add_subdirectory(doc)
+
+# Configure documentation uploader
+configure_file("${project_cmake_dir}/upload_doc.sh.in"
+ ${CMAKE_BINARY_DIR}/upload_doc.sh @ONLY)
+
+# If we're configuring only to build docs, stop here
+if (DOC_ONLY)
+ message(WARNING "Configuration was done in DOC_ONLY mode."
+ " You can build documentation (make doc), but nothing else.")
+ return()
+endif()
+
+enable_testing()
+
+# Use GNUInstallDirst to get canonical paths
+include(GNUInstallDirs)
+
+# with -fPIC
+if(UNIX AND NOT WIN32)
+ set (CMAKE_INSTALL_PREFIX "/usr" CACHE STRING "Install Prefix")
+ find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
+ if(CMAKE_UNAME)
+ exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_SYSTEM_PROCESSOR)
+ set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_SYSTEM_PROCESSOR} CACHE INTERNAL
+ "processor type (i386 and x86_64)")
+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ ADD_DEFINITIONS(-fPIC)
+ endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ endif(CMAKE_UNAME)
+endif()
+
+set (CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
+
+# developer's option to cache PKG_CONFIG_PATH and
+# LD_LIBRARY_PATH for local installs
+if(PKG_CONFIG_PATH)
+ set (ENV{PKG_CONFIG_PATH} ${PKG_CONFIG_PATH}:$ENV{PKG_CONFIG_PATH})
+endif()
+if(LD_LIBRARY_PATH)
+ set (ENV{LD_LIBRARY_PATH} ${LD_LIBRARY_PATH}:$ENV{LD_LIBRARY_PATH})
+endif()
+
+
+set (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}")
+set (INCLUDE_INSTALL_DIR_POSTFIX
+ "ignition/${IGN_PROJECT_NAME}${PROJECT_MAJOR_VERSION}")
+set (INCLUDE_INSTALL_DIR_FULL
+ "${INCLUDE_INSTALL_DIR}/${INCLUDE_INSTALL_DIR_POSTFIX}")
+set (LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR})
+set (BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR})
+
+set (USE_FULL_RPATH OFF CACHE BOOL "Set to true to enable full rpath")
+
+if (USE_FULL_RPATH)
+ # use, i.e. don't skip the full RPATH for the build tree
+ set(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+ # when building, don't use the install RPATH already
+ # (but later on when installing)
+ set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
+
+ # add the automatically determined parts of the RPATH
+ # which point to directories outside the build tree to the install RPATH
+ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+ # the RPATH to be used when installing, but only if its not a system directory
+ list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}" isSystemDir)
+ if("${isSystemDir}" STREQUAL "-1")
+ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}")
+ endif("${isSystemDir}" STREQUAL "-1")
+endif()
+
+set (BUILD_IGNITION ON CACHE INTERNAL
+ "Build Ignition Msgs" FORCE)
+set (build_errors "" CACHE INTERNAL "build errors" FORCE)
+set (build_warnings "" CACHE INTERNAL "build warnings" FORCE)
+
+include (${project_cmake_dir}/DissectVersion.cmake)
+
+message (STATUS "\n\n====== Finding 3rd Party Packages ======")
+include (${project_cmake_dir}/SearchForStuff.cmake)
+message (STATUS "----------------------------------------\n")
+
+#####################################
+MESSAGE(STATUS "Checking ignition build type")
+# Set the default build type
+if (NOT CMAKE_BUILD_TYPE)
+ set (CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
+ "Choose the type of build, options are: Debug Release RelWithDebInfo Profile Check" FORCE)
+endif (NOT CMAKE_BUILD_TYPE)
+# TODO: still convert to uppercase to keep backwards compatibility with
+# uppercase old supported and deprecated modes
+string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPERCASE)
+
+set (BUILD_TYPE_PROFILE FALSE)
+set (BUILD_TYPE_RELEASE FALSE)
+set (BUILD_TYPE_RELWITHDEBINFO FALSE)
+set (BUILD_TYPE_DEBUG FALSE)
+
+if ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "PROFILE")
+ set (BUILD_TYPE_PROFILE TRUE)
+elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELEASE")
+ set (BUILD_TYPE_RELEASE TRUE)
+elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "RELWITHDEBINFO")
+ set (BUILD_TYPE_RELWITHDEBINFO TRUE)
+elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "DEBUG")
+ set (BUILD_TYPE_DEBUG TRUE)
+elseif ("${CMAKE_BUILD_TYPE_UPPERCASE}" STREQUAL "COVERAGE")
+ include (${project_cmake_dir}/CodeCoverage.cmake)
+ set (BUILD_TYPE_DEBUG TRUE)
+ SETUP_TARGET_FOR_COVERAGE(coverage ctest coverage)
+else()
+ build_error("CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} unknown. Valid options are: Debug Release RelWithDebInfo Profile Check")
+endif()
+
+#####################################
+# Handle CFlags
+unset (CMAKE_C_FLAGS_ALL CACHE)
+unset (CMAKE_CXX_FLAGS CACHE)
+
+# Check if warning options are avaliable for the compiler and return WARNING_CXX_FLAGS variable
+# MSVC generates tons of warnings on gtest code.
+# Recommended to use /W4 instead of /Wall
+if (MSVC)
+ set(WARN_LEVEL "/W2")
+else()
+ set(WARN_LEVEL "-Wall")
+endif()
+
+filter_valid_compiler_warnings(${WARN_LEVEL} -Wextra -Wno-long-long
+ -Wno-unused-value -Wno-unused-value -Wno-unused-value -Wno-unused-value
+ -Wfloat-equal -Wshadow -Winit-self -Wswitch-default
+ -Wmissing-include-dirs -pedantic)
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${WARNING_CXX_FLAGS}")
+if (DEFINED EXTRA_CMAKE_CXX_FLAGS)
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CMAKE_CXX_FLAGS}")
+endif()
+
+#################################################
+# OS Specific initialization
+if (UNIX)
+ ign_setup_unix()
+else (WIN32)
+ ign_setup_windows()
+endif()
+
+if(APPLE)
+ ign_setup_apple()
+endif()
+
+#################################################
+# Print warnings and errors
+if ( build_warnings )
+ message(STATUS "BUILD WARNINGS")
+ foreach (msg ${build_warnings})
+ message(STATUS ${msg})
+ endforeach ()
+ message(STATUS "END BUILD WARNINGS\n")
+endif (build_warnings)
+
+########### Add uninstall target ###############
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+add_custom_target(uninstall
+ "${CMAKE_COMMAND}" -P
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
+
+if (build_errors)
+ message(STATUS "BUILD ERRORS: These must be resolved before compiling.")
+ foreach (msg ${build_errors})
+ message(STATUS ${msg})
+ endforeach ()
+ message(STATUS "END BUILD ERRORS\n")
+ message (FATAL_ERROR "Errors encountered in build. "
+ "Please see the BUILD ERRORS above.")
+else (build_errors)
+
+ ########################################
+ # Write the config.h file
+ configure_file ("${project_cmake_dir}/config.hh.in"
+ "${PROJECT_BINARY_DIR}/include/ignition/${IGN_PROJECT_NAME}/config.hh")
+ ign_install_includes(
+ "${INCLUDE_INSTALL_DIR_POSTFIX}/ignition/${IGN_PROJECT_NAME}"
+ "${PROJECT_BINARY_DIR}/include/ignition/${IGN_PROJECT_NAME}/config.hh")
+
+ include_directories(
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_SOURCE_DIR}/include
+ ${PROJECT_BINARY_DIR}
+ ${PROJECT_BINARY_DIR}/include
+ ${PROJECT_BINARY_DIR}/ignition/msgs
+ ${IGNITION-MATH_INCLUDE_DIRS}
+ )
+ link_directories(${PROJECT_BINARY_DIR}/src ${IGNITION-MATH_LINK_DIRS})
+
+ if (DEFINED CMAKE_CXX_FLAGS)
+ message (STATUS "Custom CFlags:${CMAKE_CXX_FLAGS}")
+ else()
+ message (STATUS "Use default CFlags")
+ endif()
+ message (STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
+ message (STATUS "Install path: ${CMAKE_INSTALL_PREFIX}")
+
+
+ if (BUILD_IGNITION)
+ set(TEST_TYPE "UNIT")
+ add_subdirectory(ignition/msgs)
+ add_subdirectory(src)
+ add_subdirectory(include)
+ add_subdirectory(test)
+ add_subdirectory(conf)
+ endif (BUILD_IGNITION)
+
+ ########################################
+ # Make the package config files
+ set (pkgconfig_files ${PROJECT_NAME_NO_VERSION_LOWER})
+
+ foreach (pkgconfig ${pkgconfig_files})
+ configure_file(${CMAKE_SOURCE_DIR}/cmake/pkgconfig/${pkgconfig}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/cmake/pkgconfig/${pkgconfig}${PROJECT_MAJOR_VERSION}.pc @ONLY)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmake/pkgconfig/${pkgconfig}${PROJECT_MAJOR_VERSION}.pc
+ DESTINATION ${LIB_INSTALL_DIR}/pkgconfig COMPONENT pkgconfig)
+ endforeach()
+
+ ########################################
+ # Make the cmake config files
+ set(PKG_NAME ${PROJECT_NAME_NO_VERSION_UPPER})
+ set(cmake_conf_file "${PROJECT_NAME_LOWER}-config.cmake")
+ set(cmake_conf_version_file "${PROJECT_NAME_LOWER}-config-version.cmake")
+ set(cmake_targets_file "${PROJECT_NAME_LOWER}-targets.cmake")
+
+ set(PKG_DEPENDS)
+
+ if(WIN32 AND NOT CYGWIN)
+ set(CMAKE_CONFIG_INSTALL_DIR CMake)
+ else()
+ set(CMAKE_CONFIG_INSTALL_DIR
+ ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME_LOWER}/)
+ endif()
+
+ configure_package_config_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ignition-config.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}"
+ PATH_VARS LIB_INSTALL_DIR INCLUDE_INSTALL_DIR_FULL
+ INSTALL_DESTINATION ${CMAKE_CONFIG_INSTALL_DIR})
+
+ # Use write_basic_package_version_file to generate a ConfigVersion file that
+ # allow users of gazebo to specify the API or version to depend on
+ # TODO: keep this instruction until deprecate Ubuntu/Precise and update with
+ # https://github.com/Kitware/CMake/blob/v2.8.8/Modules/CMakePackageConfigHelpers.cmake
+ include(WriteBasicConfigVersionFile)
+ write_basic_config_version_file(
+ ${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_version_file}
+ VERSION "${PROJECT_VERSION_FULL}"
+ COMPATIBILITY SameMajorVersion)
+
+ install(FILES
+ ${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_file}
+ ${CMAKE_CURRENT_BINARY_DIR}/${cmake_conf_version_file}
+ DESTINATION ${CMAKE_CONFIG_INSTALL_DIR} COMPONENT cmake)
+
+ # Create *-targets.cmake file for build directory
+ # TODO: keep this instruction until we depend on CMake 3
+ # then change the first line from TARGETS ...
+ # to EXPORT ... to match the format used in install(EXPORT
+ export(TARGETS ${PROJECT_LIBRARY_TARGET_NAME}
+ FILE ${CMAKE_BINARY_DIR}/${cmake_targets_file})
+
+ # Install *-targets.cmake file
+ install(EXPORT ${PROJECT_EXPORT_NAME}
+ DESTINATION ${CMAKE_CONFIG_INSTALL_DIR}
+ FILE ${cmake_targets_file})
+
+ ########################################
+ # If present, load platform-specific build hooks. This system is used,
+ # for example, by the Ubuntu overlay, to
+ # arrange for installation of Ubuntu-specific application-launching
+ # configuration.
+ if (EXISTS ${PROJECT_SOURCE_DIR}/cmake/packager-hooks/CMakeLists.txt)
+ message(STATUS "Loading packager build hooks from cmake/packager-hooks")
+ add_subdirectory(cmake/packager-hooks)
+ endif()
+
+ message(STATUS "Configuration successful.")
+endif(build_errors)
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..4909afd
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,178 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..5f63c88
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,15 @@
+Software License Agreement (Apache License)
+
+Copyright 2014 Open Source Robotics Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..6b7be6e
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+http://ignition_robotics.org
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2e662f9
--- /dev/null
+++ b/README.md
@@ -0,0 +1,25 @@
+# Ignition Messages
+
+** Igntioin Message protobuf messages and functions for robot applications.**
+
+Ignition Messages is a component in the ignition framework, a set
+of libraries designed to rapidly develop robot applications.
+
+ [http://ignitionrobotics.org](http://ignitionrobotics.org)
+
+## Installation
+
+Standard installation can be performed in UNIX systems using the following
+steps:
+
+ - mkdir build/
+ - cd build/
+ - cmake ..
+ - sudo make install
+
+## Uninstallation
+
+To uninstall the software installed with the previous steps:
+
+ - cd build/
+ - sudo make uninstall
diff --git a/cmake/CodeCoverage.cmake b/cmake/CodeCoverage.cmake
new file mode 100644
index 0000000..c032290
--- /dev/null
+++ b/cmake/CodeCoverage.cmake
@@ -0,0 +1,132 @@
+#
+# 2012-01-31, Lars Bilke
+# - Enable Code Coverage
+#
+# 2013-09-17, Joakim Söderberg
+# - Added support for Clang.
+# - Some additional usage instructions.
+#
+# USAGE:
+# 1. Copy this file into your cmake modules path.
+#
+# 2. Add the following line to your CMakeLists.txt:
+# INCLUDE(CodeCoverage)
+#
+# 3. Set compiler flags to turn off optimization and enable coverage:
+# SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
+# SET(CMAKE_C_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
+#
+# 3. Use the function SETUP_TARGET_FOR_COVERAGE to create a custom make target
+# which runs your test executable and produces a lcov code coverage report:
+# Example:
+# SETUP_TARGET_FOR_COVERAGE(
+# my_coverage_target # Name for custom target.
+# test_driver # Name of the test driver executable that runs the tests.
+# # NOTE! This should always have a ZERO as exit code
+# # otherwise the coverage generation will not complete.
+# coverage # Name of output directory.
+# )
+#
+# 4. Build a Debug build:
+# cmake -DCMAKE_BUILD_TYPE=Debug ..
+# make
+# make my_coverage_target
+#
+#
+
+# Check prereqs
+FIND_PROGRAM( GCOV_PATH gcov )
+FIND_PROGRAM( LCOV_PATH lcov )
+FIND_PROGRAM( GREP_PATH grep )
+FIND_PROGRAM( GENHTML_PATH genhtml )
+FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
+
+IF(NOT GCOV_PATH)
+ MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
+ENDIF() # NOT GCOV_PATH
+
+IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ # Clang version 3.0.0 and greater now supports gcov as well.
+ MESSAGE(WARNING "Compiler is not GNU gcc! Clang Version 3.0.0 and greater supports gcov as well, but older versions don't.")
+
+ IF(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
+ ENDIF()
+ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
+
+SET(CMAKE_CXX_FLAGS_COVERAGE
+ "-g -O0 --coverage -fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the C++ compiler during coverage builds."
+ FORCE )
+SET(CMAKE_C_FLAGS_COVERAGE
+ "-g -O0 --coverage -fprofile-arcs -ftest-coverage"
+ CACHE STRING "Flags used by the C compiler during coverage builds."
+ FORCE )
+SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ ""
+ CACHE STRING "Flags used for linking binaries during coverage builds."
+ FORCE )
+SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE
+ ""
+ CACHE STRING "Flags used by the shared libraries linker during coverage builds."
+ FORCE )
+MARK_AS_ADVANCED(
+ CMAKE_CXX_FLAGS_COVERAGE
+ CMAKE_C_FLAGS_COVERAGE
+ CMAKE_EXE_LINKER_FLAGS_COVERAGE
+ CMAKE_SHARED_LINKER_FLAGS_COVERAGE )
+
+IF ( NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "Coverage"))
+ MESSAGE( WARNING "Code coverage results with an optimized (non-Debug) build may be misleading" )
+ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
+
+
+# Param _targetname The name of new the custom make target
+# Param _testrunner The name of the target which runs the tests.
+# MUST return ZERO always, even on errors.
+# If not, no coverage report will be created!
+# Param _outputname lcov output is generated as _outputname.info
+# HTML report is generated in _outputname/index.html
+# Optional fourth parameter is passed as arguments to _testrunner
+# Pass them in list form, e.g.: "-j;2" for -j 2
+FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
+
+ IF(NOT LCOV_PATH)
+ MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
+ ENDIF() # NOT LCOV_PATH
+
+ IF(NOT GREP_PATH)
+ MESSAGE(FATAL_ERROR "grep not found! Run code coverage on linux or mac.")
+ ENDIF()
+
+ IF(NOT GENHTML_PATH)
+ MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
+ ENDIF() # NOT GENHTML_PATH
+
+ # Setup target
+ ADD_CUSTOM_TARGET(${_targetname}
+
+ # Capturing lcov counters and generating report
+ COMMAND ${LCOV_PATH} -q --no-checksum --directory ${PROJECT_BINARY_DIR}
+ --capture --output-file ${_outputname}.info 2>/dev/null
+ COMMAND ${LCOV_PATH} -q --remove ${_outputname}.info
+ 'test/*' '/usr/*' '*_TEST*' --output-file ${_outputname}.info.cleaned
+ COMMAND ${GENHTML_PATH} -q --legend -o ${_outputname}
+ ${_outputname}.info.cleaned
+ COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "lines" | cut -d ' ' -f 4 | cut -d '%' -f 1 > coverage/lines.txt
+ COMMAND ${LCOV_PATH} --summary ${_outputname}.info.cleaned 2>&1 | grep "functions" | cut -d ' ' -f 4 | cut -d '%' -f 1 > coverage/functions.txt
+ COMMAND ${CMAKE_COMMAND} -E remove ${_outputname}.info
+ ${_outputname}.info.cleaned
+
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Resetting code coverage counters to zero.\n"
+ "Processing code coverage counters and generating report."
+ )
+
+ # Show info where to find the report
+ ADD_CUSTOM_COMMAND(TARGET ${_targetname} POST_BUILD
+ COMMAND COMMAND ${LCOV_PATH} -q --zerocounters --directory ${PROJECT_BINARY_DIR};
+ COMMENT "Open ./${_outputname}/index.html in your browser to view the coverage report."
+ )
+
+ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
diff --git a/cmake/DefaultCFlags.cmake b/cmake/DefaultCFlags.cmake
new file mode 100644
index 0000000..a2717c8
--- /dev/null
+++ b/cmake/DefaultCFlags.cmake
@@ -0,0 +1,42 @@
+# Build type link flags
+set (CMAKE_LINK_FLAGS_RELEASE " " CACHE INTERNAL "Link flags for release" FORCE)
+set (CMAKE_LINK_FLAGS_RELWITHDEBINFO " " CACHE INTERNAL "Link flags for release with debug support" FORCE)
+set (CMAKE_LINK_FLAGS_DEBUG " " CACHE INTERNAL "Link flags for debug" FORCE)
+set (CMAKE_LINK_FLAGS_PROFILE " -pg" CACHE INTERNAL "Link flags for profile" FORCE)
+set (CMAKE_LINK_FLAGS_COVERAGE " --coverage" CACHE INTERNAL "Link flags for static code checking" FORCE)
+
+set (CMAKE_C_FLAGS_RELEASE "")
+if (NOT APPLE)
+ # -s doesn't work with default osx compiler clang, alternative:
+ # http://stackoverflow.com/questions/6085491/gcc-vs-clang-symbol-strippingu
+ set (CMAKE_C_FLAGS_RELEASE "-s")
+endif()
+set (CMAKE_C_FLAGS_RELEASE " ${CMAKE_C_FLAGS_RELEASE} -O3 -DNDEBUG ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release" FORCE)
+set (CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})
+
+set (CMAKE_C_FLAGS_RELWITHDEBINFO " -g -O2 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for release with debug support" FORCE)
+set (CMAKE_CXX_FLAGS_RELWITHDEBINFO ${CMAKE_C_FLAGS_RELWITHDEBINFO})
+
+set (CMAKE_C_FLAGS_DEBUG " -ggdb3 ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for debug" FORCE)
+set (CMAKE_CXX_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
+
+set (CMAKE_C_FLAGS_PROFILE " -fno-omit-frame-pointer -g -pg ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for profile" FORCE)
+set (CMAKE_CXX_FLAGS_PROFILE ${CMAKE_C_FLAGS_PROFILE})
+
+set (CMAKE_C_FLAGS_COVERAGE " -g -O0 -Wformat=2 --coverage -fno-inline ${CMAKE_C_FLAGS_ALL}" CACHE INTERNAL "C Flags for static code checking" FORCE)
+set (CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_C_FLAGS_COVERAGE} -fno-elide-constructors -fno-default-inline -fno-implicit-inline-templates")
+
+#####################################
+# Set all the global build flags
+if (UNIX)
+ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
+ set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
+ set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_LINK_FLAGS_${CMAKE_BUILD_TYPE_UPPERCASE}}")
+ # Add visibility in UNIX
+ check_gcc_visibility()
+ if (GCC_SUPPORTS_VISIBILITY)
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+ endif()
+endif()
diff --git a/cmake/DissectVersion.cmake b/cmake/DissectVersion.cmake
new file mode 100644
index 0000000..64b18ed
--- /dev/null
+++ b/cmake/DissectVersion.cmake
@@ -0,0 +1,5 @@
+# Find version components
+STRING (REGEX REPLACE "^([0-9]+).*" "\\1" PROJECT_MAJOR_VERSION "${PROJECT_VERSION_FULL}")
+STRING (REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" PROJECT_MINOR_VERSION "${PROJECT_VERSION_FULL}")
+STRING (REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PROJECT_REVISION_VERSION ${PROJECT_VERSION_FULL})
+STRING (REGEX REPLACE "^[0-9]+\\.[0-9]+\\.[0-9]+(.*)" "\\1" PROJECT_CANDIDATE_VERSION ${PROJECT_VERSION_FULL})
diff --git a/cmake/FindOS.cmake b/cmake/FindOS.cmake
new file mode 100644
index 0000000..7a12f95
--- /dev/null
+++ b/cmake/FindOS.cmake
@@ -0,0 +1,55 @@
+# Check the OS type.
+
+# CMake does not distinguish Linux from other Unices.
+STRING (REGEX MATCH "Linux" PLAYER_OS_LINUX ${CMAKE_SYSTEM_NAME})
+# Nor *BSD
+STRING (REGEX MATCH "BSD" PLAYER_OS_BSD ${CMAKE_SYSTEM_NAME})
+# Or Solaris. I'm seeing a trend, here
+STRING (REGEX MATCH "SunOS" PLAYER_OS_SOLARIS ${CMAKE_SYSTEM_NAME})
+
+# Windows is easy (for once)
+IF (WIN32)
+ SET (PLAYER_OS_WIN TRUE BOOL INTERNAL)
+ENDIF (WIN32)
+
+# Check if it's an Apple OS
+IF (APPLE)
+ # Check if it's OS X or another MacOS (that's got to be pretty unlikely)
+ STRING (REGEX MATCH "Darwin" PLAYER_OS_OSX ${CMAKE_SYSTEM_NAME})
+ IF (NOT PLAYER_OS_OSX)
+ SET (PLAYER_OS_MACOS TRUE BOOL INTERNAL)
+ ENDIF (NOT PLAYER_OS_OSX)
+ENDIF (APPLE)
+
+# QNX
+IF (QNXNTO)
+ SET (PLAYER_OS_QNX TRUE BOOL INTERNAL)
+ENDIF (QNXNTO)
+
+IF (PLAYER_OS_LINUX)
+ MESSAGE (STATUS "Operating system is Linux")
+ELSEIF (PLAYER_OS_BSD)
+ MESSAGE (STATUS "Operating system is BSD")
+ELSEIF (PLAYER_OS_WIN)
+ MESSAGE (STATUS "Operating system is Windows")
+ELSEIF (PLAYER_OS_OSX)
+ MESSAGE (STATUS "Operating system is Apple MacOS X")
+ELSEIF (PLAYER_OS_MACOS)
+ MESSAGE (STATUS "Operating system is Apple MacOS (not OS X)")
+ELSEIF (PLAYER_OS_QNX)
+ MESSAGE (STATUS "Operating system is QNX")
+ELSEIF (PLAYER_OS_SOLARIS)
+ MESSAGE (STATUS "Operating system is Solaris")
+ELSE (PLAYER_OS_LINUX)
+ MESSAGE (STATUS "Operating system is generic Unix")
+ENDIF (PLAYER_OS_LINUX)
+
+#################################################
+# Check for non-case-sensitive filesystems
+execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/case_sensitive_filesystem
+ RESULT_VARIABLE FILESYSTEM_CASE_SENSITIVE_RETURN)
+if (${FILESYSTEM_CASE_SENSITIVE_RETURN} EQUAL 0)
+ set(FILESYSTEM_CASE_SENSITIVE TRUE)
+else()
+ set(FILESYSTEM_CASE_SENSITIVE FALSE)
+endif()
diff --git a/cmake/FindSSE.cmake b/cmake/FindSSE.cmake
new file mode 100644
index 0000000..96622f5
--- /dev/null
+++ b/cmake/FindSSE.cmake
@@ -0,0 +1,113 @@
+# Check if SSE instructions are available on the machine where
+# the project is compiled.
+
+IF (ARCH MATCHES "i386" OR ARCH MATCHES "x86_64")
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
+
+ STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
+ IF (SSE2_TRUE)
+ set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
+ ELSE (SSE2_TRUE)
+ set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
+ ENDIF (SSE2_TRUE)
+
+ # /proc/cpuinfo apparently omits sse3 :(
+ STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE)
+ IF (NOT SSE3_TRUE)
+ STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE)
+ ENDIF (NOT SSE3_TRUE)
+
+ STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE)
+ IF (SSE3_TRUE OR SSSE3_TRUE)
+ set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
+ ELSE (SSE3_TRUE OR SSSE3_TRUE)
+ set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
+ ENDIF (SSE3_TRUE OR SSSE3_TRUE)
+ IF (SSSE3_TRUE)
+ set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
+ ELSE (SSSE3_TRUE)
+ set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
+ ENDIF (SSSE3_TRUE)
+
+ STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE)
+ IF (SSE41_TRUE)
+ set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
+ ELSE (SSE41_TRUE)
+ set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
+ ENDIF (SSE41_TRUE)
+
+ STRING(REGEX REPLACE "^.*(sse4_2).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "sse4_2" "${SSE_THERE}" SSE42_TRUE)
+ IF (SSE42_TRUE)
+ set(SSE4_2_FOUND true CACHE BOOL "SSE4.2 available on host")
+ ELSE (SSE42_TRUE)
+ set(SSE4_2_FOUND false CACHE BOOL "SSE4.2 available on host")
+ ENDIF (SSE42_TRUE)
+
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
+ CPUINFO)
+
+ STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE)
+ IF (SSE2_TRUE)
+ set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
+ ELSE (SSE2_TRUE)
+ set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
+ ENDIF (SSE2_TRUE)
+
+ STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE)
+ IF (SSE3_TRUE)
+ set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
+ ELSE (SSE3_TRUE)
+ set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
+ ENDIF (SSE3_TRUE)
+
+ STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE)
+ IF (SSSE3_TRUE)
+ set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
+ ELSE (SSSE3_TRUE)
+ set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
+ ENDIF (SSSE3_TRUE)
+
+ STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO})
+ STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE)
+ IF (SSE41_TRUE)
+ set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
+ ELSE (SSE41_TRUE)
+ set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
+ ENDIF (SSE41_TRUE)
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+ # TODO
+ set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
+ set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
+ set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
+ set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
+ ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
+ set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
+ set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
+ set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ENDIF(ARCH MATCHES "i386" OR ARCH MATCHES "x86_64")
+
+if(NOT SSE2_FOUND)
+ MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.")
+endif(NOT SSE2_FOUND)
+if(NOT SSE3_FOUND)
+ MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.")
+endif(NOT SSE3_FOUND)
+if(NOT SSSE3_FOUND)
+ MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.")
+endif(NOT SSSE3_FOUND)
+if(NOT SSE4_1_FOUND)
+ MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.")
+endif(NOT SSE4_1_FOUND)
diff --git a/cmake/HostCFlags.cmake b/cmake/HostCFlags.cmake
new file mode 100644
index 0000000..f38d8d7
--- /dev/null
+++ b/cmake/HostCFlags.cmake
@@ -0,0 +1,27 @@
+include (${project_cmake_dir}/FindSSE.cmake)
+
+if (SSE2_FOUND)
+ set (CMAKE_C_FLAGS_ALL "-msse -msse2 ${CMAKE_C_FLAGS_ALL}")
+ if (NOT APPLE)
+ set (CMAKE_C_FLAGS_ALL "-mfpmath=sse ${CMAKE_C_FLAGS_ALL}")
+ endif()
+endif()
+
+if (SSE3_FOUND)
+ set (CMAKE_C_FLAGS_ALL "-msse3 ${CMAKE_C_FLAGS_ALL}")
+endif()
+if (SSSE3_FOUND)
+ set (CMAKE_C_FLAGS_ALL "-mssse3 ${CMAKE_C_FLAGS_ALL}")
+endif()
+
+if (SSE4_1_FOUND OR SSE4_2_FOUND)
+ if (SSE4_1_FOUND)
+ set (CMAKE_C_FLAGS_ALL "-msse4.1 ${CMAKE_C_FLAGS_ALL}")
+ endif()
+ if (SSE4_2_FOUND)
+ set (CMAKE_C_FLAGS_ALL "-msse4.2 ${CMAKE_C_FLAGS_ALL}")
+ endif()
+else()
+ message(STATUS "\nSSE4 disabled.\n")
+endif()
+
diff --git a/cmake/Ronn2Man.cmake b/cmake/Ronn2Man.cmake
new file mode 100644
index 0000000..b9a8505
--- /dev/null
+++ b/cmake/Ronn2Man.cmake
@@ -0,0 +1,59 @@
+#
+# Based on work of Emmanuel Roullit <emmanuel at netsniff-ng.org>
+# Copyright 2009, 2012 Emmanuel Roullit.
+# Subject to the GPL, version 2.
+#
+MACRO(ADD_MANPAGE_TARGET)
+ # It is not possible add a dependency to target 'install'
+ # Run hard-coded 'make man' when 'make install' is invoked
+ INSTALL(CODE "EXECUTE_PROCESS(COMMAND make man)")
+ ADD_CUSTOM_TARGET(man)
+ENDMACRO(ADD_MANPAGE_TARGET)
+
+FIND_PROGRAM(RONN ronn)
+FIND_PROGRAM(GZIP gzip)
+
+IF (NOT RONN OR NOT GZIP)
+ IF (NOT RONN)
+ BUILD_WARNING ("ronn not found, manpages won't be generated")
+ ENDIF(NOT RONN)
+ IF (NOT GZIP)
+ BUILD_WARNING ("gzip not found, manpages won't be generated")
+ ENDIF(NOT GZIP)
+ # empty macro
+ MACRO(manpage MANFILE)
+ ENDMACRO(manpage)
+ SET (MANPAGES_SUPPORT FALSE)
+ELSE (NOT RONN OR NOT GZIP)
+ MESSAGE (STATUS "Looking for ronn to generate manpages - found")
+ SET (MANPAGES_SUPPORT TRUE)
+
+ MACRO(manpage RONNFILE SECTION)
+ SET(RONNFILE_FULL_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${RONNFILE})
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}
+ DEPENDS ${RONNFILE}
+ COMMAND ${RONN}
+ ARGS -r --pipe ${RONNFILE_FULL_PATH}.${SECTION}.ronn
+ > ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}
+ )
+
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}.gz
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}
+ COMMAND ${GZIP} -c ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}
+ > ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}.gz
+ )
+
+ SET(MANPAGE_TARGET "man-${RONNFILE}")
+
+ ADD_CUSTOM_TARGET(${MANPAGE_TARGET} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}.gz)
+ ADD_DEPENDENCIES(man ${MANPAGE_TARGET})
+
+ INSTALL(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/${RONNFILE}.${SECTION}.gz
+ DESTINATION share/man/man${SECTION}
+ )
+ ENDMACRO(manpage RONNFILE SECTION)
+ENDIF(NOT RONN OR NOT GZIP)
diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
new file mode 100644
index 0000000..9f849d6
--- /dev/null
+++ b/cmake/SearchForStuff.cmake
@@ -0,0 +1,71 @@
+include (${project_cmake_dir}/Utils.cmake)
+include (CheckCXXSourceCompiles)
+
+include (${project_cmake_dir}/FindOS.cmake)
+include (FindPkgConfig)
+
+execute_process(COMMAND pkg-config --modversion protobuf
+ OUTPUT_VARIABLE PROTOBUF_VERSION
+ RESULT_VARIABLE protobuf_modversion_failed)
+
+########################################
+if (PROTOBUF_VERSION LESS 2.3.0)
+ BUILD_ERROR("Incorrect version: Ignition Messages requires protobuf "
+ "version 2.3.0 or greater")
+endif()
+
+########################################
+# The Google Protobuf library for message generation + serialization
+find_package(Protobuf REQUIRED)
+if (NOT PROTOBUF_FOUND)
+ BUILD_ERROR ("Missing: Google Protobuf (libprotobuf-dev)")
+endif()
+if (NOT PROTOBUF_PROTOC_EXECUTABLE)
+ BUILD_ERROR ("Missing: Google Protobuf Compiler (protobuf-compiler)")
+endif()
+if (NOT PROTOBUF_PROTOC_LIBRARY)
+ BUILD_ERROR ("Missing: Google Protobuf Compiler Library (libprotoc-dev)")
+endif()
+
+########################################
+# The protobuf ruby bindings.
+find_program(RUBY_PROTOBUF protoc-gen-ruby)
+set(RUBY_INSTALL_DIR lib/ruby)
+if (NOT RUBY_PROTOBUF_FOUND)
+ BUILD_WARNING ("Missing: protobuf ruby bindings (sudo gem install protobuf)")
+endif()
+
+########################################
+# Include man pages stuff
+include (${project_cmake_dir}/Ronn2Man.cmake)
+add_manpage_target()
+
+#################################################
+# Macro to check for visibility capability in compiler
+# Original idea from: https://gitorious.org/ferric-cmake-stuff/
+macro (check_gcc_visibility)
+ include (CheckCXXCompilerFlag)
+ check_cxx_compiler_flag(-fvisibility=hidden GCC_SUPPORTS_VISIBILITY)
+endmacro()
+
+########################################
+# Find ignition math in unix platforms
+# In Windows we expect a call from configure.bat script with the paths
+if (NOT WIN32)
+ find_package(ignition-math2 QUIET)
+ if (NOT ignition-math2_FOUND)
+ message(STATUS "Looking for ignition-math2-config.cmake - not found")
+ BUILD_ERROR ("Missing: Ignition math2 library.")
+ else()
+ message(STATUS "Looking for ignition-math2-config.cmake - found")
+ endif()
+endif()
+
+#################################################
+# Find ign command line utility:
+find_package(ignition-tools)
+if (IGNITION-TOOLS_BINARY_DIRS)
+ set (HAVE_IGN TRUE)
+else()
+ BUILD_WARNING ("ignition-tools not found, for command line utilities, please install ignition-tools.")
+endif()
diff --git a/cmake/TargetArch.cmake b/cmake/TargetArch.cmake
new file mode 100644
index 0000000..323824b
--- /dev/null
+++ b/cmake/TargetArch.cmake
@@ -0,0 +1,158 @@
+# Copyright (c) 2012 Petroules Corporation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer. 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 OWNER 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.
+
+# Based on the Qt 5 processor detection code, so should be very accurate
+# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
+# Currently handles arm (v5, v6, v7), x86 (32/64), ia64, and ppc (32/64)
+
+# Regarding POWER/PowerPC, just as is noted in the Qt source,
+# "There are many more known variants/revisions that we do not handle/detect."
+
+
+
+set(archdetect_c_code "
+#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
+ #if defined(__ARM_ARCH_7__) \\
+ || defined(__ARM_ARCH_7A__) \\
+ || defined(__ARM_ARCH_7R__) \\
+ || defined(__ARM_ARCH_7M__) \\
+ || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7)
+ #error cmake_ARCH armv7
+ #elif defined(__ARM_ARCH_6__) \\
+ || defined(__ARM_ARCH_6J__) \\
+ || defined(__ARM_ARCH_6T2__) \\
+ || defined(__ARM_ARCH_6Z__) \\
+ || defined(__ARM_ARCH_6K__) \\
+ || defined(__ARM_ARCH_6ZK__) \\
+ || defined(__ARM_ARCH_6M__) \\
+ || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
+ #error cmake_ARCH armv6
+ #elif defined(__ARM_ARCH_5TEJ__) \\
+ || (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
+ #error cmake_ARCH armv5
+ #else
+ #error cmake_ARCH arm
+ #endif
+#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
+ #error cmake_ARCH i386
+#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
+ #error cmake_ARCH x86_64
+#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
+ #error cmake_ARCH ia64
+#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
+ || defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
+ || defined(_M_MPPC) || defined(_M_PPC)
+ #if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
+ #error cmake_ARCH ppc64
+ #else
+ #error cmake_ARCH ppc
+ #endif
+#endif
+
+#error cmake_ARCH unknown
+")
+
+# Set ppc_support to TRUE before including this file or ppc and ppc64
+# will be treated as invalid architectures since they are no longer supported by Apple
+
+function(target_architecture output_var)
+ if(APPLE AND CMAKE_OSX_ARCHITECTURES)
+ # On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
+ # First let's normalize the order of the values
+
+ # Note that it's not possible to compile PowerPC applications if you are using
+ # the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
+ # disable it by default
+ # See this page for more information:
+ # http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
+
+ # Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
+ # On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
+
+ foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
+ if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
+ set(osx_arch_ppc TRUE)
+ elseif("${osx_arch}" STREQUAL "i386")
+ set(osx_arch_i386 TRUE)
+ elseif("${osx_arch}" STREQUAL "x86_64")
+ set(osx_arch_x86_64 TRUE)
+ elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
+ set(osx_arch_ppc64 TRUE)
+ else()
+ message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
+ endif()
+ endforeach()
+
+ # Now add all the architectures in our normalized order
+ if(osx_arch_ppc)
+ list(APPEND ARCH ppc)
+ endif()
+
+ if(osx_arch_i386)
+ list(APPEND ARCH i386)
+ endif()
+
+ if(osx_arch_x86_64)
+ list(APPEND ARCH x86_64)
+ endif()
+
+ if(osx_arch_ppc64)
+ list(APPEND ARCH ppc64)
+ endif()
+ else()
+ file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
+
+ enable_language(C)
+
+ # Detect the architecture in a rather creative way...
+ # This compiles a small C program which is a series of ifdefs that selects a
+ # particular #error preprocessor directive whose message string contains the
+ # target architecture. The program will always fail to compile (both because
+ # file is not a valid C program, and obviously because of the presence of the
+ # #error preprocessor directives... but by exploiting the preprocessor in this
+ # way, we can detect the correct target architecture even when cross-compiling,
+ # since the program itself never needs to be run (only the compiler/preprocessor)
+ try_run(
+ run_result_unused
+ compile_result_unused
+ "${CMAKE_BINARY_DIR}"
+ "${CMAKE_BINARY_DIR}/arch.c"
+ COMPILE_OUTPUT_VARIABLE ARCH
+ CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
+ )
+
+ # Parse the architecture name from the compiler output
+ string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
+
+ # Get rid of the value marker leaving just the architecture name
+ string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
+
+ # If we are compiling with an unknown architecture this variable should
+ # already be set to "unknown" but in the case that it's empty (i.e. due
+ # to a typo in the code), then set it to unknown
+ if (NOT ARCH)
+ set(ARCH unknown)
+ endif()
+ endif()
+
+ set(${output_var} "${ARCH}" PARENT_SCOPE)
+endfunction()
diff --git a/cmake/TestUtils.cmake b/cmake/TestUtils.cmake
new file mode 100644
index 0000000..0699488
--- /dev/null
+++ b/cmake/TestUtils.cmake
@@ -0,0 +1,55 @@
+#################################################
+macro (ign_build_tests)
+ # Find the Python interpreter for running the
+ # check_test_ran.py script
+ find_package(PythonInterp QUIET)
+
+ # Build all the tests
+ foreach(GTEST_SOURCE_file ${ARGN})
+ string(REGEX REPLACE ".cc" "" BINARY_NAME ${GTEST_SOURCE_file})
+ set(BINARY_NAME ${TEST_TYPE}_${BINARY_NAME})
+ if(USE_LOW_MEMORY_TESTS)
+ add_definitions(-DUSE_LOW_MEMORY_TESTS=1)
+ endif(USE_LOW_MEMORY_TESTS)
+ add_executable(${BINARY_NAME} ${GTEST_SOURCE_file})
+
+ add_dependencies(${BINARY_NAME}
+ ${PROJECT_LIBRARY_TARGET_NAME}
+ gtest gtest_main
+ )
+
+ if (UNIX)
+ target_link_libraries(${BINARY_NAME}
+ libgtest_main.a
+ libgtest.a
+ pthread
+ ${PROJECT_LIBRARY_TARGET_NAME})
+ elseif(WIN32)
+ target_link_libraries(${BINARY_NAME}
+ gtest.lib
+ gtest_main.lib
+ ${PROJECT_LIBRARY_TARGET_NAME})
+
+ # Copy in ignition-msgs library
+ add_custom_command(TARGET ${BINARY_NAME}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${CMAKE_BINARY_DIR}/ignition/msgs/${PROJECT_NAME}.dll"
+ $<TARGET_FILE_DIR:${BINARY_NAME}> VERBATIM)
+
+ else()
+ message(FATAL_ERROR "Unsupported platform")
+ endif()
+
+ add_test(${BINARY_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${BINARY_NAME}
+ --gtest_output=xml:${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
+
+ set_tests_properties(${BINARY_NAME} PROPERTIES TIMEOUT 240)
+
+ if(PYTHONINTERP_FOUND)
+ # Check that the test produced a result and create a failure if it didn't.
+ # Guards against crashed and timed out tests.
+ add_test(check_${BINARY_NAME} ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/tools/check_test_ran.py
+ ${CMAKE_BINARY_DIR}/test_results/${BINARY_NAME}.xml)
+ endif()
+ endforeach()
+endmacro()
diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake
new file mode 100644
index 0000000..3beb0c7
--- /dev/null
+++ b/cmake/Utils.cmake
@@ -0,0 +1,181 @@
+################################################################################
+#APPEND_TO_CACHED_STRING(_string _cacheDesc [items...])
+# Appends items to a cached list.
+MACRO (APPEND_TO_CACHED_STRING _string _cacheDesc)
+ FOREACH (newItem ${ARGN})
+ SET (${_string} "${${_string}} ${newItem}" CACHE INTERNAL ${_cacheDesc} FORCE)
+ ENDFOREACH (newItem ${ARGN})
+ #STRING(STRIP ${${_string}} ${_string})
+ENDMACRO (APPEND_TO_CACHED_STRING)
+
+################################################################################
+# APPEND_TO_CACHED_LIST (_list _cacheDesc [items...]
+# Appends items to a cached list.
+MACRO (APPEND_TO_CACHED_LIST _list _cacheDesc)
+ SET (tempList ${${_list}})
+ FOREACH (newItem ${ARGN})
+ LIST (APPEND tempList ${newItem})
+ ENDFOREACH (newItem ${newItem})
+ SET (${_list} ${tempList} CACHE INTERNAL ${_cacheDesc} FORCE)
+ENDMACRO(APPEND_TO_CACHED_LIST)
+
+#################################################
+# Macro to turn a list into a string (why doesn't CMake have this built-in?)
+MACRO (LIST_TO_STRING _string _list)
+ SET (${_string})
+ FOREACH (_item ${_list})
+ SET (${_string} "${${_string}} ${_item}")
+ ENDFOREACH (_item)
+ #STRING(STRIP ${${_string}} ${_string})
+ENDMACRO (LIST_TO_STRING)
+
+#################################################
+# BUILD ERROR macro
+macro (BUILD_ERROR)
+ foreach (str ${ARGN})
+ SET (msg "\t${str}")
+ MESSAGE (STATUS ${msg})
+ APPEND_TO_CACHED_LIST(build_errors "build errors" ${msg})
+ endforeach ()
+endmacro (BUILD_ERROR)
+
+#################################################
+# BUILD WARNING macro
+macro (BUILD_WARNING)
+ foreach (str ${ARGN})
+ SET (msg "\t${str}" )
+ MESSAGE (STATUS ${msg} )
+ APPEND_TO_CACHED_LIST(build_warnings "build warning" ${msg})
+ endforeach (str ${ARGN})
+endmacro (BUILD_WARNING)
+
+#################################################
+macro (ign_add_library _name)
+ set(LIBS_DESTINATION ${PROJECT_BINARY_DIR}/src)
+ set_source_files_properties(${ARGN} PROPERTIES COMPILE_DEFINITIONS "BUILDING_DLL")
+ add_library(${_name} SHARED ${ARGN})
+ target_link_libraries (${_name} ${general_libraries})
+ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LIBS_DESTINATION})
+ if (MSVC)
+ set_target_properties( ${_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${LIBS_DESTINATION})
+ set_target_properties( ${_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${LIBS_DESTINATION})
+ set_target_properties( ${_name} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${LIBS_DESTINATION})
+ endif ( MSVC )
+endmacro ()
+
+#################################################
+macro (ign_add_static_library _name)
+ add_library(${_name} STATIC ${ARGN})
+ target_link_libraries (${_name} ${general_libraries})
+endmacro ()
+
+#################################################
+macro (ign_add_executable _name)
+ add_executable(${_name} ${ARGN})
+ target_link_libraries (${_name} ${general_libraries})
+endmacro ()
+
+
+#################################################
+macro (ign_install_includes _subdir)
+ install(FILES ${ARGN}
+ DESTINATION ${INCLUDE_INSTALL_DIR}/${_subdir} COMPONENT headers)
+endmacro()
+
+#################################################
+macro (ign_install_library _name _exportName)
+ set_target_properties(${_name} PROPERTIES SOVERSION ${PROJECT_MAJOR_VERSION} VERSION ${PROJECT_VERSION_FULL})
+ install (TARGETS ${_name} EXPORT ${_exportName} DESTINATION ${LIB_INSTALL_DIR} COMPONENT shlib)
+endmacro ()
+
+#################################################
+macro (ign_install_executable _name )
+ set_target_properties(${_name} PROPERTIES VERSION ${PROJECT_VERSION_FULL})
+ install (TARGETS ${_name} DESTINATION ${BIN_INSTALL_DIR})
+ manpage(${_name} 1)
+endmacro ()
+
+#################################################
+macro (ign_setup_unix)
+ # USE_HOST_CFLAGS (default TRUE)
+ # Will check building host machine for proper cflags
+ if(NOT DEFINED USE_HOST_CFLAGS OR USE_HOST_CFLAGS)
+ message(STATUS "Enable host CFlags")
+ include (${project_cmake_dir}/HostCFlags.cmake)
+ endif()
+
+ # USE_UPSTREAM_CFLAGS (default TRUE)
+ # Will use predefined ignition developers cflags
+ if(NOT DEFINED USE_UPSTREAM_CFLAGS OR USE_UPSTREAM_CFLAGS)
+ message(STATUS "Enable upstream CFlags")
+ include(${project_cmake_dir}/DefaultCFlags.cmake)
+ endif()
+endmacro()
+
+#################################################
+macro (ign_setup_windows)
+ # Need for M_PI constant
+ add_definitions(-D_USE_MATH_DEFINES -DWINDOWS_LEAN_AND_MEAN)
+ if(MSVC)
+ add_definitions("/EHsc")
+ endif()
+endmacro()
+
+#################################################
+macro (ign_setup_apple)
+ # NOTE MacOSX provides different system versions than CMake is parsing.
+ # The following table lists the most recent OSX versions
+ # 9.x.x = Mac OSX Leopard (10.5)
+ # 10.x.x = Mac OSX Snow Leopard (10.6)
+ # 11.x.x = Mac OSX Lion (10.7)
+ # 12.x.x = Mac OSX Mountain Lion (10.8)
+ if (${CMAKE_SYSTEM_VERSION} LESS 10)
+ add_definitions(-DMAC_OS_X_VERSION=1050)
+ elseif (${CMAKE_SYSTEM_VERSION} GREATER 10 AND ${CMAKE_SYSTEM_VERSION} LESS 11)
+ add_definitions(-DMAC_OS_X_VERSION=1060)
+ elseif (${CMAKE_SYSTEM_VERSION} GREATER 11 AND ${CMAKE_SYSTEM_VERSION} LESS 12)
+ add_definitions(-DMAC_OS_X_VERSION=1070)
+ elseif (${CMAKE_SYSTEM_VERSION} GREATER 12 OR ${CMAKE_SYSTEM_VERSION} EQUAL 12)
+ add_definitions(-DMAC_OS_X_VERSION=1080)
+ # Use libc++ on Mountain Lion (10.8)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+ else ()
+ add_definitions(-DMAC_OS_X_VERSION=0)
+ endif ()
+
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup")
+endmacro()
+
+# This should be migrated to more fine control solution based on set_property APPEND
+# directories. It's present on cmake 2.8.8 while precise version is 2.8.7
+link_directories(${PROJECT_BINARY_DIR}/test)
+include_directories("${PROJECT_SOURCE_DIR}/test/gtest/include")
+
+#################################################
+# Enable tests compilation by default
+if (NOT DEFINED ENABLE_TESTS_COMPILATION)
+ set (ENABLE_TESTS_COMPILATION True)
+endif()
+
+# Define testing macros as empty and redefine them if support is found and
+# ENABLE_TESTS_COMPILATION is set to true
+macro (ign_build_tests)
+endmacro()
+
+if (ENABLE_TESTS_COMPILATION)
+ include (${project_cmake_dir}/TestUtils.cmake)
+endif()
+
+#################################################
+# Macro to setup supported compiler warnings
+# Based on work of Florent Lamiraux, Thomas Moulard, JRL, CNRS/AIST.
+include(CheckCXXCompilerFlag)
+
+macro(filter_valid_compiler_warnings)
+ foreach(flag ${ARGN})
+ CHECK_CXX_COMPILER_FLAG(${flag} R${flag})
+ if(${R${flag}})
+ set(WARNING_CXX_FLAGS "${WARNING_CXX_FLAGS} ${flag}")
+ endif()
+ endforeach()
+endmacro()
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 0000000..efcb24a
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt"")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+ message(STATUS "Uninstalling "$ENV{DESTDIR}${file}"")
+ if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove "$ENV{DESTDIR}${file}""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing "$ENV{DESTDIR}${file}"")
+ endif(NOT "${rm_retval}" STREQUAL 0)
+ else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "File "$ENV{DESTDIR}${file}" does not exist.")
+ endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
diff --git a/cmake/config.hh.in b/cmake/config.hh.in
new file mode 100644
index 0000000..8b92b88
--- /dev/null
+++ b/cmake/config.hh.in
@@ -0,0 +1,15 @@
+/* Config.hh. Generated by CMake for @PROJECT_NAME_NO_VERSION at . */
+
+/* Version number */
+#define IGNITION_MSGS_MAJOR_VERSION ${PROJECT_MAJOR_VERSION}
+#define IGNITION_MSGS_MINOR_VERSION ${PROJECT_MINOR_VERSION}
+#define IGNITION_MSGS_PATCH_VERSION ${PROJECT_PATCH_VERSION}
+
+#define IGNITION_MSGS_VERSION "${PROJECT_VERSION}"
+#define IGNITION_MSGS_VERSION_FULL "${PROJECT_VERSION_FULL}"
+
+#define IGNITION_MSGS_VERSION_HEADER "Ignition msgs, version ${PROJECT_VERSION_FULL}\nCopyright (C) 2016 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n"
+
+#cmakedefine BUILD_TYPE_PROFILE 1
+#cmakedefine BUILD_TYPE_DEBUG 1
+#cmakedefine BUILD_TYPE_RELEASE 1
diff --git a/cmake/cpack.cmake b/cmake/cpack.cmake
new file mode 100644
index 0000000..db7df17
--- /dev/null
+++ b/cmake/cpack.cmake
@@ -0,0 +1,25 @@
+################################################################################
+#Find available package generators
+
+# DEB
+if ("${CMAKE_SYSTEM}" MATCHES "Linux")
+ find_program(DPKG_PROGRAM dpkg)
+ if (EXISTS ${DPKG_PROGRAM})
+ list (APPEND CPACK_GENERATOR "DEB")
+ endif(EXISTS ${DPKG_PROGRAM})
+
+ find_program(RPMBUILD_PROGRAM rpmbuild)
+endif()
+
+list (APPEND CPACK_SOURCE_GENERATOR "TBZ2")
+list (APPEND CPACK_SOURCE_GENERATOR "ZIP")
+list (APPEND CPACK_SOURCE_IGNORE_FILES "TODO;/.hg/;.swp$;/build/;.hgtags")
+
+include (InstallRequiredSystemLibraries)
+
+#execute_process(COMMAND dpkg --print-architecture _NPROCE)
+set (DEBIAN_PACKAGE_DEPENDS "")
+
+set (RPM_PACKAGE_DEPENDS "")
+
+set (PROJECT_CPACK_CFG_FILE "${PROJECT_BINARY_DIR}/cpack_options.cmake")
diff --git a/cmake/cpack_options.cmake.in b/cmake/cpack_options.cmake.in
new file mode 100644
index 0000000..7287a47
--- /dev/null
+++ b/cmake/cpack_options.cmake.in
@@ -0,0 +1,28 @@
+set(CPACK_PACKAGE_NAME "@PROJECT_NAME_NO_VERSION@")
+set(CPACK_PACKAGE_VENDOR "osrfoundation.org")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
+ "A set of @IGN_PROJECT_NAME@ classes for robot applications.")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "@PROJECT_NAME_NO_VERSION_LOWER@")
+set(CPACK_RESOURCE_FILE_LICENSE "@CMAKE_CURRENT_SOURCE_DIR@/LICENSE")
+set(CPACK_RESOURCE_FILE_README "@CMAKE_CURRENT_SOURCE_DIR@/README.md")
+set(CPACK_PACKAGE_DESCRIPTION_FILE "@CMAKE_CURRENT_SOURCE_DIR@/README.md")
+set(CPACK_PACKAGE_MAINTAINER "Nate Koenig <nate at osrfoundation.org>")
+set(CPACK_PACKAGE_CONTACT "Nate Koenig <natekoenig at osrfoundation.org>")
+
+set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "@DPKG_ARCH@")
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "@DEBIAN_PACKAGE_DEPENDS@")
+set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
+set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
+set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
+set(CPACK_DEBIAN_PACKAGE_DESCRIPTION
+ "A set of @IGN_PROJECT_NAME@ classes for robot applications.")
+
+set(CPACK_RPM_PACKAGE_ARCHITECTURE "@DPKG_ARCH@")
+set(CPACK_RPM_PACKAGE_REQUIRES "@DEBIAN_PACKAGE_DEPENDS@")
+set(CPACK_RPM_PACKAGE_DESCRIPTION
+ "A set of @IGN_PROJECT_NAME@ classes for robot applications.")
+
+set (CPACK_PACKAGE_FILE_NAME
+ "@PROJECT_NAME_NO_VERSION_LOWER at -@PROJECT_VERSION_FULL@")
+set (CPACK_SOURCE_PACKAGE_FILE_NAME
+ "@PROJECT_NAME_NO_VERSION_LOWER at -@PROJECT_VERSION_FULL@")
diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in
new file mode 100644
index 0000000..820fe96
--- /dev/null
+++ b/cmake/ignition-config.cmake.in
@@ -0,0 +1,48 @@
+# - Config file for the @PKG_NAME@ package.
+#
+# For finding and loading @PKG_NAME@ from your project, type:
+#
+# find_package(@PROJECT_NAME_LOWER@)
+#
+# It defines the following variables:
+#
+# @PROJECT_NAME_LOWER at _FOUND - System has @PKG_NAME at .
+# @PKG_NAME at _INCLUDE_DIRS - include directories for @PKG_NAME@ and its dependencies.
+# @PKG_NAME at _LIBRARY_DIRS - Paths in which the linker should search for libraries.
+# @PKG_NAME at _LIBRARIES - Libraries to link against.
+# @PKG_NAME at _CXX_FLAGS - Compiler flags for compiling C++ sources.
+# @PKG_NAME at _LDFLAGS - Linker flags.
+
+if (@PKG_NAME at _CONFIG_INCLUDED)
+ return()
+endif()
+set(@PKG_NAME at _CONFIG_INCLUDED TRUE)
+
+ at PACKAGE_INIT@
+
+if(NOT TARGET @PROJECT_LIBRARY_TARGET_NAME@)
+ include("${CMAKE_CURRENT_LIST_DIR}/@cmake_targets_file@")
+endif()
+
+list(APPEND @PKG_NAME at _CXX_FLAGS -std=c++11)
+if ("${CMAKE_CXX_COMPILER_ID} " MATCHES "Clang ")
+ set(@PKG_NAME at _CXX_FLAGS "${@PKG_NAME at _CXX_FLAGS} -stdlib=libc++")
+endif ()
+
+# On windows we produce .dll libraries with no prefix
+if (WIN32)
+ set(CMAKE_FIND_LIBRARY_PREFIXES "")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".dll")
+endif()
+
+# Compatibility
+set(@PKG_NAME at _LIBRARIES @PROJECT_LIBRARY_TARGET_NAME@)
+set(@PKG_NAME at _INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIR_FULL@")
+set(@PKG_NAME at _LIBRARY_DIRS "@PACKAGE_LIB_INSTALL_DIR@")
+set(@PKG_NAME at _LDFLAGS "-L at PACKAGE_LIB_INSTALL_DIR@")
+
+find_package(ignition-math2 REQUIRED)
+check_required_components(ignition-math2)
+list(APPEND @PKG_NAME at _INCLUDE_DIRS ${IGNITION-MATH_INCLUDE_DIRS})
+list(APPEND @PKG_NAME at _LIBRARY_DIRS ${IGNITION-MATH_LIBRARY_DIRS})
+list(APPEND @PKG_NAME at _LIBRARIES ${IGNITION-MATH_LIBRARIES})
diff --git a/cmake/pkgconfig/ignition-msgs.in b/cmake/pkgconfig/ignition-msgs.in
new file mode 100644
index 0000000..6d22e92
--- /dev/null
+++ b/cmake/pkgconfig/ignition-msgs.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
+includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/ignition/@IGN_PROJECT_NAME@@PROJECT_MAJOR_VERSION@
+
+Name: Ignition Msgs
+Description: A set of msgs classes for robot applications
+Version: @PROJECT_VERSION_FULL@
+Requires:
+Libs: "-L${libdir}" -lignition-math at PROJECT_MAJOR_VERSION@
+CFlags: "-I${includedir}" -std=c++11
diff --git a/cmake/upload_doc.sh.in b/cmake/upload_doc.sh.in
new file mode 100644
index 0000000..2afc291
--- /dev/null
+++ b/cmake/upload_doc.sh.in
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+# Check if the node was configured to use s3cmd
+# This is done by running s3cmd --configure
+if [ ! -f "${HOME}/.s3cfg" ]; then
+ echo "No $HOME/.s3cfg file found. Please config the software first in your system"
+ exit 1
+fi
+
+# Make documentation if not build
+if [ ! -f "@CMAKE_BINARY_DIR@/doxygen/html/index.html" ]; then
+ make doc
+ if [ ! -f "@CMAKE_BINARY_DIR@/doxygen/html/index.html" ]; then
+ echo "Documentation not present. Install doxygen, and run `make doc` in the build directory"
+ exit 1
+ fi
+fi
+
+# Dry run
+s3cmd sync @CMAKE_BINARY_DIR@/doxygen/html/* s3://osrf-distributions/ign- at IGN_PROJECT_NAME@/api/@PROJECT_VERSION_FULL@/ --dry-run -v
+
+echo -n "Upload (Y/n)? "
+read ans
+
+if [ "$ans" = "n" ] || [ "$ans" = "N" ]; then
+ exit 1
+else
+ s3cmd sync @CMAKE_BINARY_DIR@/doxygen/html/* s3://osrf-distributions/ign- at IGN_PROJECT_NAME@/api/@PROJECT_VERSION_FULL@/ -v
+fi
diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt
new file mode 100644
index 0000000..7771d2a
--- /dev/null
+++ b/conf/CMakeLists.txt
@@ -0,0 +1,23 @@
+include (${project_cmake_dir}/Utils.cmake)
+
+set(ign_library_path "${CMAKE_BINARY_DIR}/src/cmd/cmdmsgs${PROJECT_MAJOR_VERSION}")
+
+# Generate a configuration file for internal testing.
+# Note that the major version of the library is included in the name.
+# Ex: transport0.yaml
+configure_file(
+ "msgs.yaml.in"
+ "${CMAKE_BINARY_DIR}/test/conf/msgs${PROJECT_MAJOR_VERSION}.yaml" @ONLY)
+
+set(ign_library_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmdmsgs${PROJECT_MAJOR_VERSION}")
+
+# Generate a configuration file.
+# Note that the major version of the library is included in the name.
+# Ex: transport0.yaml
+configure_file(
+ "msgs.yaml.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/msgs${PROJECT_MAJOR_VERSION}.yaml" @ONLY)
+
+# Install the yaml configuration files in an unversioned location.
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/msgs${PROJECT_MAJOR_VERSION}.yaml
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/)
diff --git a/conf/msgs.yaml.in b/conf/msgs.yaml.in
new file mode 100644
index 0000000..37d877d
--- /dev/null
+++ b/conf/msgs.yaml.in
@@ -0,0 +1,8 @@
+--- # Subcommands available inside ignition-transport.
+format: 1.0.0
+library_name: @PROJECT_NAME_NO_VERSION_LOWER@
+library_version: @PROJECT_VERSION_FULL@
+library_path: @ign_library_path@
+commands:
+ - msg : Print information about messages.
+---
diff --git a/configure.bat b/configure.bat
new file mode 100644
index 0000000..7b5fe29
--- /dev/null
+++ b/configure.bat
@@ -0,0 +1,16 @@
+ at set build_type=Release
+ at if not "%1"=="" set build_type=%1
+ at echo Configuring for build type %build_type%
+
+ at set PROTOBUF_PATH=%cd%\..\..\protobuf-2.6.0-win64-vc12
+ at set IGN_MATH_PATH=%cd%\..\..\ign-math\build\install\%build_type%
+
+cmake -G "NMake Makefiles"^
+ -DCMAKE_PREFIX_PATH="%IGN_MATH_PATH%"^
+ -DCMAKE_INSTALL_PREFIX="install\%build_type%"^
+ -DCMAKE_BUILD_TYPE="%build_type%"^
+ -DPROTOBUF_SRC_ROOT_FOLDER="%PROTOBUF_PATH%"^
+ -DIGNITION-MATH_INCLUDE_DIRS:STRING="%IGN_MATH_PATH%\include\ignition\math2"^
+ -DIGNITION-MATH_LIBRARY_DIRS:STRING="%IGN_MATH_PATH%\lib"^
+ -DIGNITION-MATH_LIBRARIES="ignition-math2"^
+ -DENABLE_TESTS_COMPILATION:BOOL=True ..
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt
new file mode 100644
index 0000000..36e4496
--- /dev/null
+++ b/doc/CMakeLists.txt
@@ -0,0 +1,14 @@
+find_package(Doxygen)
+
+if (DOXYGEN_FOUND)
+ configure_file(${CMAKE_SOURCE_DIR}/doc/ignition.in
+ ${CMAKE_BINARY_DIR}/ignition.dox @ONLY)
+
+ add_custom_target(doc
+ # Generate the API documentation
+ ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/ignition.dox
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMAND cp ${CMAKE_SOURCE_DIR}/doc/ignition_logo.svg
+ ${CMAKE_BINARY_DIR}/doxygen/html
+ COMMENT "Generating API documentation with Doxygen" VERBATIM)
+endif()
diff --git a/doc/doxygen.css b/doc/doxygen.css
new file mode 100644
index 0000000..5588342
--- /dev/null
+++ b/doc/doxygen.css
@@ -0,0 +1,775 @@
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 12px;
+}
+
+/* @group Heading Levels */
+
+h1 {
+ font-size: 150%;
+}
+
+h2 {
+ font-size: 120%;
+}
+
+h3 {
+ font-size: 100%;
+}
+
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
+}
+
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+ font-weight: bold;
+}
+
+span.legend {
+ font-size: 70%;
+ text-align: center;
+}
+
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+}
+
+div.qindex
+{
+ width: 100%;
+ line-height: 140%;
+}
+
+div.navpath
+{
+ margin-left: 20em;
+ line-height: 140%;
+}
+
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.contents a:visited {
+ color: #4665A2;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
+ color: #ffffff;
+ border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code {
+ color: #4665A2;
+}
+
+a.codeRef {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
+
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+}
+
+div.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ margin-bottom: 6px;
+ font-weight: bold;
+}
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
+
+body {
+ background: white;
+ color: black;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 20em;
+ margin-right: 10px;
+}
+
+td.indexkey {
+ background-color: #EBEFF6;
+ font-weight: bold;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
+}
+
+td.indexvalue {
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
+}
+
+tr.memlist {
+ background-color: #EEF1F7;
+}
+
+p.formulaDsp {
+ text-align: center;
+}
+
+img.formulaDsp {
+
+}
+
+img.formulaInl {
+ vertical-align: middle;
+}
+
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+
+div.center img {
+ border: 0px;
+}
+
+address.footer {
+ text-align: right;
+ padding-right: 12px;
+}
+
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+ background: #EBEFF6;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memItemLeft, .memItemRight, .memTemplParams {
+ border-top: 1px solid #C4CFE5;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memTemplParams {
+ color: #4665A2;
+ white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtemplate {
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 3px;
+}
+
+.memnav {
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+
+.memitem {
+ padding: 0;
+ margin-bottom: 10px;
+}
+
+.memname {
+ white-space: nowrap;
+ font-weight: bold;
+ margin-left: 6px;
+}
+
+.memproto {
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 8px;
+ -moz-border-radius-topleft: 8px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 8px;
+ -webkit-border-top-left-radius: 8px;
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
+
+}
+
+.memdoc {
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 2px 5px;
+ background-color: #FBFCFD;
+ border-top-width: 0;
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 8px;
+ -moz-border-radius-bottomright: 8px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 8px;
+ -webkit-border-bottom-right-radius: 8px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
+}
+
+.paramkey {
+ text-align: right;
+}
+
+.paramtype {
+ white-space: nowrap;
+}
+
+.paramname {
+ color: #602020;
+ white-space: nowrap;
+}
+.paramname em {
+ font-style: normal;
+}
+
+/* @end */
+
+/* @group Directory (tree) */
+
+/* for the tree view */
+
+.ftvtree {
+ font-family: sans-serif;
+ margin: 0px;
+}
+
+/* these are for tree view when used as main index */
+
+.directory {
+ font-size: 9pt;
+ font-weight: bold;
+ margin: 5px;
+}
+
+.directory h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+/*
+The following two styles can be used to replace the root node title
+with an image of your choice. Simply uncomment the next two styles,
+specify the name of your image and be sure to set 'height' to the
+proper pixel height of your image.
+*/
+
+/*
+.directory h3.swap {
+ height: 61px;
+ background-repeat: no-repeat;
+ background-image: url("yourimage.gif");
+}
+.directory h3.swap span {
+ display: none;
+}
+*/
+
+.directory > h3 {
+ margin-top: 0;
+}
+
+.directory p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory div {
+ display: none;
+ margin: 0px;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+/* these are for tree view when not used as main index */
+
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
+}
+
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+.directory-alt > h3 {
+ margin-top: 0;
+}
+
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+.directory-alt img {
+ vertical-align: -30%;
+}
+
+/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+}
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right: 15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath a:hover
+{
+ color:#6884BD;
+}
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ margin-left: 20em;
+ border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+#content {
+ /*position: absolute; */
+ left:12em;
+ top:0em;
+ padding-left:3em;
+ padding-right:3em;
+ padding-bottom:2em;
+ margin-top:1em;
+ margin-right:2em;
+}
+
+.floatright
+{
+ float: right;
+ margin: 0 0 1em 1em;
+}
+
+.timestamp {
+ text-align:right;
+ background-color: #DDD;
+ font-size:75%;
+}
+
+
+#MSearchBox
+{
+ border: 1px solid black;
+ position: static;
+ margin: 10px;
+ display: block;
+ height: 20px;
+}
+
+#MSearchField
+{
+ background:none;
+}
+
+/*iframe#MSearchResults
+{
+ height: 500px;
+ text-wrap: unrestricted;
+ border: none;
+}
+*/
+/*
+#MSearchResultsWindow
+{
+ display: block;
+ position: fixed;
+}*/
+
+div.leftbar
+{
+ text-align:left;
+ float: left;
+ border-right: 1px solid #dddddd;
+ width: 18em;
+ margin: 5 5 5 5;
+ padding: 4 4 4 4;
+ background-color: #ffffff;
+ position: fixed;
+ height: 100%;
+}
+
+div.menu {
+ #display:block;
+ background:#ffffff;
+ font-size: 90%;
+ /*border-top: 2px solid #000000;
+ border-bottom: 2px solid #000000;
+*/
+ margin: 0 0 10px 0;
+}
+
+div.menu dl {
+ margin-top: 0px;
+ margin-bottom: 5px;
+}
+
+div.menu dt {
+ font-weight:bold;
+ padding:0 4px 4px 4px;
+ font-size: 110%;
+ text-align: left;
+ text-decoration:none;
+}
+
+div.menu dd {
+ font-weight: bold;
+ margin-left: 0px;
+ padding-left: 20px;
+ padding-bottom: 2px;
+ font-size: 100%;
+}
+
+
+div.leftbar img {
+ border:0;
+}
+
+div.submenu dd {
+ font-size: 70%;
+ margin-left: 8px;
+ padding-left: 10px;
+ padding-bottom: 3px;
+}
+
+div.submenu dd .secondline {
+ margin-left: 12px;
+}
diff --git a/doc/footer.html b/doc/footer.html
new file mode 100644
index 0000000..71d71c4
--- /dev/null
+++ b/doc/footer.html
@@ -0,0 +1 @@
+<!--</td></tr></table>-->
diff --git a/doc/header.html b/doc/header.html
new file mode 100644
index 0000000..dffae4a
--- /dev/null
+++ b/doc/header.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=9"/>
+ <meta name="keywords" content="Ingition: Math">
+ <title>Ignition: $title</title>
+ <link href="tabs.css" rel="stylesheet" type="text/css">
+ <script type="text/javascript" src="jquery.js"></script>
+ <script type="text/javascript" src="dynsections.js"></script>
+ <link href="search/search.css" rel="stylesheet" type="text/css">
+ <script type="text/javascript" src="search/search.js"></script>
+ <script type="text/javascript">
+ $(document).ready(function() { searchBox.OnSelectItem(0); });
+ </script>
+
+ <link href="doxygen.css" rel="stylesheet" type="text/css">
+ <!--<link href="tabs.css" rel="stylesheet" type="text/css">-->
+ <link href="style.css" rel="stylesheet" type="text/css">
+ </head>
+
+<body>
+ <div class="leftbar">
+ <h2 style="text-align:center;">
+ <a href="index.html"><img src="ignition_logo.svg" width="180px"/></a>
+ </h2>
+
+ <div class="menu">
+ <dl>
+ <dt>API</dt>
+ <dd><a href="classes.html">Class List</a></dd>
+ <dd><a href="globals.html">Globals List</a></dd>
+ <dd><a href="files.html">Files</a></dd>
+ </dl>
+ </div>
+ <div class="menu">
+ <dl>
+ <dt>Links</dt>
+ <dd><a href="http://ignitionrobotics.org">Ignition Website</a></dd>
+ <dd><a href="https://bitbucket.org/ignitionrobotics/ign-msgs/issues/new">Report Documentation Issues</a></dd>
+ </dl>
+ </div>
+
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span>
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span>
+ </div> <!-- End MSearchBox -->
+
+ <div id="MSearchResultsWindow" style="position: static; display: block; border: none; background-color: #ffffff; width: 18em;">
+ <iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults"
+ style="height: 500px; width: 18em; display: block; text-wrap: unrestricted">
+ </iframe>
+ </div>
+ </div>
+
+ <div id="top">
diff --git a/doc/ignition.in b/doc/ignition.in
new file mode 100644
index 0000000..2c7acdf
--- /dev/null
+++ b/doc/ignition.in
@@ -0,0 +1,2305 @@
+# Doxyfile 1.8.6
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a double hash (##) is considered a comment and is placed in
+# front of the TAG it is preceding.
+#
+# All text after a single hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists, items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (\" \").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all text
+# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
+# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
+# for the list of possible encodings.
+# The default value is: UTF-8.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
+# double-quotes, unless you are using Doxywizard) that should identify the
+# project for which the documentation is generated. This name is used in the
+# title of most generated pages and in a few other places.
+# The default value is: My Project.
+
+PROJECT_NAME = IgnitionMsgs
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
+# could be handy for archiving the generated documentation or if some version
+# control system is used.
+
+PROJECT_NUMBER = @PROJECT_VERSION_FULL@
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer a
+# quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF =
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
+# the documentation. The maximum height of the logo should not exceed 55 pixels
+# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
+# to the output directory.
+
+PROJECT_LOGO =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
+# into which the generated documentation will be written. If a relative path is
+# entered, it will be relative to the location where doxygen was started. If
+# left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = doxygen
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
+# directories (in 2 levels) under the output directory of each output format and
+# will distribute the generated files over these directories. Enabling this
+# option can be useful when feeding doxygen a huge amount of source files, where
+# putting all generated files in the same directory would otherwise causes
+# performance problems for the file system.
+# The default value is: NO.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
+# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
+# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
+# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
+# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
+# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
+# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
+# Ukrainian and Vietnamese.
+# The default value is: English.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
+# descriptions after the members that are listed in the file and class
+# documentation (similar to Javadoc). Set to NO to disable this.
+# The default value is: YES.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
+# description of a member or function before the detailed description
+#
+# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+# The default value is: YES.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator that is
+# used to form the text in various listings. Each string in this list, if found
+# as the leading text of the brief description, will be stripped from the text
+# and the result, after processing the whole list, is used as the annotated
+# text. Otherwise, the brief description is used as-is. If left blank, the
+# following values are used ($name is automatically replaced with the name of
+# the entity):The $name class, The $name widget, The $name file, is, provides,
+# specifies, contains, represents, a, an and the.
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# doxygen will generate a detailed section even if there is only a brief
+# description.
+# The default value is: NO.
+
+ALWAYS_DETAILED_SEC = YES
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+# The default value is: NO.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
+# before files name in the file list and in the header files. If set to NO the
+# shortest path that makes the file name unique will be used
+# The default value is: YES.
+
+FULL_PATH_NAMES = NO
+
+# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
+# Stripping is only done if one of the specified strings matches the left-hand
+# part of the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the path to
+# strip.
+#
+# Note that you can specify absolute paths here, but also relative paths, which
+# will be relative from the directory where doxygen is started.
+# This tag requires that the tag FULL_PATH_NAMES is set to YES.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
+# path mentioned in the documentation of a class, which tells the reader which
+# header file to include in order to use a class. If left blank only the name of
+# the header file containing the class definition is used. Otherwise one should
+# specify the list of include paths that are normally passed to the compiler
+# using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
+# less readable) file names. This can be useful is your file systems doesn't
+# support long names like on DOS, Mac, or CD-ROM.
+# The default value is: NO.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
+# first line (until the first dot) of a Javadoc-style comment as the brief
+# description. If set to NO, the Javadoc-style will behave just like regular Qt-
+# style comments (thus requiring an explicit @brief command for a brief
+# description.)
+# The default value is: NO.
+
+JAVADOC_AUTOBRIEF = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
+# line (until the first dot) of a Qt-style comment as the brief description. If
+# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
+# requiring an explicit \brief command for a brief description.)
+# The default value is: NO.
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
+# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+# a brief description. This used to be the default behavior. The new default is
+# to treat a multi-line C++ comment block as a detailed description. Set this
+# tag to YES if you prefer the old behavior instead.
+#
+# Note that setting this tag to YES also means that rational rose comments are
+# not recognized any more.
+# The default value is: NO.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
+# documentation from any documented member that it re-implements.
+# The default value is: YES.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
+# new page for each member. If set to NO, the documentation of a member will be
+# part of the file/class/namespace that contains it.
+# The default value is: NO.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
+# uses this value to replace tabs by spaces in code fragments.
+# Minimum value: 1, maximum value: 16, default value: 4.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that act as commands in
+# the documentation. An alias has the form:
+# name=value
+# For example adding
+# "sideeffect=@par Side Effects:\n"
+# will allow you to put the command \sideeffect (or @sideeffect) in the
+# documentation, which will result in a user-defined paragraph with heading
+# "Side Effects:". You can put \n's in the value part of an alias to insert
+# newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding "class=itcl::class"
+# will allow you to use the command class in the itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
+# only. Doxygen will then generate output that is more tailored for C. For
+# instance, some of the names that are used will be different. The list of all
+# members will be omitted, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
+# Python sources only. Doxygen will then generate output that is more tailored
+# for that language. For instance, namespaces will be presented as packages,
+# qualified scopes will look different, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources. Doxygen will then generate output that is tailored for Fortran.
+# The default value is: NO.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for VHDL.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given
+# extension. Doxygen has a built-in mapping, but you can override or extend it
+# using this tag. The format is ext=language, where ext is a file extension, and
+# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
+# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C.
+#
+# Note For files without extension you can use no_extension as a placeholder.
+#
+# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
+# the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
+# according to the Markdown format, which allows for more readable
+# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# The output of markdown processing is further processed by doxygen, so you can
+# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
+# case of backward compatibilities issues.
+# The default value is: YES.
+
+MARKDOWN_SUPPORT = YES
+
+# When enabled doxygen tries to link words that correspond to documented
+# classes, or namespaces to their corresponding documentation. Such a link can
+# be prevented in individual cases by by putting a % sign in front of the word
+# or globally by setting AUTOLINK_SUPPORT to NO.
+# The default value is: YES.
+
+AUTOLINK_SUPPORT = YES
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should set this
+# tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string);
+# versus func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+# The default value is: NO.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+# The default value is: NO.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
+# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# will parse them like normal C++ but will assume all classes use public instead
+# of private inheritance when no explicit protection keyword is present.
+# The default value is: NO.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate
+# getter and setter methods for a property. Setting this option to YES will make
+# doxygen to replace the get and set methods by a property in the documentation.
+# This will only work if the methods are indeed getting or setting a simple
+# type. If this is not the case, or you want to show the methods anyway, you
+# should set this option to NO.
+# The default value is: YES.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+# The default value is: NO.
+
+DISTRIBUTE_GROUP_DOC = YES
+
+# Set the SUBGROUPING tag to YES to allow class member groups of the same type
+# (for instance a group of public functions) to be put as a subgroup of that
+# type (e.g. under the Public Functions section). Set it to NO to prevent
+# subgrouping. Alternatively, this can be done per class using the
+# \nosubgrouping command.
+# The default value is: YES.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
+# are shown inside the group in which they are included (e.g. using \ingroup)
+# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
+# and RTF).
+#
+# Note that this feature does not work in combination with
+# SEPARATE_MEMBER_PAGES.
+# The default value is: NO.
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
+# with only public data fields or simple typedef fields will be shown inline in
+# the documentation of the scope in which they are defined (i.e. file,
+# namespace, or group documentation), provided this scope is documented. If set
+# to NO, structs, classes, and unions are shown on a separate page (for HTML and
+# Man pages) or section (for LaTeX and RTF).
+# The default value is: NO.
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
+# enum is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically be
+# useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+# The default value is: NO.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
+# cache is used to resolve symbols given their name and scope. Since this can be
+# an expensive process and often the same symbol appears multiple times in the
+# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
+# doxygen will become slower. If the cache is too large, memory is wasted. The
+# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
+# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
+# symbols. At the end of a run doxygen will report the cache usage and suggest
+# the optimal cache size from a speed point of view.
+# Minimum value: 0, maximum value: 9, default value: 0.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available. Private
+# class members and static file members will be hidden unless the
+# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
+# Note: This will also disable the warnings about undocumented members that are
+# normally produced when WARNINGS is set to YES.
+# The default value is: NO.
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
+# be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
+# scope will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PACKAGE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
+# included in the documentation.
+# The default value is: NO.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
+# locally in source files will be included in the documentation. If set to NO
+# only classes defined in header files are included. Does not have any effect
+# for Java sources.
+# The default value is: YES.
+
+EXTRACT_LOCAL_CLASSES = NO
+
+# This flag is only useful for Objective-C code. When set to YES local methods,
+# which are defined in the implementation section but not in the interface are
+# included in the documentation. If set to NO only methods in the interface are
+# included.
+# The default value is: NO.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base name of
+# the file that contains the anonymous namespace. By default anonymous namespace
+# are hidden.
+# The default value is: NO.
+
+EXTRACT_ANON_NSPACES = YES
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
+# undocumented members inside documented classes or files. If set to NO these
+# members will be included in the various overviews, but no documentation
+# section is generated. This option has no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy. If set
+# to NO these classes will be included in the various overviews. This option has
+# no effect if EXTRACT_ALL is enabled.
+# The default value is: NO.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
+# (class|struct|union) declarations. If set to NO these declarations will be
+# included in the documentation.
+# The default value is: NO.
+
+HIDE_FRIEND_COMPOUNDS = YES
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
+# documentation blocks found inside the body of a function. If set to NO these
+# blocks will be appended to the function's detailed documentation block.
+# The default value is: NO.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation that is typed after a
+# \internal command is included. If the tag is set to NO then the documentation
+# will be excluded. Set it to YES to include the internal documentation.
+# The default value is: NO.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
+# names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+# The default value is: system dependent.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
+# their full class and namespace scopes in the documentation. If set to YES the
+# scope will be hidden.
+# The default value is: NO.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
+# the files that are included by a file in the documentation of that file.
+# The default value is: YES.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
+# grouped member an include statement to the documentation, telling the reader
+# which file to include in order to use the member.
+# The default value is: NO.
+
+SHOW_GROUPED_MEMB_INC = NO
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
+# files with double quotes in the documentation rather than with sharp brackets.
+# The default value is: NO.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
+# documentation for inline members.
+# The default value is: YES.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
+# (detailed) documentation of file and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order.
+# The default value is: YES.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
+# descriptions of file, namespace and class members alphabetically by member
+# name. If set to NO the members will appear in declaration order. Note that
+# this will also influence the order of the classes in the class list.
+# The default value is: NO.
+
+SORT_BRIEF_DOCS = YES
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
+# (brief and detailed) documentation of class members so that constructors and
+# destructors are listed first. If set to NO the constructors will appear in the
+# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
+# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
+# member documentation.
+# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
+# detailed member documentation.
+# The default value is: NO.
+
+SORT_MEMBERS_CTORS_1ST = YES
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
+# of group names into alphabetical order. If set to NO the group names will
+# appear in their defined order.
+# The default value is: NO.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
+# fully-qualified names, including namespaces. If set to NO, the class list will
+# be sorted only by class name, not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the alphabetical
+# list.
+# The default value is: NO.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
+# type resolution of all parameters of a function it will reject a match between
+# the prototype and the implementation of a member function even if there is
+# only one candidate or it is obvious which candidate to choose by doing a
+# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
+# accept a match between prototype and implementation in such cases.
+# The default value is: NO.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
+# todo list. This list is created by putting \todo commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
+# test list. This list is created by putting \test commands in the
+# documentation.
+# The default value is: YES.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
+# list. This list is created by putting \bug commands in the documentation.
+# The default value is: YES.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
+# the deprecated list. This list is created by putting \deprecated commands in
+# the documentation.
+# The default value is: YES.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional documentation
+# sections, marked by \if <section_label> ... \endif and \cond <section_label>
+# ... \endcond blocks.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
+# initial value of a variable or macro / define can have for it to appear in the
+# documentation. If the initializer consists of more lines than specified here
+# it will be hidden. Use a value of 0 to hide initializers completely. The
+# appearance of the value of individual variables and macros / defines can be
+# controlled using \showinitializer or \hideinitializer command in the
+# documentation regardless of this setting.
+# Minimum value: 0, maximum value: 10000, default value: 30.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
+# the bottom of the documentation of classes and structs. If set to YES the list
+# will mention the files that were used to generate the documentation.
+# The default value is: YES.
+
+SHOW_USED_FILES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
+# will remove the Files entry from the Quick Index and from the Folder Tree View
+# (if specified).
+# The default value is: YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
+# page. This will remove the Namespaces entry from the Quick Index and from the
+# Folder Tree View (if specified).
+# The default value is: YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command command input-file, where command is the value of the
+# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
+# by doxygen. Whatever the program writes to standard output is used as the file
+# version. For an example see the documentation.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. To create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option. You can
+# optionally specify a file name after the option, if omitted DoxygenLayout.xml
+# will be used as the name of the layout file.
+#
+# Note that if you run doxygen from a directory containing a file called
+# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
+# tag is left empty.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
+# the reference definitions. This must be a list of .bib files. The .bib
+# extension is automatically appended if omitted. This requires the bibtex tool
+# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# For LaTeX the style of the bibliography can be controlled using
+# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
+# search path. Do not use file names with spaces, bibtex cannot handle them. See
+# also \cite for info how to create references.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# Configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated to
+# standard output by doxygen. If QUIET is set to YES this implies that the
+# messages are off.
+# The default value is: NO.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
+# this implies that the warnings are on.
+#
+# Tip: Turn warnings on while writing the documentation.
+# The default value is: YES.
+
+WARNINGS = YES
+
+# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
+# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
+# will automatically be disabled.
+# The default value is: YES.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some parameters
+# in a documented function, or documenting parameters that don't exist or using
+# markup commands wrongly.
+# The default value is: YES.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
+# are documented, but have no documentation for their parameters or return
+# value. If set to NO doxygen will only warn about wrong or incomplete parameter
+# documentation, but not about the absence of documentation.
+# The default value is: NO.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that doxygen
+# can produce. The string should contain the $file, $line, and $text tags, which
+# will be replaced by the file and line number from which the warning originated
+# and the warning text. Optionally the format may contain $version, which will
+# be replaced by the version of the file (if it could be obtained via
+# FILE_VERSION_FILTER)
+# The default value is: $file:$line: $text.
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning and error
+# messages should be written. If left blank the output is written to standard
+# error (stderr).
+
+WARN_LOGFILE = /tmp/ignition-math_dox.warn
+
+#---------------------------------------------------------------------------
+# Configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain
+# documented source files. You may enter file names like myfile.cpp or
+# directories like /usr/src/myproject. Separate the files or directories with
+# spaces.
+# Note: If this tag is empty the current directory is searched.
+
+INPUT = @CMAKE_SOURCE_DIR@/doc/mainpage.html \
+ @CMAKE_SOURCE_DIR@/ignition/msgs
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
+# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
+# documentation (see: http://www.gnu.org/software/libiconv) for the list of
+# possible encodings.
+# The default value is: UTF-8.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank the
+# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
+# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
+# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
+# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
+# *.qsf, *.as and *.js.
+
+FILE_PATTERNS = *.proto
+
+# The RECURSIVE tag can be used to specify whether or not subdirectories should
+# be searched for input files as well.
+# The default value is: NO.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+#
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+# The default value is: NO.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories.
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+#
+# Note that the wildcards are matched against the file with absolute path, so to
+# exclude all test directories use the pattern */test/*
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or directories
+# that contain example code fragments that are included (see the \include
+# command).
+
+EXAMPLE_PATH = examples
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
+# *.h) to filter out the source-files in the directories. If left blank all
+# files are included.
+
+EXAMPLE_PATTERNS = *.cc \
+ *.hh
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude commands
+# irrespective of the value of the RECURSIVE tag.
+# The default value is: NO.
+
+EXAMPLE_RECURSIVE = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or directories
+# that contain images that are to be included in the documentation (see the
+# \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command:
+#
+# <filter> <input-file>
+#
+# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
+# name of an input file. Doxygen will then use the output that the filter
+# program writes to standard output. If FILTER_PATTERNS is specified, this tag
+# will be ignored.
+#
+# Note that the filter must not add or remove lines; it is applied before the
+# code is scanned, but not when the output code is generated. If lines are added
+# or removed, the anchors will not be placed correctly.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form: pattern=filter
+# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
+# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
+# patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER ) will also be used to filter the input files that are used for
+# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
+# The default value is: NO.
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
+# it is also possible to disable source filtering for a specific pattern using
+# *.ext= (so without naming a filter).
+# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
+
+FILTER_SOURCE_PATTERNS =
+
+# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
+# is part of the input, its contents will be placed on the main page
+# (index.html). This can be useful if you have a project on for instance GitHub
+# and want to reuse the introduction page also for the doxygen output.
+
+USE_MDFILE_AS_MAINPAGE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
+# generated. Documented entities will be cross-referenced with these sources.
+#
+# Note: To get rid of all source code in the generated output, make sure that
+# also VERBATIM_HEADERS is set to NO.
+# The default value is: NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body of functions,
+# classes and enums directly into the documentation.
+# The default value is: NO.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
+# special comment blocks from generated source code fragments. Normal C, C++ and
+# Fortran comments will always remain visible.
+# The default value is: YES.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
+# function all documented functions referencing it will be listed.
+# The default value is: NO.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES then for each documented function
+# all documented entities called/used by that function will be listed.
+# The default value is: NO.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
+# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
+# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
+# link to the documentation.
+# The default value is: YES.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
+# source code will show a tooltip with additional information such as prototype,
+# brief description and links to the definition and documentation. Since this
+# will make the HTML file larger and loading of large files a bit slower, you
+# can opt to disable this feature.
+# The default value is: YES.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+SOURCE_TOOLTIPS = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code will
+# point to the HTML generated by the htags(1) tool instead of doxygen built-in
+# source browser. The htags tool is part of GNU's global source tagging system
+# (see http://www.gnu.org/software/global/global.html). You will need version
+# 4.8.6 or higher.
+#
+# To use it do the following:
+# - Install the latest version of global
+# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Make sure the INPUT points to the root of the source tree
+# - Run doxygen as normal
+#
+# Doxygen will invoke htags (and that will in turn invoke gtags), so these
+# tools must be available from the command line (i.e. in the search path).
+#
+# The result: instead of the source browser generated by doxygen, the links to
+# source code will now point to the output of htags.
+# The default value is: NO.
+# This tag requires that the tag SOURCE_BROWSER is set to YES.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
+# verbatim copy of the header file for each class for which an include is
+# specified. Set to NO to disable this.
+# See also: Section \class.
+# The default value is: YES.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
+# compounds will be generated. Enable this if the project contains a lot of
+# classes, structs, unions or interfaces.
+# The default value is: YES.
+
+ALPHABETICAL_INDEX = YES
+
+# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
+# which the alphabetical index list will be split.
+# Minimum value: 1, maximum value: 20, default value: 5.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+COLS_IN_ALPHA_INDEX = 3
+
+# In case all classes in a project start with a common prefix, all classes will
+# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
+# can be used to specify a prefix (or a list of prefixes) that should be ignored
+# while generating the index headers.
+# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
+# The default value is: YES.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
+# generated HTML page (for example: .htm, .php, .asp).
+# The default value is: .html.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
+# each generated HTML page. If the tag is left blank doxygen will generate a
+# standard header.
+#
+# To get valid HTML the header file that includes any scripts and style sheets
+# that doxygen needs, which is dependent on the configuration options used (e.g.
+# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
+# default header using
+# doxygen -w html new_header.html new_footer.html new_stylesheet.css
+# YourConfigFile
+# and then modify the file new_header.html. See also section "Doxygen usage"
+# for information on how to generate the default header that doxygen normally
+# uses.
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. For a description
+# of the possible markers and block names see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_HEADER = "@CMAKE_SOURCE_DIR@/doc/header.html"
+
+# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
+# generated HTML page. If the tag is left blank doxygen will generate a standard
+# footer. See HTML_HEADER for more information on how to generate a default
+# footer and what special commands can be used inside the footer. See also
+# section "Doxygen usage" for information on how to generate the default footer
+# that doxygen normally uses.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FOOTER = "@CMAKE_SOURCE_DIR@/doc/footer.html"
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
+# sheet that is used by each HTML page. It can be used to fine-tune the look of
+# the HTML output. If left blank doxygen will generate a default style sheet.
+# See also section "Doxygen usage" for information on how to generate the style
+# sheet that doxygen normally uses.
+# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
+# it is more robust and this tag (HTML_STYLESHEET) will in the future become
+# obsolete.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user-
+# defined cascading style sheet that is included after the standard style sheets
+# created by doxygen. Using this option one can overrule certain style aspects.
+# This is preferred over using HTML_STYLESHEET since it does not replace the
+# standard style sheet and is therefor more robust against future updates.
+# Doxygen will copy the style sheet file to the output directory. For an example
+# see the documentation.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_STYLESHEET = "@CMAKE_SOURCE_DIR@/doc/style.css"
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
+# files will be copied as-is; there are no commands or markers available.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
+# will adjust the colors in the stylesheet and background images according to
+# this color. Hue is specified as an angle on a colorwheel, see
+# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
+# purple, and 360 is red again.
+# Minimum value: 0, maximum value: 359, default value: 220.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_HUE = 13
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
+# in the HTML output. For a value of 0 the output will use grayscales only. A
+# value of 255 will produce the most vivid colors.
+# Minimum value: 0, maximum value: 255, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_SAT = 76
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
+# luminance component of the colors in the HTML output. Values below 100
+# gradually make the output lighter, whereas values above 100 make the output
+# darker. The value divided by 100 is the actual gamma applied, so 80 represents
+# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
+# change the gamma.
+# Minimum value: 40, maximum value: 240, default value: 80.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
+# shown in the various tree structured indices initially; the user can expand
+# and collapse entries dynamically later on. Doxygen will expand the tree to
+# such a level that at most the specified number of entries are visible (unless
+# a fully collapsed tree already exceeds this amount). So setting the number of
+# entries 1 will produce a full collapsed tree by default. 0 is a special value
+# representing an infinite number of entries and will result in a full expanded
+# tree by default.
+# Minimum value: 0, maximum value: 9999, default value: 100.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files will be
+# generated that can be used as input for Apple's Xcode 3 integrated development
+# environment (see: http://developer.apple.com/tools/xcode/), introduced with
+# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
+# Makefile in the HTML output directory. Running make will produce the docset in
+# that directory and running make install will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
+# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_DOCSET = NO
+
+# This tag determines the name of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# The default value is: Doxygen generated docs.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDNAME = "Gazebo API Documentation"
+
+# This tag specifies a string that should uniquely identify the documentation
+# set bundle. This should be a reverse domain-name style string, e.g.
+# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_BUNDLE_ID = org.doxygen.Project
+
+# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+# The default value is: org.doxygen.Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_ID = org.doxygen.Publisher
+
+# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
+# The default value is: Publisher.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_PUBLISHER_NAME = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
+# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
+# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
+# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
+# Windows.
+#
+# The HTML Help Workshop contains a compiler that can convert all HTML output
+# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
+# files are now used as the Windows 98 help format, and will replace the old
+# Windows help format (.hlp) on all Windows platforms in the future. Compressed
+# HTML files also contain an index, a table of contents, and you can search for
+# words in the documentation. The HTML workshop also contains a viewer for
+# compressed HTML files.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_HTMLHELP = NO
+
+# The CHM_FILE tag can be used to specify the file name of the resulting .chm
+# file. You can add a path in front of the file if the result should not be
+# written to the html output directory.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_FILE =
+
+# The HHC_LOCATION tag can be used to specify the location (absolute path
+# including file name) of the HTML help compiler ( hhc.exe). If non-empty
+# doxygen will try to run the HTML help compiler on the generated index.hhp.
+# The file has to be specified with full path.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+HHC_LOCATION =
+
+# The GENERATE_CHI flag controls if a separate .chi index file is generated (
+# YES) or that it should be included in the master .chm file ( NO).
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+GENERATE_CHI = NO
+
+# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
+# and project file content.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+CHM_INDEX_ENCODING =
+
+# The BINARY_TOC flag controls whether a binary table of contents is generated (
+# YES) or a normal table of contents ( NO) in the .chm file.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members to
+# the table of contents of the HTML help documentation and to the tree view.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
+# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
+# (.qch) of the generated HTML documentation.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
+# the file name of the resulting .qch file. The path specified is relative to
+# the HTML output folder.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
+# Project output. For more information please see Qt Help Project / Namespace
+# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
+# Help Project output. For more information please see Qt Help Project / Virtual
+# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
+# folders).
+# The default value is: doc.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
+# filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see Qt Help Project / Custom
+# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
+# filters).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's filter section matches. Qt Help Project / Filter Attributes (see:
+# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHP_SECT_FILTER_ATTRS =
+
+# The QHG_LOCATION tag can be used to specify the location of Qt's
+# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
+# generated .qhp file.
+# This tag requires that the tag GENERATE_QHP is set to YES.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
+# generated, together with the HTML files, they form an Eclipse help plugin. To
+# install this plugin and make it available under the help contents menu in
+# Eclipse, the contents of the directory containing the HTML and XML files needs
+# to be copied into the plugins directory of eclipse. The name of the directory
+# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
+# After copying Eclipse needs to be restarted before the help appears.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the Eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have this
+# name. Each documentation set should have its own identifier.
+# The default value is: org.doxygen.Project.
+# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# If you want full control over the layout of the generated HTML pages it might
+# be necessary to disable the index and replace it with your own. The
+# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
+# of each HTML page. A value of NO enables the index and the value YES disables
+# it. Since the tabs in the index contain the same information as the navigation
+# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+DISABLE_INDEX = YES
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information. If the tag
+# value is set to YES, a side panel will be generated containing a tree-like
+# index structure (just like the one that is generated for HTML Help). For this
+# to work a browser that supports JavaScript, DHTML, CSS and frames is required
+# (i.e. any modern browser). Windows users are probably better off using the
+# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
+# further fine-tune the look of the index. As an example, the default style
+# sheet generated by doxygen has an example that shows how to put an image at
+# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
+# the same information as the tab index, you could consider setting
+# DISABLE_INDEX to YES when enabling this option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+GENERATE_TREEVIEW = NO
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
+# doxygen will group on one line in the generated HTML documentation.
+#
+# Note that a value of 0 will completely suppress the enum values from appearing
+# in the overview section.
+# Minimum value: 0, maximum value: 20, default value: 4.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
+# to set the initial width (in pixels) of the frame in which the tree is shown.
+# Minimum value: 0, maximum value: 1500, default value: 250.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
+# external symbols imported via tag files in a separate window.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of LaTeX formulas included as images in
+# the HTML documentation. When you change the font size after a successful
+# doxygen run you need to manually remove any form_*.png images from the HTML
+# output directory to force them to be regenerated.
+# Minimum value: 8, maximum value: 50, default value: 10.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are not
+# supported properly for IE 6.0, but are supported on all modern browsers.
+#
+# Note that when changing this option you need to delete any form_*.png files in
+# the HTML output directory before the changes have effect.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
+# http://www.mathjax.org) which uses client side Javascript for the rendering
+# instead of using prerendered bitmaps. Use this if you do not have LaTeX
+# installed or if you want to formulas look prettier in the HTML output. When
+# enabled you may also need to install MathJax separately and configure the path
+# to it using the MATHJAX_RELPATH option.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you can set the default output format to be used for
+# the MathJax output. See the MathJax site (see:
+# http://docs.mathjax.org/en/latest/output.html) for more details.
+# Possible values are: HTML-CSS (which is slower, but has the best
+# compatibility), NativeMML (i.e. MathML) and SVG.
+# The default value is: HTML-CSS.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_FORMAT = HTML-CSS
+
+# When MathJax is enabled you need to specify the location relative to the HTML
+# output directory using the MATHJAX_RELPATH option. The destination directory
+# should contain the MathJax.js script. For instance, if the mathjax directory
+# is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
+# Content Delivery Network so you can quickly see the result without installing
+# MathJax. However, it is strongly recommended to install a local copy of
+# MathJax from http://www.mathjax.org before deployment.
+# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
+# extension names that should be enabled during MathJax rendering. For example
+# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_EXTENSIONS =
+
+# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
+# of code that will be used on startup of the MathJax code. See the MathJax site
+# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# example see the documentation.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_CODEFILE =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
+# the HTML output. The underlying search engine uses javascript and DHTML and
+# should work on any modern browser. Note that when using HTML help
+# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
+# there is already a search function so this one should typically be disabled.
+# For large projects the javascript based search engine can be slow, then
+# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
+# search using the keyboard; to jump to the search box use <access key> + S
+# (what the <access key> is depends on the OS and browser, but it is typically
+# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
+# key> to jump into the search results window, the results can be navigated
+# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
+# the search. The filter options can be selected when the cursor is inside the
+# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
+# to select a filter and <Enter> or <escape> to activate or cancel the filter
+# option.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a web server instead of a web client using Javascript. There
+# are two flavours of web server based searching depending on the
+# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for
+# searching and an index file used by the script. When EXTERNAL_SEARCH is
+# enabled the indexing and searching needs to be provided by external tools. See
+# the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SERVER_BASED_SEARCH = NO
+
+# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
+# script for searching. Instead the search results are written to an XML file
+# which needs to be processed by an external indexer. Doxygen will invoke an
+# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
+# search results.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/).
+#
+# See the section "External Indexing and Searching" for details.
+# The default value is: NO.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH = NO
+
+# The SEARCHENGINE_URL should point to a search engine hosted by a web server
+# which will return the search results when EXTERNAL_SEARCH is enabled.
+#
+# Doxygen ships with an example indexer ( doxyindexer) and search engine
+# (doxysearch.cgi) which are based on the open source search engine library
+# Xapian (see: http://xapian.org/). See the section "External Indexing and
+# Searching" for details.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHENGINE_URL =
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
+# search data is written to a file for indexing by an external tool. With the
+# SEARCHDATA_FILE tag the name of this file can be specified.
+# The default file is: searchdata.xml.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+SEARCHDATA_FILE = searchdata.xml
+
+# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
+# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
+# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
+# projects and redirect the results back to the right project.
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTERNAL_SEARCH_ID =
+
+# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
+# projects other than the one defined by this configuration file, but that are
+# all added to the same external search index. Each project needs to have a
+# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
+# to a relative location where the documentation can be found. The format is:
+# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
+# This tag requires that the tag SEARCHENGINE is set to YES.
+
+EXTRA_SEARCH_MAPPINGS =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
+# The default value is: YES.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked.
+#
+# Note that when enabling USE_PDFLATEX this option is only used for generating
+# bitmaps for formulas in the HTML output, but not in the Makefile that is
+# written to the output directory.
+# The default file is: latex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
+# index for LaTeX.
+# The default file is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used by the
+# printer.
+# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
+# 14 inches) and executive (7.25 x 10.5 inches).
+# The default value is: a4.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PAPER_TYPE = letter
+
+# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
+# that should be included in the LaTeX output. To get the times font for
+# instance you can specify
+# EXTRA_PACKAGES=times
+# If left blank no extra packages will be included.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
+# generated LaTeX document. The header should contain everything until the first
+# chapter. If it is left blank doxygen will generate a standard header. See
+# section "Doxygen usage" for information on how to let doxygen write the
+# default header to a separate file.
+#
+# Note: Only use a user-defined header if you know what you are doing! The
+# following commands have a special meaning inside the header: $title,
+# $datetime, $date, $doxygenversion, $projectname, $projectnumber. Doxygen will
+# replace them by respectively the title of the page, the current date and time,
+# only the current date, the version number of doxygen, the project name (see
+# PROJECT_NAME), or the project number (see PROJECT_NUMBER).
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
+# generated LaTeX document. The footer should contain everything after the last
+# chapter. If it is left blank doxygen will generate a standard footer.
+#
+# Note: Only use a user-defined footer if you know what you are doing!
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_FOOTER =
+
+# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the LATEX_OUTPUT output
+# directory. Note that the files will be copied as-is; there are no commands or
+# markers available.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EXTRA_FILES =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
+# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
+# contain links (just like the HTML output) instead of page references. This
+# makes the output suitable for online browsing using a PDF viewer.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+PDF_HYPERLINKS = NO
+
+# If the LATEX_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
+# the PDF file directly from the LaTeX files. Set this option to YES to get a
+# higher quality PDF documentation.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
+# command to the generated LaTeX files. This will instruct LaTeX to keep running
+# if errors occur, instead of asking the user for help. This option is also used
+# when generating formulas in HTML.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BATCHMODE = NO
+
+# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
+# index chapters (such as File Index, Compound Index, etc.) in the output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_HIDE_INDICES = NO
+
+# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
+# code with syntax highlighting in the LaTeX output.
+#
+# Note that which sources are shown also depends on other settings such as
+# SOURCE_BROWSER.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. See
+# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# The default value is: plain.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# Configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
+# RTF output is optimized for Word 97 and may not look too pretty with other RTF
+# readers/editors.
+# The default value is: NO.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: rtf.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
+# documents. This may be useful for small projects and may help to save some
+# trees in general.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
+# contain hyperlink fields. The RTF file will contain links (just like the HTML
+# output) instead of page references. This makes the output suitable for online
+# browsing using Word or some other Word compatible readers that support those
+# fields.
+#
+# Note: WordPad (write) and others do not support links.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's config
+# file, i.e. a series of assignments. You only have to provide replacements,
+# missing definitions are set to their default value.
+#
+# See also section "Doxygen usage" for information on how to generate the
+# default style sheet that doxygen normally uses.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an RTF document. Syntax is
+# similar to doxygen's config file. A template extensions file can be generated
+# using doxygen -e rtf extensionFile.
+# This tag requires that the tag GENERATE_RTF is set to YES.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
+# classes and files.
+# The default value is: NO.
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it. A directory man3 will be created inside the directory specified by
+# MAN_OUTPUT.
+# The default directory is: man.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to the generated
+# man pages. In case the manual section does not start with a number, the number
+# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
+# optional.
+# The default value is: .3.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
+# will generate one additional man file for each entity documented in the real
+# man page(s). These additional files only source the real man page, but without
+# them the man command would be unable to find the correct page.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_MAN is set to YES.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
+# captures the structure of the code including all documentation.
+# The default value is: NO.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
+# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
+# it.
+# The default directory is: xml.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify a XML schema, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify a XML DTD, which can be used by a
+# validating XML parser to check the syntax of the XML files.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
+# listings (including syntax highlighting and cross-referencing information) to
+# the XML output. Note that enabling this will significantly increase the size
+# of the XML output.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# Configuration options related to the DOCBOOK output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
+# that can be used to generate PDF.
+# The default value is: NO.
+
+GENERATE_DOCBOOK = NO
+
+# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
+# front of it.
+# The default directory is: docbook.
+# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
+
+DOCBOOK_OUTPUT = docbook
+
+#---------------------------------------------------------------------------
+# Configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
+# Definitions (see http://autogen.sf.net) file that captures the structure of
+# the code including all documentation. Note that this feature is still
+# experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
+# file that captures the structure of the code including all documentation.
+#
+# Note that this feature is still experimental and incomplete at the moment.
+# The default value is: NO.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
+# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
+# output from the Perl module output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
+# formatted so it can be parsed by a human reader. This is useful if you want to
+# understand what is going on. On the other hand, if this tag is set to NO the
+# size of the Perl module output will be much smaller and Perl will parse it
+# just the same.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file are
+# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
+# so different doxyrules.make files included by the same Makefile don't
+# overwrite each other's variables.
+# This tag requires that the tag GENERATE_PERLMOD is set to YES.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
+# C-preprocessor directives found in the sources and include files.
+# The default value is: YES.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
+# in the source code. If set to NO only conditional compilation will be
+# performed. Macro expansion can be done in a controlled way by setting
+# EXPAND_ONLY_PREDEF to YES.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+MACRO_EXPANSION = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
+# the macro expansion is limited to the macros specified with the PREDEFINED and
+# EXPAND_AS_DEFINED tags.
+# The default value is: NO.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES the includes files in the
+# INCLUDE_PATH will be searched if a #include is found.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by the
+# preprocessor.
+# This tag requires that the tag SEARCH_INCLUDES is set to YES.
+
+INCLUDE_PATH = .
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will be
+# used.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that are
+# defined before the preprocessor is started (similar to the -D option of e.g.
+# gcc). The argument of the tag is a list of macros of the form: name or
+# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
+# is assumed. To prevent a macro definition from being undefined via #undef or
+# recursively expanded use the := operator instead of the = operator.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
+# tag can be used to specify a list of macro names that should be expanded. The
+# macro definition that is found in the sources will be used. Use the PREDEFINED
+# tag if you want to use a different macro definition that overrules the
+# definition found in the source code.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
+# remove all refrences to function-like macros that are alone on a line, have an
+# all uppercase name, and do not end with a semicolon. Such function macros are
+# typically used for boiler-plate code, and will confuse the parser if not
+# removed.
+# The default value is: YES.
+# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
+
+SKIP_FUNCTION_MACROS = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tag files. For each tag
+# file the location of the external documentation should be added. The format of
+# a tag file without this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where loc1 and loc2 can be relative or absolute paths or URLs. See the
+# section "Linking to external documentation" for more information about the use
+# of tag files.
+# Note: Each tag file must have an unique name (where the name does NOT include
+# the path). If a tag file is not located in the directory in which doxygen is
+# run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
+# tag file that is based on the input files it reads. See section "Linking to
+# external documentation" for more information about the usage of tag files.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
+# class index. If set to NO only the inherited external classes will be listed.
+# The default value is: NO.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
+# the modules index. If set to NO, only the current project's groups will be
+# listed.
+# The default value is: YES.
+
+EXTERNAL_GROUPS = NO
+
+# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
+# the related pages index. If set to NO, only the current project's pages will
+# be listed.
+# The default value is: YES.
+
+EXTERNAL_PAGES = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of 'which perl').
+# The default file (with absolute path) is: /usr/bin/perl.
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
+# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
+# NO turns the diagrams off. Note that this option also works with HAVE_DOT
+# disabled, but it is recommended to install and use dot, since it yields more
+# powerful graphs.
+# The default value is: YES.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see:
+# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# You can include diagrams made with dia in doxygen documentation. Doxygen will
+# then run dia to produce the diagram and insert it in the documentation. The
+# DIA_PATH tag allows you to specify the directory where the dia binary resides.
+# If left empty dia is assumed to be found in the default search path.
+
+DIA_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide inheritance
+# and usage relations if the target is undocumented or is not a class.
+# The default value is: YES.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz (see:
+# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
+# Bell Labs. The other options in this section have no effect if this option is
+# set to NO
+# The default value is: NO.
+
+HAVE_DOT = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
+# to run in parallel. When set to 0 doxygen will base this on the number of
+# processors available in the system. You can set it explicitly to a value
+# larger than 0 to get control over the balance between CPU load and processing
+# speed.
+# Minimum value: 0, maximum value: 32, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_NUM_THREADS = 0
+
+# When you want a differently looking font n the dot files that doxygen
+# generates you can specify the font name using DOT_FONTNAME. You need to make
+# sure dot is able to find the font, which can be done by putting it in a
+# standard location or by setting the DOTFONTPATH environment variable or by
+# setting DOT_FONTPATH to the directory containing the font.
+# The default value is: Helvetica.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTNAME = FreeSans.ttf
+
+# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
+# dot graphs.
+# Minimum value: 4, maximum value: 24, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the default font as specified with
+# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
+# the path where dot can find it using this tag.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
+# each documented class showing the direct and indirect inheritance relations.
+# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
+# graph for each documented class showing the direct and indirect implementation
+# dependencies (inheritance, containment, and class references variables) of the
+# class with other documented classes.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+COLLABORATION_GRAPH = NO
+
+# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
+# groups, showing the direct groups dependencies.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LOOK = NO
+
+# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
+# class node. If there are many fields or methods and many nodes the graph may
+# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
+# number of items for each type to make the size more manageable. Set this to 0
+# for no limit. Note that the threshold may be exceeded by 50% before the limit
+# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
+# but if the number exceeds 15, the total amount of fields shown is limited to
+# 10.
+# Minimum value: 0, maximum value: 100, default value: 10.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+UML_LIMIT_NUM_FIELDS = 10
+
+# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
+# collaboration graphs will show the relations between templates and their
+# instances.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+TEMPLATE_RELATIONS = NO
+
+# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
+# YES then doxygen will generate a graph for each documented file showing the
+# direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDE_GRAPH = YES
+
+# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
+# set to YES then doxygen will generate a graph for each documented file showing
+# the direct and indirect include dependencies of the file with other documented
+# files.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
+# dependency graph for every global function or class method.
+#
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
+# hierarchy of all classes instead of a textual one.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
+# dependencies a directory has on other directories in a graphical way. The
+# dependency relations are determined by the #include relations between the
+# files in the directories.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot.
+# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
+# to make the SVG files visible in IE 9+ (other browsers do not have this
+# requirement).
+# Possible values are: png, jpg, gif and svg.
+# The default value is: png.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_IMAGE_FORMAT = svg
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+#
+# Note that this requires a modern browser other than Internet Explorer. Tested
+# and working are Firefox, Chrome, Safari, and Opera.
+# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
+# the SVG files visible. Older versions of IE do not have SVG support.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+INTERACTIVE_SVG = NO
+
+# The DOT_PATH tag can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the \dotfile
+# command).
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the \mscfile
+# command).
+
+MSCFILE_DIRS =
+
+# The DIAFILE_DIRS tag can be used to specify one or more directories that
+# contain dia files that are included in the documentation (see the \diafile
+# command).
+
+DIAFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
+# that will be shown in the graph. If the number of nodes in a graph becomes
+# larger than this value, doxygen will truncate the graph, which is visualized
+# by representing a node as a red box. Note that doxygen if the number of direct
+# children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
+# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+# Minimum value: 0, maximum value: 10000, default value: 50.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
+# generated by dot. A depth value of 3 means that only nodes reachable from the
+# root by following a path via at most 3 edges will be shown. Nodes that lay
+# further from the root node will be omitted. Note that setting this option to 1
+# or 2 may greatly reduce the computation time needed for large code bases. Also
+# note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+# Minimum value: 0, maximum value: 1000, default value: 0.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not seem
+# to support this out of the box.
+#
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10) support
+# this, this feature is disabled by default.
+# The default value is: NO.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
+# explaining the meaning of the various boxes and arrows in the dot generated
+# graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
+# files that are used to generate the various graphs.
+# The default value is: YES.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_CLEANUP = YES
diff --git a/doc/ignition_logo.png b/doc/ignition_logo.png
new file mode 100644
index 0000000..242e9b2
Binary files /dev/null and b/doc/ignition_logo.png differ
diff --git a/doc/ignition_logo.svg b/doc/ignition_logo.svg
new file mode 100644
index 0000000..27db0bd
--- /dev/null
+++ b/doc/ignition_logo.svg
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="473.20953"
+ height="338.49789"
+ id="svg3097"
+ version="1.1"
+ inkscape:version="0.48.4 r9939"
+ sodipodi:docname="ignition_logo.svg">
+ <defs
+ id="defs3099" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.7"
+ inkscape:cx="-8.01737"
+ inkscape:cy="108.51396"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ inkscape:window-width="1350"
+ inkscape:window-height="857"
+ inkscape:window-x="457"
+ inkscape:window-y="89"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata3102">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-159.66847,-323.82846)">
+ <g
+ id="g44"
+ transform="matrix(1.25,0,0,-1.25,389.76025,331.23471)">
+ <path
+ d="m 0,0 c 0,-3.272 2.927,-5.924 6.534,-5.924 3.61,0 6.535,2.652 6.535,5.924 0,3.272 -2.925,5.925 -6.535,5.925 C 2.927,5.925 0,3.272 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path46"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g48"
+ transform="matrix(1.25,0,0,-1.25,369.82862,394.56733)">
+ <path
+ d="m 0,0 c 0,-5.404 -4.833,-9.788 -10.797,-9.788 -5.962,0 -10.798,4.384 -10.798,9.788 0,1.761 0.513,3.412 1.412,4.84 1.86,2.956 5.366,4.949 9.386,4.949 C -4.833,9.789 0,5.406 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path50"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g52"
+ transform="matrix(1.25,0,0,-1.25,337.86512,375.95645)">
+ <path
+ d="m 0,0 c 0,-2.816 -2.52,-5.1 -5.626,-5.1 -3.108,0 -5.626,2.284 -5.626,5.1 0,2.816 2.518,5.101 5.626,5.101 C -2.52,5.101 0,2.816 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path54"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ d="m 334.872,370.83683 -7.95625,0 0,-15.96875 7.95625,0 0,15.96875 z"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path56"
+ inkscape:connector-curvature="0" />
+ <g
+ id="g58"
+ transform="matrix(1.25,0,0,-1.25,349.28362,389.69421)">
+ <path
+ d="M 0,0 -4.691,-3.898 -15.124,6.425 -10.433,10.321 0,0 z"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path60"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g62"
+ transform="matrix(1.25,0,0,-1.25,324.0755,339.67108)">
+ <path
+ d="m 0,0 c 0,0 0.454,-6.8 5.455,-6.8 5.001,0 5.228,5.358 5.228,5.358 0,0 7.954,-11.538 -5.228,-11.538 C -7.729,-12.98 0,0 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path64"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g66"
+ transform="matrix(1.25,0,0,-1.25,422.71925,394.56733)">
+ <path
+ d="m 0,0 c 0,-5.404 4.833,-9.788 10.794,-9.788 5.965,0 10.799,4.384 10.799,9.788 0,1.761 -0.512,3.412 -1.409,4.84 -1.861,2.956 -5.368,4.949 -9.39,4.949 C 4.833,9.789 0,5.406 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path68"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g70"
+ transform="matrix(1.25,0,0,-1.25,454.68275,375.95645)">
+ <path
+ d="m 0,0 c 0,-2.816 2.52,-5.1 5.626,-5.1 3.107,0 5.628,2.284 5.628,5.1 0,2.816 -2.521,5.101 -5.628,5.101 C 2.52,5.101 0,2.816 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path72"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ d="m 457.67575,370.83683 7.9575,0 0,-15.96875 -7.9575,0 0,15.96875 z"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path74"
+ inkscape:connector-curvature="0" />
+ <g
+ id="g76"
+ transform="matrix(1.25,0,0,-1.25,443.26312,389.69421)">
+ <path
+ d="M 0,0 4.692,-3.898 15.124,6.425 10.432,10.321 0,0 z"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path78"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g80"
+ transform="matrix(1.25,0,0,-1.25,468.47125,339.67108)">
+ <path
+ d="m 0,0 c 0,0 -0.452,-6.8 -5.454,-6.8 -4.999,0 -5.23,5.358 -5.23,5.358 0,0 -7.953,-11.538 5.23,-11.538 C 7.728,-12.98 0,0 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path82"
+ inkscape:connector-curvature="0" />
+ </g>
+ <path
+ d="m 422.7195,379.30433 -52.28125,0 0,-14.42375 52.28125,0 0,14.42375 z m -21.455,-35.80125 0,-6.76125 c 0,-1.81625 -1.62,-3.285 -3.62125,-3.285 -2.00125,0 -3.6225,1.46875 -3.6225,3.285 l 0,6.585 c -20.4625,1.18125 -36.6525,16.37 -36.6525,34.94875 l 0,46.6225 c 0,10.23875 9.1575,12.105 20.4575,12.105 l 37.505,0 c 11.29875,0 20.4575,-1.86625 20.4575,-12.105 l 0,-46.6225 c 0,-17.93 -15.0825,-32.70125 -34.52375,-34.7725"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path84"
+ inkscape:connector-curvature="0" />
+ <g
+ id="g86"
+ transform="matrix(1.25,0,0,-1.25,378.879,495.55483)">
+ <path
+ d="m 0,0 c 0,0 1.215,6.836 3.784,6.836 0.135,-6.393 8.377,-10.801 6.187,-21.166 19.458,7.497 20.304,31.971 20.304,31.971 0,0 -0.117,-0.883 4.259,-5.733 7.786,20.727 -10.451,29.928 -10.451,29.928 l -1.348,0.003 C 23.916,40.416 28.458,33.285 15.008,19.623 9.585,25.687 0.048,33.539 5.561,41.89 4.985,41.89 4.394,41.893 3.784,41.893 -20.647,23.148 0,0 0,0"
+ style="fill:#f1623b;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path88"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g90"
+ transform="matrix(1.25,0,0,-1.25,207.40347,592.96504)">
+ <path
+ d="m 0,0 -36.232,0 c -1.087,0 -1.956,0.869 -1.956,2.028 l 0,3.986 c 0,1.16 0.869,2.029 1.956,2.029 l 14.13,0 0,40.29 -6.086,0 c -1.087,0 -1.957,0.87 -1.957,1.957 l 0,4.058 c 0,1.159 0.87,2.028 1.957,2.028 l 20.145,0 c 1.159,0 2.028,-0.869 2.028,-2.028 l 0,-4.058 c 0,-1.087 -0.869,-1.957 -2.028,-1.957 l -6.015,0 0,-40.29 14.058,0 c 1.159,0 2.029,-0.869 2.029,-2.029 l 0,-3.986 C 2.029,0.869 1.159,0 0,0"
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path92"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g94"
+ transform="matrix(1.25,0,0,-1.25,260.3051,552.74779)">
+ <path
+ d="m 0,0 -16.087,0 c -4.42,0 -8.043,-3.623 -8.043,-8.044 l 0,-8.044 c 0,-4.42 3.623,-8.043 8.043,-8.043 L 0,-24.131 0,0 z m -8.043,-48.262 -22.174,0 c -1.087,0 -1.957,0.87 -1.957,2.03 l 0,3.986 c 0,1.158 0.87,2.028 1.957,2.028 l 22.174,0 c 4.42,0 8.043,3.623 8.043,8.044 l -16.087,0 c -8.841,0 -16.087,7.246 -16.087,16.086 l 0,8.044 c 0,8.913 7.246,16.16 16.087,16.16 l 22.102,0 c 1.159,0 2.028,-0.942 2.028,-2.03 l 0,-38.26 c 0,-8.842 -7.246,-16.088 -16.086,-16.088"
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path96"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g98"
+ transform="matrix(1.25,0,0,-1.25,328.24334,592.96504)">
+ <path
+ d="m 0,0 -3.985,0 c -1.161,0 -2.03,0.869 -2.03,2.028 l 0,22.102 c 0,4.421 -3.623,8.044 -8.043,8.044 l -16.087,0 0,-30.146 C -30.145,0.869 -31.087,0 -32.174,0 l -4.058,0 c -1.087,0 -1.956,0.869 -1.956,2.028 l 0,36.232 c 0,1.088 0.869,2.03 1.956,2.03 l 22.174,0 c 8.84,0 16.086,-7.247 16.086,-16.16 l 0,-22.102 C 2.028,0.869 1.159,0 0,0"
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path100"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g102"
+ transform="matrix(1.25,0,0,-1.25,368.55463,532.54879)">
+ <path
+ d="m 0,0 -3.986,0 c -1.159,0 -2.029,0.87 -2.029,1.957 l 0,4.058 c 0,1.159 0.87,2.028 2.029,2.028 l 3.986,0 c 1.159,0 2.029,-0.869 2.029,-2.028 l 0,-4.058 C 2.029,0.87 1.159,0 0,0 m 16.087,-48.333 -36.232,0 c -1.087,0 -1.957,0.869 -1.957,2.028 l 0,3.986 c 0,1.16 0.87,2.029 1.957,2.029 l 14.13,0 0,24.131 -6.087,0 c -1.086,0 -1.957,0.942 -1.957,2.029 l 0,4.057 c 0,1.088 0.871,2.03 1.957,2.03 l 12.102,0 c 1.159,0 2.029,-0.942 2.029,-2.03 l 0,-30.217 14.058,0 c 1.159,0 2.028,-0.869 2 [...]
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path104"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g106"
+ transform="matrix(1.25,0,0,-1.25,449.08313,592.96504)">
+ <path
+ d="m 0,0 -6.015,0 c -8.839,0 -16.087,7.246 -16.087,16.086 l 0,16.088 -14.129,0 c -1.088,0 -1.957,0.942 -1.957,2.029 l 0,4.057 c 0,1.088 0.869,2.03 1.957,2.03 l 14.129,0 0,14.058 c 0,1.159 0.871,2.028 2.029,2.028 l 3.986,0 c 1.159,0 2.029,-0.869 2.029,-2.028 l 0,-14.058 14.058,0 c 1.159,0 2.028,-0.942 2.028,-2.03 l 0,-4.057 C 2.028,33.116 1.159,32.174 0,32.174 l -14.058,0 0,-16.088 c 0,-4.42 3.623,-8.043 8.043,-8.043 l 6.015,0 c 1.159,0 2.028,-0.869 2.028,-2.029 l 0,-3.986 C 2.02 [...]
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path108"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g110"
+ transform="matrix(1.25,0,0,-1.25,489.39443,532.54879)">
+ <path
+ d="m 0,0 -3.986,0 c -1.159,0 -2.029,0.87 -2.029,1.957 l 0,4.058 c 0,1.159 0.87,2.028 2.029,2.028 l 3.986,0 c 1.159,0 2.029,-0.869 2.029,-2.028 l 0,-4.058 C 2.029,0.87 1.159,0 0,0 m 16.087,-48.333 -36.232,0 c -1.087,0 -1.957,0.869 -1.957,2.028 l 0,3.986 c 0,1.16 0.87,2.029 1.957,2.029 l 14.13,0 0,24.131 -6.087,0 c -1.086,0 -1.957,0.942 -1.957,2.029 l 0,4.057 c 0,1.088 0.871,2.03 1.957,2.03 l 12.102,0 c 1.159,0 2.029,-0.942 2.029,-2.03 l 0,-30.217 14.058,0 c 1.159,0 2.028,-0.869 2 [...]
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path112"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g114"
+ transform="matrix(1.25,0,0,-1.25,562.40473,562.80266)">
+ <path
+ d="m 0,0 c 0,4.421 -3.623,8.044 -8.043,8.044 l -8.044,0 c -4.421,0 -8.044,-3.623 -8.044,-8.044 l 0,-8.044 c 0,-4.42 3.623,-8.043 8.044,-8.043 l 8.044,0 c 4.42,0 8.043,3.623 8.043,8.043 L 0,0 z m -8.043,-24.13 -8.044,0 c -8.841,0 -16.087,7.246 -16.087,16.086 l 0,8.044 c 0,8.913 7.246,16.16 16.087,16.16 l 8.044,0 C 0.797,16.16 8.043,8.913 8.043,0 l 0,-8.044 c 0,-8.84 -7.246,-16.086 -16.086,-16.086"
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path116"
+ inkscape:connector-curvature="0" />
+ </g>
+ <g
+ id="g118"
+ transform="matrix(1.25,0,0,-1.25,630.34173,592.96504)">
+ <path
+ d="m 0,0 -3.984,0 c -1.161,0 -2.03,0.869 -2.03,2.028 l 0,22.102 c 0,4.421 -3.623,8.044 -8.043,8.044 l -16.088,0 0,-30.146 C -30.145,0.869 -31.086,0 -32.174,0 l -4.056,0 c -1.088,0 -1.958,0.869 -1.958,2.028 l 0,36.232 c 0,1.088 0.87,2.03 1.958,2.03 l 22.173,0 c 8.84,0 16.086,-7.247 16.086,-16.16 l 0,-22.102 C 2.029,0.869 1.16,0 0,0"
+ style="fill:#606163;fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path120"
+ inkscape:connector-curvature="0" />
+ </g>
+ <text
+ xml:space="preserve"
+ style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+ x="510.81549"
+ y="649.64667"
+ id="text3104"
+ sodipodi:linespacing="125%"><tspan
+ sodipodi:role="line"
+ id="tspan3106"
+ x="510.81549"
+ y="649.64667"
+ style="font-size:48px;fill:#666666">Msgs</tspan></text>
+ </g>
+</svg>
diff --git a/doc/mainpage.html b/doc/mainpage.html
new file mode 100644
index 0000000..d2520a1
--- /dev/null
+++ b/doc/mainpage.html
@@ -0,0 +1,15 @@
+/** \mainpage Ignition: Messages API Reference
+
+Welcome to the Ingition Msgs library API. Should you find problems with this documentation - typos, unclear phrases,
+or insufficient detail - please create a <a
+ href="https://bitbucket.org/osrf/ignition-math/issues/new">new bitbucket issue</a>.
+Include sufficient detail to quickly locate the problematic documentation.
+
+<dl>
+ <dt>API</dt>
+ <dd><a href="classes.html">Class List</a>- Index of all classes in Ignition Msgs, organized alphabetically</dd><br/>
+ <dd><a href="globals.html">Globals</a> - Global defines and variables.</dd><br/>
+ <dd><a href="files.html">Files</a> - A list of all the files.</dd><br/>
+</dl>
+
+*/
diff --git a/doc/search.js b/doc/search.js
new file mode 100644
index 0000000..b01927e
--- /dev/null
+++ b/doc/search.js
@@ -0,0 +1,817 @@
+// Search script generated by doxygen
+// Copyright (C) 2009 by Dimitri van Heesch.
+
+// The code in this file is loosly based on main.js, part of Natural Docs,
+// which is Copyright (C) 2003-2008 Greg Valure
+// Natural Docs is licensed under the GPL.
+
+var indexSectionsWithContent =
+{
+ 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 3: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011000000000101101110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 4: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111110000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 5: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111101111111101110111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 6: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 7: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100010010000000101000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 8: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111010010101100101111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 9: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 10: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011010100000101001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 11: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+};
+
+var indexSectionNames =
+{
+ 0: "all",
+ 1: "classes",
+ 2: "namespaces",
+ 3: "files",
+ 4: "functions",
+ 5: "variables",
+ 6: "typedefs",
+ 7: "enums",
+ 8: "enumvalues",
+ 9: "related",
+ 10: "groups",
+ 11: "pages"
+};
+
+function convertToId(search)
+{
+ var result = '';
+ for (i=0;i<search.length;i++)
+ {
+ var c = search.charAt(i);
+ var cn = c.charCodeAt(0);
+ if (c.match(/[a-z0-9]/))
+ {
+ result+=c;
+ }
+ else if (cn<16)
+ {
+ result+="_0"+cn.toString(16);
+ }
+ else
+ {
+ result+="_"+cn.toString(16);
+ }
+ }
+ return result;
+}
+
+function getXPos(item)
+{
+ var x = 0;
+ if (item.offsetWidth)
+ {
+ while (item && item!=document.body)
+ {
+ x += item.offsetLeft;
+ item = item.offsetParent;
+ }
+ }
+ return x;
+}
+
+function getYPos(item)
+{
+ var y = 0;
+ if (item.offsetWidth)
+ {
+ while (item && item!=document.body)
+ {
+ y += item.offsetTop;
+ item = item.offsetParent;
+ }
+ }
+ return y;
+}
+
+/* A class handling everything associated with the search panel.
+
+ Parameters:
+ name - The name of the global variable that will be
+ storing this instance. Is needed to be able to set timeouts.
+ resultPath - path to use for external files
+*/
+function SearchBox(name, resultsPath, inFrame, label)
+{
+ if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
+
+ // ---------- Instance variables
+ this.name = name;
+ this.resultsPath = resultsPath;
+ this.keyTimeout = 0;
+ this.keyTimeoutLength = 500;
+ this.closeSelectionTimeout = 300;
+ this.lastSearchValue = "";
+ this.lastResultsPage = "";
+ this.hideTimeout = 0;
+ this.searchIndex = 0;
+ this.searchActive = false;
+ this.insideFrame = inFrame;
+ this.searchLabel = label;
+
+ // ----------- DOM Elements
+
+ this.DOMSearchField = function()
+ { return document.getElementById("MSearchField"); }
+
+ this.DOMSearchSelect = function()
+ { return document.getElementById("MSearchSelect"); }
+
+ this.DOMSearchSelectWindow = function()
+ { return document.getElementById("MSearchSelectWindow"); }
+
+ this.DOMPopupSearchResults = function()
+ { return document.getElementById("MSearchResults"); }
+
+ this.DOMPopupSearchResultsWindow = function()
+ { return document.getElementById("MSearchResultsWindow"); }
+
+ this.DOMSearchClose = function()
+ { return document.getElementById("MSearchClose"); }
+
+ this.DOMSearchBox = function()
+ { return document.getElementById("MSearchBox"); }
+
+ // ------------ Event Handlers
+
+ // Called when focus is added or removed from the search field.
+ this.OnSearchFieldFocus = function(isActive)
+ {
+ this.Activate(isActive);
+ }
+
+ this.OnSearchSelectShow = function()
+ {
+ var searchSelectWindow = this.DOMSearchSelectWindow();
+ var searchField = this.DOMSearchSelect();
+
+ if (this.insideFrame)
+ {
+ var left = getXPos(searchField);
+ var top = getYPos(searchField);
+ left += searchField.offsetWidth + 6;
+ top += searchField.offsetHeight;
+
+ // show search selection popup
+ searchSelectWindow.style.display='block';
+ left -= searchSelectWindow.offsetWidth;
+ searchSelectWindow.style.left = left + 'px';
+ searchSelectWindow.style.top = top + 'px';
+ }
+ else
+ {
+ var left = getXPos(searchField);
+ var top = getYPos(searchField);
+ top += searchField.offsetHeight;
+
+ // show search selection popup
+ searchSelectWindow.style.display='block';
+ searchSelectWindow.style.left = left + 'px';
+ searchSelectWindow.style.top = top + 'px';
+ }
+
+ // stop selection hide timer
+ if (this.hideTimeout)
+ {
+ clearTimeout(this.hideTimeout);
+ this.hideTimeout=0;
+ }
+ return false; // to avoid "image drag" default event
+ }
+
+ this.OnSearchSelectHide = function()
+ {
+ this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
+ this.closeSelectionTimeout);
+ }
+
+ // Called when the content of the search field is changed.
+ this.OnSearchFieldChange = function(evt)
+ {
+ if (this.keyTimeout) // kill running timer
+ {
+ clearTimeout(this.keyTimeout);
+ this.keyTimeout = 0;
+ }
+
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==40 || e.keyCode==13)
+ {
+ if (e.shiftKey==1)
+ {
+ this.OnSearchSelectShow();
+ var win=this.DOMSearchSelectWindow();
+ for (i=0;i<win.childNodes.length;i++)
+ {
+ var child = win.childNodes[i]; // get span within a
+ if (child.className=='SelectItem')
+ {
+ child.focus();
+ return;
+ }
+ }
+ return;
+ }
+ else if (window.frames.MSearchResults.searchResults)
+ {
+ var elem = window.frames.MSearchResults.searchResults.NavNext(0);
+ if (elem) elem.focus();
+ }
+ }
+ else if (e.keyCode==27) // Escape out of the search field
+ {
+ this.DOMSearchField().blur();
+ //this.DOMPopupSearchResultsWindow().style.display = 'none';
+ this.DOMSearchClose().style.display = 'none';
+ this.lastSearchValue = '';
+ this.Activate(false);
+ return;
+ }
+
+ // strip whitespaces
+ var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
+
+ if (searchValue != this.lastSearchValue) // search value has changed
+ {
+ if (searchValue != "") // non-empty search
+ {
+ // set timer for search update
+ this.keyTimeout = setTimeout(this.name + '.Search()',
+ this.keyTimeoutLength);
+ }
+ else // empty search field
+ {
+ //this.DOMPopupSearchResultsWindow().style.display = 'none';
+ this.DOMSearchClose().style.display = 'none';
+ this.lastSearchValue = '';
+ }
+ }
+ }
+
+ this.SelectItemCount = function(id)
+ {
+ var count=0;
+ var win=this.DOMSearchSelectWindow();
+ for (i=0;i<win.childNodes.length;i++)
+ {
+ var child = win.childNodes[i]; // get span within a
+ if (child.className=='SelectItem')
+ {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ this.SelectItemSet = function(id)
+ {
+ var i,j=0;
+ var win=this.DOMSearchSelectWindow();
+ for (i=0;i<win.childNodes.length;i++)
+ {
+ var child = win.childNodes[i]; // get span within a
+ if (child.className=='SelectItem')
+ {
+ var node = child.firstChild;
+ if (j==id)
+ {
+ node.innerHTML='•';
+ }
+ else
+ {
+ node.innerHTML=' ';
+ }
+ j++;
+ }
+ }
+ }
+
+ // Called when an search filter selection is made.
+ // set item with index id as the active item
+ this.OnSelectItem = function(id)
+ {
+ this.searchIndex = id;
+ this.SelectItemSet(id);
+ var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
+ if (searchValue!="" && this.searchActive) // something was found -> do a search
+ {
+ this.Search();
+ }
+ }
+
+ this.OnSearchSelectKey = function(evt)
+ {
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
+ {
+ this.searchIndex++;
+ this.OnSelectItem(this.searchIndex);
+ }
+ else if (e.keyCode==38 && this.searchIndex>0) // Up
+ {
+ this.searchIndex--;
+ this.OnSelectItem(this.searchIndex);
+ }
+ else if (e.keyCode==13 || e.keyCode==27)
+ {
+ this.OnSelectItem(this.searchIndex);
+ this.CloseSelectionWindow();
+ this.DOMSearchField().focus();
+ }
+ return false;
+ }
+
+ // --------- Actions
+
+ // Closes the results window.
+ this.CloseResultsWindow = function()
+ {
+ this.DOMPopupSearchResultsWindow().style.display = 'none';
+ this.DOMSearchClose().style.display = 'none';
+ this.Activate(false);
+ }
+
+ this.CloseSelectionWindow = function()
+ {
+ this.DOMSearchSelectWindow().style.display = 'none';
+ }
+
+ // Performs a search.
+ this.Search = function()
+ {
+ this.keyTimeout = 0;
+
+ // strip leading whitespace
+ var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
+
+ var code = searchValue.toLowerCase().charCodeAt(0);
+ var hexCode;
+ if (code<16)
+ {
+ hexCode="0"+code.toString(16);
+ }
+ else
+ {
+ hexCode=code.toString(16);
+ }
+
+ var resultsPage;
+ var resultsPageWithSearch;
+ var hasResultsPage;
+
+ if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1')
+ {
+ resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
+ resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
+ hasResultsPage = true;
+ }
+ else // nothing available for this search term
+ {
+ resultsPage = this.resultsPath + '/nomatches.html';
+ resultsPageWithSearch = resultsPage;
+ hasResultsPage = false;
+ }
+
+ window.frames.MSearchResults.location = resultsPageWithSearch;
+ var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
+
+ if (domPopupSearchResultsWindow.style.display!='block')
+ {
+ var domSearchBox = this.DOMSearchBox();
+ this.DOMSearchClose().style.display = 'inline';
+ if (this.insideFrame)
+ {
+ var domPopupSearchResults = this.DOMPopupSearchResults();
+ domPopupSearchResultsWindow.style.position = 'relative';
+ domPopupSearchResultsWindow.style.display = 'block';
+ var width = document.body.clientWidth - 8; // the -8 is for IE :-(
+ domPopupSearchResultsWindow.style.width = width + 'px';
+ domPopupSearchResults.style.width = width + 'px';
+ }
+ else
+ {
+ var domPopupSearchResults = this.DOMPopupSearchResults();
+ var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
+ var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
+ domPopupSearchResultsWindow.style.display = 'block';
+ left -= domPopupSearchResults.offsetWidth;
+ domPopupSearchResultsWindow.style.top = top + 'px';
+ domPopupSearchResultsWindow.style.left = left + 'px';
+ }
+ }
+
+ this.lastSearchValue = searchValue;
+ this.lastResultsPage = resultsPage;
+ }
+
+ // -------- Activation Functions
+
+ // Activates or deactivates the search panel, resetting things to
+ // their default values if necessary.
+ this.Activate = function(isActive)
+ {
+ if (isActive || // open it
+ this.DOMPopupSearchResultsWindow().style.display == 'block'
+ )
+ {
+ this.DOMSearchBox().className = 'MSearchBoxActive';
+
+ var searchField = this.DOMSearchField();
+
+ if (searchField.value == this.searchLabel) // clear "Search" term upon entry
+ {
+ searchField.value = '';
+ this.searchActive = true;
+ }
+ }
+ else if (!isActive) // directly remove the panel
+ {
+ this.DOMSearchBox().className = 'MSearchBoxInactive';
+ this.DOMSearchField().value = this.searchLabel;
+ this.searchActive = false;
+ this.lastSearchValue = ''
+ this.lastResultsPage = '';
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// The class that handles everything on the search results page.
+function SearchResults(name)
+{
+ // The number of matches from the last run of <Search()>.
+ this.lastMatchCount = 0;
+ this.lastKey = 0;
+ this.repeatOn = false;
+
+ // Toggles the visibility of the passed element ID.
+ this.FindChildElement = function(id)
+ {
+ var parentElement = document.getElementById(id);
+ var element = parentElement.firstChild;
+
+ while (element && element!=parentElement)
+ {
+ if (element.nodeName == 'DIV' && element.className == 'SRChildren')
+ {
+ return element;
+ }
+
+ if (element.nodeName == 'DIV' && element.hasChildNodes())
+ {
+ element = element.firstChild;
+ }
+ else if (element.nextSibling)
+ {
+ element = element.nextSibling;
+ }
+ else
+ {
+ do
+ {
+ element = element.parentNode;
+ }
+ while (element && element!=parentElement && !element.nextSibling);
+
+ if (element && element!=parentElement)
+ {
+ element = element.nextSibling;
+ }
+ }
+ }
+ }
+
+ this.Toggle = function(id)
+ {
+ var element = this.FindChildElement(id);
+ if (element)
+ {
+ if (element.style.display == 'block')
+ {
+ element.style.display = 'none';
+ }
+ else
+ {
+ element.style.display = 'block';
+ }
+ }
+ }
+
+ // Searches for the passed string. If there is no parameter,
+ // it takes it from the URL query.
+ //
+ // Always returns true, since other documents may try to call it
+ // and that may or may not be possible.
+ this.Search = function(search)
+ {
+ if (!search) // get search word from URL
+ {
+ search = window.location.search;
+ search = search.substring(1); // Remove the leading '?'
+ search = unescape(search);
+ }
+
+ search = search.replace(/^ +/, ""); // strip leading spaces
+ search = search.replace(/ +$/, ""); // strip trailing spaces
+ search = search.toLowerCase();
+ search = convertToId(search);
+
+ var resultRows = document.getElementsByTagName("div");
+ var matches = 0;
+
+ var i = 0;
+ while (i < resultRows.length)
+ {
+ var row = resultRows.item(i);
+ if (row.className == "SRResult")
+ {
+ var rowMatchName = row.id.toLowerCase();
+ rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
+
+ if (search.length<=rowMatchName.length &&
+ rowMatchName.substr(0, search.length)==search)
+ {
+ row.style.display = 'block';
+ matches++;
+ }
+ else
+ {
+ row.style.display = 'none';
+ }
+ }
+ i++;
+ }
+ document.getElementById("Searching").style.display='none';
+ if (matches == 0) // no results
+ {
+ document.getElementById("NoMatches").style.display='block';
+ }
+ else // at least one result
+ {
+ document.getElementById("NoMatches").style.display='none';
+ }
+ this.lastMatchCount = matches;
+ return true;
+ }
+
+ // return the first item with index index or higher that is visible
+ this.NavNext = function(index)
+ {
+ var focusItem;
+ while (1)
+ {
+ var focusName = 'Item'+index;
+ focusItem = document.getElementById(focusName);
+ if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
+ {
+ break;
+ }
+ else if (!focusItem) // last element
+ {
+ break;
+ }
+ focusItem=null;
+ index++;
+ }
+ return focusItem;
+ }
+
+ this.NavPrev = function(index)
+ {
+ var focusItem;
+ while (1)
+ {
+ var focusName = 'Item'+index;
+ focusItem = document.getElementById(focusName);
+ if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
+ {
+ break;
+ }
+ else if (!focusItem) // last element
+ {
+ break;
+ }
+ focusItem=null;
+ index--;
+ }
+ return focusItem;
+ }
+
+ this.ProcessKeys = function(e)
+ {
+ if (e.type == "keydown")
+ {
+ this.repeatOn = false;
+ this.lastKey = e.keyCode;
+ }
+ else if (e.type == "keypress")
+ {
+ if (!this.repeatOn)
+ {
+ if (this.lastKey) this.repeatOn = true;
+ return false; // ignore first keypress after keydown
+ }
+ }
+ else if (e.type == "keyup")
+ {
+ this.lastKey = 0;
+ this.repeatOn = false;
+ }
+ return this.lastKey!=0;
+ }
+
+ this.Nav = function(evt,itemIndex)
+ {
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==13) return true;
+ if (!this.ProcessKeys(e)) return false;
+
+ if (this.lastKey==38) // Up
+ {
+ var newIndex = itemIndex-1;
+ var focusItem = this.NavPrev(newIndex);
+ if (focusItem)
+ {
+ var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
+ if (child && child.style.display == 'block') // children visible
+ {
+ var n=0;
+ var tmpElem;
+ while (1) // search for last child
+ {
+ tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
+ if (tmpElem)
+ {
+ focusItem = tmpElem;
+ }
+ else // found it!
+ {
+ break;
+ }
+ n++;
+ }
+ }
+ }
+ if (focusItem)
+ {
+ focusItem.focus();
+ }
+ else // return focus to search field
+ {
+ parent.document.getElementById("MSearchField").focus();
+ }
+ }
+ else if (this.lastKey==40) // Down
+ {
+ var newIndex = itemIndex+1;
+ var focusItem;
+ var item = document.getElementById('Item'+itemIndex);
+ var elem = this.FindChildElement(item.parentNode.parentNode.id);
+ if (elem && elem.style.display == 'block') // children visible
+ {
+ focusItem = document.getElementById('Item'+itemIndex+'_c0');
+ }
+ if (!focusItem) focusItem = this.NavNext(newIndex);
+ if (focusItem) focusItem.focus();
+ }
+ else if (this.lastKey==39) // Right
+ {
+ var item = document.getElementById('Item'+itemIndex);
+ var elem = this.FindChildElement(item.parentNode.parentNode.id);
+ if (elem) elem.style.display = 'block';
+ }
+ else if (this.lastKey==37) // Left
+ {
+ var item = document.getElementById('Item'+itemIndex);
+ var elem = this.FindChildElement(item.parentNode.parentNode.id);
+ if (elem) elem.style.display = 'none';
+ }
+ else if (this.lastKey==27) // Escape
+ {
+ parent.searchBox.CloseResultsWindow();
+ parent.document.getElementById("MSearchField").focus();
+ }
+ else if (this.lastKey==13) // Enter
+ {
+ return true;
+ }
+ return false;
+ }
+
+ this.NavChild = function(evt,itemIndex,childIndex)
+ {
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==13) return true;
+ if (!this.ProcessKeys(e)) return false;
+
+ if (this.lastKey==38) // Up
+ {
+ if (childIndex>0)
+ {
+ var newIndex = childIndex-1;
+ document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
+ }
+ else // already at first child, jump to parent
+ {
+ document.getElementById('Item'+itemIndex).focus();
+ }
+ }
+ else if (this.lastKey==40) // Down
+ {
+ var newIndex = childIndex+1;
+ var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
+ if (!elem) // last child, jump to parent next parent
+ {
+ elem = this.NavNext(itemIndex+1);
+ }
+ if (elem)
+ {
+ elem.focus();
+ }
+ }
+ else if (this.lastKey==27) // Escape
+ {
+ parent.searchBox.CloseResultsWindow();
+ parent.document.getElementById("MSearchField").focus();
+ }
+ else if (this.lastKey==13) // Enter
+ {
+ return true;
+ }
+ return false;
+ }
+}
+
+function setKeyActions(elem,action)
+{
+ elem.setAttribute('onkeydown',action);
+ elem.setAttribute('onkeypress',action);
+ elem.setAttribute('onkeyup',action);
+}
+
+function setClassAttr(elem,attr)
+{
+ elem.setAttribute('class',attr);
+ elem.setAttribute('className',attr);
+}
+
+function createResults()
+{
+ var results = document.getElementById("SRResults");
+ for (var e=0; e<searchData.length; e++)
+ {
+ var id = searchData[e][0];
+ var srResult = document.createElement('div');
+ srResult.setAttribute('id','SR_'+id);
+ setClassAttr(srResult,'SRResult');
+ var srEntry = document.createElement('div');
+ setClassAttr(srEntry,'SREntry');
+ var srLink = document.createElement('a');
+ srLink.setAttribute('id','Item'+e);
+ setKeyActions(srLink,'return searchResults.Nav(event,'+e+')');
+ setClassAttr(srLink,'SRSymbol');
+ srLink.innerHTML = searchData[e][1][0];
+ srEntry.appendChild(srLink);
+ if (searchData[e][1].length==2) // single result
+ {
+ srLink.setAttribute('href',searchData[e][1][1][0]);
+ if (searchData[e][1][1][1])
+ {
+ srLink.setAttribute('target','_parent');
+ }
+ var srScope = document.createElement('span');
+ setClassAttr(srScope,'SRScope');
+ srScope.innerHTML = searchData[e][1][1][2];
+ srEntry.appendChild(srScope);
+ }
+ else // multiple results
+ {
+ srLink.setAttribute('href','javascript:searchResults.Toggle("SR_'+id+'")');
+ var srChildren = document.createElement('div');
+ setClassAttr(srChildren,'SRChildren');
+ for (var c=0; c<searchData[e][1].length-1; c++)
+ {
+ var srChild = document.createElement('a');
+ srChild.setAttribute('id','Item'+e+'_c'+c);
+ setKeyActions(srChild,'return searchResults.NavChild(event,'+e+','+c+')');
+ setClassAttr(srChild,'SRScope');
+ srChild.setAttribute('href',searchData[e][1][c+1][0]);
+ if (searchData[e][1][c+1][1])
+ {
+ srChild.setAttribute('target','_parent');
+ }
+ srChild.innerHTML = searchData[e][1][c+1][2];
+ srChildren.appendChild(srChild);
+ }
+ srEntry.appendChild(srChildren);
+ }
+ srResult.appendChild(srEntry);
+ results.appendChild(srResult);
+ }
+}
+
diff --git a/doc/style.css b/doc/style.css
new file mode 100644
index 0000000..43449be
--- /dev/null
+++ b/doc/style.css
@@ -0,0 +1,107 @@
+body, table, div, p, dl {
+ font-family: arial, verdana, sans, sans-serif;
+ background-color: #FFF;
+ font-size: 12px;
+ margin: 0;
+ padding 0;
+}
+
+div#top {
+ margin: 0 0 0 20em;
+}
+div.header {
+ margin-left: 20em;
+}
+
+div.contents {
+ margin-top: 0px;
+ margin-left: 20em;
+ margin-right: 10px;
+}
+
+.floatright
+{
+ float: right;
+ margin: 0 0 1em 1em;
+}
+
+.timestamp {
+ text-align:right;
+ background-color: #DDD;
+ font-size:75%;
+}
+
+
+div.leftbar
+{
+ text-align:left;
+ float: left;
+ border-right: 1px solid #dddddd;
+ width: 18em;
+ margin: 0 0 0 0;
+ padding: 4 4 4 4;
+ background-color: #ffffff;
+ position: fixed;
+ height: 100%;
+}
+
+div.menu {
+ #display:block;
+ background:#ffffff;
+ font-size: 90%;
+ /*border-top: 2px solid #000000;
+ * border-bottom: 2px solid #000000;
+ * */
+ margin: 0 0 10px 0;
+}
+
+div.menu dl {
+ margin-top: 0px;
+ margin-bottom: 5px;
+}
+
+div.menu dt {
+ font-weight:bold;
+ padding:0 4px 4px 4px;
+ font-size: 110%;
+ text-align: left;
+ text-decoration:none;
+}
+
+div.menu dd {
+ font-weight: bold;
+ margin-left: 0px;
+ padding-left: 20px;
+ padding-bottom: 2px;
+ font-size: 100%;
+}
+
+
+div.leftbar img {
+ border:0;
+}
+
+div.submenu dd {
+ font-size: 70%;
+ margin-left: 8px;
+ padding-left: 10px;
+ padding-bottom: 3px;
+}
+
+div.submenu dd .secondline {
+ margin-left: 12px;
+}
+
+#MSearchBox
+{
+ border: 1px solid black;
+ position: static;
+ margin: 10px;
+ display: block;
+ height: 20px;
+}
+
+#MSearchField
+{
+ background:none;
+}
diff --git a/ignition/msgs/CMakeLists.txt b/ignition/msgs/CMakeLists.txt
new file mode 100644
index 0000000..48a5b9b
--- /dev/null
+++ b/ignition/msgs/CMakeLists.txt
@@ -0,0 +1,278 @@
+include_directories(${PROTOBUF_INCLUDE_DIRS})
+
+set (msgs
+altimeter.proto
+any.proto
+atmosphere.proto
+axis.proto
+battery.proto
+boolean.proto
+boxgeom.proto
+bytes.proto
+camera_cmd.proto
+camera_lens.proto
+camerasensor.proto
+cessna.proto
+clock.proto
+cmd_vel2d.proto
+collision.proto
+color.proto
+contact.proto
+contactsensor.proto
+contacts.proto
+cylindergeom.proto
+density.proto
+diagnostics.proto
+distortion.proto
+double.proto
+double_v.proto
+duration.proto
+empty.proto
+entity_factory.proto
+float.proto
+float_v.proto
+fluid.proto
+fog.proto
+friction.proto
+geometry.proto
+gps.proto
+gps_sensor.proto
+gui_camera.proto
+gui.proto
+header.proto
+heightmapgeom.proto
+hydra.proto
+imagegeom.proto
+image.proto
+images_stamped.proto
+image_stamped.proto
+imu.proto
+imu_sensor.proto
+inertial.proto
+int32.proto
+int32_v.proto
+int64.proto
+int64_v.proto
+joint_animation.proto
+joint_cmd.proto
+joint.proto
+joint_wrench.proto
+joint_wrench_stamped.proto
+joystick.proto
+laserscan.proto
+laserscan_stamped.proto
+light.proto
+link_data.proto
+link.proto
+log_control.proto
+logical_camera_image.proto
+logical_camera_sensor.proto
+log_playback_control.proto
+log_playback_stats.proto
+log_status.proto
+magnetometer.proto
+marker.proto
+marker_v.proto
+material.proto
+meshgeom.proto
+model_configuration.proto
+model.proto
+model_v.proto
+packet.proto
+param.proto
+param_v.proto
+physics.proto
+pid.proto
+planegeom.proto
+plugin.proto
+plugin_v.proto
+pointcloud.proto
+polylinegeom.proto
+pose_animation.proto
+pose.proto
+poses_stamped.proto
+pose_stamped.proto
+pose_trajectory.proto
+pose_v.proto
+projector.proto
+propagation_grid.proto
+propagation_particle.proto
+publishers.proto
+publish.proto
+quaternion.proto
+raysensor.proto
+request.proto
+response.proto
+rest_login.proto
+rest_logout.proto
+rest_post.proto
+rest_response.proto
+road.proto
+scene.proto
+selection.proto
+sensor_noise.proto
+sensor.proto
+server_control.proto
+shadows.proto
+sim_event.proto
+sky.proto
+sonar.proto
+sonar_stamped.proto
+spheregeom.proto
+spherical_coordinates.proto
+stringmsg.proto
+stringmsg_v.proto
+subscribe.proto
+surface.proto
+tactile.proto
+test.proto
+time.proto
+topic_info.proto
+track_visual.proto
+uint32.proto
+uint32_v.proto
+uint64.proto
+uint64_v.proto
+undo_redo.proto
+user_cmd.proto
+user_cmd_stats.proto
+vector2d.proto
+vector3d.proto
+visual.proto
+web_request.proto
+wind.proto
+wireless_node.proto
+wireless_nodes.proto
+world_control.proto
+world_modify.proto
+world_reset.proto
+world_stats.proto
+wrench.proto
+wrench_stamped.proto
+)
+
+set(PROTO_SRCS)
+set(PROTO_HDRS)
+set(PROTO_RB)
+
+# Need to add .exe to executable in windows
+if (WIN32)
+ set(ignmsgs_out_binary "ign_msgs_gen.exe")
+else()
+ set(ignmsgs_out_binary "ign_msgs_gen")
+endif()
+
+foreach(FIL ${msgs})
+ get_filename_component(ABS_FIL ${FIL} ABSOLUTE)
+ get_filename_component(FIL_WE ${FIL} NAME_WE)
+
+ list(APPEND PROTO_SRCS
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.cc")
+ list(APPEND PROTO_HDRS
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.h")
+
+ # Add Ruby generation when we start using protobuf 3, which
+ # should have a built in ruby generator
+ if (WIN32 OR NOT RUBY_PROTOBUF_FOUND)
+ add_custom_command(
+ OUTPUT
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.cc"
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.h"
+ COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
+ ARGS --plugin=protoc-gen-ignmsgs=${CMAKE_BINARY_DIR}/src/${ignmsgs_out_binary}
+ --cpp_out=dllexport_decl=IGNITION_MSGS_VISIBLE:${CMAKE_CURRENT_BINARY_DIR}
+ --java_out ${CMAKE_CURRENT_BINARY_DIR}
+ --ignmsgs_out ${CMAKE_CURRENT_BINARY_DIR}
+ --proto_path ${PROJECT_SOURCE_DIR} ${ABS_FIL}
+ DEPENDS ${ABS_FIL} ign_msgs_gen
+ COMMENT "Running C++, and Java protocol buffer compiler on ${FIL}"
+ VERBATIM)
+ else()
+ list(APPEND PROTO_RB
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.rb")
+
+ add_custom_command(
+ OUTPUT
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.cc"
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/ignition/msgs/${FIL_WE}.pb.rb"
+
+ COMMAND ${PROTOBUF_PROTOC_EXECUTABLE}
+ ARGS --plugin=protoc-gen-ignmsgs=${CMAKE_BINARY_DIR}/src/${ignmsgs_out_binary}
+ --cpp_out=dllexport_decl=IGNITION_MSGS_VISIBLE:${CMAKE_CURRENT_BINARY_DIR}
+ --java_out=${CMAKE_CURRENT_BINARY_DIR}
+ --ruby_out=${CMAKE_CURRENT_BINARY_DIR}
+ --ignmsgs_out ${CMAKE_CURRENT_BINARY_DIR}
+ --proto_path ${PROJECT_SOURCE_DIR} ${ABS_FIL}
+ DEPENDS ${ABS_FIL} ign_msgs_gen
+ COMMENT "Running C++, Java, and Ruby protocol buffer compiler on ${FIL}"
+ VERBATIM )
+ endif()
+
+endforeach()
+
+set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS}
+ PROPERTIES GENERATED TRUE)
+
+link_directories(${IGNITION-MATH_LIBRARY_DIRS})
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+ign_add_library(${PROJECT_LIBRARY_TARGET_NAME}
+ ${PROTO_SRCS} ${PROJECT_SOURCE_DIR}/src/Factory.cc
+ ${PROJECT_SOURCE_DIR}/src/ign.cc
+ ${PROJECT_SOURCE_DIR}/src/Utility.cc)
+target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} ${PROTOBUF_LIBRARY}
+ ${IGNITION-MATH_LIBRARIES})
+
+if (UNIX)
+ # Need to add default visibility to ignition-msgs
+ get_target_property(current_property ${PROJECT_LIBRARY_TARGET_NAME}
+ COMPILE_FLAGS)
+
+ # property non-existent or empty
+ if(NOT current_property)
+ set_target_properties(${PROJECT_LIBRARY_TARGET_NAME}
+ PROPERTIES GENERATED TRUE
+ COMPILE_FLAGS "-fvisibility=default")
+ else()
+ set_target_properties(${PROJECT_LIBRARY_TARGET_NAME}
+ PROPERTIES COMPILE_FLAGS
+ "${current_property} -fvisibility=default")
+ endif()
+endif()
+
+add_dependencies(${PROJECT_LIBRARY_TARGET_NAME} ign_msgs_gen)
+
+set (ign_msgs_headers "" CACHE INTERNAL "Include dirs description")
+
+foreach (hdr ${PROTO_HDRS})
+ string (REPLACE "${CMAKE_CURRENT_BINARY_DIR}/" "" hdr ${hdr})
+ APPEND_TO_CACHED_STRING(ign_msgs_headers
+ "Ignition messages" "#include <${hdr}>\n")
+endforeach()
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/ign_auto_headers.hh.in
+ ${CMAKE_CURRENT_BINARY_DIR}/MessageTypes.hh)
+
+ign_install_includes(
+ "${INCLUDE_INSTALL_DIR_POSTFIX}/ignition/${IGN_PROJECT_NAME}"
+ ${CMAKE_CURRENT_BINARY_DIR}/MessageTypes.hh)
+
+# When the minimum CMake required version will be >= 3.1
+# we could use the target_compile_features() command
+# to enable C++11 support in a platform-independent way.
+if(NOT MSVC)
+ target_compile_options(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC "-std=c++11")
+endif()
+
+target_include_directories(${PROJECT_LIBRARY_TARGET_NAME}
+ PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR_FULL}>)
+
+message(STATUS "Installing Ruby messages to ${RUBY_INSTALL_DIR}/ignition/msgs")
+install(FILES ${PROTO_RB} DESTINATION ${RUBY_INSTALL_DIR}/ignition/msgs)
+
+ign_install_includes(
+ "${INCLUDE_INSTALL_DIR_POSTFIX}/ignition/${IGN_PROJECT_NAME}" ${PROTO_HDRS})
+ign_install_library(${PROJECT_LIBRARY_TARGET_NAME} ${PROJECT_EXPORT_NAME})
+ign_install_includes(
+ "${INCLUDE_INSTALL_DIR_POSTFIX}/ignition/${IGN_PROJECT_NAME}" ${msgs})
diff --git a/ignition/msgs/altimeter.proto b/ignition/msgs/altimeter.proto
new file mode 100644
index 0000000..6972e2e
--- /dev/null
+++ b/ignition/msgs/altimeter.proto
@@ -0,0 +1,25 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "AltimeterProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Altimeter
+/// \brief Data from an altimeter sensor
+
+import "ignition/msgs/time.proto";
+
+/// \brief Altimeter sensor data
+message Altimeter
+{
+ /// \brief Timestamp of the altimeter data
+ optional Time time = 1;
+
+ /// \brief Vertical position data, in meters.
+ optional double vertical_position = 2 [default = 0];
+
+ /// \brief Vertical velocity data, in meters/second.
+ optional double vertical_velocity = 3 [default = 0];
+
+ /// \brief Vertical reference.
+ optional double vertical_reference = 4 [default = 0];
+}
diff --git a/ignition/msgs/any.proto b/ignition/msgs/any.proto
new file mode 100644
index 0000000..06c43e0
--- /dev/null
+++ b/ignition/msgs/any.proto
@@ -0,0 +1,82 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "EmptyProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Any
+/// \brief A message that is capable of containing a wide variety of data types.
+
+import "ignition/msgs/color.proto";
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/quaternion.proto";
+import "ignition/msgs/time.proto";
+import "ignition/msgs/vector3d.proto";
+
+message Any
+{
+ /// \brief The type of data the message contains.
+ enum ValueType
+ {
+ /// \brief Indicates that the message is empty
+ NONE = 1;
+
+ /// \brief Indicates that the message contains a double
+ DOUBLE = 2;
+
+ /// \brief Indicates that the message contains an int32
+ INT32 = 3;
+
+ /// \brief Indicates that the message contains a string
+ STRING = 4;
+
+ /// \brief Indicates that the message contains a Boolean
+ BOOLEAN = 5;
+
+ /// \brief Indicates that the message contains a Vector3d
+ VECTOR3D = 6;
+
+ /// \brief Indicates that the message contains a Color
+ COLOR = 7;
+
+ /// \brief Indicates that the message contains a Pose
+ POSE3D = 8;
+
+ /// \brief Indicates that the message contains a Quaternion
+ QUATERNIOND = 9;
+
+ /// \brief Indicates that the message contains a Time
+ TIME = 10;
+ }
+
+ /// \todo: Use protobuf oneof feature when we support protobuf 2.6
+
+ /// \brief Type of value that is contained in this message.
+ required ValueType type = 1 [default = NONE];
+
+ /// \brief A double value
+ optional double double_value = 2;
+
+ /// \brief An int32 value
+ optional int32 int_value = 3;
+
+ /// \brief A string value
+ optional string string_value = 4;
+
+ /// \brief A boolean value
+ optional bool bool_value = 5;
+
+ /// \brief A Vector3d value
+ optional Vector3d vector3d_value = 6;
+
+ /// \brief A Color value
+ optional Color color_value = 7;
+
+ /// \brief A Pose value
+ optional Pose pose3d_value = 8;
+
+ /// \brief A Quaternion value
+ optional Quaternion quaternion_value = 9;
+
+ /// \brief A Time value
+ optional Time time_value = 10;
+}
diff --git a/ignition/msgs/atmosphere.proto b/ignition/msgs/atmosphere.proto
new file mode 100644
index 0000000..20a7aea
--- /dev/null
+++ b/ignition/msgs/atmosphere.proto
@@ -0,0 +1,33 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "AtmosphereProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Atmosphere
+/// \brief A message containing a description of the global atmosphere properties
+
+
+message Atmosphere
+{
+ /// \brief Types of atmosphere models.
+ enum Type
+ {
+ /// \brief Adiabatic atmosphere model.
+ ADIABATIC = 1;
+ }
+
+ /// \brief Type of the atmosphere model.
+ optional Type type = 1[default=ADIABATIC];
+
+ /// \brief Temperature at sea level in kelvins.
+ optional double temperature = 2;
+
+ /// \brief Pressure at sea level in pascals.
+ optional double pressure = 3;
+
+ /// \brief Mass density of the air at sea level in kg/m^3.
+ optional double mass_density = 4;
+
+ /// \brief Enable atmosphere model
+ optional bool enable_atmosphere = 5;
+}
diff --git a/ignition/msgs/axis.proto b/ignition/msgs/axis.proto
new file mode 100644
index 0000000..6a06d45
--- /dev/null
+++ b/ignition/msgs/axis.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "AxisProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Axis
+/// \brief msgs::Joint axis message
+
+import "ignition/msgs/vector3d.proto";
+
+message Axis
+{
+ optional Vector3d xyz = 1;
+ optional double limit_lower = 2 [default = 0];
+ optional double limit_upper = 3 [default = 0];
+ optional double limit_effort = 4 [default = 0];
+ optional double limit_velocity = 5 [default = 0];
+ optional double damping = 6 [default = 0];
+ optional double friction = 7 [default = 0];
+ optional bool use_parent_model_frame = 8 [default = false];
+}
diff --git a/ignition/msgs/battery.proto b/ignition/msgs/battery.proto
new file mode 100644
index 0000000..19ad3b1
--- /dev/null
+++ b/ignition/msgs/battery.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "BatteryProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Battery
+/// \brief Message for a battery
+
+message Battery
+{
+ /// \brief Name of the battery
+ optional string name = 1 [default = ""];
+
+ /// \brief Real voltage in volts.
+ optional double voltage = 2 [default = 0];
+}
diff --git a/ignition/msgs/boolean.proto b/ignition/msgs/boolean.proto
new file mode 100644
index 0000000..501190b
--- /dev/null
+++ b/ignition/msgs/boolean.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "BoolProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Bool
+/// \brief Boolean message
+
+message Boolean
+{
+ /// \brief Boolean data
+ optional bool data = 1 [default = false];
+}
diff --git a/ignition/msgs/boxgeom.proto b/ignition/msgs/boxgeom.proto
new file mode 100644
index 0000000..6f24c7c
--- /dev/null
+++ b/ignition/msgs/boxgeom.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "BoxGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface BoxGeom
+/// \brief Information about a box geometry
+
+import "ignition/msgs/vector3d.proto";
+
+message BoxGeom
+{
+ optional Vector3d size = 1;
+}
diff --git a/ignition/msgs/bytes.proto b/ignition/msgs/bytes.proto
new file mode 100644
index 0000000..2c790ca
--- /dev/null
+++ b/ignition/msgs/bytes.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "BytesProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Bytes
+/// \brief Bytes message
+
+message Bytes
+{
+ /// \brief Bytes data
+ optional bytes data = 1;
+}
diff --git a/ignition/msgs/camera_cmd.proto b/ignition/msgs/camera_cmd.proto
new file mode 100644
index 0000000..ef0115d
--- /dev/null
+++ b/ignition/msgs/camera_cmd.proto
@@ -0,0 +1,12 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CameraCmdProtos";
+
+/// \ingroup ignition.msgs
+/// \interface CameraCmd
+/// \brief Message for camera command
+
+message CameraCmd
+{
+ optional string follow_model = 1;
+}
diff --git a/ignition/msgs/camera_lens.proto b/ignition/msgs/camera_lens.proto
new file mode 100644
index 0000000..79bea22
--- /dev/null
+++ b/ignition/msgs/camera_lens.proto
@@ -0,0 +1,48 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CameraLensProtos";
+
+/// \ingroup ignition.msgs
+/// \interface CameraLens
+/// \brief Information and control over a camera lens element
+
+message CameraLens
+{
+ /// \brief Type of projection of the lens
+ /// possible values are "gnomonical", "stereographic", "equidistant",
+ /// "equisolid_angle", "stereographic", "custom".
+ /// If you set this value to "custom" you need to specify at least one
+ /// of the `c1`, `c2`, `c3`, `f` or `fun`.
+ optional string type = 1 [default="gnomoical"];
+
+ /// \brief Linear image scaling factor
+ optional double c1 = 2;
+
+ /// \brief Angle scaling factor
+ optional double c2 = 3;
+
+ /// \brief Angle offset factor
+ optional double c3 = 4;
+
+ /// \brief Linear scaling factor, unlike `c1`, will be adjusted to match hfov
+ /// if scale_to_fov is set to `true`.
+ optional double f = 5;
+
+ /// \brief Angle modification function
+ // possible values are "tan", "sin" and "id".
+ optional string fun = 6;
+
+ /// \brief Scale image to fit horizontal FOV
+ optional bool scale_to_hfov = 7;
+
+ /// \brief Everything outside of this angle will be hidden,
+ /// the angle is counted from camera's X (forward) axis.
+ optional double cutoff_angle = 8;
+
+ /// \brief Horizontal field of view in radians.
+ optional double hfov = 9;
+
+ /// \brief Size of cube map texture,
+ /// used to store intermediate rendering result.
+ optional int32 env_texture_size = 10;
+}
diff --git a/ignition/msgs/camerasensor.proto b/ignition/msgs/camerasensor.proto
new file mode 100644
index 0000000..3719171
--- /dev/null
+++ b/ignition/msgs/camerasensor.proto
@@ -0,0 +1,22 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CameraSensorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface CameraSensor
+/// \brief Information about a camera sensor element
+
+import "ignition/msgs/vector2d.proto";
+import "ignition/msgs/distortion.proto";
+
+message CameraSensor
+{
+ optional double horizontal_fov = 1;
+ optional Vector2d image_size = 2;
+ optional string image_format = 3;
+ optional double near_clip = 4;
+ optional double far_clip = 5;
+ optional bool save_enabled = 6;
+ optional string save_path = 7;
+ optional Distortion distortion = 8;
+}
diff --git a/ignition/msgs/cessna.proto b/ignition/msgs/cessna.proto
new file mode 100644
index 0000000..7380768
--- /dev/null
+++ b/ignition/msgs/cessna.proto
@@ -0,0 +1,52 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CessnaProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Cessna
+/// \brief Cessna message
+
+message Cessna
+{
+ /// \brief Current RPM of the propeller.
+ optional float propeller_speed = 1;
+
+ /// \brief Current left aileron angle in rads.
+ optional float left_aileron = 2;
+
+ /// \brief Current left flap angle in rads.
+ optional float left_flap = 3;
+
+ /// \brief Current right aileron angle in rads.
+ optional float right_aileron = 4;
+
+ /// \brief Current right flap angle in rads.
+ optional float right_flap = 5;
+
+ /// \brief Current elevators angle in rads.
+ optional float elevators = 6;
+
+ /// \brief Current ruddle angle in rads.
+ optional float rudder = 7;
+
+ /// \brief Target RPM of the propeller.
+ optional float cmd_propeller_speed = 8;
+
+ /// \brief Target left aileron angle in rads.
+ optional float cmd_left_aileron = 9;
+
+ /// \brief Target left flap angle in rads.
+ optional float cmd_left_flap = 10;
+
+ /// \brief Target right aileron angle in rads.
+ optional float cmd_right_aileron = 11;
+
+ /// \brief Target right flap angle in rads.
+ optional float cmd_right_flap = 12;
+
+ /// \brief Target elevators angle in rads.
+ optional float cmd_elevators = 13;
+
+ /// \brief Target ruddle angle in rads.
+ optional float cmd_rudder = 14;
+}
diff --git a/ignition/msgs/clock.proto b/ignition/msgs/clock.proto
new file mode 100644
index 0000000..d59259b
--- /dev/null
+++ b/ignition/msgs/clock.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ClockProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Clock
+/// \brief A message with clock information
+
+import "ignition/msgs/time.proto";
+
+message Clock
+{
+ optional Time system = 1;
+ optional Time real = 2;
+ optional Time sim = 3;
+}
diff --git a/ignition/msgs/cmd_vel2d.proto b/ignition/msgs/cmd_vel2d.proto
new file mode 100644
index 0000000..05e6eb6
--- /dev/null
+++ b/ignition/msgs/cmd_vel2d.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CmdVel2DProtos";
+
+/// \ingroup ignition.msgs
+/// \interface CmdVel2D
+/// \brief A planar velocity and orientation.
+
+message CmdVel2D
+{
+ optional double velocity = 1 [default = 0];
+ optional double theta = 2 [default = 0];
+}
diff --git a/ignition/msgs/collision.proto b/ignition/msgs/collision.proto
new file mode 100644
index 0000000..0b5cdfa
--- /dev/null
+++ b/ignition/msgs/collision.proto
@@ -0,0 +1,26 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CollisionProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Collision
+/// \brief Information about a collision element
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/geometry.proto";
+import "ignition/msgs/surface.proto";
+import "ignition/msgs/visual.proto";
+
+message Collision
+{
+ optional uint32 id = 1 [default = 0];
+ optional string name = 2 [default = ""];
+ optional double laser_retro = 3;
+ optional double max_contacts = 4;
+ optional Pose pose = 5;
+ optional Geometry geometry = 6;
+ optional Surface surface = 7;
+
+ repeated Visual visual = 8;
+}
+
diff --git a/ignition/msgs/color.proto b/ignition/msgs/color.proto
new file mode 100644
index 0000000..a4b22cc
--- /dev/null
+++ b/ignition/msgs/color.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ColorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Color
+/// \brief Color message
+
+
+message Color
+{
+ optional float r = 2 [default = 0.0];
+ optional float g = 3 [default = 0.0];
+ optional float b = 4 [default = 0.0];
+ optional float a = 5 [default = 1.0];
+}
diff --git a/ignition/msgs/contact.proto b/ignition/msgs/contact.proto
new file mode 100644
index 0000000..1e9c48d
--- /dev/null
+++ b/ignition/msgs/contact.proto
@@ -0,0 +1,25 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ContactProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Contact
+/// \brief Contact message for passing info between two entities
+
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/time.proto";
+import "ignition/msgs/joint_wrench.proto";
+
+message Contact
+{
+ optional string collision1 = 1 [default = ""];
+ optional string collision2 = 2 [default = ""];
+
+ repeated Vector3d position = 3;
+ repeated Vector3d normal = 4;
+ repeated double depth = 5;
+ repeated JointWrench wrench = 6;
+
+ optional Time time = 7;
+ optional string world = 8 [default = "default"];
+}
diff --git a/ignition/msgs/contacts.proto b/ignition/msgs/contacts.proto
new file mode 100644
index 0000000..0bedb3a
--- /dev/null
+++ b/ignition/msgs/contacts.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ContactsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Contacts
+/// \brief Contacts from collision detection
+
+
+import "ignition/msgs/contact.proto";
+import "ignition/msgs/time.proto";
+
+message Contacts
+{
+ repeated Contact contact = 1;
+ optional Time time = 2;
+}
diff --git a/ignition/msgs/contactsensor.proto b/ignition/msgs/contactsensor.proto
new file mode 100644
index 0000000..540404c
--- /dev/null
+++ b/ignition/msgs/contactsensor.proto
@@ -0,0 +1,12 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ContactSensorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface ContactSensor
+/// \brief Information about a contact sensor element
+
+message ContactSensor
+{
+ optional string collision_name = 1;
+}
diff --git a/ignition/msgs/cylindergeom.proto b/ignition/msgs/cylindergeom.proto
new file mode 100644
index 0000000..247a683
--- /dev/null
+++ b/ignition/msgs/cylindergeom.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "CylinderGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface CylinderGeom
+/// \brief Information about a cylinder geometry
+
+message CylinderGeom
+{
+ optional double radius = 1 [default = 0];
+ optional double length = 2 [default = 0];
+}
diff --git a/ignition/msgs/density.proto b/ignition/msgs/density.proto
new file mode 100644
index 0000000..2d0f91b
--- /dev/null
+++ b/ignition/msgs/density.proto
@@ -0,0 +1,12 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "DensityProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Density
+/// \brief Information about density
+
+message Density
+{
+ optional double density = 1 [default = 0];
+}
diff --git a/ignition/msgs/diagnostics.proto b/ignition/msgs/diagnostics.proto
new file mode 100644
index 0000000..9504326
--- /dev/null
+++ b/ignition/msgs/diagnostics.proto
@@ -0,0 +1,25 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "DiagnosticsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Diagnostics
+/// \brief Diagnostic information about a running instance of Gazebo.
+/// Gazebo must have been compiled with the ENABLE_DIAGNOSTICS flag.
+
+import "ignition/msgs/time.proto";
+
+message Diagnostics
+{
+ message DiagTime
+ {
+ optional string name = 1 [default = ""];
+ optional Time elapsed = 2;
+ optional Time wall = 3;
+ }
+
+ repeated DiagTime time = 1;
+ optional Time real_time = 2;
+ optional Time sim_time = 3;
+ optional double real_time_factor = 4 [default = 0.0];
+}
diff --git a/ignition/msgs/distortion.proto b/ignition/msgs/distortion.proto
new file mode 100644
index 0000000..dab5a7c
--- /dev/null
+++ b/ignition/msgs/distortion.proto
@@ -0,0 +1,19 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "DistortionProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Distortion
+/// \brief Information about a distortion element
+
+import "ignition/msgs/vector2d.proto";
+
+message Distortion
+{
+ optional Vector2d center = 1;
+ optional double k1 = 2;
+ optional double k2 = 3;
+ optional double k3 = 4;
+ optional double p1 = 5;
+ optional double p2 = 6;
+}
diff --git a/ignition/msgs/double.proto b/ignition/msgs/double.proto
new file mode 100644
index 0000000..9d56aa0
--- /dev/null
+++ b/ignition/msgs/double.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "DoubleProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Double
+/// \brief A message for double data
+
+message Double
+{
+ /// \brief Double data
+ optional double data = 1 [default = 0.0];
+}
diff --git a/ignition/msgs/double_v.proto b/ignition/msgs/double_v.proto
new file mode 100644
index 0000000..3319357
--- /dev/null
+++ b/ignition/msgs/double_v.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "DoubleVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Double_V
+/// \brief A message for a vector of double data
+
+message Double_V
+{
+ /// \brief Vector of double data
+ repeated double data = 1;
+}
diff --git a/ignition/msgs/duration.proto b/ignition/msgs/duration.proto
new file mode 100644
index 0000000..6af4d60
--- /dev/null
+++ b/ignition/msgs/duration.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "DurationProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Duration
+/// \brief A message for duration data
+
+message Duration
+{
+ /// \brief Seconds
+ optional int64 sec = 1 [default = 0];
+
+ /// \brief Nanoseconds
+ optional int32 nsec = 2 [default = 0];
+}
diff --git a/ignition/msgs/empty.proto b/ignition/msgs/empty.proto
new file mode 100644
index 0000000..090e0bf
--- /dev/null
+++ b/ignition/msgs/empty.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "EmptyProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Empty
+/// \brief An empty message.
+
+message Empty
+{
+ /// \brief Unused field.
+ optional bool unused = 1;
+}
diff --git a/ignition/msgs/entity_factory.proto b/ignition/msgs/entity_factory.proto
new file mode 100644
index 0000000..dbe587a
--- /dev/null
+++ b/ignition/msgs/entity_factory.proto
@@ -0,0 +1,48 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "EntityFactoryProtos";
+
+/// \ingroup ignition.msgs
+/// \interface EntityFactory
+/// \brief Message to create new entities in gazebo, at a given pose.
+/// A model can be created in one of the following ways:
+///
+/// 1. From an SDF string (sdf field)
+/// 2. From an SDF file (sdf_filename)
+/// 3. Cloning an existing model (clone_model_name)
+///
+/// If more than one way is specified, the first field will be parsed and the
+/// following ignored.
+///
+/// The message can also be used to edit an existing entity. The new entity
+/// description is pushed into the entity named `edit_name`.
+/// See issue #1954 for the current limitations using this method to edit
+/// entities.
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/light.proto";
+
+message EntityFactory
+{
+ /// \brief SDF description in string format.
+ optional string sdf = 1;
+
+ /// \brief Full path to SDF file.
+ optional string sdf_filename = 2;
+
+ /// \brief Pose where the entity will be spawned.
+ optional Pose pose = 3;
+
+ /// \brief Name of the entity which will be updated.
+ optional string edit_name = 4;
+
+ /// \brief Name of model to clone.
+ optional string clone_model_name = 5;
+
+ /// \brief Whether the server is allowed to rename the model in case of
+ /// overlap with existing models.
+ optional bool allow_renaming = 6;
+
+ /// \brief For inserting lights.
+ optional Light light = 7;
+}
diff --git a/ignition/msgs/float.proto b/ignition/msgs/float.proto
new file mode 100644
index 0000000..e092844
--- /dev/null
+++ b/ignition/msgs/float.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "FloatProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Float
+/// \brief A message for float data
+
+message Float
+{
+ /// \brief Float data
+ optional float data = 1;
+}
diff --git a/ignition/msgs/float_v.proto b/ignition/msgs/float_v.proto
new file mode 100644
index 0000000..481e7e5
--- /dev/null
+++ b/ignition/msgs/float_v.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "FloatVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Float_V
+/// \brief A message for a vector of float data
+
+message Float_V
+{
+ /// \brief Vector of float data
+ repeated float data = 1;
+}
diff --git a/ignition/msgs/fluid.proto b/ignition/msgs/fluid.proto
new file mode 100644
index 0000000..666b9ad
--- /dev/null
+++ b/ignition/msgs/fluid.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "FluidProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Fluid
+/// \brief msg passing fluid particle position
+
+import "ignition/msgs/vector3d.proto";
+
+message Fluid
+{
+ // Name of the fluid
+ optional string name = 1;
+
+ // Position of each particle in the fluid.
+ repeated Vector3d position = 2;
+}
diff --git a/ignition/msgs/fog.proto b/ignition/msgs/fog.proto
new file mode 100644
index 0000000..0ef4d63
--- /dev/null
+++ b/ignition/msgs/fog.proto
@@ -0,0 +1,25 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "FogProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Fog
+/// \brief Message for fog data
+
+import "ignition/msgs/color.proto";
+
+message Fog
+{
+ enum FogType
+ {
+ NONE = 1;
+ LINEAR = 2;
+ EXPONENTIAL = 3;
+ EXPONENTIAL2 = 4;
+ }
+ optional FogType type = 1;
+ optional Color color = 2;
+ optional float density = 3;
+ optional float start = 4;
+ optional float end = 5;
+}
diff --git a/ignition/msgs/friction.proto b/ignition/msgs/friction.proto
new file mode 100644
index 0000000..3b3d763
--- /dev/null
+++ b/ignition/msgs/friction.proto
@@ -0,0 +1,62 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "FrictionProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Friction
+/// \brief Information about friction
+
+import "ignition/msgs/vector3d.proto";
+
+message Friction
+{
+ message Torsional
+ {
+ message ODE
+ {
+ /// \brief Force dependent slip for torsional friction, between the range
+ /// of [0..1].
+ optional double slip = 1;
+ }
+
+ /// \brief Torsional coefficient of friction in the range of [0..1].
+ optional double coefficient = 1;
+
+ /// \brief By default, torsional friction is calculated using the
+ /// "patch_radius", which is sqrt(R*d), where "R" is the radius of the
+ /// collision at the contact point (surface_radius) and "d" is the contact
+ /// depth. If this flag is set to false, surface_radius and contact depth
+ /// will be used instead of patch radius.
+ optional bool use_patch_radius = 2;
+
+ /// \brief Radius of contact patch surface, used for torsional friction.
+ optional double patch_radius = 3;
+
+ /// \brief Surface radius on the point of contact, used for torsional
+ /// friction.
+ optional double surface_radius = 4;
+
+ /// \brief Torsional friction information exclusive to ODE physics engine.
+ optional ODE ode = 5;
+ }
+
+ /// \brief Coefficient of friction in the range of [0..1].
+ optional double mu = 1;
+
+ /// \brief Second coefficient of friction in the range of [0..1].
+ optional double mu2 = 2;
+
+ /// \brief Direction of mu1 in the collision local reference frame.
+ optional Vector3d fdir1 = 3;
+
+ /// \brief Force dependent slip direction 1 in collision local frame, between
+ /// the range of [0..1].
+ optional double slip1 = 4;
+
+ /// \brief Force dependent slip direction 2 in collision local frame, between
+ /// the range of [0..1].
+ optional double slip2 = 5;
+
+ /// \brief Torsional friction.
+ optional Torsional torsional = 6;
+}
diff --git a/ignition/msgs/geometry.proto b/ignition/msgs/geometry.proto
new file mode 100644
index 0000000..9a15419
--- /dev/null
+++ b/ignition/msgs/geometry.proto
@@ -0,0 +1,47 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "GeometryProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Geometry
+/// \brief Information about a geometry element
+
+import "ignition/msgs/boxgeom.proto";
+import "ignition/msgs/cylindergeom.proto";
+import "ignition/msgs/spheregeom.proto";
+import "ignition/msgs/planegeom.proto";
+import "ignition/msgs/imagegeom.proto";
+import "ignition/msgs/heightmapgeom.proto";
+import "ignition/msgs/meshgeom.proto";
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/polylinegeom.proto";
+
+message Geometry
+{
+ enum Type
+ {
+ BOX = 1;
+ CYLINDER = 2;
+ SPHERE = 3;
+ PLANE = 4;
+ IMAGE = 5;
+ HEIGHTMAP = 6;
+ MESH = 7;
+ TRIANGLE_FAN = 8;
+ LINE_STRIP = 9;
+ POLYLINE = 10;
+ EMPTY = 11;
+ }
+
+ optional Type type = 1;
+ optional BoxGeom box = 2;
+ optional CylinderGeom cylinder = 3;
+ optional PlaneGeom plane = 4;
+ optional SphereGeom sphere = 5;
+ optional ImageGeom image = 6;
+ optional HeightmapGeom heightmap = 7;
+ optional MeshGeom mesh = 8;
+
+ repeated Vector3d points = 9;
+ repeated Polyline polyline = 10;
+}
diff --git a/ignition/msgs/gps.proto b/ignition/msgs/gps.proto
new file mode 100644
index 0000000..a4f3e4f
--- /dev/null
+++ b/ignition/msgs/gps.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "GPSProtos";
+
+/// \ingroup ignition.msgs
+/// \interface GPS
+/// \brief Data from a GPS sensor
+
+import "ignition/msgs/time.proto";
+
+message GPS
+{
+ optional Time time = 1;
+ optional string link_name = 2;
+ optional double latitude_deg = 3;
+ optional double longitude_deg = 4;
+ optional double altitude = 5;
+ optional double velocity_east = 6;
+ optional double velocity_north = 7;
+ optional double velocity_up = 8;
+}
diff --git a/ignition/msgs/gps_sensor.proto b/ignition/msgs/gps_sensor.proto
new file mode 100644
index 0000000..b63cf92
--- /dev/null
+++ b/ignition/msgs/gps_sensor.proto
@@ -0,0 +1,30 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Protos";
+
+/// \ingroup ignition.msgs
+/// \interface GPSSensor
+/// \brief Information about a GPS sensor element
+
+import "ignition/msgs/sensor_noise.proto";
+
+message GPSSensor
+{
+ /// \brief Sensing information
+ message Sensing
+ {
+ /// \brief Horizontal noise
+ optional SensorNoise horizontal_noise = 1;
+
+ /// \brief Vertical noise
+ optional SensorNoise vertical_noise = 2;
+ }
+
+ /// \brief Position sensing. Consists of horizontal and vertical noise
+ /// properties
+ optional Sensing position = 1;
+
+ /// \brief Velocity sensing. Consists of horizontal and vertical noise
+ /// properties
+ optional Sensing velocity = 2;
+}
diff --git a/ignition/msgs/gui.proto b/ignition/msgs/gui.proto
new file mode 100644
index 0000000..2bed0ec
--- /dev/null
+++ b/ignition/msgs/gui.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "GUIProtos";
+
+/// \ingroup ignition.msgs
+/// \interface GUI
+/// \brief Message for a GUI
+
+import "ignition/msgs/gui_camera.proto";
+import "ignition/msgs/plugin.proto";
+
+message GUI
+{
+ optional bool fullscreen = 1;
+ optional GUICamera camera = 2;
+ repeated Plugin plugin = 3;
+}
diff --git a/ignition/msgs/gui_camera.proto b/ignition/msgs/gui_camera.proto
new file mode 100644
index 0000000..069546c
--- /dev/null
+++ b/ignition/msgs/gui_camera.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "GUICameraProtos";
+
+/// \ingroup ignition.msgs
+/// \interface GUICamera
+/// \brief Message for a GUI Camera
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/track_visual.proto";
+
+message GUICamera
+{
+ optional string name = 1;
+ optional string view_controller = 2;
+ optional Pose pose = 3;
+ optional TrackVisual track = 4;
+
+ /// \brief Type of projection: "perspective" or "orthographic".
+ optional string projection_type = 5;
+}
diff --git a/ignition/msgs/header.proto b/ignition/msgs/header.proto
new file mode 100644
index 0000000..0781d23
--- /dev/null
+++ b/ignition/msgs/header.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "HeaderProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Header
+/// \brief General information included by many messages
+
+import "ignition/msgs/time.proto";
+
+message Header
+{
+ optional string str_id = 1;
+ optional Time stamp = 2;
+ optional int32 index = 3;
+}
diff --git a/ignition/msgs/heightmapgeom.proto b/ignition/msgs/heightmapgeom.proto
new file mode 100644
index 0000000..27101e9
--- /dev/null
+++ b/ignition/msgs/heightmapgeom.proto
@@ -0,0 +1,40 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "HeightmapGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface HeightmapGeom
+/// \brief Message for a heightmap geometry
+
+import "ignition/msgs/image.proto";
+import "ignition/msgs/vector3d.proto";
+
+message HeightmapGeom
+{
+ optional Image image = 1; // The height data
+ optional Vector3d size = 2; // Size in meters
+ optional Vector3d origin = 3; // Origin in world coordinate frame
+ repeated float heights = 4;
+ optional int32 width = 5;
+ optional int32 height = 6;
+
+ message Texture
+ {
+ optional string diffuse = 1;
+ optional string normal = 2;
+ optional double size = 3;
+ }
+
+ message Blend
+ {
+ optional double min_height = 1;
+ optional double fade_dist = 2;
+ }
+
+ repeated Texture texture = 7; // List of textures
+ repeated Blend blend = 8; // How to blend the textures
+ optional bool use_terrain_paging = 9; // Enable terrain paging in rendering
+
+ // The image filename
+ optional string filename = 10;
+}
diff --git a/ignition/msgs/hydra.proto b/ignition/msgs/hydra.proto
new file mode 100644
index 0000000..9123879
--- /dev/null
+++ b/ignition/msgs/hydra.proto
@@ -0,0 +1,54 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "HydraProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Hydra
+/// \brief Message that contains information about a Hydra Razer controller
+
+import "ignition/msgs/pose.proto";
+
+message Hydra
+{
+ message Paddle
+ {
+ // Pose of the paddle
+ optional Pose pose = 1;
+
+ // The button labeled LB
+ optional bool button_bumper = 2;
+
+ // Button 1
+ optional bool button_1 = 3;
+
+ // Button 2
+ optional bool button_2 = 4;
+
+ // Button 3
+ optional bool button_3 = 5;
+
+ // Button 4
+ optional bool button_4 = 6;
+
+ // Button that is activated by pressing down on the joystick.
+ optional bool button_joy = 7;
+
+ // The button located between button 1 and 2.
+ optional bool button_center = 8;
+
+ // Range(-1, 1) where -1 == back, and +1 == forward.
+ optional double joy_x = 9;
+
+ // Range(-1, 1) where -1 == left, and +1 == right.
+ optional double joy_y = 10;
+
+ // Range(0, 1) where 0 is no press, and 1 is full press.
+ optional double trigger = 11;
+ }
+
+ // Info for the right paddle
+ optional Paddle right = 1;
+
+ // Info for the left paddle
+ optional Paddle left = 2;
+}
diff --git a/ignition/msgs/ign_auto_headers.hh.in b/ignition/msgs/ign_auto_headers.hh.in
new file mode 100644
index 0000000..91d00ab
--- /dev/null
+++ b/ignition/msgs/ign_auto_headers.hh.in
@@ -0,0 +1,2 @@
+// Automatically generated
+${ign_msgs_headers}
diff --git a/ignition/msgs/image.proto b/ignition/msgs/image.proto
new file mode 100644
index 0000000..6e469d0
--- /dev/null
+++ b/ignition/msgs/image.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ImageProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Image
+/// \brief Message for an image
+
+message Image
+{
+ optional uint32 width = 1; // Image width (number of columns)
+ optional uint32 height = 2; // Image height (number of rows)
+ optional uint32 pixel_format = 3; // Corresponds to Image::PixelFormat enum
+ optional uint32 step = 4; // Full row length in bytes
+ // repeated uint32 data = 5; // Actual data, size if (step * rows)
+ optional bytes data = 5; // Actual data, size if (step * rows)
+}
diff --git a/ignition/msgs/image_stamped.proto b/ignition/msgs/image_stamped.proto
new file mode 100644
index 0000000..e6239b6
--- /dev/null
+++ b/ignition/msgs/image_stamped.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ImageStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface ImageStamped
+/// \brief Message for an image with a time
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/image.proto";
+
+message ImageStamped
+{
+ // Time when the data was captured
+ optional Time time = 1;
+ optional Image image = 2;
+}
diff --git a/ignition/msgs/imagegeom.proto b/ignition/msgs/imagegeom.proto
new file mode 100644
index 0000000..47dc7d8
--- /dev/null
+++ b/ignition/msgs/imagegeom.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ImageGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface ImageGeom
+/// \brief Message for a image geometry
+
+message ImageGeom
+{
+ optional string uri = 1;
+ optional double scale = 2;
+ optional int32 threshold = 3 [default = 255];
+ optional double height = 4;
+ optional int32 granularity = 5;
+}
diff --git a/ignition/msgs/images_stamped.proto b/ignition/msgs/images_stamped.proto
new file mode 100644
index 0000000..0dd7e1e
--- /dev/null
+++ b/ignition/msgs/images_stamped.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ImagesStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface ImagesStamped
+/// \brief Message for a multiple image with a time
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/image.proto";
+
+message ImagesStamped
+{
+ // Time when all the images were captured
+ optional Time time = 1;
+ repeated Image image = 2;
+}
diff --git a/ignition/msgs/imu.proto b/ignition/msgs/imu.proto
new file mode 100644
index 0000000..8ade324
--- /dev/null
+++ b/ignition/msgs/imu.proto
@@ -0,0 +1,20 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "IMUProtos";
+
+/// \ingroup ignition.msgs
+/// \interface IMU
+/// \brief Data from an IMU sensor
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/quaternion.proto";
+
+message IMU
+{
+ optional Time stamp = 1;
+ optional string entity_name = 2;
+ optional Quaternion orientation = 3;
+ optional Vector3d angular_velocity = 4;
+ optional Vector3d linear_acceleration = 5;
+}
diff --git a/ignition/msgs/imu_sensor.proto b/ignition/msgs/imu_sensor.proto
new file mode 100644
index 0000000..2151187
--- /dev/null
+++ b/ignition/msgs/imu_sensor.proto
@@ -0,0 +1,44 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "IMUSensorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface IMUSensor
+/// \brief Information about an imu sensor
+
+import "ignition/msgs/sensor_noise.proto";
+
+message IMUSensor
+{
+ /// \brief Angular velocity information
+ message AngularVelocity
+ {
+ /// \brief Noise about the x-axis
+ optional SensorNoise x_noise = 1;
+
+ /// \brief Noise about the y-axis
+ optional SensorNoise y_noise = 2;
+
+ /// \brief Noise about the z-axis
+ optional SensorNoise z_noise = 3;
+ }
+
+ /// \brief Linear acceleration information
+ message LinearAcceleration
+ {
+ /// \brief Noise about the x-axis
+ optional SensorNoise x_noise = 1;
+
+ /// \brief Noise about the y-axis
+ optional SensorNoise y_noise = 2;
+
+ /// \brief Noise about the z-axis
+ optional SensorNoise z_noise = 3;
+ }
+
+ /// \brief Angular velocity information
+ optional AngularVelocity angular_velocity = 1;
+
+ /// \brief Linear acceleration information
+ optional LinearAcceleration linear_acceleration = 2;
+}
diff --git a/ignition/msgs/inertial.proto b/ignition/msgs/inertial.proto
new file mode 100644
index 0000000..3406cd0
--- /dev/null
+++ b/ignition/msgs/inertial.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "InertialProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Inertial
+/// \brief Information about inertia
+
+import "ignition/msgs/pose.proto";
+
+message Inertial
+{
+ optional double mass = 1;
+ optional Pose pose = 2;
+ optional double ixx = 3;
+ optional double ixy = 4;
+ optional double ixz = 5;
+ optional double iyy = 6;
+ optional double iyz = 7;
+ optional double izz = 8;
+}
diff --git a/ignition/msgs/int32.proto b/ignition/msgs/int32.proto
new file mode 100644
index 0000000..aca8a14
--- /dev/null
+++ b/ignition/msgs/int32.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Int32Protos";
+
+/// \ingroup ignition.msgs
+/// \interface Int32
+/// \brief Integer message
+
+message Int32
+{
+ /// \brief Integer data
+ optional int32 data = 1;
+}
diff --git a/ignition/msgs/int32_v.proto b/ignition/msgs/int32_v.proto
new file mode 100644
index 0000000..87c3e33
--- /dev/null
+++ b/ignition/msgs/int32_v.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Int32VProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Int32_V
+/// \brief A message for a vector of int data
+
+message Int32_V
+{
+ /// \brief Vector of int data
+ repeated int32 data = 1;
+}
diff --git a/ignition/msgs/int64.proto b/ignition/msgs/int64.proto
new file mode 100644
index 0000000..2851209
--- /dev/null
+++ b/ignition/msgs/int64.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Int64Protos";
+
+/// \ingroup ignition.msgs
+/// \interface Int64
+/// \brief Integer message
+
+message Int64
+{
+ /// \brief Integer data
+ optional int64 data = 1;
+}
diff --git a/ignition/msgs/int64_v.proto b/ignition/msgs/int64_v.proto
new file mode 100644
index 0000000..567a94c
--- /dev/null
+++ b/ignition/msgs/int64_v.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Int64VProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Int64_V
+/// \brief A message for a vector of int data
+
+message Int64_V
+{
+ /// \brief Vector of int data
+ repeated int64 data = 1;
+}
diff --git a/ignition/msgs/joint.proto b/ignition/msgs/joint.proto
new file mode 100644
index 0000000..11a0cbd
--- /dev/null
+++ b/ignition/msgs/joint.proto
@@ -0,0 +1,68 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "JointProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Joint
+/// \brief Message for creating joint
+
+import "ignition/msgs/axis.proto";
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/sensor.proto";
+
+message Joint
+{
+
+ message Gearbox
+ {
+ /// \brief Gearbox joint reference body link
+ optional string gearbox_reference_body = 1;
+
+ /// \brief Gearbox ratio.
+ optional double gearbox_ratio = 2;
+ }
+
+ message Screw
+ {
+ /// \brief Screw joint thread pitch.
+ optional double thread_pitch = 1;
+ }
+
+ enum Type
+ {
+ REVOLUTE = 1;
+ REVOLUTE2 = 2;
+ PRISMATIC = 3;
+ UNIVERSAL = 4;
+ BALL = 5;
+ SCREW = 6;
+ GEARBOX = 7;
+ FIXED = 8;
+ }
+
+ optional string name = 1;
+ optional uint32 id = 2;
+ repeated double angle = 3;
+ optional Type type = 4;
+ optional string parent = 5;
+ optional uint32 parent_id = 6;
+ optional string child = 7;
+ optional uint32 child_id = 8;
+ optional Pose pose = 9;
+ optional Axis axis1 = 10;
+ optional Axis axis2 = 11;
+
+ optional double cfm = 12;
+ optional double bounce = 13;
+ optional double velocity = 14;
+ optional double fudge_factor = 15;
+ optional double limit_cfm = 16;
+ optional double limit_erp = 17;
+ optional double suspension_cfm = 18;
+ optional double suspension_erp = 19;
+
+ optional Gearbox gearbox = 20;
+ optional Screw screw = 21;
+
+ repeated Sensor sensor = 22;
+}
diff --git a/ignition/msgs/joint_animation.proto b/ignition/msgs/joint_animation.proto
new file mode 100644
index 0000000..d309e71
--- /dev/null
+++ b/ignition/msgs/joint_animation.proto
@@ -0,0 +1,23 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "JointAnimationProtos";
+
+/// \ingroup ignition.msgs
+/// \interface JointAnimation
+/// \brief Message for a model joint animation, does not appear to be used.
+/// \todo Document me.
+
+import "ignition/msgs/time.proto";
+
+message JointAnimation
+{
+ message Joint
+ {
+ repeated string name = 1;
+ repeated double angle = 2;
+ }
+
+ optional string model_name = 1;
+ repeated Joint joint = 2;
+ repeated Time time = 3;
+}
diff --git a/ignition/msgs/joint_cmd.proto b/ignition/msgs/joint_cmd.proto
new file mode 100644
index 0000000..78712ed
--- /dev/null
+++ b/ignition/msgs/joint_cmd.proto
@@ -0,0 +1,20 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "JointCmdProtos";
+
+/// \ingroup ignition.msgs
+/// \interface JointCmd
+/// \brief Message for joint command, used by physics::JointControlWidget
+
+import "ignition/msgs/pid.proto";
+
+message JointCmd
+{
+ optional string name = 1;
+ optional int32 axis = 2 [default=0];
+ optional double force = 3;
+
+ optional PID position = 4;
+ optional PID velocity = 5;
+ optional bool reset = 6;
+}
diff --git a/ignition/msgs/joint_wrench.proto b/ignition/msgs/joint_wrench.proto
new file mode 100644
index 0000000..00f68b5
--- /dev/null
+++ b/ignition/msgs/joint_wrench.proto
@@ -0,0 +1,20 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "JointWrenchProtos";
+
+/// \ingroup ignition.msgs
+/// \interface JointWrench
+/// \brief Joint wrench message
+
+import "ignition/msgs/wrench.proto";
+
+message JointWrench
+{
+ optional string body_1_name = 1;
+ optional uint32 body_1_id = 2;
+ optional string body_2_name = 3;
+ optional uint32 body_2_id = 4;
+
+ optional Wrench body_1_wrench = 5;
+ optional Wrench body_2_wrench = 6;
+}
diff --git a/ignition/msgs/joint_wrench_stamped.proto b/ignition/msgs/joint_wrench_stamped.proto
new file mode 100644
index 0000000..35ae132
--- /dev/null
+++ b/ignition/msgs/joint_wrench_stamped.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Protos";
+
+/// \ingroup ignition.msgs
+/// \interface ForceTorque
+/// \brief ForceTorque from constraint solving
+
+
+import "ignition/msgs/joint_wrench.proto";
+import "ignition/msgs/time.proto";
+
+message ForceTorque
+{
+ repeated JointWrench wrench = 1;
+ optional Time time = 2;
+}
+
diff --git a/ignition/msgs/joystick.proto b/ignition/msgs/joystick.proto
new file mode 100644
index 0000000..ce6fc49
--- /dev/null
+++ b/ignition/msgs/joystick.proto
@@ -0,0 +1,25 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "JoyStickProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Joystick
+/// \brief Message for a joystick
+
+import "ignition/msgs/vector3d.proto";
+
+message Joystick
+{
+ // Translation measurements along the x,y,z
+ // axes. These values should be normalized to
+ // the range -1...1
+ optional Vector3d translation = 1;
+
+ // Rotation measurements about the x,y,z
+ // axes. These values should be normalized to
+ // the range -1...1
+ optional Vector3d rotation = 2;
+
+ // Button measurements
+ repeated int32 buttons = 3;
+}
diff --git a/ignition/msgs/laserscan.proto b/ignition/msgs/laserscan.proto
new file mode 100644
index 0000000..73b3c05
--- /dev/null
+++ b/ignition/msgs/laserscan.proto
@@ -0,0 +1,28 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LaserScanProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LaserScan
+/// \brief Data from a laser scan
+
+import "ignition/msgs/pose.proto";
+
+message LaserScan
+{
+ optional string frame = 1;
+ optional Pose world_pose = 2;
+ optional double angle_min = 3;
+ optional double angle_max = 4;
+ optional double angle_step = 5;
+ optional double range_min = 6;
+ optional double range_max = 7;
+ optional uint32 count = 8;
+ optional double vertical_angle_min = 9;
+ optional double vertical_angle_max = 10;
+ optional double vertical_angle_step = 11;
+ optional uint32 vertical_count = 12;
+
+ repeated double ranges = 13;
+ repeated double intensities = 14;
+}
diff --git a/ignition/msgs/laserscan_stamped.proto b/ignition/msgs/laserscan_stamped.proto
new file mode 100644
index 0000000..0faf54a
--- /dev/null
+++ b/ignition/msgs/laserscan_stamped.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LaserScanStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LaserScanStamped
+/// \brief Message for an laser scan with a time
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/laserscan.proto";
+
+message LaserScanStamped
+{
+ // Time when the data was captured
+ optional Time time = 1;
+ optional LaserScan scan = 2;
+}
diff --git a/ignition/msgs/light.proto b/ignition/msgs/light.proto
new file mode 100644
index 0000000..4cdb21c
--- /dev/null
+++ b/ignition/msgs/light.proto
@@ -0,0 +1,36 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LightProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Light
+/// \brief Message for a light
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/color.proto";
+
+message Light
+{
+ optional string name = 1;
+ enum LightType
+ {
+ POINT = 1;
+ SPOT = 2;
+ DIRECTIONAL = 3;
+ }
+ optional LightType type = 2;
+
+ optional Pose pose = 3;
+ optional Color diffuse = 4;
+ optional Color specular = 5;
+ optional float attenuation_constant = 6;
+ optional float attenuation_linear = 7;
+ optional float attenuation_quadratic = 8;
+ optional Vector3d direction = 9;
+ optional float range = 10;
+ optional bool cast_shadows = 11;
+ optional float spot_inner_angle = 12;
+ optional float spot_outer_angle = 13;
+ optional float spot_falloff = 14;
+}
diff --git a/ignition/msgs/link.proto b/ignition/msgs/link.proto
new file mode 100644
index 0000000..e9c7115
--- /dev/null
+++ b/ignition/msgs/link.proto
@@ -0,0 +1,37 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LinkProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Link
+/// \brief Information about a link
+
+import "ignition/msgs/inertial.proto";
+import "ignition/msgs/collision.proto";
+import "ignition/msgs/visual.proto";
+import "ignition/msgs/sensor.proto";
+import "ignition/msgs/projector.proto";
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/battery.proto";
+import "ignition/msgs/density.proto";
+
+message Link
+{
+ optional uint32 id = 1;
+ optional string name = 2;
+ optional bool self_collide = 3;
+ optional bool gravity = 4;
+ optional bool kinematic = 5;
+ optional bool enabled = 6;
+ optional Density density = 7;
+ optional Inertial inertial = 8;
+ optional Pose pose = 9;
+ repeated Visual visual = 10;
+ repeated Collision collision = 11;
+ repeated Sensor sensor = 12;
+ repeated Projector projector = 13;
+ optional bool canonical = 14;
+
+ /// \brief An optional vector of batteries that are attached to this link.
+ repeated Battery battery = 15;
+}
diff --git a/ignition/msgs/link_data.proto b/ignition/msgs/link_data.proto
new file mode 100644
index 0000000..b43ba1b
--- /dev/null
+++ b/ignition/msgs/link_data.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LinkDataProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LinkData
+/// \brief Timestamped link data
+
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/time.proto";
+
+message LinkData
+{
+ optional Time time = 1;
+ optional string name = 2;
+ optional Vector3d linear_velocity = 3;
+ optional Vector3d angular_velocity = 4;
+}
diff --git a/ignition/msgs/log_control.proto b/ignition/msgs/log_control.proto
new file mode 100644
index 0000000..208bca5
--- /dev/null
+++ b/ignition/msgs/log_control.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LogControlProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LogControl
+/// \brief A message that allows for control of logging functions
+
+message LogControl
+{
+ optional bool start = 1;
+ optional bool stop = 2;
+ optional bool paused = 3;
+ optional string base_path = 4;
+ optional string encoding = 5;
+}
diff --git a/ignition/msgs/log_playback_control.proto b/ignition/msgs/log_playback_control.proto
new file mode 100644
index 0000000..dc33331
--- /dev/null
+++ b/ignition/msgs/log_playback_control.proto
@@ -0,0 +1,31 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LogPlaybackControlProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LogPlaybackControl
+/// \brief A message that allows for control of log playback functions.
+
+import "ignition/msgs/time.proto";
+
+message LogPlaybackControl
+{
+ /// \brief Pause/play the log file.
+ optional bool pause = 1;
+
+ /// \brief Make a relative jump. The value indicates the number of
+ /// iterations that will be executed at once. If a negative
+ /// value is specified, the playback will jump backwards.
+ optional sint32 multi_step = 2;
+
+ /// \brief Jump to the beginning of the log file.
+ optional bool rewind = 3;
+
+ /// \brief Jump to the end of the log file.
+ optional bool forward = 4;
+
+ /// \brief Jump to a specific simulation time in the log file. The
+ /// playback service will load the frame with the closest
+ /// simulation time bigger than the "seek" value.
+ optional Time seek = 5;
+}
diff --git a/ignition/msgs/log_playback_stats.proto b/ignition/msgs/log_playback_stats.proto
new file mode 100644
index 0000000..c5d809b
--- /dev/null
+++ b/ignition/msgs/log_playback_stats.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LogPlaybackStatisticsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LogPlaybackStatistics
+/// \brief A message with statistics about a log during playback.
+
+import "ignition/msgs/time.proto";
+
+message LogPlaybackStatistics
+{
+ /// \brief Log start time
+ optional Time start_time = 1;
+
+ /// \brief Log end time
+ optional Time end_time = 2;
+}
diff --git a/ignition/msgs/log_status.proto b/ignition/msgs/log_status.proto
new file mode 100644
index 0000000..8340752
--- /dev/null
+++ b/ignition/msgs/log_status.proto
@@ -0,0 +1,32 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LogStatusProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LogStatus
+/// \brief A message that contains information about data logging
+
+import "ignition/msgs/time.proto";
+
+message LogStatus
+{
+ message LogFile
+ {
+ enum Units
+ {
+ BYTES = 1;
+ K_BYTES = 2;
+ M_BYTES = 3;
+ G_BYTES = 4;
+ }
+
+ optional string uri = 1;
+ optional string base_path = 2;
+ optional string full_path = 3;
+ optional float size = 4;
+ optional Units size_units = 5;
+ }
+
+ optional Time sim_time = 1;
+ optional LogFile log_file = 2;
+}
diff --git a/ignition/msgs/logical_camera_image.proto b/ignition/msgs/logical_camera_image.proto
new file mode 100644
index 0000000..f13d7f1
--- /dev/null
+++ b/ignition/msgs/logical_camera_image.proto
@@ -0,0 +1,30 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LogicalCameraImageProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LogicalCameraImage
+/// \brief Information about models seen by a LogicalCameraSensor
+
+import "ignition/msgs/pose.proto";
+
+message LogicalCameraImage
+{
+ /// \brief Information about a model that is reported by a
+ /// LogicalCameraSensor
+ message Model
+ {
+ /// \brief Name of the detected model
+ optional string name = 1;
+
+ /// \brief Pose of the detected model. The pose is relative to the
+ /// logical camera's pose.
+ optional Pose pose = 2;
+ }
+
+ /// \brief Pose of the logical camera.
+ optional Pose pose = 1;
+
+ /// \brief All the models seen by the LogicalCamera
+ repeated Model model = 2;
+}
diff --git a/ignition/msgs/logical_camera_sensor.proto b/ignition/msgs/logical_camera_sensor.proto
new file mode 100644
index 0000000..289ff70
--- /dev/null
+++ b/ignition/msgs/logical_camera_sensor.proto
@@ -0,0 +1,22 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "LogicalCameraSensorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface LogicalCameraSensor
+/// \brief Information about a logical camera sensor element
+
+message LogicalCameraSensor
+{
+ /// \brief Near clipping plane of the view frustum in meters.
+ optional double near_clip = 1;
+
+ /// \brief Far clipping plane of the view frustum in meters.
+ optional double far_clip = 2;
+
+ /// \brief Horizontal field of view in radians.
+ optional double horizontal_fov = 3;
+
+ /// \brief Near and far clipping plane aspect ratio (width/height).
+ optional double aspect_ratio = 4;
+}
diff --git a/ignition/msgs/magnetometer.proto b/ignition/msgs/magnetometer.proto
new file mode 100644
index 0000000..63bd5dc
--- /dev/null
+++ b/ignition/msgs/magnetometer.proto
@@ -0,0 +1,20 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "MagnetometerProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Magnetometer
+/// \brief Data from a magnetic field strength sensor
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/vector3d.proto";
+
+/// \brief Message that encapsulates sensor data from a magnetometer.
+message Magnetometer
+{
+ /// \brief Global time at which the magnetic field strength was sampled
+ optional Time time = 1;
+
+ /// \brief Magnetic field strength (in Tesla) along body-frame axis
+ optional Vector3d field_tesla = 2;
+}
diff --git a/ignition/msgs/marker.proto b/ignition/msgs/marker.proto
new file mode 100644
index 0000000..bfd8a87
--- /dev/null
+++ b/ignition/msgs/marker.proto
@@ -0,0 +1,133 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "MarkerProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Marker
+/// \brief A message used to draw visuals
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/material.proto";
+
+message Marker
+{
+ /// \brief The marker type (shape/geometry)
+ enum Type
+ {
+ NONE = 0;
+ BOX = 1;
+ CYLINDER = 2;
+ LINE_LIST = 4;
+ LINE_STRIP = 3;
+ POINTS = 5;
+ SPHERE = 6;
+ TEXT = 7;
+ TRIANGLE_FAN = 8;
+ TRIANGLE_LIST = 9;
+ TRIANGLE_STRIP = 10;
+ }
+
+ /// \brief How to interpret the data.
+ enum Action
+ {
+ /// \brief Use this action to create a new marker or modify an exisiting
+ /// marker. A marker will be created if the provided id does not match
+ /// an exisiting marker, otherwise the marker with the provided id will
+ /// be modified.
+ ADD_MODIFY = 0;
+
+ /// \brief Use this action to delete an existing marking.
+ /// Nothing will happend if the provided id does not match an exisiting
+ /// marker.
+ DELETE_MARKER = 1;
+
+ /// \brief Delete all the markers. If a namespace is provided,
+ /// then only the markers in the provided namespace are deleted.
+ DELETE_ALL = 2;
+ }
+
+ /// \brief The action to take
+ ///
+ /// Relevant Type: all
+ optional Action action = 1;
+
+ /// \brief Namespace of the marker. A namespace groups id's together.
+ ///
+ /// Relevant Action: ADD_MODIFY, DELETE_MARKER, DELETE_ALL
+ optional string ns = 2;
+
+ /// \brief The id within the namespace of the visual. Each marker has a
+ /// unique id. It's up to the user to select id values.
+ ///
+ /// Relevant Action: ADD_MODIFY, DELETE_MARKER
+ ///
+ /// Relevant Type: all
+ optional uint64 id = 3;
+
+ /// \brief The layer the visual belongs to.
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: all
+ optional string layer = 4[default="default"];
+
+ /// \brief The type of geometry.
+ ///
+ /// Relevant Action: ADD_MODIFY
+ optional Type type = 5;
+
+ /// \brief How long to keep the visual alive before deletion. A value of
+ /// zero indicates forever. The lifetime is based on simulation-time, not
+ /// real-time.
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: all
+ optional Time lifetime = 6;
+
+ /// \brief Pose of the marker
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: all
+ optional Pose pose = 7;
+
+ /// \brief Scale of the marker.
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: all
+ optional Vector3d scale = 8;
+
+ /// \brief Marker color
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: all
+ optional Material material = 9;
+
+ /// \brief Used to specify geometry for a LINE_STRIP, LINE_LIST, POINTS,
+ /// TRIANGLE_LIST, TRIANGLE_FAN, TRIANGLE_STRIP
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: LINE_STRIP, LINE_LIST, POINTS, TRIANGLE_FAN, TRIANGLE_LIST,
+ /// TRIANGLE_STRIP
+ repeated Vector3d point = 10;
+
+ /// \brief String to display. Only used for TEXT marker.
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: TEXT
+ optional string text = 11;
+
+ /// \brief Attach this marker to a "parent" visual.
+ ///
+ /// Relevant Action: ADD_MODIFY
+ ///
+ /// Relevant Type: all
+ optional string parent = 12;
+}
diff --git a/ignition/msgs/marker_v.proto b/ignition/msgs/marker_v.proto
new file mode 100644
index 0000000..7d5a214
--- /dev/null
+++ b/ignition/msgs/marker_v.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "MarkerVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Marker_V
+/// \brief A list of marker visuals
+
+import "ignition/msgs/marker.proto";
+
+message Marker_V
+{
+ /// \brief List of marker messages.
+ repeated Marker marker = 1;
+}
diff --git a/ignition/msgs/material.proto b/ignition/msgs/material.proto
new file mode 100644
index 0000000..31661a0
--- /dev/null
+++ b/ignition/msgs/material.proto
@@ -0,0 +1,35 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "MaterialProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Material
+/// \brief Information about a material
+
+import "ignition/msgs/color.proto";
+
+message Material
+{
+ enum ShaderType
+ {
+ VERTEX = 1;
+ PIXEL = 2;
+ NORMAL_MAP_OBJECT_SPACE = 3;
+ NORMAL_MAP_TANGENT_SPACE = 4;
+ }
+
+ message Script
+ {
+ repeated string uri = 1;
+ optional string name = 2;
+ }
+
+ optional Script script = 1;
+ optional ShaderType shader_type = 2;
+ optional string normal_map = 3;
+ optional Color ambient = 4;
+ optional Color diffuse = 5;
+ optional Color specular = 6;
+ optional Color emissive = 7;
+ optional bool lighting = 8;
+}
diff --git a/ignition/msgs/meshgeom.proto b/ignition/msgs/meshgeom.proto
new file mode 100644
index 0000000..125bd62
--- /dev/null
+++ b/ignition/msgs/meshgeom.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "MeshGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface MeshGeom
+/// \brief Message for a mesh geometry
+
+import "ignition/msgs/vector3d.proto";
+
+message MeshGeom
+{
+ optional string filename = 1;
+ optional Vector3d scale = 2;
+ optional string submesh = 3;
+ optional bool center_submesh = 4;
+}
diff --git a/ignition/msgs/model.proto b/ignition/msgs/model.proto
new file mode 100644
index 0000000..e948d4d
--- /dev/null
+++ b/ignition/msgs/model.proto
@@ -0,0 +1,30 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ModelProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Model
+/// \brief Information about a model
+
+import "ignition/msgs/joint.proto";
+import "ignition/msgs/link.proto";
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/visual.proto";
+import "ignition/msgs/vector3d.proto";
+
+message Model
+{
+ optional string name = 1;
+ optional uint32 id = 2;
+ optional bool is_static = 3;
+ optional Pose pose = 4;
+ repeated Joint joint = 5;
+ repeated Link link = 6;
+ optional bool deleted = 7;
+ repeated Visual visual = 8;
+ optional Vector3d scale = 9;
+ optional bool self_collide = 10;
+
+ /// \brief An array of nested models.
+ repeated Model model = 11;
+}
diff --git a/ignition/msgs/model_configuration.proto b/ignition/msgs/model_configuration.proto
new file mode 100644
index 0000000..8fd0716
--- /dev/null
+++ b/ignition/msgs/model_configuration.proto
@@ -0,0 +1,24 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ModelConfigurationProtos";
+
+/// \ingroup ignition.msgs
+/// \interface ModelConfiguration
+/// \brief Message for model configuration (joint positions)
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/pose.proto";
+
+message ModelConfiguration
+{
+ // Time when the pose should be enforced
+ optional Time time = 1;
+ repeated string joint_names = 2;
+ repeated double joint_positions = 3;
+
+ // Specify model pose
+ optional Pose pose = 4;
+
+ // Option to set model pose by specifying pose of link
+ optional string link_name = 5;
+}
diff --git a/ignition/msgs/model_v.proto b/ignition/msgs/model_v.proto
new file mode 100644
index 0000000..4825d7a
--- /dev/null
+++ b/ignition/msgs/model_v.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ModelVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Model_V
+/// \brief An array of models.
+
+import "ignition/msgs/model.proto";
+
+message Model_V
+{
+ repeated Model models = 2;
+}
diff --git a/ignition/msgs/packet.proto b/ignition/msgs/packet.proto
new file mode 100644
index 0000000..65189d7
--- /dev/null
+++ b/ignition/msgs/packet.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PacketProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Packet
+/// \brief Message that encapsulates another message with a type description
+
+import "ignition/msgs/time.proto";
+
+message Packet
+{
+ optional Time stamp = 1;
+ optional string type = 2;
+ optional bytes serialized_data = 3;
+}
diff --git a/ignition/msgs/param.proto b/ignition/msgs/param.proto
new file mode 100644
index 0000000..a5b80b1
--- /dev/null
+++ b/ignition/msgs/param.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "EmptyProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Param
+/// \brief A generic message holding a name-value pair. It can be nested.
+
+import "ignition/msgs/any.proto";
+
+message Param
+{
+ /// \brief Param name.
+ required string name = 1;
+
+ /// \brief Param value.
+ optional Any value = 2;
+
+ /// \brief Params nested within this one.
+ repeated Param children = 3;
+}
diff --git a/ignition/msgs/param_v.proto b/ignition/msgs/param_v.proto
new file mode 100644
index 0000000..2940511
--- /dev/null
+++ b/ignition/msgs/param_v.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "EmptyProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Param_V
+/// \brief Message for a vector of params.
+
+import "ignition/msgs/param.proto";
+
+message Param_V
+{
+ /// \brief Repeated params.
+ repeated Param param = 1;
+}
diff --git a/ignition/msgs/physics.proto b/ignition/msgs/physics.proto
new file mode 100644
index 0000000..c517c82
--- /dev/null
+++ b/ignition/msgs/physics.proto
@@ -0,0 +1,41 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PhysicsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Physics
+/// \brief A message containing a description of the global physics properties
+
+import "ignition/msgs/vector3d.proto";
+
+message Physics
+{
+ enum Type
+ {
+ ODE = 1;
+ BULLET = 2;
+ SIMBODY = 3;
+ DART = 4;
+ }
+ optional Type type = 1[default=ODE];
+
+ optional string solver_type = 2;
+ optional double min_step_size = 3;
+ optional int32 precon_iters = 4;
+ optional int32 iters = 5;
+ optional double sor = 6;
+ optional double cfm = 7;
+ optional double erp = 8;
+ optional double contact_max_correcting_vel = 9;
+ optional double contact_surface_layer = 10;
+ optional Vector3d gravity = 11;
+ optional bool enable_physics = 12;
+ optional double real_time_factor = 13;
+ optional double real_time_update_rate = 14;
+ optional double max_step_size = 15;
+ // The name of this physics profile (not to be confused with type)
+ optional string profile_name = 16;
+
+ /// \brief Magnetic field
+ optional Vector3d magnetic_field = 17;
+}
diff --git a/ignition/msgs/pid.proto b/ignition/msgs/pid.proto
new file mode 100644
index 0000000..eb1fdaf
--- /dev/null
+++ b/ignition/msgs/pid.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PIDProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PID
+/// \brief Message for simple PID controllers
+
+message PID
+{
+ optional double target = 1[default=0.0];
+ optional double p_gain = 2[default=0.0];
+ optional double i_gain = 3[default=0.0];
+ optional double d_gain = 4[default=0.0];
+ optional double i_max = 5[default=0.0];
+ optional double i_min = 6[default=0.0];
+ optional double limit = 7[default=0.0];
+}
diff --git a/ignition/msgs/planegeom.proto b/ignition/msgs/planegeom.proto
new file mode 100644
index 0000000..a4329ea
--- /dev/null
+++ b/ignition/msgs/planegeom.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PlaneGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PlaneGeom
+/// \brief Message for a plane geometry
+
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/vector2d.proto";
+
+message PlaneGeom
+{
+ optional Vector3d normal = 1;
+ optional Vector2d size = 2;
+ optional double d = 3 [default = 0];
+}
diff --git a/ignition/msgs/plugin.proto b/ignition/msgs/plugin.proto
new file mode 100644
index 0000000..61ac599
--- /dev/null
+++ b/ignition/msgs/plugin.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PluginProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Plugin
+/// \brief A message containing visual information for gazebo::Plugin
+
+message Plugin
+{
+ optional string name = 1;
+ optional string filename = 2;
+ optional string innerxml = 3 [default = ""];
+}
diff --git a/ignition/msgs/plugin_v.proto b/ignition/msgs/plugin_v.proto
new file mode 100644
index 0000000..8847081
--- /dev/null
+++ b/ignition/msgs/plugin_v.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PluginVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Plugin_V
+/// \brief An array of plugins.
+
+import "ignition/msgs/plugin.proto";
+
+message Plugin_V
+{
+ /// \brief Plugin messages.
+ repeated Plugin plugins = 1;
+}
diff --git a/ignition/msgs/pointcloud.proto b/ignition/msgs/pointcloud.proto
new file mode 100644
index 0000000..1f142f7
--- /dev/null
+++ b/ignition/msgs/pointcloud.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PointCloudProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PointCloud
+/// \brief A point cloud
+
+import "ignition/msgs/vector3d.proto";
+
+message PointCloud
+{
+ repeated Vector3d points = 1;
+}
diff --git a/ignition/msgs/polylinegeom.proto b/ignition/msgs/polylinegeom.proto
new file mode 100644
index 0000000..7c8a20d
--- /dev/null
+++ b/ignition/msgs/polylinegeom.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Protos";
+
+/// \ingroup ignition.msgs
+/// \interface Polyline
+/// \brief Information about Polyline geometry
+
+import "ignition/msgs/vector2d.proto";
+
+message Polyline
+{
+ optional double height = 1;
+ repeated Vector2d point = 2;
+}
diff --git a/ignition/msgs/pose.proto b/ignition/msgs/pose.proto
new file mode 100644
index 0000000..4d81e81
--- /dev/null
+++ b/ignition/msgs/pose.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PoseProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Pose
+/// \brief Message for a pose
+
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/quaternion.proto";
+
+message Pose
+{
+ optional string name = 1;
+ optional uint32 id = 2;
+ optional Vector3d position = 3;
+ optional Quaternion orientation = 4;
+}
diff --git a/ignition/msgs/pose_animation.proto b/ignition/msgs/pose_animation.proto
new file mode 100644
index 0000000..e4b9f77
--- /dev/null
+++ b/ignition/msgs/pose_animation.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PoseAnimationProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PoseAnimation
+/// \brief Message for a model pose animation
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/time.proto";
+
+message PoseAnimation
+{
+ optional string model_name = 1;
+ optional uint32 model_id = 2;
+ repeated Pose pose = 3;
+ repeated Time time = 4;
+}
diff --git a/ignition/msgs/pose_stamped.proto b/ignition/msgs/pose_stamped.proto
new file mode 100644
index 0000000..684d3df
--- /dev/null
+++ b/ignition/msgs/pose_stamped.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PoseStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PoseStamped
+/// \brief Message for a pose with a time
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/pose.proto";
+
+message PoseStamped
+{
+ optional Time time = 1; // Time when the data was captured
+ optional Pose pose = 2;
+}
diff --git a/ignition/msgs/pose_trajectory.proto b/ignition/msgs/pose_trajectory.proto
new file mode 100644
index 0000000..8335efe
--- /dev/null
+++ b/ignition/msgs/pose_trajectory.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PoseTrajectoryProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PoseTrajectory
+/// \brief Message for a pose trajectory
+
+import "ignition/msgs/pose_stamped.proto";
+
+message PoseTrajectory
+{
+ optional string name = 1;
+ optional uint32 id = 2;
+ repeated PoseStamped pose_stamped = 3;
+}
diff --git a/ignition/msgs/pose_v.proto b/ignition/msgs/pose_v.proto
new file mode 100644
index 0000000..e9dccc3
--- /dev/null
+++ b/ignition/msgs/pose_v.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PoseVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Pose_V
+/// \brief Message for a vector of poses
+
+import "ignition/msgs/pose.proto";
+
+message Pose_V
+{
+ repeated Pose pose = 1;
+}
diff --git a/ignition/msgs/poses_stamped.proto b/ignition/msgs/poses_stamped.proto
new file mode 100644
index 0000000..8e90e9d
--- /dev/null
+++ b/ignition/msgs/poses_stamped.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PosesStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PosesStamped
+/// \brief Message for a vector of poses with a time stamp
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/pose.proto";
+
+message PosesStamped
+{
+ optional Time time = 1;
+ repeated Pose pose = 2;
+}
diff --git a/ignition/msgs/projector.proto b/ignition/msgs/projector.proto
new file mode 100644
index 0000000..fcc9bd1
--- /dev/null
+++ b/ignition/msgs/projector.proto
@@ -0,0 +1,20 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ProjectorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Projector
+/// \brief Information about a projector
+
+import "ignition/msgs/pose.proto";
+
+message Projector
+{
+ optional string name = 1;
+ optional string texture = 2;
+ optional Pose pose = 3;
+ optional double fov = 4[default=0.785];
+ optional double near_clip = 5[default=0.1];
+ optional double far_clip = 6[default=10.0];
+ optional bool enabled = 7[default=true];
+}
diff --git a/ignition/msgs/propagation_grid.proto b/ignition/msgs/propagation_grid.proto
new file mode 100644
index 0000000..259c591
--- /dev/null
+++ b/ignition/msgs/propagation_grid.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PropagationGridProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PropagationGrid
+/// \brief Wireless propagation grid
+
+import "ignition/msgs/propagation_particle.proto";
+
+message PropagationGrid
+{
+ repeated PropagationParticle particle = 1;
+}
diff --git a/ignition/msgs/propagation_particle.proto b/ignition/msgs/propagation_particle.proto
new file mode 100644
index 0000000..cfc278e
--- /dev/null
+++ b/ignition/msgs/propagation_particle.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PropagationParticleProtos";
+
+/// \ingroup ignition.msgs
+/// \interface PropagationParticle
+/// \brief Wireless strength signal in a point
+
+message PropagationParticle
+{
+ optional double x = 1;
+ optional double y = 2;
+ optional double signal_level = 3;
+}
diff --git a/ignition/msgs/publish.proto b/ignition/msgs/publish.proto
new file mode 100644
index 0000000..03c2763
--- /dev/null
+++ b/ignition/msgs/publish.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PublishProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Publish
+/// \brief Message that contains information about a publisher of data
+
+message Publish
+{
+ optional string topic = 1;
+ optional string msg_type = 2;
+ optional string host = 3;
+ optional uint32 port = 4;
+}
diff --git a/ignition/msgs/publishers.proto b/ignition/msgs/publishers.proto
new file mode 100644
index 0000000..02e3da4
--- /dev/null
+++ b/ignition/msgs/publishers.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "PublishersProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Publishers
+/// \brief A list of publishers
+
+import "ignition/msgs/publish.proto";
+
+message Publishers
+{
+ repeated Publish publisher = 1;
+}
diff --git a/ignition/msgs/quaternion.proto b/ignition/msgs/quaternion.proto
new file mode 100644
index 0000000..fd18d92
--- /dev/null
+++ b/ignition/msgs/quaternion.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "QuaternionProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Quaternion
+/// \brief A message for a quaternion
+
+message Quaternion
+{
+ optional double x = 2;
+ optional double y = 3;
+ optional double z = 4;
+ optional double w = 5;
+}
diff --git a/ignition/msgs/raysensor.proto b/ignition/msgs/raysensor.proto
new file mode 100644
index 0000000..239c8aa
--- /dev/null
+++ b/ignition/msgs/raysensor.proto
@@ -0,0 +1,25 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RaySensorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface RaySensor
+/// \brief Information about a ray sensor element
+
+message RaySensor
+{
+ optional bool display_scan = 1;
+ optional int32 horizontal_samples = 2;
+ optional double horizontal_resolution = 3;
+ optional double horizontal_min_angle = 4;
+ optional double horizontal_max_angle = 5;
+
+ optional int32 vertical_samples = 6;
+ optional double vertical_resolution = 7;
+ optional double vertical_min_angle = 8;
+ optional double vertical_max_angle = 9;
+
+ optional double range_min = 10;
+ optional double range_max = 11;
+ optional double range_resolution = 12;
+}
diff --git a/ignition/msgs/request.proto b/ignition/msgs/request.proto
new file mode 100644
index 0000000..8954c9f
--- /dev/null
+++ b/ignition/msgs/request.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RequestProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Request
+/// \brief A message containing a string request
+
+message Request
+{
+ optional int32 id = 1;
+ optional string request = 2;
+ optional string data = 3;
+ optional double dbl_data = 4;
+}
diff --git a/ignition/msgs/response.proto b/ignition/msgs/response.proto
new file mode 100644
index 0000000..030a871
--- /dev/null
+++ b/ignition/msgs/response.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ResponseProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Response
+/// \brief Message that encapsulates a respons message with a type description
+
+message Response
+{
+ optional int32 id = 1;
+ optional string request = 2;
+ optional string response = 3;
+ optional string type = 4;
+ optional bytes serialized_data = 5;
+}
diff --git a/ignition/msgs/rest_login.proto b/ignition/msgs/rest_login.proto
new file mode 100644
index 0000000..00ba7a9
--- /dev/null
+++ b/ignition/msgs/rest_login.proto
@@ -0,0 +1,22 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RestLoginProtos";
+
+/// \ingroup ignition.msgs
+/// \interface RestLogin
+/// \brief A message to login to a REST service
+
+message RestLogin
+{
+ /// \brief ID of this request message
+ optional uint32 id = 1;
+
+ /// \brief Rest service URL
+ optional string url = 2;
+
+ /// \brief Login user name
+ optional string username = 3;
+
+ /// \brief Login password
+ optional string password = 4;
+}
diff --git a/ignition/msgs/rest_logout.proto b/ignition/msgs/rest_logout.proto
new file mode 100644
index 0000000..090a623
--- /dev/null
+++ b/ignition/msgs/rest_logout.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RestLogoutProtos";
+
+/// \ingroup ignition.msgs
+/// \interface RestLogout
+/// \brief Message for login out of a REST service.
+
+message RestLogout
+{
+ /// \brief ID of this request message
+ optional uint32 id = 1;
+
+ /// \brief the web service url
+ optional string url = 2;
+}
diff --git a/ignition/msgs/rest_post.proto b/ignition/msgs/rest_post.proto
new file mode 100644
index 0000000..0347872
--- /dev/null
+++ b/ignition/msgs/rest_post.proto
@@ -0,0 +1,20 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RestPostProtos";
+
+/// \ingroup ignition.msgs
+/// \interface RestPost
+/// \brief A message to POST data on a REST service. The route (ex /news) and
+/// the content of the message in JSON format are specified.
+
+message RestPost
+{
+ /// \brief ID of this request message
+ optional uint32 id = 1;
+
+ /// \brief Route to post to.
+ optional string route = 2;
+
+ /// \brief Data to post in JSON format
+ optional string json = 3;
+}
diff --git a/ignition/msgs/rest_response.proto b/ignition/msgs/rest_response.proto
new file mode 100644
index 0000000..f384cba
--- /dev/null
+++ b/ignition/msgs/rest_response.proto
@@ -0,0 +1,34 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RestResponseProtos";
+
+/// \ingroup ignition.msgs
+/// \interface RestResponse
+/// \brief A message for reporting a response from a REST service call
+
+message RestResponse
+{
+ enum Type
+ {
+ /// \brief Rest service call was successfull
+ SUCCESS = 1;
+
+ /// \brief Error calling rest service
+ ERR = 2;
+
+ /// \brief Response to a login request
+ LOGIN = 3;
+
+ /// \brief Response to a logout request
+ LOGOUT = 4;
+ }
+
+ /// \brief ID of the response message
+ optional uint32 id = 1;
+
+ /// \brief Type of response
+ optional Type type = 2;
+
+ /// \brief Message describing the response
+ optional string msg = 3;
+}
diff --git a/ignition/msgs/road.proto b/ignition/msgs/road.proto
new file mode 100644
index 0000000..cbbcf5b
--- /dev/null
+++ b/ignition/msgs/road.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "RoadProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Road
+/// \brief Message for a road
+
+import "ignition/msgs/vector3d.proto";
+import "ignition/msgs/material.proto";
+
+message Road
+{
+ optional string name = 1;
+ optional double width = 2;
+ repeated Vector3d point = 3;
+ optional Material material = 4;
+}
diff --git a/ignition/msgs/scene.proto b/ignition/msgs/scene.proto
new file mode 100644
index 0000000..b6a6c2a
--- /dev/null
+++ b/ignition/msgs/scene.proto
@@ -0,0 +1,32 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SceneProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Scene
+/// \brief A message containing a description of a scene
+
+import "ignition/msgs/color.proto";
+import "ignition/msgs/fog.proto";
+import "ignition/msgs/sky.proto";
+import "ignition/msgs/light.proto";
+import "ignition/msgs/joint.proto";
+import "ignition/msgs/model.proto";
+
+message Scene
+{
+ optional string name = 1;
+ optional Color ambient = 2;
+ optional Color background = 3;
+ optional Sky sky = 4;
+ optional bool shadows = 5 [default = true];
+ optional Fog fog = 6;
+ optional bool grid = 7;
+
+ repeated Model model = 8;
+ repeated Light light = 9;
+ repeated Joint joint = 10;
+
+ /// \brief Show/hide world origin indicator.
+ optional bool origin_visual = 11;
+}
diff --git a/ignition/msgs/selection.proto b/ignition/msgs/selection.proto
new file mode 100644
index 0000000..b3c6001
--- /dev/null
+++ b/ignition/msgs/selection.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SelectionProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Selection
+/// \brief A message for GUI selection data
+
+message Selection
+{
+ optional uint32 id = 1;
+ optional string name = 2;
+ optional bool selected = 3 [default = false];
+}
diff --git a/ignition/msgs/sensor.proto b/ignition/msgs/sensor.proto
new file mode 100644
index 0000000..976b8a5
--- /dev/null
+++ b/ignition/msgs/sensor.proto
@@ -0,0 +1,69 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SEnsorProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Sensor
+/// \brief Information about a sensor element
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/camerasensor.proto";
+import "ignition/msgs/raysensor.proto";
+import "ignition/msgs/contactsensor.proto";
+import "ignition/msgs/logical_camera_sensor.proto";
+import "ignition/msgs/gps_sensor.proto";
+import "ignition/msgs/imu_sensor.proto";
+
+message Sensor
+{
+ /// \brief Name of the sensor
+ optional string name = 1;
+
+ /// \brief Id of the sensor
+ optional uint32 id = 2;
+
+ /// \brief Name of the parent, usually a link or joint.
+ optional string parent = 3;
+
+ /// \brief Id of the parent, usually a link or joint.
+ optional uint32 parent_id = 4;
+
+ /// \brief Sensor type
+ optional string type = 5;
+
+ /// \brief True indicates that the sensor should always
+ /// produce data, instead of producing data only when
+ /// a consumer is connected to the data topic
+ optional bool always_on = 6;
+
+ /// \brief Refresh rate
+ optional double update_rate = 7;
+
+ /// \brief Sensor pose
+ optional Pose pose = 8;
+
+ /// \brief Description of a camera sensor
+ optional CameraSensor camera = 9;
+
+ /// \brief Description of a ray (laser) sensor
+ optional RaySensor ray = 10;
+
+ /// \brief Description of a contact sensor
+ optional ContactSensor contact = 11;
+
+ /// \brief True value indicates that sensor data should be
+ /// visualized in the GUI
+ optional bool visualize = 12;
+
+ /// \brief Topic on which sensor data is published
+ optional string topic = 13;
+
+ /// \brief Description of a logical camera sensor
+ optional LogicalCameraSensor logical_camera = 14;
+
+ /// \brief Description of a gps sensor
+ optional GPSSensor gps = 15;
+
+ /// \brief Description of an IMU sensor
+ optional IMUSensor imu = 16;
+}
diff --git a/ignition/msgs/sensor_noise.proto b/ignition/msgs/sensor_noise.proto
new file mode 100644
index 0000000..fcd2dba
--- /dev/null
+++ b/ignition/msgs/sensor_noise.proto
@@ -0,0 +1,46 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Protos";
+
+/// \ingroup ignition.msgs
+/// \interface SensorNoise
+/// \brief Information about a sensor noise
+
+message SensorNoise
+{
+ /// \brief Noise types
+ enum Type
+ {
+ /// \brief No noise
+ NONE = 1;
+
+ /// \brief Gaussian noise
+ GAUSSIAN = 2;
+
+ /// \brief Gaussian noise plus quantization of outputs (rounding)
+ GAUSSIAN_QUANTIZED = 3;
+ }
+
+ /// \brief The type of noise
+ optional Type type = 1;
+
+ /// \brief Noise mean
+ /// Used by GAUSSIAN, and GAUSSIAN_QUANTIZED
+ optional double mean = 2;
+
+ /// \brief Noise standard deviation
+ /// Used by GAUSSIAN, and GAUSSIAN_QUANTIZED
+ optional double stddev = 3;
+
+ /// \brief Noise mean bias
+ /// Used by GAUSSIAN, and GAUSSIAN_QUANTIZED
+ optional double bias_mean = 4;
+
+ /// \brief Noise standard deviation bias
+ /// Used by GAUSSIAN, and GAUSSIAN_QUANTIZED
+ optional double bias_stddev = 5;
+
+ /// \brief Noise precision.
+ /// Used by GAUSSIAN_QUANTIZED
+ optional double precision = 6;
+}
diff --git a/ignition/msgs/server_control.proto b/ignition/msgs/server_control.proto
new file mode 100644
index 0000000..6b7101d
--- /dev/null
+++ b/ignition/msgs/server_control.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ServerControlProtos";
+
+/// \ingroup ignition.msgs
+/// \interface ServerControl
+/// \brief A message that allows for control of the server functions
+
+message ServerControl
+{
+ optional string save_world_name = 1;
+ optional string save_filename = 2;
+ optional string open_filename = 3;
+ optional bool new_world = 4;
+ optional bool stop = 5;
+ optional bool clone = 6;
+ optional uint32 new_port = 7;
+}
diff --git a/ignition/msgs/shadows.proto b/ignition/msgs/shadows.proto
new file mode 100644
index 0000000..aec353b
--- /dev/null
+++ b/ignition/msgs/shadows.proto
@@ -0,0 +1,22 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "ShadowsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Shadows
+/// \brief A message for shadow data
+
+import "ignition/msgs/color.proto";
+
+message Shadows
+{
+ enum ShadowType
+ {
+ STENCIL_ADDITIVE = 1;
+ STENCIL_MODULATIVE = 2;
+ TEXTURE_ADDITIVE = 3;
+ TEXTURE_MODULATIVE = 4;
+ }
+ optional ShadowType type = 5;
+ optional Color color = 6;
+}
diff --git a/ignition/msgs/sim_event.proto b/ignition/msgs/sim_event.proto
new file mode 100644
index 0000000..cb2e06e
--- /dev/null
+++ b/ignition/msgs/sim_event.proto
@@ -0,0 +1,26 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SimEventProtos";
+
+import "ignition/msgs/world_stats.proto";
+
+/// \ingroup ignition.msgs
+/// \interface SimEvent
+
+message SimEvent
+{
+ /// \brief ID of this event message
+ optional uint32 id = 1;
+
+ /// \brief Type of sim event
+ optional string type = 2;
+
+ /// \brief Name of sim event
+ optional string name = 3;
+
+ /// \brief Statistics of the world
+ optional WorldStatistics world_statistics = 4;
+
+ /// \brief Data describing the sim event
+ optional string data = 5;
+}
diff --git a/ignition/msgs/sky.proto b/ignition/msgs/sky.proto
new file mode 100644
index 0000000..5d936e6
--- /dev/null
+++ b/ignition/msgs/sky.proto
@@ -0,0 +1,22 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SkyProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Sky
+/// \brief Information about the sky
+
+import "ignition/msgs/color.proto";
+
+message Sky
+{
+ optional double time = 1;
+ optional double sunrise = 2;
+ optional double sunset = 3;
+
+ optional double wind_speed = 4;
+ optional double wind_direction = 5;
+ optional Color cloud_ambient = 6;
+ optional double humidity = 7;
+ optional double mean_cloud_size = 8;
+}
diff --git a/ignition/msgs/sonar.proto b/ignition/msgs/sonar.proto
new file mode 100644
index 0000000..87f2d0e
--- /dev/null
+++ b/ignition/msgs/sonar.proto
@@ -0,0 +1,23 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SonarProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Sonar
+/// \brief Message for a sonar value
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/vector3d.proto";
+
+message Sonar
+{
+ optional string frame = 1;
+ optional Pose world_pose = 2;
+ optional double range_min = 3;
+ optional double range_max = 4;
+ optional double radius = 5;
+ optional double range = 6;
+
+ /// Location of the contact in the world frame.
+ optional Vector3d contact = 7;
+}
diff --git a/ignition/msgs/sonar_stamped.proto b/ignition/msgs/sonar_stamped.proto
new file mode 100644
index 0000000..8fa4b6e
--- /dev/null
+++ b/ignition/msgs/sonar_stamped.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SonarStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface SonarStamped
+/// \brief Message for a time stamped sonar value
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/sonar.proto";
+
+message SonarStamped
+{
+ // Time when the data was captured
+ optional Time time = 1;
+ optional Sonar sonar = 2;
+}
diff --git a/ignition/msgs/spheregeom.proto b/ignition/msgs/spheregeom.proto
new file mode 100644
index 0000000..45b7d11
--- /dev/null
+++ b/ignition/msgs/spheregeom.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SphereGeomProtos";
+
+/// \ingroup ignition.msgs
+/// \interface SphereGeom
+/// \brief Information about a sphere geometry
+
+message SphereGeom
+{
+ /// \brief Radius of the sphere.
+ optional double radius = 1;
+}
diff --git a/ignition/msgs/spherical_coordinates.proto b/ignition/msgs/spherical_coordinates.proto
new file mode 100644
index 0000000..7f58531
--- /dev/null
+++ b/ignition/msgs/spherical_coordinates.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SphericalCoordinatesProtos";
+
+/// \ingroup ignition.msgs
+/// \interface SphericalCoordinates
+/// \brief Spherical coordinates information
+
+message SphericalCoordinates
+{
+ enum SurfaceModel
+ {
+ EARTH_WGS84 = 1;
+ }
+
+ optional SurfaceModel surface_model = 1;
+ optional double latitude_deg = 2;
+ optional double longitude_deg = 3;
+ optional double elevation = 4;
+ optional double heading_deg = 5;
+}
diff --git a/ignition/msgs/stringmsg.proto b/ignition/msgs/stringmsg.proto
new file mode 100644
index 0000000..933123a
--- /dev/null
+++ b/ignition/msgs/stringmsg.proto
@@ -0,0 +1,12 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "StringMsgProtos";
+
+/// \ingroup ignition.msgs
+/// \interface StringMsg
+/// \brief A message for string data
+
+message StringMsg
+{
+ optional string data = 1;
+}
diff --git a/ignition/msgs/stringmsg_v.proto b/ignition/msgs/stringmsg_v.proto
new file mode 100644
index 0000000..2d12ab2
--- /dev/null
+++ b/ignition/msgs/stringmsg_v.proto
@@ -0,0 +1,12 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "StringMsgVProtos";
+
+/// \ingroup ignition.msgs
+/// \interface StringMsg_V
+/// \brief A message for a vector of string data
+
+message StringMsg_V
+{
+ repeated string data = 1;
+}
diff --git a/ignition/msgs/subscribe.proto b/ignition/msgs/subscribe.proto
new file mode 100644
index 0000000..eb8d1eb
--- /dev/null
+++ b/ignition/msgs/subscribe.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SubscribeProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Subscribe
+/// \brief A message for subscription data
+
+message Subscribe
+{
+ optional string topic = 1;
+ optional string host = 2;
+ optional uint32 port = 3;
+ optional string msg_type = 4;
+ optional bool latching = 5 [default=false];
+}
diff --git a/ignition/msgs/surface.proto b/ignition/msgs/surface.proto
new file mode 100644
index 0000000..3d4073e
--- /dev/null
+++ b/ignition/msgs/surface.proto
@@ -0,0 +1,26 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "SurfaceProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Surface
+/// \brief Information about a surface element
+
+import "ignition/msgs/friction.proto";
+
+message Surface
+{
+ optional Friction friction = 1;
+ optional double restitution_coefficient = 2;
+ optional double bounce_threshold = 3;
+ optional double soft_cfm = 4;
+ optional double soft_erp = 5;
+ optional double kp = 6;
+ optional double kd = 7;
+ optional double max_vel = 8;
+ optional double min_depth = 9;
+ optional bool collide_without_contact = 10;
+ optional uint32 collide_without_contact_bitmask = 11;
+ optional uint32 collide_bitmask = 12;
+ optional double elastic_modulus = 13;
+}
diff --git a/ignition/msgs/tactile.proto b/ignition/msgs/tactile.proto
new file mode 100644
index 0000000..fd1fdce
--- /dev/null
+++ b/ignition/msgs/tactile.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "TactileProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Tactile
+/// \brief Message for a tactile data
+
+import "ignition/msgs/time.proto";
+
+message Tactile
+{
+ repeated string collision_name = 1;
+ repeated uint32 collision_id = 2;
+ repeated double pressure = 3;
+ optional Time time = 4;
+}
diff --git a/ignition/msgs/test.proto b/ignition/msgs/test.proto
new file mode 100644
index 0000000..6cb0e0d
--- /dev/null
+++ b/ignition/msgs/test.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "TestProtos";
+
+import "ignition/msgs/header.proto";
+
+/// \ingroup ignition.msgs
+/// \interface Test
+/// \brief A test message
+
+message Test
+{
+ optional Header header = 1;
+}
diff --git a/ignition/msgs/time.proto b/ignition/msgs/time.proto
new file mode 100644
index 0000000..fe9508d
--- /dev/null
+++ b/ignition/msgs/time.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "TimeProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Time
+/// \brief A message for time data
+
+message Time
+{
+ /// \brief Seconds
+ optional int64 sec = 1;
+
+ /// \brief Nanoseconds
+ optional int32 nsec = 2;
+}
diff --git a/ignition/msgs/topic_info.proto b/ignition/msgs/topic_info.proto
new file mode 100644
index 0000000..98d321d
--- /dev/null
+++ b/ignition/msgs/topic_info.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "TopicInfoProtos";
+
+/// \ingroup ignition.msgs
+/// \interface TopicInfo
+/// \brief A message for topic information
+
+import "ignition/msgs/publish.proto";
+import "ignition/msgs/subscribe.proto";
+
+message TopicInfo
+{
+ optional string msg_type = 1;
+ repeated Publish publisher = 2;
+ repeated Subscribe subscriber = 3;
+}
diff --git a/ignition/msgs/track_visual.proto b/ignition/msgs/track_visual.proto
new file mode 100644
index 0000000..8fb446a
--- /dev/null
+++ b/ignition/msgs/track_visual.proto
@@ -0,0 +1,41 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "TrackVisualProtos";
+
+/// \ingroup ignition.msgs
+/// \interface TrackVisual
+/// \brief Message for a tracking a rendering::Visual with a rendering::Camera
+
+import "ignition/msgs/vector3d.proto";
+
+message TrackVisual
+{
+ /// \brief Name of the visual to track
+ optional string name = 1;
+
+ /// \brief Id of the visual to track
+ optional uint32 id = 2;
+
+ /// \brief True to have the tracking camera inherit the orientation of
+ /// the tracked visual.
+ optional bool inherit_orientation = 3;
+
+ /// \brief Minimum follow distance
+ optional double min_dist = 4;
+
+ /// \brief Maximum follow distance
+ optional double max_dist = 5;
+
+ /// \brief If set to true, the position of the camera is fixed.
+ optional bool static = 6;
+
+ /// \brief If set to true, the position of the camera is relative to the
+ /// model reference frame.
+ optional bool use_model_frame = 7;
+
+ /// \brief Position of the camera.
+ optional Vector3d xyz = 8;
+
+ /// \brief If set to true, the camera inherits the yaw rotation of the model.
+ optional bool inherit_yaw = 9;
+}
diff --git a/ignition/msgs/uint32.proto b/ignition/msgs/uint32.proto
new file mode 100644
index 0000000..d10eb74
--- /dev/null
+++ b/ignition/msgs/uint32.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UInt32Protos";
+
+/// \ingroup ignition.msgs
+/// \interface UInt32
+/// \brief Integer message
+
+message UInt32
+{
+ /// \brief Integer data
+ optional uint32 data = 1;
+}
diff --git a/ignition/msgs/uint32_v.proto b/ignition/msgs/uint32_v.proto
new file mode 100644
index 0000000..408103e
--- /dev/null
+++ b/ignition/msgs/uint32_v.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UInt32VProtos";
+
+/// \ingroup ignition.msgs
+/// \interface UInt32_V
+/// \brief A message for a vector of int data
+
+message UInt32_V
+{
+ /// \brief Vector of int data
+ repeated uint32 data = 1;
+}
diff --git a/ignition/msgs/uint64.proto b/ignition/msgs/uint64.proto
new file mode 100644
index 0000000..c9d37d1
--- /dev/null
+++ b/ignition/msgs/uint64.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UInt64Protos";
+
+/// \ingroup ignition.msgs
+/// \interface UInt64
+/// \brief Integer message
+
+message UInt64
+{
+ /// \brief Integer data
+ optional uint64 data = 1;
+}
diff --git a/ignition/msgs/uint64_v.proto b/ignition/msgs/uint64_v.proto
new file mode 100644
index 0000000..b22c8c5
--- /dev/null
+++ b/ignition/msgs/uint64_v.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UInt64VProtos";
+
+/// \ingroup ignition.msgs
+/// \interface UInt64_V
+/// \brief A message for a vector of int data
+
+message UInt64_V
+{
+ /// \brief Vector of int data
+ repeated uint64 data = 1;
+}
diff --git a/ignition/msgs/undo_redo.proto b/ignition/msgs/undo_redo.proto
new file mode 100644
index 0000000..ce5d7e2
--- /dev/null
+++ b/ignition/msgs/undo_redo.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UndoRedoProtos";
+
+/// \ingroup ignition.msgs
+/// \interface UndoRedo
+/// \brief A message requesting to undo or redo user commands.
+
+message UndoRedo
+{
+ /// \brief True to undo, false to redo.
+ optional bool undo = 1;
+
+ /// \brief Unique id of the user command. If this is provided, all commands
+ /// leading to that will be undone / redone.
+ optional uint32 id = 2;
+}
diff --git a/ignition/msgs/user_cmd.proto b/ignition/msgs/user_cmd.proto
new file mode 100644
index 0000000..722ee3b
--- /dev/null
+++ b/ignition/msgs/user_cmd.proto
@@ -0,0 +1,55 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UserCmdProtos";
+
+import "ignition/msgs/light.proto";
+import "ignition/msgs/model.proto";
+import "ignition/msgs/world_control.proto";
+import "ignition/msgs/wrench.proto";
+
+/// \ingroup ignition.msgs
+/// \interface UserCmd
+/// \brief Notifies that a new command has been executed by a user
+
+message UserCmd
+{
+ /// \brief Types of user commands
+ enum Type
+ {
+ /// \brief Moving an entity.
+ MOVING = 1;
+
+ /// \brief Controlling the world.
+ WORLD_CONTROL = 2;
+
+ /// \brief Applying wrench.
+ WRENCH = 3;
+
+ /// \brief Scaling an entity.
+ SCALING = 4;
+ }
+
+ /// \brief Unique id for user command.
+ optional uint32 id = 1;
+
+ /// \brief Description for the command.
+ optional string description = 2;
+
+ /// \brief Type of command.
+ optional Type type = 3;
+
+ /// \brief For model modify commands.
+ repeated Model model = 4;
+
+ /// \brief For light modify commands.
+ repeated Light light = 5;
+
+ /// \brief Name of entity targeted by command
+ optional string entity_name = 6;
+
+ /// \brief For World Control commands.
+ optional WorldControl world_control = 7;
+
+ /// \brief Wrench for apply wrench commands.
+ optional Wrench wrench = 8;
+}
diff --git a/ignition/msgs/user_cmd_stats.proto b/ignition/msgs/user_cmd_stats.proto
new file mode 100644
index 0000000..3cf4e04
--- /dev/null
+++ b/ignition/msgs/user_cmd_stats.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "UserCmdStatsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface UserCmdStats
+/// \brief Contains statistics about user commands.
+
+import "ignition/msgs/user_cmd.proto";
+
+message UserCmdStats
+{
+ /// \brief User commands in the undo list.
+ repeated UserCmd undo_cmd = 1;
+
+ /// \brief User commands in the redo list.
+ repeated UserCmd redo_cmd = 2;
+}
diff --git a/ignition/msgs/vector2d.proto b/ignition/msgs/vector2d.proto
new file mode 100644
index 0000000..207ffaf
--- /dev/null
+++ b/ignition/msgs/vector2d.proto
@@ -0,0 +1,13 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Vector2dProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Vector2d
+/// \brief Message for a vector2 double
+
+message Vector2d
+{
+ optional double x = 1;
+ optional double y = 2;
+}
diff --git a/ignition/msgs/vector3d.proto b/ignition/msgs/vector3d.proto
new file mode 100644
index 0000000..3a3f6b0
--- /dev/null
+++ b/ignition/msgs/vector3d.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "Vector3dProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Vector3d
+/// \brief Message for a vector3 double
+
+message Vector3d
+{
+ optional double x = 1;
+ optional double y = 2;
+ optional double z = 3;
+}
diff --git a/ignition/msgs/visual.proto b/ignition/msgs/visual.proto
new file mode 100644
index 0000000..4312aac
--- /dev/null
+++ b/ignition/msgs/visual.proto
@@ -0,0 +1,70 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "VisualProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Visual
+/// \brief A message containing visual information for rendering::Visual
+
+import "ignition/msgs/pose.proto";
+import "ignition/msgs/geometry.proto";
+import "ignition/msgs/material.proto";
+import "ignition/msgs/plugin.proto";
+import "ignition/msgs/vector3d.proto";
+
+message Visual
+{
+ /// \brief Optional meta information for the visual. The information
+ /// contained within this element should be used to provide additional
+ /// feedback to an end user.
+ message Meta
+ {
+ /// \brief The layer in which this visual is displayed. The layer number
+ /// is useful for programs, such as Gazebo, that put visuals in different
+ /// layers for enhanced visualization.
+ optional int32 layer = 1;
+ }
+
+ enum Type
+ {
+ /// \brief Entity visual
+ ENTITY = 0;
+ /// \brief Model visual
+ MODEL = 1;
+ /// \brief Link visual
+ LINK = 2;
+ /// \brief Visual visual
+ VISUAL = 3;
+ /// \brief Collision visual
+ COLLISION = 4;
+ /// \brief Sensor visual
+ SENSOR = 5;
+ /// \brief GUI visual
+ GUI = 6;
+ /// \brief Physics data visual
+ PHYSICS = 7;
+ }
+
+ optional string name = 1;
+ optional uint32 id = 2;
+ optional string parent_name = 3;
+ optional uint32 parent_id = 4;
+ optional bool cast_shadows = 5;
+ optional double transparency = 6;
+ optional double laser_retro = 7;
+ optional Pose pose = 8;
+ optional Geometry geometry = 9;
+ optional Material material = 10;
+
+ optional bool visible = 11;
+ optional bool delete_me = 12;
+ optional bool is_static = 13;
+ optional Plugin plugin = 14;
+ optional Vector3d scale = 15;
+
+ /// \brief Option meta information associated with this visual.
+ optional Meta meta = 16;
+
+ /// \brief Type of visual.
+ optional Type type = 17;
+}
diff --git a/ignition/msgs/web_request.proto b/ignition/msgs/web_request.proto
new file mode 100644
index 0000000..fca2fc7
--- /dev/null
+++ b/ignition/msgs/web_request.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WebRequestProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WebRequest
+/// \brief Message for making request from the web.
+
+message WebRequest
+{
+ optional string operation = 1;
+ optional string topic = 2;
+ optional string msg_type = 3;
+ optional string compression = 4;
+ optional double hz = 5;
+}
diff --git a/ignition/msgs/wind.proto b/ignition/msgs/wind.proto
new file mode 100644
index 0000000..c0134d7
--- /dev/null
+++ b/ignition/msgs/wind.proto
@@ -0,0 +1,15 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WindProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Wind
+/// \brief A message containing a description of the global wind properties
+
+import "ignition/msgs/vector3d.proto";
+
+message Wind
+{
+ optional Vector3d linear_velocity = 1;
+ optional bool enable_wind = 2;
+}
diff --git a/ignition/msgs/wireless_node.proto b/ignition/msgs/wireless_node.proto
new file mode 100644
index 0000000..c2de243
--- /dev/null
+++ b/ignition/msgs/wireless_node.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WirelessNodeProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WirelessNode
+/// \brief Message for sending info about a detected wireless transmitter
+
+message WirelessNode
+{
+ optional string essid = 1;
+ optional double frequency = 2;
+ optional double signal_level = 3;
+}
diff --git a/ignition/msgs/wireless_nodes.proto b/ignition/msgs/wireless_nodes.proto
new file mode 100644
index 0000000..31115be
--- /dev/null
+++ b/ignition/msgs/wireless_nodes.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WirelessNodesProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WirelessNodes
+/// \brief Msgs for sending information about a list of wireless transmitters
+
+import "ignition/msgs/wireless_node.proto";
+
+message WirelessNodes
+{
+ repeated WirelessNode node = 1;
+}
diff --git a/ignition/msgs/world_control.proto b/ignition/msgs/world_control.proto
new file mode 100644
index 0000000..6d2aa02
--- /dev/null
+++ b/ignition/msgs/world_control.proto
@@ -0,0 +1,18 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WorldControlProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WorldControl
+/// \brief A message that allows for control of world functions
+
+import "ignition/msgs/world_reset.proto";
+
+message WorldControl
+{
+ optional bool pause = 1;
+ optional bool step = 2;
+ optional uint32 multi_step = 3;
+ optional WorldReset reset = 4;
+ optional uint32 seed = 5;
+}
diff --git a/ignition/msgs/world_modify.proto b/ignition/msgs/world_modify.proto
new file mode 100644
index 0000000..ffbdb3a
--- /dev/null
+++ b/ignition/msgs/world_modify.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WorldModifyProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WorldModify
+/// \brief A message that allows for modifying (open, close) worlds
+
+message WorldModify
+{
+ optional string world_name = 1;
+ optional bool remove = 2;
+ optional bool create = 3;
+ optional bool cloned = 4;
+ optional string cloned_uri = 5;
+}
diff --git a/ignition/msgs/world_reset.proto b/ignition/msgs/world_reset.proto
new file mode 100644
index 0000000..c747aad
--- /dev/null
+++ b/ignition/msgs/world_reset.proto
@@ -0,0 +1,14 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WorldResetProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WorldReset
+/// \brief A message that controls how the world is reset
+
+message WorldReset
+{
+ optional bool all = 1[default = true];
+ optional bool time_only = 2[default = false];
+ optional bool model_only = 3[default = false];
+}
diff --git a/ignition/msgs/world_stats.proto b/ignition/msgs/world_stats.proto
new file mode 100644
index 0000000..06c3584
--- /dev/null
+++ b/ignition/msgs/world_stats.proto
@@ -0,0 +1,21 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WorldStatsProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WorldStatistics
+/// \brief A message statiscs about a world
+
+import "ignition/msgs/log_playback_stats.proto";
+import "ignition/msgs/time.proto";
+
+message WorldStatistics
+{
+ optional Time sim_time = 2;
+ optional Time pause_time = 3;
+ optional Time real_time = 4;
+ optional bool paused = 5;
+ optional uint64 iterations = 6;
+ optional int32 model_count = 7;
+ optional LogPlaybackStatistics log_playback_stats = 8;
+}
diff --git a/ignition/msgs/wrench.proto b/ignition/msgs/wrench.proto
new file mode 100644
index 0000000..96010f8
--- /dev/null
+++ b/ignition/msgs/wrench.proto
@@ -0,0 +1,16 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WrenchProtos";
+
+/// \ingroup ignition.msgs
+/// \interface Wrench
+/// \brief Message for a wrench value
+
+import "ignition/msgs/vector3d.proto";
+
+message Wrench
+{
+ optional Vector3d force = 1;
+ optional Vector3d torque = 2;
+ optional Vector3d force_offset = 3;
+}
diff --git a/ignition/msgs/wrench_stamped.proto b/ignition/msgs/wrench_stamped.proto
new file mode 100644
index 0000000..d3e3352
--- /dev/null
+++ b/ignition/msgs/wrench_stamped.proto
@@ -0,0 +1,17 @@
+package ignition.msgs;
+option java_package = "com.ignition.msgs";
+option java_outer_classname = "WrenchStampedProtos";
+
+/// \ingroup ignition.msgs
+/// \interface WrenchStamped
+/// \brief Message for a time stamped wrench value
+
+import "ignition/msgs/time.proto";
+import "ignition/msgs/wrench.proto";
+
+message WrenchStamped
+{
+ // Time when the data was captured
+ optional Time time = 1;
+ optional Wrench wrench = 2;
+}
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
new file mode 100644
index 0000000..25ec897
--- /dev/null
+++ b/include/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(ignition)
diff --git a/include/ignition/CMakeLists.txt b/include/ignition/CMakeLists.txt
new file mode 100644
index 0000000..bdf8afc
--- /dev/null
+++ b/include/ignition/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(msgs)
diff --git a/include/ignition/msgs/CMakeLists.txt b/include/ignition/msgs/CMakeLists.txt
new file mode 100644
index 0000000..5d9aeb7
--- /dev/null
+++ b/include/ignition/msgs/CMakeLists.txt
@@ -0,0 +1,24 @@
+include (${project_cmake_dir}/Utils.cmake)
+
+set (headers
+ Factory.hh
+ Generator.hh
+ System.hh
+ Utility.hh
+ ign.hh
+)
+
+set (ign_headers "" CACHE INTERNAL "Ignition headers" FORCE)
+foreach (hdr ${headers})
+ APPEND_TO_CACHED_STRING(ign_headers
+ "Ignition headers" "#include <ignition/${IGN_PROJECT_NAME}/${hdr}>\n")
+endforeach()
+
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/ign_auto_headers.hh.in
+ ${CMAKE_CURRENT_BINARY_DIR}/msgs.hh)
+
+ign_install_includes("${INCLUDE_INSTALL_DIR_POSTFIX}/ignition"
+ ${CMAKE_CURRENT_BINARY_DIR}/msgs.hh)
+
+ign_install_includes(
+ "${INCLUDE_INSTALL_DIR_POSTFIX}/ignition/${IGN_PROJECT_NAME}" ${headers})
diff --git a/include/ignition/msgs/Factory.hh b/include/ignition/msgs/Factory.hh
new file mode 100644
index 0000000..6453094
--- /dev/null
+++ b/include/ignition/msgs/Factory.hh
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#ifndef IGNITION_MSGS_FACTORY_HH_
+#define IGNITION_MSGS_FACTORY_HH_
+
+#include <google/protobuf/message.h>
+#include <string>
+#include <map>
+#include <memory>
+#include <vector>
+
+#include <ignition/msgs/System.hh>
+
+namespace ignition
+{
+ namespace msgs
+ {
+ /// \def FactoryFn
+ /// \brief Prototype for message factory generation
+ typedef std::unique_ptr<google::protobuf::Message> (*FactoryFn) ();
+
+ /// \class Factory Factory.hh ignition/msgs.hh
+ /// \brief A factory that generates protobuf message based on a string
+ /// type.
+ class IGNITION_MSGS_VISIBLE Factory
+ {
+ /// \brief Register a message.
+ /// \param[in] _msgType Type of message to register.
+ /// \param[in] _factoryfn Function that generates the message.
+ public: static void Register(const std::string &_msgType,
+ FactoryFn _factoryfn);
+
+ /// \brief Create a new instance of a message.
+ /// \param[in] _msgType Type of message to create.
+ /// \return Pointer to a google protobuf message. Null if the message
+ /// type could not be handled.
+ public: template<typename T>
+ static std::unique_ptr<T> New(const std::string &_msgType)
+ {
+ return std::unique_ptr<T>(
+ static_cast<T*>(New(_msgType).release()));
+ }
+
+ /// \brief Create a new instance of a message.
+ /// \param[in] _msgType Type of message to create.
+ /// \param[in] _args Message arguments. This will populate the message.
+ /// \return Pointer to a google protobuf message. Null if the message
+ /// type could not be handled.
+ public: template<typename T>
+ static std::unique_ptr<T> New(const std::string &_msgType,
+ const std::string &_args)
+ {
+ return std::unique_ptr<T>(
+ static_cast<T*>(New(_msgType, _args).release()));
+ }
+
+ /// \brief Create a new instance of a message.
+ /// \param[in] _msgType Type of message to create.
+ /// \return Pointer to a google protobuf message. Null if the message
+ /// type could not be handled.
+ public: static std::unique_ptr<google::protobuf::Message> New(
+ const std::string &_msgType);
+
+ /// \brief Create a new instance of a message.
+ /// \param[in] _msgType Type of message to create.
+ /// \param[in] _args Message arguments. This will populate the message.
+ /// \return Pointer to a google protobuf message. Null if the message
+ /// type could not be handled.
+ public: static std::unique_ptr<google::protobuf::Message> New(
+ const std::string &_msgType, const std::string &_args);
+
+ /// \brief Get all the message types
+ /// \param[out] _types Vector of strings of the message types.
+ public: static void Types(std::vector<std::string> &_types);
+
+ /// \brief A list of registered message types
+ private: static std::map<std::string, FactoryFn> *msgMap;
+ };
+
+ /// \brief Static message registration macro
+ ///
+ /// Use this macro to register messages.
+ /// \param[in] _msgtype Message type name.
+ /// \param[in] _classname Class name for message.
+ #define IGN_REGISTER_STATIC_MSG(_msgtype, _classname) \
+ IGNITION_MSGS_VISIBLE \
+ std::unique_ptr<google::protobuf::Message> New##_classname() \
+ { \
+ return std::unique_ptr<ignition::msgs::_classname>(\
+ new ignition::msgs::_classname); \
+ } \
+ class IGNITION_MSGS_VISIBLE IgnMsg##_classname \
+ { \
+ public: IgnMsg##_classname() \
+ { \
+ ignition::msgs::Factory::Register(_msgtype, New##_classname);\
+ } \
+ }; \
+ static IgnMsg##_classname IgnitionMessagesInitializer;
+ }
+}
+#endif
diff --git a/include/ignition/msgs/Generator.hh b/include/ignition/msgs/Generator.hh
new file mode 100644
index 0000000..d14884c
--- /dev/null
+++ b/include/ignition/msgs/Generator.hh
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#ifndef IGNITION_MSGS_GENERATOR_HH_
+#define IGNITION_MSGS_GENERATOR_HH_
+
+#include <google/protobuf/compiler/code_generator.h>
+#include <string>
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace cpp {
+class GeneratorContext;
+
+/// \internal
+/// \brief Google protobuf message generator for igntion::msgs
+class Generator : public CodeGenerator
+{
+ /// \brief Constructor
+ /// \param[in] _name Name value (currently unused)
+ public: Generator(const std::string &_name);
+
+ /// \brief Destructor
+ public: virtual ~Generator();
+
+ /// \brief Generate a message.
+ /// \param[in] _file File descriptor of the message.
+ /// \param[in] _parameter Unused string value
+ /// \param[in] _generatorContext Output directory.
+ /// \param[in] _error Unused string value
+ public: virtual bool Generate(const FileDescriptor *_file,
+ const string &_parameter,
+ OutputDirectory *_generatorContext,
+ string *_error) const;
+
+ // private: GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(Generator);
+};
+
+}
+}
+}
+}
+#endif
diff --git a/include/ignition/msgs/System.hh b/include/ignition/msgs/System.hh
new file mode 100644
index 0000000..b5a3280
--- /dev/null
+++ b/include/ignition/msgs/System.hh
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#ifndef IGNITION_MSGS_SYSTEM_HH_
+#define IGNITION_MSGS_SYSTEM_HH_
+
+/** \def IGNITION_MSGS_VISIBLE
+ * Use to represent "symbol visible" if supported
+ */
+
+/** \def IGNITION_MSGS_HIDDEN
+ * Use to represent "symbol hidden" if supported
+ */
+
+#ifndef IGNITION_MSGS_VISIBLE
+#if defined _WIN32 || defined __CYGWIN__
+ #ifdef BUILDING_DLL
+ #ifdef __GNUC__
+ #define IGNITION_MSGS_VISIBLE __attribute__ ((dllexport))
+ #else
+ #define IGNITION_MSGS_VISIBLE __declspec(dllexport)
+ #endif
+ #else
+ #ifdef __GNUC__
+ #define IGNITION_MSGS_VISIBLE __attribute__ ((dllimport))
+ #else
+ #define IGNITION_MSGS_VISIBLE __declspec(dllimport)
+ #endif
+ #endif
+ #define IGNITION_HIDDEN
+#else
+ #if __GNUC__ >= 4
+ #define IGNITION_MSGS_VISIBLE __attribute__ ((visibility ("default")))
+ #define IGNITION_MSGS_HIDDEN __attribute__ ((visibility ("hidden")))
+ #else
+ #define IGNITION_MSGS_VISIBLE
+ #define IGNITION_MSGS_HIDDEN
+ #endif
+#endif
+#endif
+
+// Use safer functions on Windows
+#ifdef _MSC_VER
+ #define ign_strdup _strdup
+#else
+ #define ign_strdup strdup
+#endif
+
+#endif
diff --git a/include/ignition/msgs/Utility.hh b/include/ignition/msgs/Utility.hh
new file mode 100644
index 0000000..1df2148
--- /dev/null
+++ b/include/ignition/msgs/Utility.hh
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#ifndef IGNITION_MSGS_UTILITY_HH_
+#define IGNITION_MSGS_UTILITY_HH_
+
+#include <ignition/math/Vector3.hh>
+#include <ignition/math/Pose3.hh>
+#include <ignition/math/Plane.hh>
+#include <ignition/msgs/MessageTypes.hh>
+#include <ignition/msgs/System.hh>
+
+namespace ignition
+{
+ namespace msgs
+ {
+ /// \brief Convert a msgs::Vector3d to an ignition::math::Vector
+ /// \param[in] _v The vector to convert
+ /// \return An ignition::math::Vector3d object
+ IGNITION_MSGS_VISIBLE
+ ignition::math::Vector3d Convert(const msgs::Vector3d &_v);
+
+ /// \brief Convert a msgs::Vector2d to an ignition::math::Vector2d
+ /// \param[in] _v The vector2 to convert
+ /// \return An ignition::math::Vector2d object
+ IGNITION_MSGS_VISIBLE
+ ignition::math::Vector2d Convert(const msgs::Vector2d &_v);
+
+ /// \brief Convert a msgs::Quaternion to an ignition::math::Quaterniond
+ /// \param[in] _q The quaternion to convert
+ /// \return An ignition::math::Quaterniond object
+ IGNITION_MSGS_VISIBLE
+ ignition::math::Quaterniond Convert(const msgs::Quaternion &_q);
+
+ /// \brief Convert a msgs::Pose to an ignition::math::Pose3d
+ /// \param[in] _q The pose to convert
+ /// \return An ignition::math::Pose3d object
+ IGNITION_MSGS_VISIBLE
+ ignition::math::Pose3d Convert(const msgs::Pose &_p);
+
+ /// \brief Convert a msgs::PlaneGeom to an ignition::math::Planed
+ /// \param[in] _p The plane to convert
+ /// \return An ignition::math::Planed object
+ IGNITION_MSGS_VISIBLE
+ ignition::math::Planed Convert(const msgs::PlaneGeom &_p);
+
+ /// \brief Convert a ignition::math::Vector3d to a msgs::Vector3d
+ /// \param[in] _v The vector to convert
+ /// \return A msgs::Vector3d object
+ IGNITION_MSGS_VISIBLE
+ msgs::Vector3d Convert(const ignition::math::Vector3d &_v);
+
+ /// \brief Convert a ignition::math::Vector2d to a msgs::Vector2d
+ /// \param[in] _v The vector to convert
+ /// \return A msgs::Vector2d object
+ IGNITION_MSGS_VISIBLE
+ msgs::Vector2d Convert(const ignition::math::Vector2d &_v);
+
+ /// \brief Convert a ignition::math::Quaterniond to a msgs::Quaternion
+ /// \param[in] _q The quaternion to convert
+ /// \return A msgs::Quaternion object
+ IGNITION_MSGS_VISIBLE
+ msgs::Quaternion Convert(const ignition::math::Quaterniond &_q);
+
+ /// \brief Convert a ignition::math::Pose3d to a msgs::Pose
+ /// \param[in] _p The pose to convert
+ /// \return A msgs::Pose object
+ IGNITION_MSGS_VISIBLE
+ msgs::Pose Convert(const ignition::math::Pose3d &_p);
+
+ /// \brief Convert a ignition::math::Planed to a msgs::PlaneGeom
+ /// \param[in] _p The plane to convert
+ /// \return A msgs::PlaneGeom object
+ IGNITION_MSGS_VISIBLE
+ msgs::PlaneGeom Convert(const ignition::math::Planed &_p);
+
+ /// \brief Set a msgs::Vector3d from an ignition::math::Vector3d
+ /// \param[out] _pt A msgs::Vector3d pointer
+ /// \param[in] _v An ignition::math::Vector3d reference
+ IGNITION_MSGS_VISIBLE
+ void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v);
+
+ /// \brief Set a msgs::Vector2d from an ignition::math::Vector2d
+ /// \param[out] _pt A msgs::Vector2d pointer
+ /// \param[in] _v An ignition::math::Vector2d reference
+ IGNITION_MSGS_VISIBLE
+ void Set(msgs::Vector2d *_pt, const ignition::math::Vector2d &_v);
+
+ /// \brief Set a msgs::Quaternion from an ignition::math::Quaterniond
+ /// \param[out] _q A msgs::Quaternion pointer
+ /// \param[in] _v An ignition::math::Quaterniond reference
+ IGNITION_MSGS_VISIBLE
+ void Set(msgs::Quaternion *_q, const ignition::math::Quaterniond &_v);
+
+ /// \brief Set a msgs::Pose from an ignition::math::Pose3d
+ /// \param[out] _p A msgs::Pose pointer
+ /// \param[in] _v An ignition::math::Pose3d reference
+ IGNITION_MSGS_VISIBLE
+ void Set(msgs::Pose *_p, const ignition::math::Pose3d &_v);
+
+ /// \brief Set a msgs::Plane from an ignition::math::Planed
+ /// \param[out] _p A msgs::Plane pointer
+ /// \param[in] _v An ignition::math::Planed reference
+ IGNITION_MSGS_VISIBLE
+ void Set(msgs::PlaneGeom *_p, const ignition::math::Planed &_v);
+ }
+}
+#endif
diff --git a/include/ignition/msgs/ign.hh b/include/ignition/msgs/ign.hh
new file mode 100644
index 0000000..d2b0fdb
--- /dev/null
+++ b/include/ignition/msgs/ign.hh
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#ifndef IGNITION_MSGS_IGN_HH_
+#define IGNITION_MSGS_IGN_HH_
+
+#include <cstring>
+#include "ignition/msgs/System.hh"
+
+/// \brief External hook to execute 'ign msg -i' from the command line.
+/// \param[in] _msg Message type name.
+extern "C" IGNITION_MSGS_VISIBLE void cmdMsgInfo(const char *_msg);
+
+/// \brief External hook to execute 'ign msg -l' from the command line.
+extern "C" IGNITION_MSGS_VISIBLE void cmdMsgList();
+
+/// \brief External hook to read the library version.
+/// \return C-string representing the version. Ex.: 0.1.2
+extern "C" IGNITION_MSGS_VISIBLE char *ignitionMsgsVersion();
+
+#endif
diff --git a/include/ignition/msgs/ign_auto_headers.hh.in b/include/ignition/msgs/ign_auto_headers.hh.in
new file mode 100644
index 0000000..344a0a3
--- /dev/null
+++ b/include/ignition/msgs/ign_auto_headers.hh.in
@@ -0,0 +1,4 @@
+// Automatically generated
+#include <ignition/${IGN_PROJECT_NAME}/config.hh>
+#include <ignition/${IGN_PROJECT_NAME}/MessageTypes.hh>
+${ign_headers}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..fc6cb12
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,29 @@
+include (${project_cmake_dir}/Utils.cmake)
+
+set (sources
+)
+
+set (gtest_sources
+ Factory_TEST.cc
+ Utility_TEST.cc
+)
+
+include_directories (${PROTOBUF_INCLUDE_DIR})
+add_executable(ign_msgs_gen Generator.cc generator_main.cc)
+target_link_libraries(ign_msgs_gen
+ ${PROTOBUF_LIBRARY} ${PROTOBUF_PROTOC_LIBRARY})
+
+if (UNIX)
+ target_link_libraries(ign_msgs_gen pthread)
+endif()
+
+# When the minimum CMake required version will be >= 3.1
+# we could use the target_compile_features() command
+# to enable C++11 support in a platform-independent way.
+if(NOT MSVC)
+ target_compile_options(ign_msgs_gen PUBLIC "-std=c++11")
+endif()
+
+link_directories(${IGNITION-MATH_LIBRARY_DIRS})
+ign_build_tests(${gtest_sources})
+add_subdirectory(cmd)
diff --git a/src/Factory.cc b/src/Factory.cc
new file mode 100644
index 0000000..cb3c3ab
--- /dev/null
+++ b/src/Factory.cc
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#include <google/protobuf/text_format.h>
+#include "ignition/msgs/Factory.hh"
+
+using namespace ignition;
+using namespace msgs;
+
+std::map<std::string, FactoryFn> *Factory::msgMap = NULL;
+
+/////////////////////////////////////////////////
+void Factory::Register(const std::string &_msgType,
+ FactoryFn _factoryfn)
+{
+ // Create the msgMap if it's null
+ if (!msgMap)
+ msgMap = new std::map<std::string, FactoryFn>;
+
+ (*msgMap)[_msgType] = _factoryfn;
+}
+
+/////////////////////////////////////////////////
+std::unique_ptr<google::protobuf::Message> Factory::New(
+ const std::string &_msgType)
+{
+ std::unique_ptr<google::protobuf::Message> msg;
+
+ std::string type;
+ // Convert "ignition.msgs." to "ign_msgs.".
+ if (_msgType.find("ignition.msgs.") == 0)
+ {
+ type = "ign_msgs." + _msgType.substr(14);
+ }
+ // Convert ".ignition.msgs." to "ign_msgs.".
+ else if (_msgType.find(".ignition.msgs.") == 0)
+ {
+ type = "ign_msgs." + _msgType.substr(15);
+ }
+ else
+ {
+ // Fix typenames that are missing "ign_msgs." at the beginning.
+ if (_msgType.find("ign_msgs.") != 0)
+ type = "ign_msgs.";
+ type += _msgType;
+ }
+
+ // Create a new message if a FactoryFn has been assigned to the message
+ // type
+ if (msgMap->find(type) != msgMap->end())
+ msg = ((*msgMap)[type]) ();
+
+ return msg;
+}
+
+/////////////////////////////////////////////////
+std::unique_ptr<google::protobuf::Message> Factory::New(
+ const std::string &_msgType, const std::string &_args)
+{
+ auto msg = New(_msgType);
+ if (msg)
+ {
+ google::protobuf::TextFormat::ParseFromString(_args, msg.get());
+ }
+
+ return msg;
+}
+
+/////////////////////////////////////////////////
+void Factory::Types(std::vector<std::string> &_types)
+{
+ _types.clear();
+
+ // Return the list of all known message types.
+ std::map<std::string, FactoryFn>::const_iterator iter;
+ for (iter = msgMap->begin(); iter != msgMap->end(); ++iter)
+ {
+ _types.push_back(iter->first);
+ }
+}
diff --git a/src/Factory_TEST.cc b/src/Factory_TEST.cc
new file mode 100644
index 0000000..d7865c2
--- /dev/null
+++ b/src/Factory_TEST.cc
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#include <gtest/gtest.h>
+#include <cstddef>
+#include <algorithm>
+#include "ignition/msgs/MessageTypes.hh"
+#include "ignition/msgs/Factory.hh"
+
+using namespace ignition;
+
+/////////////////////////////////////////////////
+TEST(FactoryTest, Type)
+{
+ std::vector<std::string> types;
+ msgs::Factory::Types(types);
+ EXPECT_FALSE(types.empty());
+ EXPECT_TRUE(std::find(types.begin(), types.end(),
+ std::string("ign_msgs.Vector3d")) !=
+ types.end());
+}
+
+/////////////////////////////////////////////////
+TEST(FactoryTest, New)
+{
+ auto msg = msgs::Factory::New<msgs::Vector3d>("ign_msgs.Vector3d");
+
+ EXPECT_TRUE(msg.get() != nullptr);
+
+ msg->set_x(1.0);
+ msg->set_y(2.0);
+ msg->set_z(3.0);
+
+ auto msgFilled = msgs::Factory::New<msgs::Vector3d>(
+ "ign_msgs.Vector3d", "x: 1.0, y: 2.0, z: 3.0");
+
+ EXPECT_EQ(msg->x(), msgFilled->x());
+ EXPECT_EQ(msg->y(), msgFilled->y());
+ EXPECT_EQ(msg->z(), msgFilled->z());
+}
diff --git a/src/Generator.cc b/src/Generator.cc
new file mode 100644
index 0000000..a41c718
--- /dev/null
+++ b/src/Generator.cc
@@ -0,0 +1,183 @@
+/*
+ * Copyright 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#ifdef _WIN32
+#pragma warning(disable : 4244 4267)
+#endif
+
+#include <google/protobuf/descriptor.h>
+#include <google/protobuf/compiler/code_generator.h>
+#include <google/protobuf/io/printer.h>
+#include <google/protobuf/io/zero_copy_stream.h>
+#include <google/protobuf/descriptor.pb.h>
+
+#include <algorithm>
+#include <iostream>
+#include <memory>
+#include <string>
+#include <utility>
+#include <vector>
+
+#include "ignition/msgs/Generator.hh"
+
+namespace google {
+namespace protobuf {
+namespace compiler {
+namespace cpp {
+
+/////////////////////////////////////////////////
+void replaceAll(std::string &_src, const std::string &_oldValue,
+ const std::string &_newValue)
+{
+ for (size_t i = 0; (i = _src.find(_oldValue, i)) != std::string::npos;)
+ {
+ _src.replace(i, _oldValue.length(), _newValue);
+ i += _newValue.length() - _oldValue.length() + 1;
+ }
+}
+
+/////////////////////////////////////////////////
+Generator::Generator(const std::string &/*_name*/)
+{
+}
+
+/////////////////////////////////////////////////
+Generator::~Generator()
+{
+}
+
+/////////////////////////////////////////////////
+bool Generator::Generate(const FileDescriptor *_file,
+ const string &/*_parameter*/,
+ OutputDirectory *_generatorContext,
+ std::string * /*_error*/) const
+{
+ std::string headerFilename = _file->name();
+ std::string delim = ".proto";
+ size_t pos = headerFilename.rfind(delim);
+ headerFilename.replace(pos, delim.size(), ".pb.h");
+
+ std::string sourceFilename = _file->name();
+ pos = sourceFilename.rfind(delim);
+ sourceFilename.replace(pos, delim.size(), ".pb.cc");
+
+ // Add shared point include
+ {
+ std::unique_ptr<io::ZeroCopyOutputStream> output(
+ _generatorContext->OpenForInsert(headerFilename, "includes"));
+ io::Printer printer(output.get(), '$');
+
+ printer.Print("#ifndef _WIN32\n", "name", "includes");
+ printer.Print("#pragma GCC system_header\n", "name", "includes");
+ printer.Print("#else\n", "name", "includes");
+ printer.Print("#pragma warning(disable: 4244 4267 4100 4244 4512",
+ "name", "includes");
+ printer.Print(" 4127 4068 4275 4251)\n", "name", "includes");
+ printer.Print("#endif\n", "name", "includes");
+ }
+
+ // Add shared point include
+ {
+ std::unique_ptr<io::ZeroCopyOutputStream> output(
+ _generatorContext->OpenForInsert(sourceFilename, "includes"));
+ io::Printer printer(output.get(), '$');
+
+ printer.Print("#include \"ignition/msgs/Factory.hh\"\n", "name",
+ "includes");
+
+ printer.Print("#ifndef _WIN32\n", "name", "includes");
+ printer.Print("#pragma GCC diagnostic ignored \"-Wshadow\"\n", "name",
+ "includes");
+ printer.Print("#else\n", "name", "includes");
+ printer.Print("#pragma warning(disable: 4244 4267 4100 4244 4512",
+ "name", "includes");
+ printer.Print(" 4127 4068)\n", "name", "includes");
+ printer.Print("#endif\n", "name", "includes");
+
+ std::string factory = "IGN_REGISTER_STATIC_MSG(\"ign_msgs.";
+ factory += _file->message_type(0)->name() + "\", " +
+ _file->message_type(0)->name() +")";
+ printer.Print(factory.c_str(), "name", "includes");
+ }
+
+
+ {
+ std::unique_ptr<io::ZeroCopyOutputStream> output(
+ _generatorContext->OpenForInsert(headerFilename, "includes"));
+ io::Printer printer(output.get(), '$');
+
+ printer.Print("#include <memory>\n", "name", "includes");
+ printer.Print("#include <ignition/msgs/System.hh>\n", "name",
+ "includes");
+ }
+
+ // Add unique pointer typedef
+ {
+ std::unique_ptr<io::ZeroCopyOutputStream> output(
+ _generatorContext->OpenForInsert(headerFilename, "namespace_scope"));
+ io::Printer printer(output.get(), '$');
+
+ std::string package = _file->package();
+ replaceAll(package, ".", "::");
+
+
+ std::string ptrType = "typedef std::unique_ptr<" + package
+ + "::" + _file->message_type(0)->name() + "> "
+ + _file->message_type(0)->name() + "UniquePtr;\n";
+
+ printer.Print(ptrType.c_str(), "name", "namespace_scope");
+ }
+
+ // Add shared pointer typedef
+ {
+ std::unique_ptr<io::ZeroCopyOutputStream> output(
+ _generatorContext->OpenForInsert(headerFilename, "namespace_scope"));
+ io::Printer printer(output.get(), '$');
+
+ std::string package = _file->package();
+ replaceAll(package, ".", "::");
+
+
+ std::string ptrType = "typedef std::shared_ptr<" + package
+ + "::" + _file->message_type(0)->name() + "> "
+ + _file->message_type(0)->name() + "SharedPtr;\n";
+
+ printer.Print(ptrType.c_str(), "name", "namespace_scope");
+ }
+
+ // Add const shared pointer typedef
+ {
+ std::unique_ptr<io::ZeroCopyOutputStream> output(
+ _generatorContext->OpenForInsert(headerFilename, "global_scope"));
+ io::Printer printer(output.get(), '$');
+
+ std::string package = _file->package();
+ replaceAll(package, ".", "::");
+
+ std::string constType = "typedef const std::shared_ptr<" + package
+ + "::" + _file->message_type(0)->name() + " const> Const"
+ + _file->message_type(0)->name() + "SharedPtr;";
+
+ printer.Print(constType.c_str(), "name", "global_scope");
+ }
+
+ return true;
+}
+}
+}
+}
+}
diff --git a/src/Utility.cc b/src/Utility.cc
new file mode 100644
index 0000000..9b93367
--- /dev/null
+++ b/src/Utility.cc
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#include "ignition/msgs/Utility.hh"
+
+namespace ignition
+{
+ namespace msgs
+ {
+ /////////////////////////////////////////////
+ ignition::math::Vector3d Convert(const msgs::Vector3d &_v)
+ {
+ return ignition::math::Vector3d(_v.x(), _v.y(), _v.z());
+ }
+
+ /////////////////////////////////////////////
+ ignition::math::Vector2d Convert(const msgs::Vector2d &_v)
+ {
+ return ignition::math::Vector2d(_v.x(), _v.y());
+ }
+
+ /////////////////////////////////////////////
+ ignition::math::Quaterniond Convert(const msgs::Quaternion &_q)
+ {
+ return ignition::math::Quaterniond(_q.w(), _q.x(), _q.y(), _q.z());
+ }
+
+ /////////////////////////////////////////////
+ ignition::math::Pose3d Convert(const msgs::Pose &_p)
+ {
+ return ignition::math::Pose3d(Convert(_p.position()),
+ Convert(_p.orientation()));
+ }
+
+ /////////////////////////////////////////////
+ ignition::math::Planed Convert(const msgs::PlaneGeom &_p)
+ {
+ return ignition::math::Planed(Convert(_p.normal()),
+ ignition::math::Vector2d(_p.size().x(), _p.size().y()),
+ _p.d());
+ }
+
+ /////////////////////////////////////////////////
+ msgs::Vector3d Convert(const ignition::math::Vector3d &_v)
+ {
+ msgs::Vector3d result;
+ result.set_x(_v.X());
+ result.set_y(_v.Y());
+ result.set_z(_v.Z());
+ return result;
+ }
+
+ /////////////////////////////////////////////////
+ msgs::Vector2d Convert(const ignition::math::Vector2d &_v)
+ {
+ msgs::Vector2d result;
+ result.set_x(_v.X());
+ result.set_y(_v.Y());
+ return result;
+ }
+
+ /////////////////////////////////////////////
+ msgs::Quaternion Convert(const ignition::math::Quaterniond &_q)
+ {
+ msgs::Quaternion result;
+ result.set_x(_q.X());
+ result.set_y(_q.Y());
+ result.set_z(_q.Z());
+ result.set_w(_q.W());
+ return result;
+ }
+
+ /////////////////////////////////////////////
+ msgs::Pose Convert(const ignition::math::Pose3d &_p)
+ {
+ msgs::Pose result;
+ result.mutable_position()->CopyFrom(Convert(_p.Pos()));
+ result.mutable_orientation()->CopyFrom(Convert(_p.Rot()));
+ return result;
+ }
+
+ /////////////////////////////////////////////
+ msgs::PlaneGeom Convert(const ignition::math::Planed &_p)
+ {
+ msgs::PlaneGeom result;
+ result.mutable_normal()->CopyFrom(Convert(_p.Normal()));
+ result.mutable_size()->set_x(_p.Size().X());
+ result.mutable_size()->set_y(_p.Size().Y());
+ result.set_d(_p.Offset());
+ return result;
+ }
+
+ /////////////////////////////////////////////
+ void Set(msgs::Vector3d *_pt, const ignition::math::Vector3d &_v)
+ {
+ _pt->set_x(_v.X());
+ _pt->set_y(_v.Y());
+ _pt->set_z(_v.Z());
+ }
+
+ /////////////////////////////////////////////
+ void Set(msgs::Vector2d *_pt, const ignition::math::Vector2d &_v)
+ {
+ _pt->set_x(_v.X());
+ _pt->set_y(_v.Y());
+ }
+
+ /////////////////////////////////////////////
+ void Set(msgs::Quaternion *_q, const ignition::math::Quaterniond &_v)
+ {
+ _q->set_x(_v.X());
+ _q->set_y(_v.Y());
+ _q->set_z(_v.Z());
+ _q->set_w(_v.W());
+ }
+
+ /////////////////////////////////////////////
+ void Set(msgs::Pose *_p, const ignition::math::Pose3d &_v)
+ {
+ Set(_p->mutable_position(), _v.Pos());
+ Set(_p->mutable_orientation(), _v.Rot());
+ }
+
+ /////////////////////////////////////////////////
+ void Set(msgs::PlaneGeom *_p, const ignition::math::Planed &_v)
+ {
+ Set(_p->mutable_normal(), _v.Normal());
+ _p->mutable_size()->set_x(_v.Size().X());
+ _p->mutable_size()->set_y(_v.Size().Y());
+ _p->set_d(_v.Offset());
+ }
+ }
+}
diff --git a/src/Utility_TEST.cc b/src/Utility_TEST.cc
new file mode 100644
index 0000000..eb34579
--- /dev/null
+++ b/src/Utility_TEST.cc
@@ -0,0 +1,220 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+#include <gtest/gtest.h>
+#include "ignition/msgs/MessageTypes.hh"
+#include "ignition/msgs/Utility.hh"
+
+using namespace ignition;
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, CovertMathVector3ToMsgs)
+{
+ msgs::Vector3d msg = msgs::Convert(math::Vector3d(1, 2, 3));
+ EXPECT_DOUBLE_EQ(1, msg.x());
+ EXPECT_DOUBLE_EQ(2, msg.y());
+ EXPECT_DOUBLE_EQ(3, msg.z());
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertMsgsVector3dToMath)
+{
+ msgs::Vector3d msg = msgs::Convert(math::Vector3d(1, 2, 3));
+ math::Vector3d v = msgs::Convert(msg);
+ EXPECT_DOUBLE_EQ(1, v.X());
+ EXPECT_DOUBLE_EQ(2, v.Y());
+ EXPECT_DOUBLE_EQ(3, v.Z());
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertMathQuaterionToMsgs)
+{
+ msgs::Quaternion msg =
+ msgs::Convert(math::Quaterniond(M_PI * 0.25, M_PI * 0.5, M_PI));
+
+ EXPECT_TRUE(math::equal(msg.x(), -0.65328148243818818));
+ EXPECT_TRUE(math::equal(msg.y(), 0.27059805007309856));
+ EXPECT_TRUE(math::equal(msg.z(), 0.65328148243818829));
+ EXPECT_TRUE(math::equal(msg.w(), 0.27059805007309851));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertMsgsQuaterionToMath)
+{
+ msgs::Quaternion msg =
+ msgs::Convert(math::Quaterniond(M_PI * 0.25, M_PI * 0.5, M_PI));
+ math::Quaterniond v = msgs::Convert(msg);
+
+ // TODO: to real unit test move math::equal to EXPECT_DOUBLE_EQ
+ EXPECT_TRUE(math::equal(v.X(), -0.65328148243818818));
+ EXPECT_TRUE(math::equal(v.Y(), 0.27059805007309856));
+ EXPECT_TRUE(math::equal(v.Z(), 0.65328148243818829));
+ EXPECT_TRUE(math::equal(v.W(), 0.27059805007309851));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertPoseMathToMsgs)
+{
+ msgs::Pose msg = msgs::Convert(math::Pose3d(
+ math::Vector3d(1, 2, 3),
+ math::Quaterniond(M_PI * 0.25, M_PI * 0.5, M_PI)));
+
+ EXPECT_DOUBLE_EQ(1, msg.position().x());
+ EXPECT_DOUBLE_EQ(2, msg.position().y());
+ EXPECT_DOUBLE_EQ(3, msg.position().z());
+
+ EXPECT_TRUE(math::equal(msg.orientation().x(), -0.65328148243818818));
+ EXPECT_TRUE(math::equal(msg.orientation().y(), 0.27059805007309856));
+ EXPECT_TRUE(math::equal(msg.orientation().z(), 0.65328148243818829));
+ EXPECT_TRUE(math::equal(msg.orientation().w(), 0.27059805007309851));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertMsgPoseToMath)
+{
+ msgs::Pose msg = msgs::Convert(
+ math::Pose3d(math::Vector3d(1, 2, 3),
+ math::Quaterniond(M_PI * 0.25, M_PI * 0.5, M_PI)));
+ math::Pose3d v = msgs::Convert(msg);
+
+ EXPECT_DOUBLE_EQ(1, v.Pos().X());
+ EXPECT_DOUBLE_EQ(2, v.Pos().Y());
+ EXPECT_DOUBLE_EQ(3, v.Pos().Z());
+ EXPECT_TRUE(math::equal(v.Rot().X(), -0.65328148243818818));
+ EXPECT_TRUE(math::equal(v.Rot().Y(), 0.27059805007309856));
+ EXPECT_TRUE(math::equal(v.Rot().Z(), 0.65328148243818829));
+ EXPECT_TRUE(math::equal(v.Rot().W(), 0.27059805007309851));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertMathPlaneToMsgs)
+{
+ msgs::PlaneGeom msg = msgs::Convert(
+ math::Planed(math::Vector3d(0, 0, 1),
+ math::Vector2d(123, 456), 1.0));
+
+ EXPECT_DOUBLE_EQ(0, msg.normal().x());
+ EXPECT_DOUBLE_EQ(0, msg.normal().y());
+ EXPECT_DOUBLE_EQ(1, msg.normal().z());
+
+ EXPECT_DOUBLE_EQ(123, msg.size().x());
+ EXPECT_DOUBLE_EQ(456, msg.size().y());
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, ConvertMsgsPlaneToMath)
+{
+ msgs::PlaneGeom msg = msgs::Convert(
+ math::Planed(math::Vector3d(0, 0, 1),
+ math::Vector2d(123, 456), 1.0));
+ math::Planed v = msgs::Convert(msg);
+
+ EXPECT_DOUBLE_EQ(0, v.Normal().X());
+ EXPECT_DOUBLE_EQ(0, v.Normal().Y());
+ EXPECT_DOUBLE_EQ(1, v.Normal().Z());
+
+ EXPECT_DOUBLE_EQ(123, v.Size().X());
+ EXPECT_DOUBLE_EQ(456, v.Size().Y());
+
+ EXPECT_TRUE(math::equal(1.0, v.Offset()));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, SetVector3)
+{
+ msgs::Vector3d msg;
+ msgs::Set(&msg, math::Vector3d(1, 2, 3));
+ EXPECT_DOUBLE_EQ(1, msg.x());
+ EXPECT_DOUBLE_EQ(2, msg.y());
+ EXPECT_DOUBLE_EQ(3, msg.z());
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, SetVector2d)
+{
+ msgs::Vector2d msg;
+ msgs::Set(&msg, math::Vector2d(1, 2));
+ EXPECT_DOUBLE_EQ(1, msg.x());
+ EXPECT_DOUBLE_EQ(2, msg.y());
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, SetQuaternion)
+{
+ msgs::Quaternion msg;
+ msgs::Set(&msg, math::Quaterniond(M_PI * 0.25, M_PI * 0.5, M_PI));
+ EXPECT_TRUE(math::equal(msg.x(), -0.65328148243818818));
+ EXPECT_TRUE(math::equal(msg.y(), 0.27059805007309856));
+ EXPECT_TRUE(math::equal(msg.z(), 0.65328148243818829));
+ EXPECT_TRUE(math::equal(msg.w(), 0.27059805007309851));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, SetPose)
+{
+ msgs::Pose msg;
+ msgs::Set(&msg, math::Pose3d(math::Vector3d(1, 2, 3),
+ math::Quaterniond(M_PI * 0.25, M_PI * 0.5, M_PI)));
+
+ EXPECT_DOUBLE_EQ(1, msg.position().x());
+ EXPECT_DOUBLE_EQ(2, msg.position().y());
+ EXPECT_DOUBLE_EQ(3, msg.position().z());
+
+ EXPECT_TRUE(math::equal(msg.orientation().x(), -0.65328148243818818));
+ EXPECT_TRUE(math::equal(msg.orientation().y(), 0.27059805007309856));
+ EXPECT_TRUE(math::equal(msg.orientation().z(), 0.65328148243818829));
+ EXPECT_TRUE(math::equal(msg.orientation().w(), 0.27059805007309851));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, SetPlane)
+{
+ msgs::PlaneGeom msg;
+ msgs::Set(&msg, math::Planed(
+ math::Vector3d(0, 0, 1),
+ math::Vector2d(123, 456), 1.0));
+
+ EXPECT_DOUBLE_EQ(0, msg.normal().x());
+ EXPECT_DOUBLE_EQ(0, msg.normal().y());
+ EXPECT_DOUBLE_EQ(1, msg.normal().z());
+
+ EXPECT_DOUBLE_EQ(123, msg.size().x());
+ EXPECT_DOUBLE_EQ(456, msg.size().y());
+
+ EXPECT_TRUE(math::equal(1.0, msg.d()));
+}
+
+/////////////////////////////////////////////////
+TEST(UtilityTest, Initialization)
+{
+ {
+ msgs::Vector3d msg;
+ EXPECT_DOUBLE_EQ(0, msg.x());
+ EXPECT_DOUBLE_EQ(0, msg.y());
+ EXPECT_DOUBLE_EQ(0, msg.z());
+ }
+
+ {
+ msgs::Wrench msg;
+ EXPECT_DOUBLE_EQ(0, msg.force().x());
+ EXPECT_DOUBLE_EQ(0, msg.force().y());
+ EXPECT_DOUBLE_EQ(0, msg.force().z());
+ EXPECT_DOUBLE_EQ(0, msg.torque().x());
+ EXPECT_DOUBLE_EQ(0, msg.torque().y());
+ EXPECT_DOUBLE_EQ(0, msg.torque().z());
+ }
+}
diff --git a/src/cmd/CMakeLists.txt b/src/cmd/CMakeLists.txt
new file mode 100644
index 0000000..0112fce
--- /dev/null
+++ b/src/cmd/CMakeLists.txt
@@ -0,0 +1,16 @@
+include (${project_cmake_dir}/Utils.cmake)
+
+# Generate a the ruby script.
+# Note that the major version of the library is included in the name.
+# Ex: cmdmsgs0.rb
+if (APPLE)
+ set(IGN_LIBRARY_NAME lib${PROJECT_NAME_LOWER}.dylib)
+else()
+ set(IGN_LIBRARY_NAME lib${PROJECT_NAME_LOWER}.so)
+endif()
+configure_file(
+ "cmdmsgs.rb.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmdmsgs${PROJECT_MAJOR_VERSION}.rb" @ONLY)
+
+# Install the ruby command line library in an unversioned location.
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/cmdmsgs${PROJECT_MAJOR_VERSION}.rb DESTINATION lib/ruby/ignition)
diff --git a/src/cmd/cmdmsgs.rb.in b/src/cmd/cmdmsgs.rb.in
new file mode 100644
index 0000000..f7823f9
--- /dev/null
+++ b/src/cmd/cmdmsgs.rb.in
@@ -0,0 +1,152 @@
+#!/usr/bin/ruby
+
+# Copyright (C) 2016 Open Source Robotics Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# We use 'dl' for Ruby <= 1.9.x and 'fiddle' for Ruby >= 2.0.x
+if RUBY_VERSION.split('.')[0] < '2'
+ require 'dl'
+ require 'dl/import'
+ include DL
+else
+ require 'fiddle'
+ require 'fiddle/import'
+ include Fiddle
+end
+
+require 'optparse'
+
+# Constants.
+LIBRARY_NAME = '@IGN_LIBRARY_NAME@'
+LIBRARY_VERSION = '@PROJECT_VERSION_FULL@'
+COMMON_OPTIONS =
+ " -h [ --help ] Print this help message.\n"\
+ " --force-version <VERSION> Use a specific library version.\n"\
+ ' --versions Show the available versions.'
+COMMANDS = { 'msg' =>
+ "Print information about ignition messages.\n\n" +
+ " ign msg [options]\n\n" +
+ "Options:\n\n" +
+ " -i [ --info ] Get info about a message.\n" +
+ " -l [ --list ] List all topics.\n" +
+ COMMON_OPTIONS
+}
+
+#
+# Class for the Ignition msgs command line tools.
+#
+class Cmd
+ #
+ # Return a structure describing the options.
+ #
+ def parse(args)
+ options = {}
+
+ usage = COMMANDS[args[0]]
+
+ # Read the command line arguments.
+ opt_parser = OptionParser.new do |opts|
+ opts.banner = usage
+
+ opts.on('-h', '--help", "Print this help message') do
+ puts usage
+ exit(0)
+ end
+
+ opts.on('-l', '--list', 'Print all message types') do |l|
+ options['list'] = l
+ end
+
+ opts.on('-i msg', '--info', String,
+ 'Print information about a message') do |t|
+ options['info'] = t
+ end
+ end
+ begin
+ opt_parser.parse!(args)
+ rescue
+ puts usage
+ exit(-1)
+ end
+
+ # Check that there is at least one command and there is a plugin that knows
+ # how to handle it.
+ if ARGV.empty? || !COMMANDS.key?(ARGV[0]) ||
+ options.empty?
+ puts usage
+ exit(-1)
+ end
+
+ options['command'] = ARGV[0]
+
+ options
+ end # parse()
+
+ def execute(args)
+ options = parse(args)
+
+ # puts 'Parsed:'
+ # puts options
+
+ # Read the plugin that handles the command.
+ plugin = LIBRARY_NAME
+ conf_version = LIBRARY_VERSION
+
+ begin
+ Importer.dlload plugin
+ rescue DLError
+ puts "Library error: [#{plugin}] not found."
+ exit(-1)
+ end
+
+ # Read the library version.
+ Importer.extern 'char* ignitionMSgsVersion()'
+ begin
+ plugin_version = Importer.ignitionMsgsVersion.to_s
+ rescue DLError
+ puts "Library error: Problem running 'ignitionMsgsVersion()' from #{plugin}."
+ exit(-1)
+ end
+
+ # Sanity check: Verify that the version of the yaml file matches the version
+ # of the library that we are using.
+ unless plugin_version.eql? conf_version
+ puts "Error: Version mismatch. Your configuration file version is
+ [#{conf_version}] but #{plugin} version is [#{plugin_version}]."
+ exit(-1)
+ end
+
+ begin
+ case options['command']
+ when 'msg'
+ if options.key?('list')
+ Importer.extern 'void cmdMsgList()'
+ Importer.cmdMsgList
+ elsif options.key?('info')
+ Importer.extern 'void cmdMsgInfo(const char *)'
+ Importer.cmdMsgInfo(options['info'])
+ else
+ puts 'Command error: I do not have an implementation '\
+ 'for this command.'
+ end
+ else
+ puts 'Command error: I do not have an implementation for '\
+ "command [ign #{options['command']}]."
+ end
+ rescue
+ puts "Library error: Problem running [#{options['command']}]() "\
+ "from #{plugin}."
+ end
+ end
+end
diff --git a/src/generator_main.cc b/src/generator_main.cc
new file mode 100644
index 0000000..3a8d1c8
--- /dev/null
+++ b/src/generator_main.cc
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+#include <google/protobuf/compiler/plugin.h>
+#include "ignition/msgs/Generator.hh"
+
+int main(int _argc, char *_argv[])
+{
+#ifdef _MSC_VER
+ // Don't print a silly message or stick a modal dialog box in my face,
+ // please.
+ _set_abort_behavior(0, ~0);
+#endif // !_MSC_VER
+
+ google::protobuf::compiler::cpp::Generator
+ generator("ignition-msgs-plugin");
+ return google::protobuf::compiler::PluginMain(_argc, _argv, &generator);
+}
diff --git a/src/ign.cc b/src/ign.cc
new file mode 100644
index 0000000..88aea0a
--- /dev/null
+++ b/src/ign.cc
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2016 Open Source Robotics Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * */
+#include <google/protobuf/descriptor.h>
+#include <iostream>
+#include "ignition/msgs/msgs.hh"
+
+#ifdef _MSC_VER
+# pragma warning(disable: 4503)
+#endif
+
+using namespace ignition;
+using namespace msgs;
+
+//////////////////////////////////////////////////
+void cmdMsgInfo(const char *_msg)
+{
+ if (_msg)
+ {
+ auto msg = ignition::msgs::Factory::New(_msg);
+ if (msg)
+ {
+ auto descriptor = msg->GetDescriptor();
+ auto fileDescriptor = descriptor->file();
+ std::cout << "Name: " << descriptor->full_name() << std::endl;
+ std::cout << "File: " << fileDescriptor->name() << std::endl << std::endl;
+
+ std::cout << descriptor->DebugString() << std::endl;
+ }
+ else
+ std::cerr << "Unable to create message of type[" << _msg << "]\n";
+ }
+ else
+ {
+ std::cerr << "Messsage type is null\n";
+ }
+}
+
+//////////////////////////////////////////////////
+void cmdMsgList()
+{
+ std::vector<std::string> types;
+ ignition::msgs::Factory::Types(types);
+
+ for (auto const &type : types)
+ std::cout << type << std::endl;
+}
+
+//////////////////////////////////////////////////
+char *ignitionMsgsVersion()
+{
+ int majorVersion = IGNITION_MSGS_MAJOR_VERSION;
+ int minorVersion = IGNITION_MSGS_MINOR_VERSION;
+ int patchVersion = IGNITION_MSGS_PATCH_VERSION;
+
+ return ign_strdup((std::to_string(majorVersion) + "." +
+ std::to_string(minorVersion) + "." +
+ std::to_string(patchVersion)).c_str());
+}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644
index 0000000..b40c9d6
--- /dev/null
+++ b/test/CMakeLists.txt
@@ -0,0 +1,22 @@
+include_directories (
+ ${PROJECT_SOURCE_DIR}/test/gtest/include
+ ${PROJECT_SOURCE_DIR}/test/gtest
+ ${PROJECT_SOURCE_DIR}/test
+)
+
+configure_file (test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h)
+
+# Build gtest
+add_library(gtest STATIC gtest/src/gtest-all.cc)
+add_library(gtest_main STATIC gtest/src/gtest_main.cc)
+target_link_libraries(gtest_main gtest)
+set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a")
+set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a")
+
+execute_process(COMMAND cmake -E remove_directory ${CMAKE_BINARY_DIR}/test_results)
+execute_process(COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test_results)
+include_directories(${GTEST_INCLUDE_DIRS})
+
+add_subdirectory(integration)
+add_subdirectory(performance)
+add_subdirectory(regression)
diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt
new file mode 100644
index 0000000..95c0559
--- /dev/null
+++ b/test/integration/CMakeLists.txt
@@ -0,0 +1,8 @@
+set(TEST_TYPE "INTEGRATION")
+
+set(tests
+)
+
+link_directories(${PROJECT_BINARY_DIR}/test)
+
+ign_build_tests(${tests})
diff --git a/test/performance/CMakeLists.txt b/test/performance/CMakeLists.txt
new file mode 100644
index 0000000..6946147
--- /dev/null
+++ b/test/performance/CMakeLists.txt
@@ -0,0 +1,8 @@
+set(TEST_TYPE "PERFORMANCE")
+
+set(tests
+)
+
+link_directories(${PROJECT_BINARY_DIR}/test)
+
+ign_build_tests(${tests})
diff --git a/test/regression/CMakeLists.txt b/test/regression/CMakeLists.txt
new file mode 100644
index 0000000..6e3a8e0
--- /dev/null
+++ b/test/regression/CMakeLists.txt
@@ -0,0 +1,8 @@
+set(TEST_TYPE "REGRESSION")
+
+set(tests
+)
+
+link_directories(${PROJECT_BINARY_DIR}/test)
+
+ign_build_tests(${tests})
diff --git a/test/test_config.h.in b/test/test_config.h.in
new file mode 100644
index 0000000..b6ba74a
--- /dev/null
+++ b/test/test_config.h.in
@@ -0,0 +1 @@
+#define PROJECT_SOURCE_PATH "${PROJECT_SOURCE_DIR}"
diff --git a/tools/check_test_ran.py b/tools/check_test_ran.py
new file mode 100755
index 0000000..ecf9518
--- /dev/null
+++ b/tools/check_test_ran.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2008, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# 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 OWNER 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.
+#
+# Revision $Id: check_test_ran.py 16671 2012-04-27 16:15:28Z dthomas $
+
+"""
+Writes a test failure out to test file if it doesn't exist.
+"""
+
+# Adapted from rosunit/check_test_ran.py
+
+from __future__ import print_function
+NAME="check_test_ran.py"
+
+import os
+import sys
+
+def usage():
+ print("""Usage:
+\t%s test-file.xml
+"""%(NAME), file=sys.stderr)
+ print(sys.argv)
+ sys.exit(getattr(os, 'EX_USAGE', 1))
+
+def check_main():
+ if len(sys.argv) < 2:
+ usage()
+ test_file = sys.argv[1]
+
+ print("Checking for test results in %s"%test_file)
+
+ if not os.path.exists(test_file):
+ if not os.path.exists(os.path.dirname(test_file)):
+ os.makedirs(os.path.dirname(test_file))
+
+ print("Cannot find results, writing failure results to", test_file)
+
+ with open(test_file, 'w') as f:
+ test_name = os.path.basename(test_file)
+ d = {'test': test_name, 'test_file': test_file }
+ f.write("""<?xml version="1.0" encoding="UTF-8"?>
+<testsuite tests="1" failures="1" time="1" errors="0" name="%(test)s">
+ <testcase name="test_ran" status="run" time="1" classname="Results">
+ <failure message="Unable to find test results for %(test)s, test did not run.\nExpected results in %(test_file)s" type=""/>
+ </testcase>
+</testsuite>"""%d)
+
+if __name__ == '__main__':
+ check_main()
\ No newline at end of file
diff --git a/tools/code_check.sh b/tools/code_check.sh
new file mode 100644
index 0000000..d805a5c
--- /dev/null
+++ b/tools/code_check.sh
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+# Jenkins will pass -xml, in which case we want to generate XML output
+xmlout=0
+if test "$1" = "-xmldir" -a -n "$2"; then
+ xmlout=1
+ xmldir=$2
+ mkdir -p $xmldir
+ rm -rf $xmldir/*.xml
+ # Assuming that Jenkins called, the `build` directory is sibling to src dir
+ builddir=../build
+else
+ # This is a heuristic guess; not everyone puts the `build` dir in the src dir
+ builddir=./build
+fi
+
+# Identify cppcheck version
+CPPCHECK_VERSION=`cppcheck --version | sed -e 's at Cppcheck @@'`
+CPPCHECK_LT_157=`echo "$CPPCHECK_VERSION 1.57" | \
+ awk '{if ($1 < $2) print 1; else print 0}'`
+
+QUICK_CHECK=0
+if test "$1" = "--quick"
+then
+ QUICK_CHECK=1
+ QUICK_SOURCE=$2
+ hg_root=`hg root`
+ if [ "$?" -ne "0" ] ; then
+ echo This is not an hg repository
+ exit
+ fi
+ cd $hg_root
+ hg log -r $QUICK_SOURCE > /dev/null
+ if [ "$?" -ne "0" ] ; then
+ echo $QUICK_SOURCE is not a valid changeset hash
+ exit
+ fi
+ CHECK_FILES=""
+ while read line; do
+ for f in $line; do
+ CHECK_FILES="$CHECK_FILES `echo $f | grep '\.[ch][ch]*$' | grep -v '^deps'`"
+ done
+ done
+ CPPCHECK_FILES="$CHECK_FILES"
+ CPPLINT_FILES="$CHECK_FILES"
+ QUICK_TMP=`mktemp -t asdfXXXXXXXXXX`
+else
+ CHECK_DIRS="./src ./include ./test/integration ./test/regression ./test/performance"
+ if [ $CPPCHECK_LT_157 -eq 1 ]; then
+ # cppcheck is older than 1.57, so don't check header files (issue #907)
+ CPPCHECK_FILES=`find $CHECK_DIRS -name "*.cc"`
+ else
+ CPPCHECK_FILES=`find $CHECK_DIRS -name "*.cc" -o -name "*.hh"`
+ fi
+ CPPLINT_FILES=`\
+ find $CHECK_DIRS -name "*.cc" -o -name "*.hh" -o -name "*.c" -o -name "*.h"`
+fi
+
+SUPPRESS=/tmp/cpp_check.suppress
+
+# The follow suppression is useful when checking for missing includes.
+# It's disable for now because checking for missing includes is very
+# time consuming. See CPPCHECK_CMD3.
+# echo "missingIncludeSystem" >> $SUPPRESS
+echo "" > $SUPPRESS
+
+#cppcheck
+CPPCHECK_BASE="cppcheck -q --suppressions-list=$SUPPRESS"
+if [ $CPPCHECK_LT_157 -eq 0 ]; then
+ # use --language argument if 1.57 or greater (issue #907)
+ CPPCHECK_BASE="$CPPCHECK_BASE --language=c++"
+fi
+CPPCHECK_INCLUDES="-I ./include -I $builddir -I test -I ./include/ignition/msgs"
+CPPCHECK_RULES="-DIGNITION_MSGS_VISIBLE"
+CPPCHECK_CMD1A="-j 4 --enable=style,performance,portability,information"
+CPPCHECK_CMD1B="$CPPCHECK_RULES $CPPCHECK_FILES"
+CPPCHECK_CMD1="$CPPCHECK_CMD1A $CPPCHECK_CMD1B"
+CPPCHECK_CMD2="--enable=unusedFunction $CPPCHECK_FILES"
+
+# Checking for missing includes is very time consuming. This is disabled
+# for now
+CPPCHECK_CMD3="-j 4 --enable=missingInclude $CPPCHECK_FILES $CPPCHECK_INCLUDES"
+# CPPCHECK_CMD3=""
+
+if [ $xmlout -eq 1 ]; then
+ # Performance, style, portability, and information
+ ($CPPCHECK_BASE --xml $CPPCHECK_CMD1) 2> $xmldir/cppcheck.xml
+
+ # Check the configuration
+ ($CPPCHECK_BASE --xml $CPPCHECK_CMD3) 2> $xmldir/cppcheck-configuration.xml
+elif [ $QUICK_CHECK -eq 1 ]; then
+ for f in $CHECK_FILES; do
+ prefix=`basename $f | sed -e 's@\..*$@@'`
+ ext=`echo $f | sed -e 's@^.*\.@@'`
+ tmp2="$QUICK_TMP"."$ext"
+ tmp2base=`basename "$QUICK_TMP"`
+ hg cat -r $QUICK_SOURCE $hg_root/$f > $tmp2
+
+ # Fix suppressions for tmp files
+ sed -i -e "s@$f@$tmp2@" $SUPPRESS
+
+ # Skip cppcheck for header files if cppcheck is old
+ DO_CPPCHECK=0
+ if [ $ext = 'cc' ]; then
+ DO_CPPCHECK=1
+ elif [ $CPPCHECK_LT_157 -eq 0 ]; then
+ DO_CPPCHECK=1
+ fi
+
+ if [ $DO_CPPCHECK -eq 1 ]; then
+ $CPPCHECK_BASE $CPPCHECK_CMD1A $CPPCHECK_RULES $tmp2 2>&1 \
+ | sed -e "s@$tmp2@$f at g" \
+ | grep -v 'use --check-config for details' \
+ | grep -v 'Include file: .*not found'
+ fi
+
+ # Undo changes to suppression file
+ sed -i -e "s@$tmp2@$f@" $SUPPRESS
+
+ python $hg_root/tools/cpplint.py $tmp2 2>&1 \
+ | sed -e "s@$tmp2@$f at g" -e "s@$tmp2base@$prefix at g" \
+ | grep -v 'Total errors found: 0'
+
+ rm $tmp2
+ done
+ rm $QUICK_TMP
+else
+ # Performance, style, portability, and information
+ $CPPCHECK_BASE $CPPCHECK_INCLUDES $CPPCHECK_CMD1 2>&1
+
+ # Check the configuration
+ $CPPCHECK_BASE $CPPCHECK_CMD3 2>&1
+fi
+
+# cpplint
+if [ $xmlout -eq 1 ]; then
+ (echo $CPPLINT_FILES | xargs python tools/cpplint.p --extensions=cc,hhy 2>&1) \
+ | python tools/cpplint_to_cppcheckxml.py 2> $xmldir/cpplint.xml
+elif [ $QUICK_CHECK -eq 0 ]; then
+ echo $CPPLINT_FILES | xargs python tools/cpplint.py --extensions=cc,hh 2>&1
+fi
diff --git a/tools/cpplint.py b/tools/cpplint.py
new file mode 100644
index 0000000..1b1e4cf
--- /dev/null
+++ b/tools/cpplint.py
@@ -0,0 +1,5622 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2009 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * 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.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# 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
+# OWNER 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.
+
+"""Does google-lint on c++ files.
+
+The goal of this script is to identify places in the code that *may*
+be in non-compliance with google style. It does not attempt to fix
+up these problems -- the point is to educate. It does also not
+attempt to find all problems, or to ensure that everything it does
+find is legitimately a problem.
+
+In particular, we can get very confused by /* and // inside strings!
+We do a small hack, which is to ignore //'s with "'s after them on the
+same line, but it is far from perfect (in either direction).
+"""
+
+import codecs
+import copy
+import getopt
+import math # for log
+import os
+import re
+import sre_compile
+import string
+import sys
+import unicodedata
+
+
+_USAGE = """
+Syntax: cpplint.py [--verbose=#] [--output=vs7] [--filter=-x,+y,...]
+ [--counting=total|toplevel|detailed] [--root=subdir]
+ [--linelength=digits]
+ <file> [file] ...
+
+ The style guidelines this tries to follow are those in
+ http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
+
+ Every problem is given a confidence score from 1-5, with 5 meaning we are
+ certain of the problem, and 1 meaning it could be a legitimate construct.
+ This will miss some errors, and is not a substitute for a code review.
+
+ To suppress false-positive errors of a certain category, add a
+ 'NOLINT(category)' comment to the line. NOLINT or NOLINT(*)
+ suppresses errors of all categories on that line.
+
+ The files passed in will be linted; at least one file must be provided.
+ Default linted extensions are .cc, .cpp, .cu, .cuh and .h. Change the
+ extensions with the --extensions flag.
+
+ Flags:
+
+ output=vs7
+ By default, the output is formatted to ease emacs parsing. Visual Studio
+ compatible output (vs7) may also be used. Other formats are unsupported.
+
+ verbose=#
+ Specify a number 0-5 to restrict errors to certain verbosity levels.
+
+ filter=-x,+y,...
+ Specify a comma-separated list of category-filters to apply: only
+ error messages whose category names pass the filters will be printed.
+ (Category names are printed with the message and look like
+ "[whitespace/indent]".) Filters are evaluated left to right.
+ "-FOO" and "FOO" means "do not print categories that start with FOO".
+ "+FOO" means "do print categories that start with FOO".
+
+ Examples: --filter=-whitespace,+whitespace/braces
+ --filter=whitespace,runtime/printf,+runtime/printf_format
+ --filter=-,+build/include_what_you_use
+
+ To see a list of all the categories used in cpplint, pass no arg:
+ --filter=
+
+ counting=total|toplevel|detailed
+ The total number of errors found is always printed. If
+ 'toplevel' is provided, then the count of errors in each of
+ the top-level categories like 'build' and 'whitespace' will
+ also be printed. If 'detailed' is provided, then a count
+ is provided for each category like 'build/class'.
+
+ root=subdir
+ The root directory used for deriving header guard CPP variable.
+ By default, the header guard CPP variable is calculated as the relative
+ path to the directory that contains .git, .hg, or .svn. When this flag
+ is specified, the relative path is calculated from the specified
+ directory. If the specified directory does not exist, this flag is
+ ignored.
+
+ Examples:
+ Assuming that src/.git exists, the header guard CPP variables for
+ src/chrome/browser/ui/browser.h are:
+
+ No flag => CHROME_BROWSER_UI_BROWSER_H_
+ --root=chrome => BROWSER_UI_BROWSER_H_
+ --root=chrome/browser => UI_BROWSER_H_
+
+ linelength=digits
+ This is the allowed line length for the project. The default value is
+ 80 characters.
+
+ Examples:
+ --linelength=120
+
+ extensions=extension,extension,...
+ The allowed file extensions that cpplint will check
+
+ Examples:
+ --extensions=hpp,cpp
+"""
+
+# We categorize each error message we print. Here are the categories.
+# We want an explicit list so we can list them all in cpplint --filter=.
+# If you add a new error message with a new category, add it to the list
+# here! cpplint_unittest.py should tell you if you forget to do this.
+_ERROR_CATEGORIES = [
+ 'build/class',
+ 'build/c++11',
+ 'build/deprecated',
+ 'build/endif_comment',
+ 'build/explicit_make_pair',
+ 'build/forward_decl',
+ 'build/header_guard',
+ 'build/include',
+ 'build/include_alpha',
+ 'build/include_order',
+ 'build/include_what_you_use',
+ 'build/namespaces',
+ 'build/printf_format',
+ 'build/storage_class',
+ 'legal/copyright',
+ 'readability/alt_tokens',
+ 'readability/braces',
+ 'readability/casting',
+ 'readability/check',
+ 'readability/constructors',
+ 'readability/fn_size',
+ 'readability/function',
+ 'readability/multiline_comment',
+ 'readability/multiline_string',
+ 'readability/namespace',
+ 'readability/nolint',
+ 'readability/nul',
+ 'readability/streams',
+ 'readability/todo',
+ 'readability/utf8',
+ 'runtime/arrays',
+ 'runtime/casting',
+ 'runtime/explicit',
+ 'runtime/int',
+ 'runtime/init',
+ 'runtime/invalid_increment',
+ 'runtime/member_string_references',
+ 'runtime/memset',
+ 'runtime/operator',
+ 'runtime/printf',
+ 'runtime/printf_format',
+ 'runtime/references',
+ 'runtime/string',
+ 'runtime/threadsafe_fn',
+ 'runtime/vlog',
+ 'whitespace/blank_line',
+ 'whitespace/braces',
+ 'whitespace/comma',
+ 'whitespace/comments',
+ 'whitespace/empty_conditional_body',
+ 'whitespace/empty_loop_body',
+ 'whitespace/end_of_line',
+ 'whitespace/ending_newline',
+ 'whitespace/forcolon',
+ 'whitespace/indent',
+ 'whitespace/line_length',
+ 'whitespace/newline',
+ 'whitespace/operators',
+ 'whitespace/parens',
+ 'whitespace/semicolon',
+ 'whitespace/tab',
+ 'whitespace/todo'
+ ]
+
+# The default state of the category filter. This is overridden by the --filter=
+# flag. By default all errors are on, so only add here categories that should be
+# off by default (i.e., categories that must be enabled by the --filter= flags).
+# All entries here should start with a '-' or '+', as in the --filter= flag.
+_DEFAULT_FILTERS = ['-build/include_alpha']
+
+# We used to check for high-bit characters, but after much discussion we
+# decided those were OK, as long as they were in UTF-8 and didn't represent
+# hard-coded international strings, which belong in a separate i18n file.
+
+# C++ headers
+_CPP_HEADERS = frozenset([
+ # Legacy
+ 'algobase.h',
+ 'algo.h',
+ 'alloc.h',
+ 'builtinbuf.h',
+ 'bvector.h',
+ 'complex.h',
+ 'defalloc.h',
+ 'deque.h',
+ 'editbuf.h',
+ 'fstream.h',
+ 'function.h',
+ 'hash_map',
+ 'hash_map.h',
+ 'hash_set',
+ 'hash_set.h',
+ 'hashtable.h',
+ 'heap.h',
+ 'indstream.h',
+ 'iomanip.h',
+ 'iostream.h',
+ 'istream.h',
+ 'iterator.h',
+ 'list.h',
+ 'map.h',
+ 'multimap.h',
+ 'multiset.h',
+ 'ostream.h',
+ 'pair.h',
+ 'parsestream.h',
+ 'pfstream.h',
+ 'procbuf.h',
+ 'pthread_alloc',
+ 'pthread_alloc.h',
+ 'rope',
+ 'rope.h',
+ 'ropeimpl.h',
+ 'set.h',
+ 'slist',
+ 'slist.h',
+ 'stack.h',
+ 'stdiostream.h',
+ 'stl_alloc.h',
+ 'stl_relops.h',
+ 'streambuf.h',
+ 'stream.h',
+ 'strfile.h',
+ 'strstream.h',
+ 'tempbuf.h',
+ 'tree.h',
+ 'type_traits.h',
+ 'vector.h',
+ # 17.6.1.2 C++ library headers
+ 'algorithm',
+ 'array',
+ 'atomic',
+ 'bitset',
+ 'chrono',
+ 'codecvt',
+ 'complex',
+ 'condition_variable',
+ 'deque',
+ 'exception',
+ 'forward_list',
+ 'fstream',
+ 'functional',
+ 'future',
+ 'initializer_list',
+ 'iomanip',
+ 'ios',
+ 'iosfwd',
+ 'iostream',
+ 'istream',
+ 'iterator',
+ 'limits',
+ 'list',
+ 'locale',
+ 'map',
+ 'memory',
+ 'mutex',
+ 'new',
+ 'numeric',
+ 'ostream',
+ 'queue',
+ 'random',
+ 'ratio',
+ 'regex',
+ 'set',
+ 'sstream',
+ 'stack',
+ 'stdexcept',
+ 'streambuf',
+ 'string',
+ 'strstream',
+ 'system_error',
+ 'thread',
+ 'tuple',
+ 'typeindex',
+ 'typeinfo',
+ 'type_traits',
+ 'unordered_map',
+ 'unordered_set',
+ 'utility',
+ 'valarray',
+ 'vector',
+ # 17.6.1.2 C++ headers for C library facilities
+ 'cassert',
+ 'ccomplex',
+ 'cctype',
+ 'cerrno',
+ 'cfenv',
+ 'cfloat',
+ 'cinttypes',
+ 'ciso646',
+ 'climits',
+ 'clocale',
+ 'cmath',
+ 'csetjmp',
+ 'csignal',
+ 'cstdalign',
+ 'cstdarg',
+ 'cstdbool',
+ 'cstddef',
+ 'cstdint',
+ 'cstdio',
+ 'cstdlib',
+ 'cstring',
+ 'ctgmath',
+ 'ctime',
+ 'cuchar',
+ 'cwchar',
+ 'cwctype',
+ ])
+
+
+# Assertion macros. These are defined in base/logging.h and
+# testing/base/gunit.h. Note that the _M versions need to come first
+# for substring matching to work.
+_CHECK_MACROS = [
+ 'DCHECK', 'CHECK',
+ 'EXPECT_TRUE_M', 'EXPECT_TRUE',
+ 'ASSERT_TRUE_M', 'ASSERT_TRUE',
+ 'EXPECT_FALSE_M', 'EXPECT_FALSE',
+ 'ASSERT_FALSE_M', 'ASSERT_FALSE',
+ ]
+
+# Replacement macros for CHECK/DCHECK/EXPECT_TRUE/EXPECT_FALSE
+_CHECK_REPLACEMENT = dict([(m, {}) for m in _CHECK_MACROS])
+
+for op, replacement in [('==', 'EQ'), ('!=', 'NE'),
+ ('>=', 'GE'), ('>', 'GT'),
+ ('<=', 'LE'), ('<', 'LT')]:
+ _CHECK_REPLACEMENT['DCHECK'][op] = 'DCHECK_%s' % replacement
+ _CHECK_REPLACEMENT['CHECK'][op] = 'CHECK_%s' % replacement
+ _CHECK_REPLACEMENT['EXPECT_TRUE'][op] = 'EXPECT_%s' % replacement
+ _CHECK_REPLACEMENT['ASSERT_TRUE'][op] = 'ASSERT_%s' % replacement
+ _CHECK_REPLACEMENT['EXPECT_TRUE_M'][op] = 'EXPECT_%s_M' % replacement
+ _CHECK_REPLACEMENT['ASSERT_TRUE_M'][op] = 'ASSERT_%s_M' % replacement
+
+for op, inv_replacement in [('==', 'NE'), ('!=', 'EQ'),
+ ('>=', 'LT'), ('>', 'LE'),
+ ('<=', 'GT'), ('<', 'GE')]:
+ _CHECK_REPLACEMENT['EXPECT_FALSE'][op] = 'EXPECT_%s' % inv_replacement
+ _CHECK_REPLACEMENT['ASSERT_FALSE'][op] = 'ASSERT_%s' % inv_replacement
+ _CHECK_REPLACEMENT['EXPECT_FALSE_M'][op] = 'EXPECT_%s_M' % inv_replacement
+ _CHECK_REPLACEMENT['ASSERT_FALSE_M'][op] = 'ASSERT_%s_M' % inv_replacement
+
+# Alternative tokens and their replacements. For full list, see section 2.5
+# Alternative tokens [lex.digraph] in the C++ standard.
+#
+# Digraphs (such as '%:') are not included here since it's a mess to
+# match those on a word boundary.
+_ALT_TOKEN_REPLACEMENT = {
+ 'and': '&&',
+ 'bitor': '|',
+ 'or': '||',
+ 'xor': '^',
+ 'compl': '~',
+ 'bitand': '&',
+ 'and_eq': '&=',
+ 'or_eq': '|=',
+ 'xor_eq': '^=',
+ 'not': '!',
+ 'not_eq': '!='
+ }
+
+# Compile regular expression that matches all the above keywords. The "[ =()]"
+# bit is meant to avoid matching these keywords outside of boolean expressions.
+#
+# False positives include C-style multi-line comments and multi-line strings
+# but those have always been troublesome for cpplint.
+_ALT_TOKEN_REPLACEMENT_PATTERN = re.compile(
+ r'[ =()](' + ('|'.join(_ALT_TOKEN_REPLACEMENT.keys())) + r')(?=[ (]|$)')
+
+
+# These constants define types of headers for use with
+# _IncludeState.CheckNextIncludeOrder().
+_C_SYS_HEADER = 1
+_CPP_SYS_HEADER = 2
+_LIKELY_MY_HEADER = 3
+_POSSIBLE_MY_HEADER = 4
+_OTHER_HEADER = 5
+
+# These constants define the current inline assembly state
+_NO_ASM = 0 # Outside of inline assembly block
+_INSIDE_ASM = 1 # Inside inline assembly block
+_END_ASM = 2 # Last line of inline assembly block
+_BLOCK_ASM = 3 # The whole block is an inline assembly block
+
+# Match start of assembly blocks
+_MATCH_ASM = re.compile(r'^\s*(?:asm|_asm|__asm|__asm__)'
+ r'(?:\s+(volatile|__volatile__))?'
+ r'\s*[{(]')
+
+
+_regexp_compile_cache = {}
+
+# Finds occurrences of NOLINT or NOLINT(...).
+_RE_SUPPRESSION = re.compile(r'\bNOLINT\b(\([^)]*\))?')
+
+# {str, set(int)}: a map from error categories to sets of linenumbers
+# on which those errors are expected and should be suppressed.
+_error_suppressions = {}
+
+# The root directory used for deriving header guard CPP variable.
+# This is set by --root flag.
+_root = None
+
+# The allowed line length of files.
+# This is set by --linelength flag.
+_line_length = 80
+
+# The allowed extensions for file names
+# This is set by --extensions flag.
+_valid_extensions = set(['cc', 'hh', 'h', 'cpp', 'cu', 'cuh'])
+
+def ParseNolintSuppressions(filename, raw_line, linenum, error):
+ """Updates the global list of error-suppressions.
+
+ Parses any NOLINT comments on the current line, updating the global
+ error_suppressions store. Reports an error if the NOLINT comment
+ was malformed.
+
+ Args:
+ filename: str, the name of the input file.
+ raw_line: str, the line of input text, with comments.
+ linenum: int, the number of the current line.
+ error: function, an error handler.
+ """
+ # FIXME(adonovan): "NOLINT(" is misparsed as NOLINT(*).
+ matched = _RE_SUPPRESSION.search(raw_line)
+ if matched:
+ category = matched.group(1)
+ if category in (None, '(*)'): # => "suppress all"
+ _error_suppressions.setdefault(None, set()).add(linenum)
+ else:
+ if category.startswith('(') and category.endswith(')'):
+ category = category[1:-1]
+ if category in _ERROR_CATEGORIES:
+ _error_suppressions.setdefault(category, set()).add(linenum)
+ else:
+ error(filename, linenum, 'readability/nolint', 5,
+ 'Unknown NOLINT error category: %s' % category)
+
+
+def ResetNolintSuppressions():
+ "Resets the set of NOLINT suppressions to empty."
+ _error_suppressions.clear()
+
+
+def IsErrorSuppressedByNolint(category, linenum):
+ """Returns true if the specified error category is suppressed on this line.
+
+ Consults the global error_suppressions map populated by
+ ParseNolintSuppressions/ResetNolintSuppressions.
+
+ Args:
+ category: str, the category of the error.
+ linenum: int, the current line number.
+ Returns:
+ bool, True iff the error should be suppressed due to a NOLINT comment.
+ """
+ return (linenum in _error_suppressions.get(category, set()) or
+ linenum in _error_suppressions.get(None, set()))
+
+
+def Match(pattern, s):
+ """Matches the string with the pattern, caching the compiled regexp."""
+ # The regexp compilation caching is inlined in both Match and Search for
+ # performance reasons; factoring it out into a separate function turns out
+ # to be noticeably expensive.
+ if pattern not in _regexp_compile_cache:
+ _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
+ return _regexp_compile_cache[pattern].match(s)
+
+
+def ReplaceAll(pattern, rep, s):
+ """Replaces instances of pattern in a string with a replacement.
+
+ The compiled regex is kept in a cache shared by Match and Search.
+
+ Args:
+ pattern: regex pattern
+ rep: replacement text
+ s: search string
+
+ Returns:
+ string with replacements made (or original string if no replacements)
+ """
+ if pattern not in _regexp_compile_cache:
+ _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
+ return _regexp_compile_cache[pattern].sub(rep, s)
+
+
+def Search(pattern, s):
+ """Searches the string for the pattern, caching the compiled regexp."""
+ if pattern not in _regexp_compile_cache:
+ _regexp_compile_cache[pattern] = sre_compile.compile(pattern)
+ return _regexp_compile_cache[pattern].search(s)
+
+
+class _IncludeState(dict):
+ """Tracks line numbers for includes, and the order in which includes appear.
+
+ As a dict, an _IncludeState object serves as a mapping between include
+ filename and line number on which that file was included.
+
+ Call CheckNextIncludeOrder() once for each header in the file, passing
+ in the type constants defined above. Calls in an illegal order will
+ raise an _IncludeError with an appropriate error message.
+
+ """
+ # self._section will move monotonically through this set. If it ever
+ # needs to move backwards, CheckNextIncludeOrder will raise an error.
+ _INITIAL_SECTION = 0
+ _MY_H_SECTION = 1
+ _C_SECTION = 2
+ _CPP_SECTION = 3
+ _OTHER_H_SECTION = 4
+
+ _TYPE_NAMES = {
+ _C_SYS_HEADER: 'C system header',
+ _CPP_SYS_HEADER: 'C++ system header',
+ _LIKELY_MY_HEADER: 'header this file implements',
+ _POSSIBLE_MY_HEADER: 'header this file may implement',
+ _OTHER_HEADER: 'other header',
+ }
+ _SECTION_NAMES = {
+ _INITIAL_SECTION: "... nothing. (This can't be an error.)",
+ _MY_H_SECTION: 'a header this file implements',
+ _C_SECTION: 'C system header',
+ _CPP_SECTION: 'C++ system header',
+ _OTHER_H_SECTION: 'other header',
+ }
+
+ def __init__(self):
+ dict.__init__(self)
+ self.ResetSection()
+
+ def ResetSection(self):
+ # The name of the current section.
+ self._section = self._INITIAL_SECTION
+ # The path of last found header.
+ self._last_header = ''
+
+ def SetLastHeader(self, header_path):
+ self._last_header = header_path
+
+ def CanonicalizeAlphabeticalOrder(self, header_path):
+ """Returns a path canonicalized for alphabetical comparison.
+
+ - replaces "-" with "_" so they both cmp the same.
+ - removes '-inl' since we don't require them to be after the main header.
+ - lowercase everything, just in case.
+
+ Args:
+ header_path: Path to be canonicalized.
+
+ Returns:
+ Canonicalized path.
+ """
+ return header_path.replace('-inl.h', '.h').replace('-', '_').lower()
+
+ def IsInAlphabeticalOrder(self, clean_lines, linenum, header_path):
+ """Check if a header is in alphabetical order with the previous header.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ header_path: Canonicalized header to be checked.
+
+ Returns:
+ Returns true if the header is in alphabetical order.
+ """
+ # If previous section is different from current section, _last_header will
+ # be reset to empty string, so it's always less than current header.
+ #
+ # If previous line was a blank line, assume that the headers are
+ # intentionally sorted the way they are.
+ if (self._last_header > header_path and
+ not Match(r'^\s*$', clean_lines.elided[linenum - 1])):
+ return False
+ return True
+
+ def CheckNextIncludeOrder(self, header_type):
+ """Returns a non-empty error message if the next header is out of order.
+
+ This function also updates the internal state to be ready to check
+ the next include.
+
+ Args:
+ header_type: One of the _XXX_HEADER constants defined above.
+
+ Returns:
+ The empty string if the header is in the right order, or an
+ error message describing what's wrong.
+
+ """
+ error_message = ('Found %s after %s' %
+ (self._TYPE_NAMES[header_type],
+ self._SECTION_NAMES[self._section]))
+
+ last_section = self._section
+
+ if header_type == _C_SYS_HEADER:
+ if self._section <= self._C_SECTION:
+ self._section = self._C_SECTION
+ else:
+ self._last_header = ''
+ return error_message
+ elif header_type == _CPP_SYS_HEADER:
+ if self._section <= self._CPP_SECTION:
+ self._section = self._CPP_SECTION
+ else:
+ self._last_header = ''
+ return error_message
+ elif header_type == _LIKELY_MY_HEADER:
+ if self._section <= self._MY_H_SECTION:
+ self._section = self._MY_H_SECTION
+ else:
+ self._section = self._OTHER_H_SECTION
+ elif header_type == _POSSIBLE_MY_HEADER:
+ if self._section <= self._MY_H_SECTION:
+ self._section = self._MY_H_SECTION
+ else:
+ # This will always be the fallback because we're not sure
+ # enough that the header is associated with this file.
+ self._section = self._OTHER_H_SECTION
+ else:
+ assert header_type == _OTHER_HEADER
+ self._section = self._OTHER_H_SECTION
+
+ if last_section != self._section:
+ self._last_header = ''
+
+ return ''
+
+
+class _CppLintState(object):
+ """Maintains module-wide state.."""
+
+ def __init__(self):
+ self.verbose_level = 1 # global setting.
+ self.error_count = 0 # global count of reported errors
+ # filters to apply when emitting error messages
+ self.filters = _DEFAULT_FILTERS[:]
+ self.counting = 'total' # In what way are we counting errors?
+ self.errors_by_category = {} # string to int dict storing error counts
+
+ # output format:
+ # "emacs" - format that emacs can parse (default)
+ # "vs7" - format that Microsoft Visual Studio 7 can parse
+ self.output_format = 'emacs'
+
+ def SetOutputFormat(self, output_format):
+ """Sets the output format for errors."""
+ self.output_format = output_format
+
+ def SetVerboseLevel(self, level):
+ """Sets the module's verbosity, and returns the previous setting."""
+ last_verbose_level = self.verbose_level
+ self.verbose_level = level
+ return last_verbose_level
+
+ def SetCountingStyle(self, counting_style):
+ """Sets the module's counting options."""
+ self.counting = counting_style
+
+ def SetFilters(self, filters):
+ """Sets the error-message filters.
+
+ These filters are applied when deciding whether to emit a given
+ error message.
+
+ Args:
+ filters: A string of comma-separated filters (eg "+whitespace/indent").
+ Each filter should start with + or -; else we die.
+
+ Raises:
+ ValueError: The comma-separated filters did not all start with '+' or '-'.
+ E.g. "-,+whitespace,-whitespace/indent,whitespace/badfilter"
+ """
+ # Default filters always have less priority than the flag ones.
+ self.filters = _DEFAULT_FILTERS[:]
+ for filt in filters.split(','):
+ clean_filt = filt.strip()
+ if clean_filt:
+ self.filters.append(clean_filt)
+ for filt in self.filters:
+ if not (filt.startswith('+') or filt.startswith('-')):
+ raise ValueError('Every filter in --filters must start with + or -'
+ ' (%s does not)' % filt)
+
+ def ResetErrorCounts(self):
+ """Sets the module's error statistic back to zero."""
+ self.error_count = 0
+ self.errors_by_category = {}
+
+ def IncrementErrorCount(self, category):
+ """Bumps the module's error statistic."""
+ self.error_count += 1
+ if self.counting in ('toplevel', 'detailed'):
+ if self.counting != 'detailed':
+ category = category.split('/')[0]
+ if category not in self.errors_by_category:
+ self.errors_by_category[category] = 0
+ self.errors_by_category[category] += 1
+
+ def PrintErrorCounts(self):
+ """Print a summary of errors by category, and the total."""
+ for category, count in self.errors_by_category.iteritems():
+ sys.stderr.write('Category \'%s\' errors found: %d\n' %
+ (category, count))
+ sys.stderr.write('Total errors found: %d\n' % self.error_count)
+
+_cpplint_state = _CppLintState()
+
+
+def _OutputFormat():
+ """Gets the module's output format."""
+ return _cpplint_state.output_format
+
+
+def _SetOutputFormat(output_format):
+ """Sets the module's output format."""
+ _cpplint_state.SetOutputFormat(output_format)
+
+
+def _VerboseLevel():
+ """Returns the module's verbosity setting."""
+ return _cpplint_state.verbose_level
+
+
+def _SetVerboseLevel(level):
+ """Sets the module's verbosity, and returns the previous setting."""
+ return _cpplint_state.SetVerboseLevel(level)
+
+
+def _SetCountingStyle(level):
+ """Sets the module's counting options."""
+ _cpplint_state.SetCountingStyle(level)
+
+
+def _Filters():
+ """Returns the module's list of output filters, as a list."""
+ return _cpplint_state.filters
+
+
+def _SetFilters(filters):
+ """Sets the module's error-message filters.
+
+ These filters are applied when deciding whether to emit a given
+ error message.
+
+ Args:
+ filters: A string of comma-separated filters (eg "whitespace/indent").
+ Each filter should start with + or -; else we die.
+ """
+ _cpplint_state.SetFilters(filters)
+
+
+class _FunctionState(object):
+ """Tracks current function name and the number of lines in its body."""
+
+ _NORMAL_TRIGGER = 250 # for --v=0, 500 for --v=1, etc.
+ _TEST_TRIGGER = 400 # about 50% more than _NORMAL_TRIGGER.
+
+ def __init__(self):
+ self.in_a_function = False
+ self.lines_in_function = 0
+ self.current_function = ''
+
+ def Begin(self, function_name):
+ """Start analyzing function body.
+
+ Args:
+ function_name: The name of the function being tracked.
+ """
+ self.in_a_function = True
+ self.lines_in_function = 0
+ self.current_function = function_name
+
+ def Count(self):
+ """Count line in current function body."""
+ if self.in_a_function:
+ self.lines_in_function += 1
+
+ def Check(self, error, filename, linenum):
+ """Report if too many lines in function body.
+
+ Args:
+ error: The function to call with any errors found.
+ filename: The name of the current file.
+ linenum: The number of the line to check.
+ """
+ if Match(r'T(EST|est)', self.current_function):
+ base_trigger = self._TEST_TRIGGER
+ else:
+ base_trigger = self._NORMAL_TRIGGER
+ trigger = base_trigger * 2**_VerboseLevel()
+
+ if self.lines_in_function > trigger:
+ error_level = int(math.log(self.lines_in_function / base_trigger, 2))
+ # 50 => 0, 100 => 1, 200 => 2, 400 => 3, 800 => 4, 1600 => 5, ...
+ if error_level > 5:
+ error_level = 5
+ error(filename, linenum, 'readability/fn_size', error_level,
+ 'Small and focused functions are preferred:'
+ ' %s has %d non-comment lines'
+ ' (error triggered by exceeding %d lines).' % (
+ self.current_function, self.lines_in_function, trigger))
+
+ def End(self):
+ """Stop analyzing function body."""
+ self.in_a_function = False
+
+
+class _IncludeError(Exception):
+ """Indicates a problem with the include order in a file."""
+ pass
+
+
+class FileInfo:
+ """Provides utility functions for filenames.
+
+ FileInfo provides easy access to the components of a file's path
+ relative to the project root.
+ """
+
+ def __init__(self, filename):
+ self._filename = filename
+
+ def FullName(self):
+ """Make Windows paths like Unix."""
+ return os.path.abspath(self._filename).replace('\\', '/')
+
+ def RepositoryName(self):
+ """FullName after removing the local path to the repository.
+
+ If we have a real absolute path name here we can try to do something smart:
+ detecting the root of the checkout and truncating /path/to/checkout from
+ the name so that we get header guards that don't include things like
+ "C:\Documents and Settings\..." or "/home/username/..." in them and thus
+ people on different computers who have checked the source out to different
+ locations won't see bogus errors.
+ """
+ fullname = self.FullName()
+
+ if os.path.exists(fullname):
+ project_dir = os.path.dirname(fullname)
+
+ if os.path.exists(os.path.join(project_dir, ".svn")):
+ # If there's a .svn file in the current directory, we recursively look
+ # up the directory tree for the top of the SVN checkout
+ root_dir = project_dir
+ one_up_dir = os.path.dirname(root_dir)
+ while os.path.exists(os.path.join(one_up_dir, ".svn")):
+ root_dir = os.path.dirname(root_dir)
+ one_up_dir = os.path.dirname(one_up_dir)
+
+ prefix = os.path.commonprefix([root_dir, project_dir])
+ return fullname[len(prefix) + 1:]
+
+ # Not SVN <= 1.6? Try to find a git, hg, or svn top level directory by
+ # searching up from the current path.
+ root_dir = os.path.dirname(fullname)
+ while (root_dir != os.path.dirname(root_dir) and
+ not os.path.exists(os.path.join(root_dir, ".git")) and
+ not os.path.exists(os.path.join(root_dir, ".hg")) and
+ not os.path.exists(os.path.join(root_dir, ".svn"))):
+ root_dir = os.path.dirname(root_dir)
+
+ if (os.path.exists(os.path.join(root_dir, ".git")) or
+ os.path.exists(os.path.join(root_dir, ".hg")) or
+ os.path.exists(os.path.join(root_dir, ".svn"))):
+ prefix = os.path.commonprefix([root_dir, project_dir])
+ return fullname[len(prefix) + 1:]
+
+ # Don't know what to do; header guard warnings may be wrong...
+ return fullname
+
+ def Split(self):
+ """Splits the file into the directory, basename, and extension.
+
+ For 'chrome/browser/browser.cc', Split() would
+ return ('chrome/browser', 'browser', '.cc')
+
+ Returns:
+ A tuple of (directory, basename, extension).
+ """
+
+ googlename = self.RepositoryName()
+ project, rest = os.path.split(googlename)
+ return (project,) + os.path.splitext(rest)
+
+ def BaseName(self):
+ """File base name - text after the final slash, before the final period."""
+ return self.Split()[1]
+
+ def Extension(self):
+ """File extension - text following the final period."""
+ return self.Split()[2]
+
+ def NoExtension(self):
+ """File has no source file extension."""
+ return '/'.join(self.Split()[0:2])
+
+ def IsSource(self):
+ """File has a source file extension."""
+ return self.Extension()[1:] in ('c', 'cc', 'cpp', 'cxx')
+
+
+def _ShouldPrintError(category, confidence, linenum):
+ """If confidence >= verbose, category passes filter and is not suppressed."""
+
+ # There are three ways we might decide not to print an error message:
+ # a "NOLINT(category)" comment appears in the source,
+ # the verbosity level isn't high enough, or the filters filter it out.
+ if IsErrorSuppressedByNolint(category, linenum):
+ return False
+
+ if confidence < _cpplint_state.verbose_level:
+ return False
+
+ is_filtered = False
+ for one_filter in _Filters():
+ if one_filter.startswith('-'):
+ if category.startswith(one_filter[1:]):
+ is_filtered = True
+ elif one_filter.startswith('+'):
+ if category.startswith(one_filter[1:]):
+ is_filtered = False
+ else:
+ assert False # should have been checked for in SetFilter.
+ if is_filtered:
+ return False
+
+ return True
+
+
+def Error(filename, linenum, category, confidence, message):
+ """Logs the fact we've found a lint error.
+
+ We log where the error was found, and also our confidence in the error,
+ that is, how certain we are this is a legitimate style regression, and
+ not a misidentification or a use that's sometimes justified.
+
+ False positives can be suppressed by the use of
+ "cpplint(category)" comments on the offending line. These are
+ parsed into _error_suppressions.
+
+ Args:
+ filename: The name of the file containing the error.
+ linenum: The number of the line containing the error.
+ category: A string used to describe the "category" this bug
+ falls under: "whitespace", say, or "runtime". Categories
+ may have a hierarchy separated by slashes: "whitespace/indent".
+ confidence: A number from 1-5 representing a confidence score for
+ the error, with 5 meaning that we are certain of the problem,
+ and 1 meaning that it could be a legitimate construct.
+ message: The error message.
+ """
+ if _ShouldPrintError(category, confidence, linenum):
+ _cpplint_state.IncrementErrorCount(category)
+ if _cpplint_state.output_format == 'vs7':
+ sys.stderr.write('%s(%s): %s [%s] [%d]\n' % (
+ filename, linenum, message, category, confidence))
+ elif _cpplint_state.output_format == 'eclipse':
+ sys.stderr.write('%s:%s: warning: %s [%s] [%d]\n' % (
+ filename, linenum, message, category, confidence))
+ else:
+ sys.stderr.write('%s:%s: %s [%s] [%d]\n' % (
+ filename, linenum, message, category, confidence))
+
+
+# Matches standard C++ escape sequences per 2.13.2.3 of the C++ standard.
+_RE_PATTERN_CLEANSE_LINE_ESCAPES = re.compile(
+ r'\\([abfnrtv?"\\\']|\d+|x[0-9a-fA-F]+)')
+# Match a single C style comment on the same line.
+_RE_PATTERN_C_COMMENTS = r'/\*(?:[^*]|\*(?!/))*\*/'
+# Matches multi-line C style comments.
+# This RE is a little bit more complicated than one might expect, because we
+# have to take care of space removals tools so we can handle comments inside
+# statements better.
+# The current rule is: We only clear spaces from both sides when we're at the
+# end of the line. Otherwise, we try to remove spaces from the right side,
+# if this doesn't work we try on left side but only if there's a non-character
+# on the right.
+_RE_PATTERN_CLEANSE_LINE_C_COMMENTS = re.compile(
+ r'(\s*' + _RE_PATTERN_C_COMMENTS + r'\s*$|' +
+ _RE_PATTERN_C_COMMENTS + r'\s+|' +
+ r'\s+' + _RE_PATTERN_C_COMMENTS + r'(?=\W)|' +
+ _RE_PATTERN_C_COMMENTS + r')')
+
+
+def IsCppString(line):
+ """Does line terminate so, that the next symbol is in string constant.
+
+ This function does not consider single-line nor multi-line comments.
+
+ Args:
+ line: is a partial line of code starting from the 0..n.
+
+ Returns:
+ True, if next character appended to 'line' is inside a
+ string constant.
+ """
+
+ line = line.replace(r'\\', 'XX') # after this, \\" does not match to \"
+ return ((line.count('"') - line.count(r'\"') - line.count("'\"'")) & 1) == 1
+
+
+def CleanseRawStrings(raw_lines):
+ """Removes C++11 raw strings from lines.
+
+ Before:
+ static const char kData[] = R"(
+ multi-line string
+ )";
+
+ After:
+ static const char kData[] = ""
+ (replaced by blank line)
+ "";
+
+ Args:
+ raw_lines: list of raw lines.
+
+ Returns:
+ list of lines with C++11 raw strings replaced by empty strings.
+ """
+
+ delimiter = None
+ lines_without_raw_strings = []
+ for line in raw_lines:
+ if delimiter:
+ # Inside a raw string, look for the end
+ end = line.find(delimiter)
+ if end >= 0:
+ # Found the end of the string, match leading space for this
+ # line and resume copying the original lines, and also insert
+ # a "" on the last line.
+ leading_space = Match(r'^(\s*)\S', line)
+ line = leading_space.group(1) + '""' + line[end + len(delimiter):]
+ delimiter = None
+ else:
+ # Haven't found the end yet, append a blank line.
+ line = '""'
+
+ # Look for beginning of a raw string, and replace them with
+ # empty strings. This is done in a loop to handle multiple raw
+ # strings on the same line.
+ while delimiter is None:
+ # Look for beginning of a raw string.
+ # See 2.14.15 [lex.string] for syntax.
+ matched = Match(r'^(.*)\b(?:R|u8R|uR|UR|LR)"([^\s\\()]*)\((.*)$', line)
+ if matched:
+ delimiter = ')' + matched.group(2) + '"'
+
+ end = matched.group(3).find(delimiter)
+ if end >= 0:
+ # Raw string ended on same line
+ line = (matched.group(1) + '""' +
+ matched.group(3)[end + len(delimiter):])
+ delimiter = None
+ else:
+ # Start of a multi-line raw string
+ line = matched.group(1) + '""'
+ else:
+ break
+
+ lines_without_raw_strings.append(line)
+
+ # TODO(unknown): if delimiter is not None here, we might want to
+ # emit a warning for unterminated string.
+ return lines_without_raw_strings
+
+
+def FindNextMultiLineCommentStart(lines, lineix):
+ """Find the beginning marker for a multiline comment."""
+ while lineix < len(lines):
+ if lines[lineix].strip().startswith('/*'):
+ # Only return this marker if the comment goes beyond this line
+ if lines[lineix].strip().find('*/', 2) < 0:
+ return lineix
+ lineix += 1
+ return len(lines)
+
+
+def FindNextMultiLineCommentEnd(lines, lineix):
+ """We are inside a comment, find the end marker."""
+ while lineix < len(lines):
+ if lines[lineix].strip().endswith('*/'):
+ return lineix
+ lineix += 1
+ return len(lines)
+
+
+def RemoveMultiLineCommentsFromRange(lines, begin, end):
+ """Clears a range of lines for multi-line comments."""
+ # Having // dummy comments makes the lines non-empty, so we will not get
+ # unnecessary blank line warnings later in the code.
+ for i in range(begin, end):
+ lines[i] = '// dummy'
+
+
+def RemoveMultiLineComments(filename, lines, error):
+ """Removes multiline (c-style) comments from lines."""
+ lineix = 0
+ while lineix < len(lines):
+ lineix_begin = FindNextMultiLineCommentStart(lines, lineix)
+ if lineix_begin >= len(lines):
+ return
+ lineix_end = FindNextMultiLineCommentEnd(lines, lineix_begin)
+ if lineix_end >= len(lines):
+ error(filename, lineix_begin + 1, 'readability/multiline_comment', 5,
+ 'Could not find end of multi-line comment')
+ return
+ RemoveMultiLineCommentsFromRange(lines, lineix_begin, lineix_end + 1)
+ lineix = lineix_end + 1
+
+
+def CleanseComments(line):
+ """Removes //-comments and single-line C-style /* */ comments.
+
+ Args:
+ line: A line of C++ source.
+
+ Returns:
+ The line with single-line comments removed.
+ """
+ commentpos = line.find('//')
+ if commentpos != -1 and not IsCppString(line[:commentpos]):
+ line = line[:commentpos].rstrip()
+ # get rid of /* ... */
+ return _RE_PATTERN_CLEANSE_LINE_C_COMMENTS.sub('', line)
+
+
+class CleansedLines(object):
+ """Holds 3 copies of all lines with different preprocessing applied to them.
+
+ 1) elided member contains lines without strings and comments,
+ 2) lines member contains lines without comments, and
+ 3) raw_lines member contains all the lines without processing.
+ All these three members are of <type 'list'>, and of the same length.
+ """
+
+ def __init__(self, lines):
+ self.elided = []
+ self.lines = []
+ self.raw_lines = lines
+ self.num_lines = len(lines)
+ self.lines_without_raw_strings = CleanseRawStrings(lines)
+ for linenum in range(len(self.lines_without_raw_strings)):
+ self.lines.append(CleanseComments(
+ self.lines_without_raw_strings[linenum]))
+ elided = self._CollapseStrings(self.lines_without_raw_strings[linenum])
+ self.elided.append(CleanseComments(elided))
+
+ def NumLines(self):
+ """Returns the number of lines represented."""
+ return self.num_lines
+
+ @staticmethod
+ def _CollapseStrings(elided):
+ """Collapses strings and chars on a line to simple "" or '' blocks.
+
+ We nix strings first so we're not fooled by text like '"http://"'
+
+ Args:
+ elided: The line being processed.
+
+ Returns:
+ The line with collapsed strings.
+ """
+ if _RE_PATTERN_INCLUDE.match(elided):
+ return elided
+
+ # Remove escaped characters first to make quote/single quote collapsing
+ # basic. Things that look like escaped characters shouldn't occur
+ # outside of strings and chars.
+ elided = _RE_PATTERN_CLEANSE_LINE_ESCAPES.sub('', elided)
+
+ # Replace quoted strings and digit separators. Both single quotes
+ # and double quotes are processed in the same loop, otherwise
+ # nested quotes wouldn't work.
+ collapsed = ''
+ while True:
+ # Find the first quote character
+ match = Match(r'^([^\'"]*)([\'"])(.*)$', elided)
+ if not match:
+ collapsed += elided
+ break
+ head, quote, tail = match.groups()
+
+ if quote == '"':
+ # Collapse double quoted strings
+ second_quote = tail.find('"')
+ if second_quote >= 0:
+ collapsed += head + '""'
+ elided = tail[second_quote + 1:]
+ else:
+ # Unmatched double quote, don't bother processing the rest
+ # of the line since this is probably a multiline string.
+ collapsed += elided
+ break
+ else:
+ # Found single quote, check nearby text to eliminate digit separators.
+ #
+ # There is no special handling for floating point here, because
+ # the integer/fractional/exponent parts would all be parsed
+ # correctly as long as there are digits on both sides of the
+ # separator. So we are fine as long as we don't see something
+ # like "0.'3" (gcc 4.9.0 will not allow this literal).
+ if Search(r'\b(?:0[bBxX]?|[1-9])[0-9a-fA-F]*$', head):
+ match_literal = Match(r'^((?:\'?[0-9a-zA-Z_])*)(.*)$', "'" + tail)
+ collapsed += head + match_literal.group(1).replace("'", '')
+ elided = match_literal.group(2)
+ else:
+ second_quote = tail.find('\'')
+ if second_quote >= 0:
+ collapsed += head + "''"
+ elided = tail[second_quote + 1:]
+ else:
+ # Unmatched single quote
+ collapsed += elided
+ break
+
+ return collapsed
+
+
+def FindEndOfExpressionInLine(line, startpos, stack):
+ """Find the position just after the end of current parenthesized expression.
+
+ Args:
+ line: a CleansedLines line.
+ startpos: start searching at this position.
+ stack: nesting stack at startpos.
+
+ Returns:
+ On finding matching end: (index just after matching end, None)
+ On finding an unclosed expression: (-1, None)
+ Otherwise: (-1, new stack at end of this line)
+ """
+ for i in xrange(startpos, len(line)):
+ char = line[i]
+ if char in '([{':
+ # Found start of parenthesized expression, push to expression stack
+ stack.append(char)
+ elif char == '<':
+ # Found potential start of template argument list
+ if i > 0 and line[i - 1] == '<':
+ # Left shift operator
+ if stack and stack[-1] == '<':
+ stack.pop()
+ if not stack:
+ return (-1, None)
+ elif i > 0 and Search(r'\boperator\s*$', line[0:i]):
+ # operator<, don't add to stack
+ continue
+ else:
+ # Tentative start of template argument list
+ stack.append('<')
+ elif char in ')]}':
+ # Found end of parenthesized expression.
+ #
+ # If we are currently expecting a matching '>', the pending '<'
+ # must have been an operator. Remove them from expression stack.
+ while stack and stack[-1] == '<':
+ stack.pop()
+ if not stack:
+ return (-1, None)
+ if ((stack[-1] == '(' and char == ')') or
+ (stack[-1] == '[' and char == ']') or
+ (stack[-1] == '{' and char == '}')):
+ stack.pop()
+ if not stack:
+ return (i + 1, None)
+ else:
+ # Mismatched parentheses
+ return (-1, None)
+ elif char == '>':
+ # Found potential end of template argument list.
+
+ # Ignore "->" and operator functions
+ if (i > 0 and
+ (line[i - 1] == '-' or Search(r'\boperator\s*$', line[0:i - 1]))):
+ continue
+
+ # Pop the stack if there is a matching '<'. Otherwise, ignore
+ # this '>' since it must be an operator.
+ if stack:
+ if stack[-1] == '<':
+ stack.pop()
+ if not stack:
+ return (i + 1, None)
+ elif char == ';':
+ # Found something that look like end of statements. If we are currently
+ # expecting a '>', the matching '<' must have been an operator, since
+ # template argument list should not contain statements.
+ while stack and stack[-1] == '<':
+ stack.pop()
+ if not stack:
+ return (-1, None)
+
+ # Did not find end of expression or unbalanced parentheses on this line
+ return (-1, stack)
+
+
+def CloseExpression(clean_lines, linenum, pos):
+ """If input points to ( or { or [ or <, finds the position that closes it.
+
+ If lines[linenum][pos] points to a '(' or '{' or '[' or '<', finds the
+ linenum/pos that correspond to the closing of the expression.
+
+ TODO(unknown): cpplint spends a fair bit of time matching parentheses.
+ Ideally we would want to index all opening and closing parentheses once
+ and have CloseExpression be just a simple lookup, but due to preprocessor
+ tricks, this is not so easy.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ pos: A position on the line.
+
+ Returns:
+ A tuple (line, linenum, pos) pointer *past* the closing brace, or
+ (line, len(lines), -1) if we never find a close. Note we ignore
+ strings and comments when matching; and the line we return is the
+ 'cleansed' line at linenum.
+ """
+
+ line = clean_lines.elided[linenum]
+ if (line[pos] not in '({[<') or Match(r'<[<=]', line[pos:]):
+ return (line, clean_lines.NumLines(), -1)
+
+ # Check first line
+ (end_pos, stack) = FindEndOfExpressionInLine(line, pos, [])
+ if end_pos > -1:
+ return (line, linenum, end_pos)
+
+ # Continue scanning forward
+ while stack and linenum < clean_lines.NumLines() - 1:
+ linenum += 1
+ line = clean_lines.elided[linenum]
+ (end_pos, stack) = FindEndOfExpressionInLine(line, 0, stack)
+ if end_pos > -1:
+ return (line, linenum, end_pos)
+
+ # Did not find end of expression before end of file, give up
+ return (line, clean_lines.NumLines(), -1)
+
+
+def FindStartOfExpressionInLine(line, endpos, stack):
+ """Find position at the matching start of current expression.
+
+ This is almost the reverse of FindEndOfExpressionInLine, but note
+ that the input position and returned position differs by 1.
+
+ Args:
+ line: a CleansedLines line.
+ endpos: start searching at this position.
+ stack: nesting stack at endpos.
+
+ Returns:
+ On finding matching start: (index at matching start, None)
+ On finding an unclosed expression: (-1, None)
+ Otherwise: (-1, new stack at beginning of this line)
+ """
+ i = endpos
+ while i >= 0:
+ char = line[i]
+ if char in ')]}':
+ # Found end of expression, push to expression stack
+ stack.append(char)
+ elif char == '>':
+ # Found potential end of template argument list.
+ #
+ # Ignore it if it's a "->" or ">=" or "operator>"
+ if (i > 0 and
+ (line[i - 1] == '-' or
+ Match(r'\s>=\s', line[i - 1:]) or
+ Search(r'\boperator\s*$', line[0:i]))):
+ i -= 1
+ else:
+ stack.append('>')
+ elif char == '<':
+ # Found potential start of template argument list
+ if i > 0 and line[i - 1] == '<':
+ # Left shift operator
+ i -= 1
+ else:
+ # If there is a matching '>', we can pop the expression stack.
+ # Otherwise, ignore this '<' since it must be an operator.
+ if stack and stack[-1] == '>':
+ stack.pop()
+ if not stack:
+ return (i, None)
+ elif char in '([{':
+ # Found start of expression.
+ #
+ # If there are any unmatched '>' on the stack, they must be
+ # operators. Remove those.
+ while stack and stack[-1] == '>':
+ stack.pop()
+ if not stack:
+ return (-1, None)
+ if ((char == '(' and stack[-1] == ')') or
+ (char == '[' and stack[-1] == ']') or
+ (char == '{' and stack[-1] == '}')):
+ stack.pop()
+ if not stack:
+ return (i, None)
+ else:
+ # Mismatched parentheses
+ return (-1, None)
+ elif char == ';':
+ # Found something that look like end of statements. If we are currently
+ # expecting a '<', the matching '>' must have been an operator, since
+ # template argument list should not contain statements.
+ while stack and stack[-1] == '>':
+ stack.pop()
+ if not stack:
+ return (-1, None)
+
+ i -= 1
+
+ return (-1, stack)
+
+
+def ReverseCloseExpression(clean_lines, linenum, pos):
+ """If input points to ) or } or ] or >, finds the position that opens it.
+
+ If lines[linenum][pos] points to a ')' or '}' or ']' or '>', finds the
+ linenum/pos that correspond to the opening of the expression.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ pos: A position on the line.
+
+ Returns:
+ A tuple (line, linenum, pos) pointer *at* the opening brace, or
+ (line, 0, -1) if we never find the matching opening brace. Note
+ we ignore strings and comments when matching; and the line we
+ return is the 'cleansed' line at linenum.
+ """
+ line = clean_lines.elided[linenum]
+ if line[pos] not in ')}]>':
+ return (line, 0, -1)
+
+ # Check last line
+ (start_pos, stack) = FindStartOfExpressionInLine(line, pos, [])
+ if start_pos > -1:
+ return (line, linenum, start_pos)
+
+ # Continue scanning backward
+ while stack and linenum > 0:
+ linenum -= 1
+ line = clean_lines.elided[linenum]
+ (start_pos, stack) = FindStartOfExpressionInLine(line, len(line) - 1, stack)
+ if start_pos > -1:
+ return (line, linenum, start_pos)
+
+ # Did not find start of expression before beginning of file, give up
+ return (line, 0, -1)
+
+
+def CheckForCopyright(filename, lines, error):
+ """Logs an error if no Copyright message appears at the top of the file."""
+
+ # We'll say it should occur by line 10. Don't forget there's a
+ # dummy line at the front.
+ for line in xrange(1, min(len(lines), 11)):
+ if re.search(r'Copyright', lines[line], re.I): break
+ else: # means no copyright line was found
+ error(filename, 0, 'legal/copyright', 5,
+ 'No copyright message found. '
+ 'You should have a line: "Copyright [year] <Copyright Owner>"')
+
+
+def GetIndentLevel(line):
+ """Return the number of leading spaces in line.
+
+ Args:
+ line: A string to check.
+
+ Returns:
+ An integer count of leading spaces, possibly zero.
+ """
+ indent = Match(r'^( *)\S', line)
+ if indent:
+ return len(indent.group(1))
+ else:
+ return 0
+
+
+def GetHeaderGuardCPPVariable(filename):
+ """Returns the CPP variable that should be used as a header guard.
+
+ Args:
+ filename: The name of a C++ header file.
+
+ Returns:
+ The CPP variable that should be used as a header guard in the
+ named file.
+
+ """
+
+ # Restores original filename in case that cpplint is invoked from Emacs's
+ # flymake.
+ filename = re.sub(r'_flymake\.h$', '.h', filename)
+ filename = re.sub(r'/\.flymake/([^/]*)$', r'/\1', filename)
+
+ fileinfo = FileInfo(filename)
+ file_path_from_root = fileinfo.RepositoryName()
+ if _root:
+ file_path_from_root = re.sub('^' + _root + os.sep, '', file_path_from_root)
+ return re.sub(r'[-./\s]', '_', file_path_from_root).upper() + '_'
+
+
+def CheckForHeaderGuard(filename, lines, error):
+ """Checks that the file contains a header guard.
+
+ Logs an error if no #ifndef header guard is present. For other
+ headers, checks that the full pathname is used.
+
+ Args:
+ filename: The name of the C++ header file.
+ lines: An array of strings, each representing a line of the file.
+ error: The function to call with any errors found.
+ """
+
+ cppvar = GetHeaderGuardCPPVariable(filename)
+
+ ifndef = None
+ ifndef_linenum = 0
+ define = None
+ endif = None
+ endif_linenum = 0
+ for linenum, line in enumerate(lines):
+ linesplit = line.split()
+ if len(linesplit) >= 2:
+ # find the first occurrence of #ifndef and #define, save arg
+ if not ifndef and linesplit[0] == '#ifndef':
+ # set ifndef to the header guard presented on the #ifndef line.
+ ifndef = linesplit[1]
+ ifndef_linenum = linenum
+ if not define and linesplit[0] == '#define':
+ define = linesplit[1]
+ # find the last occurrence of #endif, save entire line
+ if line.startswith('#endif'):
+ endif = line
+ endif_linenum = linenum
+
+ if not ifndef:
+ error(filename, 0, 'build/header_guard', 5,
+ 'No #ifndef header guard found, suggested CPP variable is: %s' %
+ cppvar)
+ return
+
+ if not define:
+ error(filename, 0, 'build/header_guard', 5,
+ 'No #define header guard found, suggested CPP variable is: %s' %
+ cppvar)
+ return
+
+ # The guard should be PATH_FILE_H_, but we also allow PATH_FILE_H__
+ # for backward compatibility.
+ if ifndef != cppvar:
+ error_level = 0
+ if ifndef != cppvar + '_':
+ error_level = 5
+
+ ParseNolintSuppressions(filename, lines[ifndef_linenum], ifndef_linenum,
+ error)
+ error(filename, ifndef_linenum, 'build/header_guard', error_level,
+ '#ifndef header guard has wrong style, please use: %s' % cppvar)
+
+ if define != ifndef:
+ error(filename, 0, 'build/header_guard', 5,
+ '#ifndef and #define don\'t match, suggested CPP variable is: %s' %
+ cppvar)
+ return
+
+ if endif != ('#endif // %s' % cppvar):
+ error_level = 0
+ if endif != ('#endif // %s' % (cppvar + '_')):
+ error_level = 5
+
+ ParseNolintSuppressions(filename, lines[endif_linenum], endif_linenum,
+ error)
+ error(filename, endif_linenum, 'build/header_guard', error_level,
+ '#endif line should be "#endif // %s"' % cppvar)
+
+
+def CheckForBadCharacters(filename, lines, error):
+ """Logs an error for each line containing bad characters.
+
+ Two kinds of bad characters:
+
+ 1. Unicode replacement characters: These indicate that either the file
+ contained invalid UTF-8 (likely) or Unicode replacement characters (which
+ it shouldn't). Note that it's possible for this to throw off line
+ numbering if the invalid UTF-8 occurred adjacent to a newline.
+
+ 2. NUL bytes. These are problematic for some tools.
+
+ Args:
+ filename: The name of the current file.
+ lines: An array of strings, each representing a line of the file.
+ error: The function to call with any errors found.
+ """
+ for linenum, line in enumerate(lines):
+ if u'\ufffd' in line:
+ error(filename, linenum, 'readability/utf8', 5,
+ 'Line contains invalid UTF-8 (or Unicode replacement character).')
+ if '\0' in line:
+ error(filename, linenum, 'readability/nul', 5, 'Line contains NUL byte.')
+
+
+def CheckForNewlineAtEOF(filename, lines, error):
+ """Logs an error if there is no newline char at the end of the file.
+
+ Args:
+ filename: The name of the current file.
+ lines: An array of strings, each representing a line of the file.
+ error: The function to call with any errors found.
+ """
+
+ # The array lines() was created by adding two newlines to the
+ # original file (go figure), then splitting on \n.
+ # To verify that the file ends in \n, we just have to make sure the
+ # last-but-two element of lines() exists and is empty.
+ if len(lines) < 3 or lines[-2]:
+ error(filename, len(lines) - 2, 'whitespace/ending_newline', 5,
+ 'Could not find a newline character at the end of the file.')
+
+
+def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):
+ """Logs an error if we see /* ... */ or "..." that extend past one line.
+
+ /* ... */ comments are legit inside macros, for one line.
+ Otherwise, we prefer // comments, so it's ok to warn about the
+ other. Likewise, it's ok for strings to extend across multiple
+ lines, as long as a line continuation character (backslash)
+ terminates each line. Although not currently prohibited by the C++
+ style guide, it's ugly and unnecessary. We don't do well with either
+ in this lint program, so we warn about both.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Remove all \\ (escaped backslashes) from the line. They are OK, and the
+ # second (escaped) slash may trigger later \" detection erroneously.
+ line = line.replace('\\\\', '')
+
+ if line.count('/*') > line.count('*/'):
+ error(filename, linenum, 'readability/multiline_comment', 5,
+ 'Complex multi-line /*...*/-style comment found. '
+ 'Lint may give bogus warnings. '
+ 'Consider replacing these with //-style comments, '
+ 'with #if 0...#endif, '
+ 'or with more clearly structured multi-line comments.')
+
+ if (line.count('"') - line.count('\\"')) % 2:
+ error(filename, linenum, 'readability/multiline_string', 5,
+ 'Multi-line string ("...") found. This lint script doesn\'t '
+ 'do well with such strings, and may give bogus warnings. '
+ 'Use C++11 raw strings or concatenation instead.')
+
+
+# (non-threadsafe name, thread-safe alternative, validation pattern)
+#
+# The validation pattern is used to eliminate false positives such as:
+# _rand(); // false positive due to substring match.
+# ->rand(); // some member function rand().
+# ACMRandom rand(seed); // some variable named rand.
+# ISAACRandom rand(); // another variable named rand.
+#
+# Basically we require the return value of these functions to be used
+# in some expression context on the same line by matching on some
+# operator before the function name. This eliminates constructors and
+# member function calls.
+_UNSAFE_FUNC_PREFIX = r'(?:[-+*/=%^&|(<]\s*|>\s+)'
+_THREADING_LIST = (
+ ('asctime(', 'asctime_r(', _UNSAFE_FUNC_PREFIX + r'asctime\([^)]+\)'),
+ ('ctime(', 'ctime_r(', _UNSAFE_FUNC_PREFIX + r'ctime\([^)]+\)'),
+ ('getgrgid(', 'getgrgid_r(', _UNSAFE_FUNC_PREFIX + r'getgrgid\([^)]+\)'),
+ ('getgrnam(', 'getgrnam_r(', _UNSAFE_FUNC_PREFIX + r'getgrnam\([^)]+\)'),
+ ('getlogin(', 'getlogin_r(', _UNSAFE_FUNC_PREFIX + r'getlogin\(\)'),
+ ('getpwnam(', 'getpwnam_r(', _UNSAFE_FUNC_PREFIX + r'getpwnam\([^)]+\)'),
+ ('getpwuid(', 'getpwuid_r(', _UNSAFE_FUNC_PREFIX + r'getpwuid\([^)]+\)'),
+ ('gmtime(', 'gmtime_r(', _UNSAFE_FUNC_PREFIX + r'gmtime\([^)]+\)'),
+ ('localtime(', 'localtime_r(', _UNSAFE_FUNC_PREFIX + r'localtime\([^)]+\)'),
+ ('rand(', 'rand_r(', _UNSAFE_FUNC_PREFIX + r'rand\(\)'),
+ ('strtok(', 'strtok_r(',
+ _UNSAFE_FUNC_PREFIX + r'strtok\([^)]+\)'),
+ ('ttyname(', 'ttyname_r(', _UNSAFE_FUNC_PREFIX + r'ttyname\([^)]+\)'),
+ )
+
+
+def CheckPosixThreading(filename, clean_lines, linenum, error):
+ """Checks for calls to thread-unsafe functions.
+
+ Much code has been originally written without consideration of
+ multi-threading. Also, engineers are relying on their old experience;
+ they have learned posix before threading extensions were added. These
+ tests guide the engineers to use thread-safe functions (when using
+ posix directly).
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+ for single_thread_func, multithread_safe_func, pattern in _THREADING_LIST:
+ # Additional pattern matching check to confirm that this is the
+ # function we are looking for
+ if Search(pattern, line):
+ error(filename, linenum, 'runtime/threadsafe_fn', 2,
+ 'Consider using ' + multithread_safe_func +
+ '...) instead of ' + single_thread_func +
+ '...) for improved thread safety.')
+
+
+def CheckVlogArguments(filename, clean_lines, linenum, error):
+ """Checks that VLOG() is only used for defining a logging level.
+
+ For example, VLOG(2) is correct. VLOG(INFO), VLOG(WARNING), VLOG(ERROR), and
+ VLOG(FATAL) are not.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+ if Search(r'\bVLOG\((INFO|ERROR|WARNING|DFATAL|FATAL)\)', line):
+ error(filename, linenum, 'runtime/vlog', 5,
+ 'VLOG() should be used with numeric verbosity level. '
+ 'Use LOG() if you want symbolic severity levels.')
+
+# Matches invalid increment: *count++, which moves pointer instead of
+# incrementing a value.
+_RE_PATTERN_INVALID_INCREMENT = re.compile(
+ r'^\s*\*\w+(\+\+|--);')
+
+
+def CheckInvalidIncrement(filename, clean_lines, linenum, error):
+ """Checks for invalid increment *count++.
+
+ For example following function:
+ void increment_counter(int* count) {
+ *count++;
+ }
+ is invalid, because it effectively does count++, moving pointer, and should
+ be replaced with ++*count, (*count)++ or *count += 1.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+ if _RE_PATTERN_INVALID_INCREMENT.match(line):
+ error(filename, linenum, 'runtime/invalid_increment', 5,
+ 'Changing pointer instead of value (or unused value of operator*).')
+
+
+class _BlockInfo(object):
+ """Stores information about a generic block of code."""
+
+ def __init__(self, seen_open_brace):
+ self.seen_open_brace = seen_open_brace
+ self.open_parentheses = 0
+ self.inline_asm = _NO_ASM
+
+ def CheckBegin(self, filename, clean_lines, linenum, error):
+ """Run checks that applies to text up to the opening brace.
+
+ This is mostly for checking the text after the class identifier
+ and the "{", usually where the base class is specified. For other
+ blocks, there isn't much to check, so we always pass.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ pass
+
+ def CheckEnd(self, filename, clean_lines, linenum, error):
+ """Run checks that applies to text after the closing brace.
+
+ This is mostly used for checking end of namespace comments.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ pass
+
+ def IsBlockInfo(self):
+ """Returns true if this block is a _BlockInfo.
+
+ This is convenient for verifying that an object is an instance of
+ a _BlockInfo, but not an instance of any of the derived classes.
+
+ Returns:
+ True for this class, False for derived classes.
+ """
+ return self.__class__ == _BlockInfo
+
+
+class _ExternCInfo(_BlockInfo):
+ """Stores information about an 'extern "C"' block."""
+
+ def __init__(self):
+ _BlockInfo.__init__(self, True)
+
+
+class _ClassInfo(_BlockInfo):
+ """Stores information about a class."""
+
+ def __init__(self, name, class_or_struct, clean_lines, linenum):
+ _BlockInfo.__init__(self, False)
+ self.name = name
+ self.starting_linenum = linenum
+ self.is_derived = False
+ if class_or_struct == 'struct':
+ self.access = 'public'
+ self.is_struct = True
+ else:
+ self.access = 'private'
+ self.is_struct = False
+
+ # Remember initial indentation level for this class. Using raw_lines here
+ # instead of elided to account for leading comments.
+ self.class_indent = GetIndentLevel(clean_lines.raw_lines[linenum])
+
+ # Try to find the end of the class. This will be confused by things like:
+ # class A {
+ # } *x = { ...
+ #
+ # But it's still good enough for CheckSectionSpacing.
+ self.last_line = 0
+ depth = 0
+ for i in range(linenum, clean_lines.NumLines()):
+ line = clean_lines.elided[i]
+ depth += line.count('{') - line.count('}')
+ if not depth:
+ self.last_line = i
+ break
+
+ def CheckBegin(self, filename, clean_lines, linenum, error):
+ # Look for a bare ':'
+ if Search('(^|[^:]):($|[^:])', clean_lines.elided[linenum]):
+ self.is_derived = True
+
+ def CheckEnd(self, filename, clean_lines, linenum, error):
+ # Check that closing brace is aligned with beginning of the class.
+ # Only do this if the closing brace is indented by only whitespaces.
+ # This means we will not check single-line class definitions.
+ indent = Match(r'^( *)\}', clean_lines.elided[linenum])
+ if indent and len(indent.group(1)) != self.class_indent:
+ if self.is_struct:
+ parent = 'struct ' + self.name
+ else:
+ parent = 'class ' + self.name
+ error(filename, linenum, 'whitespace/indent', 3,
+ 'Closing brace should be aligned with beginning of %s' % parent)
+
+
+class _NamespaceInfo(_BlockInfo):
+ """Stores information about a namespace."""
+
+ def __init__(self, name, linenum):
+ _BlockInfo.__init__(self, False)
+ self.name = name or ''
+ self.starting_linenum = linenum
+
+ def CheckEnd(self, filename, clean_lines, linenum, error):
+ """Check end of namespace comments."""
+ line = clean_lines.raw_lines[linenum]
+
+ # Check how many lines is enclosed in this namespace. Don't issue
+ # warning for missing namespace comments if there aren't enough
+ # lines. However, do apply checks if there is already an end of
+ # namespace comment and it's incorrect.
+ #
+ # TODO(unknown): We always want to check end of namespace comments
+ # if a namespace is large, but sometimes we also want to apply the
+ # check if a short namespace contained nontrivial things (something
+ # other than forward declarations). There is currently no logic on
+ # deciding what these nontrivial things are, so this check is
+ # triggered by namespace size only, which works most of the time.
+ if (linenum - self.starting_linenum < 10
+ and not Match(r'};*\s*(//|/\*).*\bnamespace\b', line)):
+ return
+
+ # Look for matching comment at end of namespace.
+ #
+ # Note that we accept C style "/* */" comments for terminating
+ # namespaces, so that code that terminate namespaces inside
+ # preprocessor macros can be cpplint clean.
+ #
+ # We also accept stuff like "// end of namespace <name>." with the
+ # period at the end.
+ #
+ # Besides these, we don't accept anything else, otherwise we might
+ # get false negatives when existing comment is a substring of the
+ # expected namespace.
+ if self.name:
+ # Named namespace
+ if Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
+ r'[\*/\.\\\s]*$'),
+ line):
+ error(filename, linenum, 'readability/namespace', 5,
+ 'Namespace should not be terminated with "// namespace %s"' %
+ self.name)
+ else:
+ # Anonymous namespace
+ if not Match(r'};*\s*(//|/\*).*\bnamespace[\*/\.\\\s]*$', line):
+ # If "// namespace anonymous" or "// anonymous namespace (more text)",
+ # mention "// anonymous namespace" as an acceptable form
+ if Match(r'}.*\b(namespace anonymous|anonymous namespace)\b', line):
+ error(filename, linenum, 'readability/namespace', 5,
+ 'Anonymous namespace should be terminated with "// namespace"'
+ ' or "// anonymous namespace"')
+ else:
+ error(filename, linenum, 'readability/namespace', 5,
+ 'Anonymous namespace should be terminated with "// namespace"')
+
+
+class _PreprocessorInfo(object):
+ """Stores checkpoints of nesting stacks when #if/#else is seen."""
+
+ def __init__(self, stack_before_if):
+ # The entire nesting stack before #if
+ self.stack_before_if = stack_before_if
+
+ # The entire nesting stack up to #else
+ self.stack_before_else = []
+
+ # Whether we have already seen #else or #elif
+ self.seen_else = False
+
+
+class NestingState(object):
+ """Holds states related to parsing braces."""
+
+ def __init__(self):
+ # Stack for tracking all braces. An object is pushed whenever we
+ # see a "{", and popped when we see a "}". Only 3 types of
+ # objects are possible:
+ # - _ClassInfo: a class or struct.
+ # - _NamespaceInfo: a namespace.
+ # - _BlockInfo: some other type of block.
+ self.stack = []
+
+ # Top of the previous stack before each Update().
+ #
+ # Because the nesting_stack is updated at the end of each line, we
+ # had to do some convoluted checks to find out what is the current
+ # scope at the beginning of the line. This check is simplified by
+ # saving the previous top of nesting stack.
+ #
+ # We could save the full stack, but we only need the top. Copying
+ # the full nesting stack would slow down cpplint by ~10%.
+ self.previous_stack_top = []
+
+ # Stack of _PreprocessorInfo objects.
+ self.pp_stack = []
+
+ def SeenOpenBrace(self):
+ """Check if we have seen the opening brace for the innermost block.
+
+ Returns:
+ True if we have seen the opening brace, False if the innermost
+ block is still expecting an opening brace.
+ """
+ return (not self.stack) or self.stack[-1].seen_open_brace
+
+ def InNamespaceBody(self):
+ """Check if we are currently one level inside a namespace body.
+
+ Returns:
+ True if top of the stack is a namespace block, False otherwise.
+ """
+ return self.stack and isinstance(self.stack[-1], _NamespaceInfo)
+
+ def InExternC(self):
+ """Check if we are currently one level inside an 'extern "C"' block.
+
+ Returns:
+ True if top of the stack is an extern block, False otherwise.
+ """
+ return self.stack and isinstance(self.stack[-1], _ExternCInfo)
+
+ def InClassDeclaration(self):
+ """Check if we are currently one level inside a class or struct declaration.
+
+ Returns:
+ True if top of the stack is a class/struct, False otherwise.
+ """
+ return self.stack and isinstance(self.stack[-1], _ClassInfo)
+
+ def InAsmBlock(self):
+ """Check if we are currently one level inside an inline ASM block.
+
+ Returns:
+ True if the top of the stack is a block containing inline ASM.
+ """
+ return self.stack and self.stack[-1].inline_asm != _NO_ASM
+
+ def InTemplateArgumentList(self, clean_lines, linenum, pos):
+ """Check if current position is inside template argument list.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ pos: position just after the suspected template argument.
+ Returns:
+ True if (linenum, pos) is inside template arguments.
+ """
+ while linenum < clean_lines.NumLines():
+ # Find the earliest character that might indicate a template argument
+ line = clean_lines.elided[linenum]
+ match = Match(r'^[^{};=\[\]\.<>]*(.)', line[pos:])
+ if not match:
+ linenum += 1
+ pos = 0
+ continue
+ token = match.group(1)
+ pos += len(match.group(0))
+
+ # These things do not look like template argument list:
+ # class Suspect {
+ # class Suspect x; }
+ if token in ('{', '}', ';'): return False
+
+ # These things look like template argument list:
+ # template <class Suspect>
+ # template <class Suspect = default_value>
+ # template <class Suspect[]>
+ # template <class Suspect...>
+ if token in ('>', '=', '[', ']', '.'): return True
+
+ # Check if token is an unmatched '<'.
+ # If not, move on to the next character.
+ if token != '<':
+ pos += 1
+ if pos >= len(line):
+ linenum += 1
+ pos = 0
+ continue
+
+ # We can't be sure if we just find a single '<', and need to
+ # find the matching '>'.
+ (_, end_line, end_pos) = CloseExpression(clean_lines, linenum, pos - 1)
+ if end_pos < 0:
+ # Not sure if template argument list or syntax error in file
+ return False
+ linenum = end_line
+ pos = end_pos
+ return False
+
+ def UpdatePreprocessor(self, line):
+ """Update preprocessor stack.
+
+ We need to handle preprocessors due to classes like this:
+ #ifdef SWIG
+ struct ResultDetailsPageElementExtensionPoint {
+ #else
+ struct ResultDetailsPageElementExtensionPoint : public Extension {
+ #endif
+
+ We make the following assumptions (good enough for most files):
+ - Preprocessor condition evaluates to true from #if up to first
+ #else/#elif/#endif.
+
+ - Preprocessor condition evaluates to false from #else/#elif up
+ to #endif. We still perform lint checks on these lines, but
+ these do not affect nesting stack.
+
+ Args:
+ line: current line to check.
+ """
+ if Match(r'^\s*#\s*(if|ifdef|ifndef)\b', line):
+ # Beginning of #if block, save the nesting stack here. The saved
+ # stack will allow us to restore the parsing state in the #else case.
+ self.pp_stack.append(_PreprocessorInfo(copy.deepcopy(self.stack)))
+ elif Match(r'^\s*#\s*(else|elif)\b', line):
+ # Beginning of #else block
+ if self.pp_stack:
+ if not self.pp_stack[-1].seen_else:
+ # This is the first #else or #elif block. Remember the
+ # whole nesting stack up to this point. This is what we
+ # keep after the #endif.
+ self.pp_stack[-1].seen_else = True
+ self.pp_stack[-1].stack_before_else = copy.deepcopy(self.stack)
+
+ # Restore the stack to how it was before the #if
+ self.stack = copy.deepcopy(self.pp_stack[-1].stack_before_if)
+ else:
+ # TODO(unknown): unexpected #else, issue warning?
+ pass
+ elif Match(r'^\s*#\s*endif\b', line):
+ # End of #if or #else blocks.
+ if self.pp_stack:
+ # If we saw an #else, we will need to restore the nesting
+ # stack to its former state before the #else, otherwise we
+ # will just continue from where we left off.
+ if self.pp_stack[-1].seen_else:
+ # Here we can just use a shallow copy since we are the last
+ # reference to it.
+ self.stack = self.pp_stack[-1].stack_before_else
+ # Drop the corresponding #if
+ self.pp_stack.pop()
+ else:
+ # TODO(unknown): unexpected #endif, issue warning?
+ pass
+
+ # TODO(unknown): Update() is too long, but we will refactor later.
+ def Update(self, filename, clean_lines, linenum, error):
+ """Update nesting state with current line.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Remember top of the previous nesting stack.
+ #
+ # The stack is always pushed/popped and not modified in place, so
+ # we can just do a shallow copy instead of copy.deepcopy. Using
+ # deepcopy would slow down cpplint by ~28%.
+ if self.stack:
+ self.previous_stack_top = self.stack[-1]
+ else:
+ self.previous_stack_top = None
+
+ # Update pp_stack
+ self.UpdatePreprocessor(line)
+
+ # Count parentheses. This is to avoid adding struct arguments to
+ # the nesting stack.
+ if self.stack:
+ inner_block = self.stack[-1]
+ depth_change = line.count('(') - line.count(')')
+ inner_block.open_parentheses += depth_change
+
+ # Also check if we are starting or ending an inline assembly block.
+ if inner_block.inline_asm in (_NO_ASM, _END_ASM):
+ if (depth_change != 0 and
+ inner_block.open_parentheses == 1 and
+ _MATCH_ASM.match(line)):
+ # Enter assembly block
+ inner_block.inline_asm = _INSIDE_ASM
+ else:
+ # Not entering assembly block. If previous line was _END_ASM,
+ # we will now shift to _NO_ASM state.
+ inner_block.inline_asm = _NO_ASM
+ elif (inner_block.inline_asm == _INSIDE_ASM and
+ inner_block.open_parentheses == 0):
+ # Exit assembly block
+ inner_block.inline_asm = _END_ASM
+
+ # Consume namespace declaration at the beginning of the line. Do
+ # this in a loop so that we catch same line declarations like this:
+ # namespace proto2 { namespace bridge { class MessageSet; } }
+ while True:
+ # Match start of namespace. The "\b\s*" below catches namespace
+ # declarations even if it weren't followed by a whitespace, this
+ # is so that we don't confuse our namespace checker. The
+ # missing spaces will be flagged by CheckSpacing.
+ namespace_decl_match = Match(r'^\s*namespace\b\s*([:\w]+)?(.*)$', line)
+ if not namespace_decl_match:
+ break
+
+ new_namespace = _NamespaceInfo(namespace_decl_match.group(1), linenum)
+ self.stack.append(new_namespace)
+
+ line = namespace_decl_match.group(2)
+ if line.find('{') != -1:
+ new_namespace.seen_open_brace = True
+ line = line[line.find('{') + 1:]
+
+ # Look for a class declaration in whatever is left of the line
+ # after parsing namespaces. The regexp accounts for decorated classes
+ # such as in:
+ # class LOCKABLE API Object {
+ # };
+ class_decl_match = Match(
+ r'^(\s*(?:template\s*<[\w\s<>,:]*>\s*)?'
+ r'(class|struct)\s+(?:[A-Z_]+\s+)*(\w+(?:::\w+)*))'
+ r'(.*)$', line)
+ if (class_decl_match and
+ (not self.stack or self.stack[-1].open_parentheses == 0)):
+ # We do not want to accept classes that are actually template arguments:
+ # template <class Ignore1,
+ # class Ignore2 = Default<Args>,
+ # template <Args> class Ignore3>
+ # void Function() {};
+ #
+ # To avoid template argument cases, we scan forward and look for
+ # an unmatched '>'. If we see one, assume we are inside a
+ # template argument list.
+ end_declaration = len(class_decl_match.group(1))
+ if not self.InTemplateArgumentList(clean_lines, linenum, end_declaration):
+ self.stack.append(_ClassInfo(
+ class_decl_match.group(3), class_decl_match.group(2),
+ clean_lines, linenum))
+ line = class_decl_match.group(4)
+
+ # If we have not yet seen the opening brace for the innermost block,
+ # run checks here.
+ if not self.SeenOpenBrace():
+ self.stack[-1].CheckBegin(filename, clean_lines, linenum, error)
+
+ # Update access control if we are inside a class/struct
+ if self.stack and isinstance(self.stack[-1], _ClassInfo):
+ classinfo = self.stack[-1]
+ access_match = Match(
+ r'^(.*)\b(public|private|protected|signals)(\s+(?:slots\s*)?)?'
+ r':(?:[^:]|$)',
+ line)
+ if access_match:
+ classinfo.access = access_match.group(2)
+
+ # Check that access keywords are indented +1 space. Skip this
+ # check if the keywords are not preceded by whitespaces.
+ indent = access_match.group(1)
+ if (len(indent) != classinfo.class_indent + 2 and
+ Match(r'^\s*$', indent)):
+ if classinfo.is_struct:
+ parent = 'struct ' + classinfo.name
+ else:
+ parent = 'class ' + classinfo.name
+ slots = ''
+ if access_match.group(3):
+ slots = access_match.group(3)
+ error(filename, linenum, 'whitespace/indent', 3,
+ '%s%s: should be indented +2 space inside %s' % (
+ access_match.group(2), slots, parent))
+
+ # Consume braces or semicolons from what's left of the line
+ while True:
+ # Match first brace, semicolon, or closed parenthesis.
+ matched = Match(r'^[^{;)}]*([{;)}])(.*)$', line)
+ if not matched:
+ break
+
+ token = matched.group(1)
+ if token == '{':
+ # If namespace or class hasn't seen a opening brace yet, mark
+ # namespace/class head as complete. Push a new block onto the
+ # stack otherwise.
+ if not self.SeenOpenBrace():
+ self.stack[-1].seen_open_brace = True
+ elif Match(r'^extern\s*"[^"]*"\s*\{', line):
+ self.stack.append(_ExternCInfo())
+ else:
+ self.stack.append(_BlockInfo(True))
+ if _MATCH_ASM.match(line):
+ self.stack[-1].inline_asm = _BLOCK_ASM
+
+ elif token == ';' or token == ')':
+ # If we haven't seen an opening brace yet, but we already saw
+ # a semicolon, this is probably a forward declaration. Pop
+ # the stack for these.
+ #
+ # Similarly, if we haven't seen an opening brace yet, but we
+ # already saw a closing parenthesis, then these are probably
+ # function arguments with extra "class" or "struct" keywords.
+ # Also pop these stack for these.
+ if not self.SeenOpenBrace():
+ self.stack.pop()
+ else: # token == '}'
+ # Perform end of block checks and pop the stack.
+ if self.stack:
+ self.stack[-1].CheckEnd(filename, clean_lines, linenum, error)
+ self.stack.pop()
+ line = matched.group(2)
+
+ def InnermostClass(self):
+ """Get class info on the top of the stack.
+
+ Returns:
+ A _ClassInfo object if we are inside a class, or None otherwise.
+ """
+ for i in range(len(self.stack), 0, -1):
+ classinfo = self.stack[i - 1]
+ if isinstance(classinfo, _ClassInfo):
+ return classinfo
+ return None
+
+ def CheckCompletedBlocks(self, filename, error):
+ """Checks that all classes and namespaces have been completely parsed.
+
+ Call this when all lines in a file have been processed.
+ Args:
+ filename: The name of the current file.
+ error: The function to call with any errors found.
+ """
+ # Note: This test can result in false positives if #ifdef constructs
+ # get in the way of brace matching. See the testBuildClass test in
+ # cpplint_unittest.py for an example of this.
+ for obj in self.stack:
+ if isinstance(obj, _ClassInfo):
+ error(filename, obj.starting_linenum, 'build/class', 5,
+ 'Failed to find complete declaration of class %s' %
+ obj.name)
+ elif isinstance(obj, _NamespaceInfo):
+ error(filename, obj.starting_linenum, 'build/namespaces', 5,
+ 'Failed to find complete declaration of namespace %s' %
+ obj.name)
+
+
+def CheckForNonStandardConstructs(filename, clean_lines, linenum,
+ nesting_state, error):
+ r"""Logs an error if we see certain non-ANSI constructs ignored by gcc-2.
+
+ Complain about several constructs which gcc-2 accepts, but which are
+ not standard C++. Warning about these in lint is one way to ease the
+ transition to new compilers.
+ - put storage class first (e.g. "static const" instead of "const static").
+ - "%lld" instead of %qd" in printf-type functions.
+ - "%1$d" is non-standard in printf-type functions.
+ - "\%" is an undefined character escape sequence.
+ - text after #endif is not allowed.
+ - invalid inner-style forward declaration.
+ - >? and <? operators, and their >?= and <?= cousins.
+
+ Additionally, check for constructor/destructor style violations and reference
+ members, as it is very convenient to do so while checking for
+ gcc-2 compliance.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: A callable to which errors are reported, which takes 4 arguments:
+ filename, line number, error level, and message
+ """
+
+ # Remove comments from the line, but leave in strings for now.
+ line = clean_lines.lines[linenum]
+
+ if Search(r'printf\s*\(.*".*%[-+ ]?\d*q', line):
+ error(filename, linenum, 'runtime/printf_format', 3,
+ '%q in format strings is deprecated. Use %ll instead.')
+
+ if Search(r'printf\s*\(.*".*%\d+\$', line):
+ error(filename, linenum, 'runtime/printf_format', 2,
+ '%N$ formats are unconventional. Try rewriting to avoid them.')
+
+ # Remove escaped backslashes before looking for undefined escapes.
+ line = line.replace('\\\\', '')
+
+ if Search(r'("|\').*\\(%|\[|\(|{)', line):
+ error(filename, linenum, 'build/printf_format', 3,
+ '%, [, (, and { are undefined character escapes. Unescape them.')
+
+ # For the rest, work with both comments and strings removed.
+ line = clean_lines.elided[linenum]
+
+ if Search(r'\b(const|volatile|void|char|short|int|long'
+ r'|float|double|signed|unsigned'
+ r'|schar|u?int8|u?int16|u?int32|u?int64)'
+ r'\s+(register|static|extern|typedef)\b',
+ line):
+ error(filename, linenum, 'build/storage_class', 5,
+ 'Storage class (static, extern, typedef, etc) should be first.')
+
+ if Match(r'\s*#\s*endif\s*[^/\s]+', line):
+ error(filename, linenum, 'build/endif_comment', 5,
+ 'Uncommented text after #endif is non-standard. Use a comment.')
+
+ if Match(r'\s*class\s+(\w+\s*::\s*)+\w+\s*;', line):
+ error(filename, linenum, 'build/forward_decl', 5,
+ 'Inner-style forward declarations are invalid. Remove this line.')
+
+ if Search(r'(\w+|[+-]?\d+(\.\d*)?)\s*(<|>)\?=?\s*(\w+|[+-]?\d+)(\.\d*)?',
+ line):
+ error(filename, linenum, 'build/deprecated', 3,
+ '>? and <? (max and min) operators are non-standard and deprecated.')
+
+ if Search(r'^\s*const\s*string\s*&\s*\w+\s*;', line):
+ # TODO(unknown): Could it be expanded safely to arbitrary references,
+ # without triggering too many false positives? The first
+ # attempt triggered 5 warnings for mostly benign code in the regtest, hence
+ # the restriction.
+ # Here's the original regexp, for the reference:
+ # type_name = r'\w+((\s*::\s*\w+)|(\s*<\s*\w+?\s*>))?'
+ # r'\s*const\s*' + type_name + '\s*&\s*\w+\s*;'
+ error(filename, linenum, 'runtime/member_string_references', 2,
+ 'const string& members are dangerous. It is much better to use '
+ 'alternatives, such as pointers or simple constants.')
+
+ # Everything else in this function operates on class declarations.
+ # Return early if the top of the nesting stack is not a class, or if
+ # the class head is not completed yet.
+ classinfo = nesting_state.InnermostClass()
+ if not classinfo or not classinfo.seen_open_brace:
+ return
+
+ # The class may have been declared with namespace or classname qualifiers.
+ # The constructor and destructor will not have those qualifiers.
+ base_classname = classinfo.name.split('::')[-1]
+
+ # Look for single-argument constructors that aren't marked explicit.
+ # Technically a valid construct, but against style.
+ args = Match(r'\s+(?:inline\s+)?%s\s*\(([^,()]+)\)'
+ % re.escape(base_classname),
+ line)
+ if (args and
+ args.group(1) != 'void' and
+ not Search(r'\bstd::initializer_list\b', args.group(1)) and
+ not Match(r'(const\s+)?%s(\s+const)?\s*(?:<\w+>\s*)?&'
+ % re.escape(base_classname), args.group(1).strip())):
+ error(filename, linenum, 'runtime/explicit', 5,
+ 'Single-argument constructors should be marked explicit.')
+
+
+def CheckSpacingForFunctionCall(filename, clean_lines, linenum, error):
+ """Checks for the correctness of various spacing around function calls.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Since function calls often occur inside if/for/while/switch
+ # expressions - which have their own, more liberal conventions - we
+ # first see if we should be looking inside such an expression for a
+ # function call, to which we can apply more strict standards.
+ fncall = line # if there's no control flow construct, look at whole line
+ for pattern in (r'\bif\s*\((.*)\)\s*{',
+ r'\bfor\s*\((.*)\)\s*{',
+ r'\bwhile\s*\((.*)\)\s*[{;]',
+ r'\bswitch\s*\((.*)\)\s*{'):
+ match = Search(pattern, line)
+ if match:
+ fncall = match.group(1) # look inside the parens for function calls
+ break
+
+ # Except in if/for/while/switch, there should never be space
+ # immediately inside parens (eg "f( 3, 4 )"). We make an exception
+ # for nested parens ( (a+b) + c ). Likewise, there should never be
+ # a space before a ( when it's a function argument. I assume it's a
+ # function argument when the char before the whitespace is legal in
+ # a function name (alnum + _) and we're not starting a macro. Also ignore
+ # pointers and references to arrays and functions coz they're too tricky:
+ # we use a very simple way to recognize these:
+ # " (something)(maybe-something)" or
+ # " (something)(maybe-something," or
+ # " (something)[something]"
+ # Note that we assume the contents of [] to be short enough that
+ # they'll never need to wrap.
+ if ( # Ignore control structures.
+ not Search(r'\b(if|for|while|switch|return|new|delete|catch|sizeof)\b',
+ fncall) and
+ # Ignore pointers/references to functions.
+ not Search(r' \([^)]+\)\([^)]*(\)|,$)', fncall) and
+ # Ignore pointers/references to arrays.
+ not Search(r' \([^)]+\)\[[^\]]+\]', fncall)):
+ if Search(r'\w\s*\(\s(?!\s*\\$)', fncall): # a ( used for a fn call
+ error(filename, linenum, 'whitespace/parens', 4,
+ 'Extra space after ( in function call')
+ elif Search(r'\(\s+(?!(\s*\\)|\()', fncall):
+ error(filename, linenum, 'whitespace/parens', 2,
+ 'Extra space after (')
+ if (Search(r'\w\s+\(', fncall) and
+ not Search(r'#\s*define|typedef|using\s+\w+\s*=', fncall) and
+ not Search(r'\w\s+\((\w+::)*\*\w+\)\(', fncall)):
+ # TODO(unknown): Space after an operator function seem to be a common
+ # error, silence those for now by restricting them to highest verbosity.
+ if Search(r'\boperator_*\b', line):
+ error(filename, linenum, 'whitespace/parens', 0,
+ 'Extra space before ( in function call')
+ else:
+ error(filename, linenum, 'whitespace/parens', 4,
+ 'Extra space before ( in function call')
+ # If the ) is followed only by a newline or a { + newline, assume it's
+ # part of a control statement (if/while/etc), and don't complain
+ if Search(r'[^)]\s+\)\s*[^{\s]', fncall):
+ # If the closing parenthesis is preceded by only whitespaces,
+ # try to give a more descriptive error message.
+ if Search(r'^\s+\)', fncall):
+ error(filename, linenum, 'whitespace/parens', 2,
+ 'Closing ) should be moved to the previous line')
+ else:
+ error(filename, linenum, 'whitespace/parens', 2,
+ 'Extra space before )')
+
+
+def IsBlankLine(line):
+ """Returns true if the given line is blank.
+
+ We consider a line to be blank if the line is empty or consists of
+ only white spaces.
+
+ Args:
+ line: A line of a string.
+
+ Returns:
+ True, if the given line is blank.
+ """
+ return not line or line.isspace()
+
+
+def CheckForFunctionLengths(filename, clean_lines, linenum,
+ function_state, error):
+ """Reports for long function bodies.
+
+ For an overview why this is done, see:
+ http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Write_Short_Functions
+
+ Uses a simplistic algorithm assuming other style guidelines
+ (especially spacing) are followed.
+ Only checks unindented functions, so class members are unchecked.
+ Trivial bodies are unchecked, so constructors with huge initializer lists
+ may be missed.
+ Blank/comment lines are not counted so as to avoid encouraging the removal
+ of vertical space and comments just to get through a lint check.
+ NOLINT *on the last line of a function* disables this check.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ function_state: Current function name and lines in body so far.
+ error: The function to call with any errors found.
+ """
+ lines = clean_lines.lines
+ line = lines[linenum]
+ joined_line = ''
+
+ starting_func = False
+ regexp = r'(\w(\w|::|\*|\&|\s)*)\(' # decls * & space::name( ...
+ match_result = Match(regexp, line)
+ if match_result:
+ # If the name is all caps and underscores, figure it's a macro and
+ # ignore it, unless it's TEST or TEST_F.
+ function_name = match_result.group(1).split()[-1]
+ if function_name == 'TEST' or function_name == 'TEST_F' or (
+ not Match(r'[A-Z_]+$', function_name)):
+ starting_func = True
+
+ if starting_func:
+ body_found = False
+ for start_linenum in xrange(linenum, clean_lines.NumLines()):
+ start_line = lines[start_linenum]
+ joined_line += ' ' + start_line.lstrip()
+ if Search(r'(;|})', start_line): # Declarations and trivial functions
+ body_found = True
+ break # ... ignore
+ elif Search(r'{', start_line):
+ body_found = True
+ function = Search(r'((\w|:)*)\(', line).group(1)
+ if Match(r'TEST', function): # Handle TEST... macros
+ parameter_regexp = Search(r'(\(.*\))', joined_line)
+ if parameter_regexp: # Ignore bad syntax
+ function += parameter_regexp.group(1)
+ else:
+ function += '()'
+ function_state.Begin(function)
+ break
+ if not body_found:
+ # No body for the function (or evidence of a non-function) was found.
+ error(filename, linenum, 'readability/fn_size', 5,
+ 'Lint failed to find start of function body.')
+ elif Match(r'^\}\s*$', line): # function end
+ function_state.Check(error, filename, linenum)
+ function_state.End()
+ elif not Match(r'^\s*$', line):
+ function_state.Count() # Count non-blank/non-comment lines.
+
+
+_RE_PATTERN_TODO = re.compile(r'^//(\s*)TODO(\(.+?\))?:?(\s|$)?')
+
+
+def CheckComment(line, filename, linenum, next_line_start, error):
+ """Checks for common mistakes in comments.
+
+ Args:
+ line: The line in question.
+ filename: The name of the current file.
+ linenum: The number of the line to check.
+ next_line_start: The first non-whitespace column of the next line.
+ error: The function to call with any errors found.
+ """
+ commentpos = line.find('//')
+ if commentpos != -1:
+ # Check if the // may be in quotes. If so, ignore it
+ # Comparisons made explicit for clarity -- pylint: disable=g-explicit-bool-comparison
+ if (line.count('"', 0, commentpos) -
+ line.count('\\"', 0, commentpos)) % 2 == 0: # not in quotes
+ # Allow one space for new scopes, two spaces otherwise:
+ if (not (Match(r'^.*{ *//', line) and next_line_start == commentpos) and
+ ((commentpos >= 1 and
+ line[commentpos-1] not in string.whitespace) or
+ (commentpos >= 2 and
+ line[commentpos-2] not in string.whitespace))):
+ error(filename, linenum, 'whitespace/comments', 2,
+ 'At least two spaces is best between code and comments')
+
+ # Checks for common mistakes in TODO comments.
+ comment = line[commentpos:]
+ match = _RE_PATTERN_TODO.match(comment)
+ if match:
+ # One whitespace is correct; zero whitespace is handled elsewhere.
+ leading_whitespace = match.group(1)
+ if len(leading_whitespace) > 1:
+ error(filename, linenum, 'whitespace/todo', 2,
+ 'Too many spaces before TODO')
+
+ username = match.group(2)
+ # if not username:
+ # error(filename, linenum, 'readability/todo', 2,
+ # 'Missing username in TODO; it should look like '
+ # '"// TODO(my_username): Stuff."')
+
+ middle_whitespace = match.group(3)
+ # Comparisons made explicit for correctness -- pylint: disable=g-explicit-bool-comparison
+ if middle_whitespace != ' ' and middle_whitespace != '':
+ error(filename, linenum, 'whitespace/todo', 2,
+ 'TODO(my_username) should be followed by a space')
+
+ # If the comment contains an alphanumeric character, there
+ # should be a space somewhere between it and the //.
+ if Match(r'//[^ ]*\w', comment):
+ error(filename, linenum, 'whitespace/comments', 4,
+ 'Should have a space between // and comment')
+
+def CheckAccess(filename, clean_lines, linenum, nesting_state, error):
+ """Checks for improper use of DISALLOW* macros.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum] # get rid of comments and strings
+
+ matched = Match((r'\s*(DISALLOW_COPY_AND_ASSIGN|'
+ r'DISALLOW_EVIL_CONSTRUCTORS|'
+ r'DISALLOW_IMPLICIT_CONSTRUCTORS)'), line)
+ if not matched:
+ return
+ if nesting_state.stack and isinstance(nesting_state.stack[-1], _ClassInfo):
+ if nesting_state.stack[-1].access != 'private':
+ error(filename, linenum, 'readability/constructors', 3,
+ '%s must be in the private: section' % matched.group(1))
+
+ else:
+ # Found DISALLOW* macro outside a class declaration, or perhaps it
+ # was used inside a function when it should have been part of the
+ # class declaration. We could issue a warning here, but it
+ # probably resulted in a compiler error already.
+ pass
+
+
+def CheckSpacing(filename, clean_lines, linenum, nesting_state, error):
+ """Checks for the correctness of various spacing issues in the code.
+
+ Things we check for: spaces around operators, spaces after
+ if/for/while/switch, no spaces around parens in function calls, two
+ spaces between code and comment, don't start a block with a blank
+ line, don't end a function with a blank line, don't add a blank line
+ after public/protected/private, don't have too many blank lines in a row.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+
+ # Don't use "elided" lines here, otherwise we can't check commented lines.
+ # Don't want to use "raw" either, because we don't want to check inside C++11
+ # raw strings,
+ raw = clean_lines.lines_without_raw_strings
+ line = raw[linenum]
+
+ # Before nixing comments, check if the line is blank for no good
+ # reason. This includes the first line after a block is opened, and
+ # blank lines at the end of a function (ie, right before a line like '}'
+ #
+ # Skip all the blank line checks if we are immediately inside a
+ # namespace body. In other words, don't issue blank line warnings
+ # for this block:
+ # namespace {
+ #
+ # }
+ #
+ # A warning about missing end of namespace comments will be issued instead.
+ #
+ # Also skip blank line checks for 'extern "C"' blocks, which are formatted
+ # like namespaces.
+ if (IsBlankLine(line) and
+ not nesting_state.InNamespaceBody() and
+ not nesting_state.InExternC()):
+ elided = clean_lines.elided
+ prev_line = elided[linenum - 1]
+ prevbrace = prev_line.rfind('{')
+ # TODO(unknown): Don't complain if line before blank line, and line after,
+ # both start with alnums and are indented the same amount.
+ # This ignores whitespace at the start of a namespace block
+ # because those are not usually indented.
+ if prevbrace != -1 and prev_line[prevbrace:].find('}') == -1:
+ # OK, we have a blank line at the start of a code block. Before we
+ # complain, we check if it is an exception to the rule: The previous
+ # non-empty line has the parameters of a function header that are indented
+ # 4 spaces (because they did not fit in a 80 column line when placed on
+ # the same line as the function name). We also check for the case where
+ # the previous line is indented 6 spaces, which may happen when the
+ # initializers of a constructor do not fit into a 80 column line.
+ exception = False
+ if Match(r' {6}\w', prev_line): # Initializer list?
+ # We are looking for the opening column of initializer list, which
+ # should be indented 4 spaces to cause 6 space indentation afterwards.
+ search_position = linenum-2
+ while (search_position >= 0
+ and Match(r' {6}\w', elided[search_position])):
+ search_position -= 1
+ exception = (search_position >= 0
+ and elided[search_position][:5] == ' :')
+ else:
+ # Search for the function arguments or an initializer list. We use a
+ # simple heuristic here: If the line is indented 4 spaces; and we have a
+ # closing paren, without the opening paren, followed by an opening brace
+ # or colon (for initializer lists) we assume that it is the last line of
+ # a function header. If we have a colon indented 4 spaces, it is an
+ # initializer list.
+ exception = (Match(r' {4}\w[^\(]*\)\s*(const\s*)?(\{\s*$|:)',
+ prev_line)
+ or Match(r' {4}:', prev_line))
+
+ if not exception:
+ error(filename, linenum, 'whitespace/blank_line', 2,
+ 'Redundant blank line at the start of a code block '
+ 'should be deleted.')
+ # Ignore blank lines at the end of a block in a long if-else
+ # chain, like this:
+ # if (condition1) {
+ # // Something followed by a blank line
+ #
+ # } else if (condition2) {
+ # // Something else
+ # }
+ if linenum + 1 < clean_lines.NumLines():
+ next_line = raw[linenum + 1]
+ if (next_line
+ and Match(r'\s*}', next_line)
+ and next_line.find('} else ') == -1):
+ error(filename, linenum, 'whitespace/blank_line', 3,
+ 'Redundant blank line at the end of a code block '
+ 'should be deleted.')
+
+ # matched = Match(r'\s*(public|protected|private):', prev_line)
+ # if matched:
+ # error(filename, linenum, 'whitespace/blank_line', 3,
+ # 'Do not leave a blank line after "%s:"' % matched.group(1))
+
+ # Next, check comments
+ next_line_start = 0
+ if linenum + 1 < clean_lines.NumLines():
+ next_line = raw[linenum + 1]
+ next_line_start = len(next_line) - len(next_line.lstrip())
+ CheckComment(line, filename, linenum, next_line_start, error)
+
+ # get rid of comments and strings
+ line = clean_lines.elided[linenum]
+
+ # You shouldn't have spaces before your brackets, except maybe after
+ # 'delete []' or 'return []() {};'
+ if Search(r'\w\s+\[', line) and not Search(r'(?:delete|return)\s+\[', line):
+ error(filename, linenum, 'whitespace/braces', 5,
+ 'Extra space before [')
+
+ # In range-based for, we wanted spaces before and after the colon, but
+ # not around "::" tokens that might appear.
+ if (Search(r'for *\(.*[^:]:[^: ]', line) or
+ Search(r'for *\(.*[^: ]:[^:]', line)):
+ error(filename, linenum, 'whitespace/forcolon', 2,
+ 'Missing space around colon in range-based for loop')
+
+
+def CheckOperatorSpacing(filename, clean_lines, linenum, error):
+ """Checks for horizontal spacing around operators.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Don't try to do spacing checks for operator methods. Do this by
+ # replacing the troublesome characters with something else,
+ # preserving column position for all other characters.
+ #
+ # The replacement is done repeatedly to avoid false positives from
+ # operators that call operators.
+ while True:
+ match = Match(r'^(.*\boperator\b)(\S+)(\s*\(.*)$', line)
+ if match:
+ line = match.group(1) + ('_' * len(match.group(2))) + match.group(3)
+ else:
+ break
+
+ # We allow no-spaces around = within an if: "if ( (a=Foo()) == 0 )".
+ # Otherwise not. Note we only check for non-spaces on *both* sides;
+ # sometimes people put non-spaces on one side when aligning ='s among
+ # many lines (not that this is behavior that I approve of...)
+ if Search(r'[\w.]=[\w.]', line) and not Search(r'\b(if|while) ', line):
+ error(filename, linenum, 'whitespace/operators', 4,
+ 'Missing spaces around =')
+
+ # It's ok not to have spaces around binary operators like + - * /, but if
+ # there's too little whitespace, we get concerned. It's hard to tell,
+ # though, so we punt on this one for now. TODO.
+
+ # You should always have whitespace around binary operators.
+ #
+ # Check <= and >= first to avoid false positives with < and >, then
+ # check non-include lines for spacing around < and >.
+ #
+ # If the operator is followed by a comma, assume it's be used in a
+ # macro context and don't do any checks. This avoids false
+ # positives.
+ #
+ # Note that && is not included here. Those are checked separately
+ # in CheckRValueReference
+ match = Search(r'[^<>=!\s](==|!=|<=|>=|\|\|)[^<>=!\s,;\)]', line)
+ if match:
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around %s' % match.group(1))
+ elif not Match(r'#.*include', line):
+ # Look for < that is not surrounded by spaces. This is only
+ # triggered if both sides are missing spaces, even though
+ # technically should should flag if at least one side is missing a
+ # space. This is done to avoid some false positives with shifts.
+ match = Match(r'^(.*[^\s<])<[^\s=<,]', line)
+ if match:
+ (_, _, end_pos) = CloseExpression(
+ clean_lines, linenum, len(match.group(1)))
+ if end_pos <= -1:
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around <')
+
+ # Look for > that is not surrounded by spaces. Similar to the
+ # above, we only trigger if both sides are missing spaces to avoid
+ # false positives with shifts.
+ match = Match(r'^(.*[^-\s>])>[^\s=>,]', line)
+ if match:
+ (_, _, start_pos) = ReverseCloseExpression(
+ clean_lines, linenum, len(match.group(1)))
+ if start_pos <= -1:
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around >')
+
+ # We allow no-spaces around << when used like this: 10<<20, but
+ # not otherwise (particularly, not when used as streams)
+ # We also allow operators following an opening parenthesis, since
+ # those tend to be macros that deal with operators.
+ match = Search(r'(operator|\S)(?:L|UL|ULL|l|ul|ull)?<<([^\s,=])', line)
+ if (match and match.group(1) != '(' and
+ not (match.group(1).isdigit() and match.group(2).isdigit()) and
+ not (match.group(1) == 'operator' and match.group(2) == ';')):
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around <<')
+
+ # We allow no-spaces around >> for almost anything. This is because
+ # C++11 allows ">>" to close nested templates, which accounts for
+ # most cases when ">>" is not followed by a space.
+ #
+ # We still warn on ">>" followed by alpha character, because that is
+ # likely due to ">>" being used for right shifts, e.g.:
+ # value >> alpha
+ #
+ # When ">>" is used to close templates, the alphanumeric letter that
+ # follows would be part of an identifier, and there should still be
+ # a space separating the template type and the identifier.
+ # type<type<type>> alpha
+ match = Search(r'>>[a-zA-Z_]', line)
+ if match:
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around >>')
+
+ # There shouldn't be space around unary operators
+ match = Search(r'(!\s|~\s|[\s]--[\s;]|[\s]\+\+[\s;])', line)
+ if match:
+ error(filename, linenum, 'whitespace/operators', 4,
+ 'Extra space for operator %s' % match.group(1))
+
+
+def CheckParenthesisSpacing(filename, clean_lines, linenum, error):
+ """Checks for horizontal spacing around parentheses.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # No spaces after an if, while, switch, or for
+ match = Search(r' (if\(|for\(|while\(|switch\()', line)
+ if match:
+ error(filename, linenum, 'whitespace/parens', 5,
+ 'Missing space before ( in %s' % match.group(1))
+
+ # For if/for/while/switch, the left and right parens should be
+ # consistent about how many spaces are inside the parens, and
+ # there should either be zero or one spaces inside the parens.
+ # We don't want: "if ( foo)" or "if ( foo )".
+ # Exception: "for ( ; foo; bar)" and "for (foo; bar; )" are allowed.
+ match = Search(r'\b(if|for|while|switch)\s*'
+ r'\(([ ]*)(.).*[^ ]+([ ]*)\)\s*{\s*$',
+ line)
+ if match:
+ if len(match.group(2)) != len(match.group(4)):
+ if not (match.group(3) == ';' and
+ len(match.group(2)) == 1 + len(match.group(4)) or
+ not match.group(2) and Search(r'\bfor\s*\(.*; \)', line)):
+ error(filename, linenum, 'whitespace/parens', 5,
+ 'Mismatching spaces inside () in %s' % match.group(1))
+ if len(match.group(2)) not in [0, 1]:
+ error(filename, linenum, 'whitespace/parens', 5,
+ 'Should have zero or one spaces inside ( and ) in %s' %
+ match.group(1))
+
+
+def CheckCommaSpacing(filename, clean_lines, linenum, error):
+ """Checks for horizontal spacing near commas and semicolons.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ raw = clean_lines.lines_without_raw_strings
+ line = clean_lines.elided[linenum]
+
+ # You should always have a space after a comma (either as fn arg or operator)
+ #
+ # This does not apply when the non-space character following the
+ # comma is another comma, since the only time when that happens is
+ # for empty macro arguments.
+ #
+ # We run this check in two passes: first pass on elided lines to
+ # verify that lines contain missing whitespaces, second pass on raw
+ # lines to confirm that those missing whitespaces are not due to
+ # elided comments.
+ if Search(r',[^,\s]', line) and Search(r',[^,\s]', raw[linenum]):
+ error(filename, linenum, 'whitespace/comma', 3,
+ 'Missing space after ,')
+
+ # You should always have a space after a semicolon
+ # except for few corner cases
+ # TODO(unknown): clarify if 'if (1) { return 1;}' is requires one more
+ # space after ;
+ if Search(r';[^\s};\\)/]', line):
+ error(filename, linenum, 'whitespace/semicolon', 3,
+ 'Missing space after ;')
+
+
+def CheckBracesSpacing(filename, clean_lines, linenum, error):
+ """Checks for horizontal spacing near commas.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Except after an opening paren, or after another opening brace (in case of
+ # an initializer list, for instance), you should have spaces before your
+ # braces. And since you should never have braces at the beginning of a line,
+ # this is an easy test.
+ match = Match(r'^(.*[^ ({]){', line)
+ if match:
+ # Try a bit harder to check for brace initialization. This
+ # happens in one of the following forms:
+ # Constructor() : initializer_list_{} { ... }
+ # Constructor{}.MemberFunction()
+ # Type variable{};
+ # FunctionCall(type{}, ...);
+ # LastArgument(..., type{});
+ # LOG(INFO) << type{} << " ...";
+ # map_of_type[{...}] = ...;
+ # ternary = expr ? new type{} : nullptr;
+ # OuterTemplate<InnerTemplateConstructor<Type>{}>
+ #
+ # We check for the character following the closing brace, and
+ # silence the warning if it's one of those listed above, i.e.
+ # "{.;,)<>]:".
+ #
+ # To account for nested initializer list, we allow any number of
+ # closing braces up to "{;,)<". We can't simply silence the
+ # warning on first sight of closing brace, because that would
+ # cause false negatives for things that are not initializer lists.
+ # Silence this: But not this:
+ # Outer{ if (...) {
+ # Inner{...} if (...){ // Missing space before {
+ # }; }
+ #
+ # There is a false negative with this approach if people inserted
+ # spurious semicolons, e.g. "if (cond){};", but we will catch the
+ # spurious semicolon with a separate check.
+ (endline, endlinenum, endpos) = CloseExpression(
+ clean_lines, linenum, len(match.group(1)))
+ trailing_text = ''
+ if endpos > -1:
+ trailing_text = endline[endpos:]
+ for offset in xrange(endlinenum + 1,
+ min(endlinenum + 3, clean_lines.NumLines() - 1)):
+ trailing_text += clean_lines.elided[offset]
+ if not Match(r'^[\s}]*[{.;,)<>\]:]', trailing_text):
+ error(filename, linenum, 'whitespace/braces', 5,
+ 'Missing space before {')
+
+ # Make sure '} else {' has spaces.
+ if Search(r'}else', line):
+ error(filename, linenum, 'whitespace/braces', 5,
+ 'Missing space before else')
+
+ # You shouldn't have a space before a semicolon at the end of the line.
+ # There's a special case for "for" since the style guide allows space before
+ # the semicolon there.
+ if Search(r':\s*;\s*$', line):
+ error(filename, linenum, 'whitespace/semicolon', 5,
+ 'Semicolon defining empty statement. Use {} instead.')
+ elif Search(r'^\s*;\s*$', line):
+ error(filename, linenum, 'whitespace/semicolon', 5,
+ 'Line contains only semicolon. If this should be an empty statement, '
+ 'use {} instead.')
+ elif (Search(r'\s+;\s*$', line) and
+ not Search(r'\bfor\b', line)):
+ error(filename, linenum, 'whitespace/semicolon', 5,
+ 'Extra space before last semicolon. If this should be an empty '
+ 'statement, use {} instead.')
+
+
+def IsDecltype(clean_lines, linenum, column):
+ """Check if the token ending on (linenum, column) is decltype().
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: the number of the line to check.
+ column: end column of the token to check.
+ Returns:
+ True if this token is decltype() expression, False otherwise.
+ """
+ (text, _, start_col) = ReverseCloseExpression(clean_lines, linenum, column)
+ if start_col < 0:
+ return False
+ if Search(r'\bdecltype\s*$', text[0:start_col]):
+ return True
+ return False
+
+
+def IsTemplateParameterList(clean_lines, linenum, column):
+ """Check if the token ending on (linenum, column) is the end of template<>.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: the number of the line to check.
+ column: end column of the token to check.
+ Returns:
+ True if this token is end of a template parameter list, False otherwise.
+ """
+ (_, startline, startpos) = ReverseCloseExpression(
+ clean_lines, linenum, column)
+ if (startpos > -1 and
+ Search(r'\btemplate\s*$', clean_lines.elided[startline][0:startpos])):
+ return True
+ return False
+
+
+def IsRValueType(clean_lines, nesting_state, linenum, column):
+ """Check if the token ending on (linenum, column) is a type.
+
+ Assumes that text to the right of the column is "&&" or a function
+ name.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ linenum: the number of the line to check.
+ column: end column of the token to check.
+ Returns:
+ True if this token is a type, False if we are not sure.
+ """
+ prefix = clean_lines.elided[linenum][0:column]
+
+ # Get one word to the left. If we failed to do so, this is most
+ # likely not a type, since it's unlikely that the type name and "&&"
+ # would be split across multiple lines.
+ match = Match(r'^(.*)(\b\w+|[>*)&])\s*$', prefix)
+ if not match:
+ return False
+
+ # Check text following the token. If it's "&&>" or "&&," or "&&...", it's
+ # most likely a rvalue reference used inside a template.
+ suffix = clean_lines.elided[linenum][column:]
+ if Match(r'&&\s*(?:[>,]|\.\.\.)', suffix):
+ return True
+
+ # Check for simple type and end of templates:
+ # int&& variable
+ # vector<int>&& variable
+ #
+ # Because this function is called recursively, we also need to
+ # recognize pointer and reference types:
+ # int* Function()
+ # int& Function()
+ if match.group(2) in ['char', 'char16_t', 'char32_t', 'wchar_t', 'bool',
+ 'short', 'int', 'long', 'signed', 'unsigned',
+ 'float', 'double', 'void', 'auto', '>', '*', '&']:
+ return True
+
+ # If we see a close parenthesis, look for decltype on the other side.
+ # decltype would unambiguously identify a type, anything else is
+ # probably a parenthesized expression and not a type.
+ if match.group(2) == ')':
+ return IsDecltype(
+ clean_lines, linenum, len(match.group(1)) + len(match.group(2)) - 1)
+
+ # Check for casts and cv-qualifiers.
+ # match.group(1) remainder
+ # -------------- ---------
+ # const_cast< type&&
+ # const type&&
+ # type const&&
+ if Search(r'\b(?:const_cast\s*<|static_cast\s*<|dynamic_cast\s*<|'
+ r'reinterpret_cast\s*<|\w+\s)\s*$',
+ match.group(1)):
+ return True
+
+ # Look for a preceding symbol that might help differentiate the context.
+ # These are the cases that would be ambiguous:
+ # match.group(1) remainder
+ # -------------- ---------
+ # Call ( expression &&
+ # Declaration ( type&&
+ # sizeof ( type&&
+ # if ( expression &&
+ # while ( expression &&
+ # for ( type&&
+ # for( ; expression &&
+ # statement ; type&&
+ # block { type&&
+ # constructor { expression &&
+ start = linenum
+ line = match.group(1)
+ match_symbol = None
+ while start >= 0:
+ # We want to skip over identifiers and commas to get to a symbol.
+ # Commas are skipped so that we can find the opening parenthesis
+ # for function parameter lists.
+ match_symbol = Match(r'^(.*)([^\w\s,])[\w\s,]*$', line)
+ if match_symbol:
+ break
+ start -= 1
+ line = clean_lines.elided[start]
+
+ if not match_symbol:
+ # Probably the first statement in the file is an rvalue reference
+ return True
+
+ if match_symbol.group(2) == '}':
+ # Found closing brace, probably an indicate of this:
+ # block{} type&&
+ return True
+
+ if match_symbol.group(2) == ';':
+ # Found semicolon, probably one of these:
+ # for(; expression &&
+ # statement; type&&
+
+ # Look for the previous 'for(' in the previous lines.
+ before_text = match_symbol.group(1)
+ for i in xrange(start - 1, max(start - 6, 0), -1):
+ before_text = clean_lines.elided[i] + before_text
+ if Search(r'for\s*\([^{};]*$', before_text):
+ # This is the condition inside a for-loop
+ return False
+
+ # Did not find a for-init-statement before this semicolon, so this
+ # is probably a new statement and not a condition.
+ return True
+
+ if match_symbol.group(2) == '{':
+ # Found opening brace, probably one of these:
+ # block{ type&& = ... ; }
+ # constructor{ expression && expression }
+
+ # Look for a closing brace or a semicolon. If we see a semicolon
+ # first, this is probably a rvalue reference.
+ line = clean_lines.elided[start][0:len(match_symbol.group(1)) + 1]
+ end = start
+ depth = 1
+ while True:
+ for ch in line:
+ if ch == ';':
+ return True
+ elif ch == '{':
+ depth += 1
+ elif ch == '}':
+ depth -= 1
+ if depth == 0:
+ return False
+ end += 1
+ if end >= clean_lines.NumLines():
+ break
+ line = clean_lines.elided[end]
+ # Incomplete program?
+ return False
+
+ if match_symbol.group(2) == '(':
+ # Opening parenthesis. Need to check what's to the left of the
+ # parenthesis. Look back one extra line for additional context.
+ before_text = match_symbol.group(1)
+ if linenum > 1:
+ before_text = clean_lines.elided[linenum - 1] + before_text
+ before_text = match_symbol.group(1)
+
+ # Patterns that are likely to be types:
+ # [](type&&
+ # for (type&&
+ # sizeof(type&&
+ # operator=(type&&
+ #
+ if Search(r'(?:\]|\bfor|\bsizeof|\boperator\s*\S+\s*)\s*$', before_text):
+ return True
+
+ # Patterns that are likely to be expressions:
+ # if (expression &&
+ # while (expression &&
+ # : initializer(expression &&
+ # , initializer(expression &&
+ # ( FunctionCall(expression &&
+ # + FunctionCall(expression &&
+ # + (expression &&
+ #
+ # The last '+' represents operators such as '+' and '-'.
+ if Search(r'(?:\bif|\bwhile|[-+=%^(<!?:,&*]\s*)$', before_text):
+ return False
+
+ # Something else. Check that tokens to the left look like
+ # return_type function_name
+ match_func = Match(r'^(.*)\s+\w(?:\w|::)*(?:<[^<>]*>)?\s*$',
+ match_symbol.group(1))
+ if match_func:
+ # Check for constructors, which don't have return types.
+ if Search(r'\bexplicit$', match_func.group(1)):
+ return True
+ implicit_constructor = Match(r'\s*(\w+)\((?:const\s+)?(\w+)', prefix)
+ if (implicit_constructor and
+ implicit_constructor.group(1) == implicit_constructor.group(2)):
+ return True
+ return IsRValueType(clean_lines, nesting_state, linenum,
+ len(match_func.group(1)))
+
+ # Nothing before the function name. If this is inside a block scope,
+ # this is probably a function call.
+ return not (nesting_state.previous_stack_top and
+ nesting_state.previous_stack_top.IsBlockInfo())
+
+ if match_symbol.group(2) == '>':
+ # Possibly a closing bracket, check that what's on the other side
+ # looks like the start of a template.
+ return IsTemplateParameterList(
+ clean_lines, start, len(match_symbol.group(1)))
+
+ # Some other symbol, usually something like "a=b&&c". This is most
+ # likely not a type.
+ return False
+
+
+def IsRValueAllowed(clean_lines, linenum):
+ """Check if RValue reference is allowed within some range of lines.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ Returns:
+ True if line is within the region where RValue references are allowed.
+ """
+ for i in xrange(linenum, 0, -1):
+ line = clean_lines.elided[i]
+ if Match(r'GOOGLE_ALLOW_RVALUE_REFERENCES_(?:PUSH|POP)', line):
+ if not line.endswith('PUSH'):
+ return False
+ for j in xrange(linenum, clean_lines.NumLines(), 1):
+ line = clean_lines.elided[j]
+ if Match(r'GOOGLE_ALLOW_RVALUE_REFERENCES_(?:PUSH|POP)', line):
+ return line.endswith('POP')
+ return False
+
+
+def CheckRValueReference(filename, clean_lines, linenum, nesting_state, error):
+ """Check for rvalue references.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+ # Find lines missing spaces around &&.
+ # TODO(unknown): currently we don't check for rvalue references
+ # with spaces surrounding the && to avoid false positives with
+ # boolean expressions.
+ line = clean_lines.elided[linenum]
+ match = Match(r'^(.*\S)&&', line)
+ if not match:
+ match = Match(r'(.*)&&\S', line)
+ if (not match) or '(&&)' in line or Search(r'\boperator\s*$', match.group(1)):
+ return
+
+ # Either poorly formed && or an rvalue reference, check the context
+ # to get a more accurate error message. Mostly we want to determine
+ # if what's to the left of "&&" is a type or not.
+ and_pos = len(match.group(1))
+ if IsRValueType(clean_lines, nesting_state, linenum, and_pos):
+ if not IsRValueAllowed(clean_lines, linenum):
+ error(filename, linenum, 'build/c++11', 3,
+ 'RValue references are an unapproved C++ feature.')
+ else:
+ error(filename, linenum, 'whitespace/operators', 3,
+ 'Missing spaces around &&')
+
+
+def CheckSectionSpacing(filename, clean_lines, class_info, linenum, error):
+ """Checks for additional blank line issues related to sections.
+
+ Currently the only thing checked here is blank line before protected/private.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ class_info: A _ClassInfo objects.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ # Skip checks if the class is small, where small means 25 lines or less.
+ # 25 lines seems like a good cutoff since that's the usual height of
+ # terminals, and any class that can't fit in one screen can't really
+ # be considered "small".
+ #
+ # Also skip checks if we are on the first line. This accounts for
+ # classes that look like
+ # class Foo { public: ... };
+ #
+ # If we didn't find the end of the class, last_line would be zero,
+ # and the check will be skipped by the first condition.
+ if (class_info.last_line - class_info.starting_linenum <= 24 or
+ linenum <= class_info.starting_linenum):
+ return
+
+ matched = Match(r'\s*(public|protected|private):', clean_lines.lines[linenum])
+ if matched:
+ # Issue warning if the line before public/protected/private was
+ # not a blank line, but don't do this if the previous line contains
+ # "class" or "struct". This can happen two ways:
+ # - We are at the beginning of the class.
+ # - We are forward-declaring an inner class that is semantically
+ # private, but needed to be public for implementation reasons.
+ # Also ignores cases where the previous line ends with a backslash as can be
+ # common when defining classes in C macros.
+ prev_line = clean_lines.lines[linenum - 1]
+ if (not IsBlankLine(prev_line) and
+ not Search(r'\b(class|struct)\b', prev_line) and
+ not Search(r'\\$', prev_line)):
+ # Try a bit harder to find the beginning of the class. This is to
+ # account for multi-line base-specifier lists, e.g.:
+ # class Derived
+ # : public Base {
+ end_class_head = class_info.starting_linenum
+ for i in range(class_info.starting_linenum, linenum):
+ if Search(r'\{\s*$', clean_lines.lines[i]):
+ end_class_head = i
+ break
+ if end_class_head < linenum - 1:
+ error(filename, linenum, 'whitespace/blank_line', 3,
+ '"%s:" should be preceded by a blank line' % matched.group(1))
+
+
+def GetPreviousNonBlankLine(clean_lines, linenum):
+ """Return the most recent non-blank line and its line number.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file contents.
+ linenum: The number of the line to check.
+
+ Returns:
+ A tuple with two elements. The first element is the contents of the last
+ non-blank line before the current line, or the empty string if this is the
+ first non-blank line. The second is the line number of that line, or -1
+ if this is the first non-blank line.
+ """
+
+ prevlinenum = linenum - 1
+ while prevlinenum >= 0:
+ prevline = clean_lines.elided[prevlinenum]
+ if not IsBlankLine(prevline): # if not a blank line...
+ return (prevline, prevlinenum)
+ prevlinenum -= 1
+ return ('', -1)
+
+
+def CheckBraces(filename, clean_lines, linenum, error):
+ """Looks for misplaced braces (e.g. at the end of line).
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+
+ line = clean_lines.elided[linenum] # get rid of comments and strings
+
+ #if Match(r'\s*{\s*$', line):
+ # # We allow an open brace to start a line in the case where someone is using
+ # # braces in a block to explicitly create a new scope, which is commonly used
+ # # to control the lifetime of stack-allocated variables. Braces are also
+ # # used for brace initializers inside function calls. We don't detect this
+ # # perfectly: we just don't complain if the last non-whitespace character on
+ # # the previous non-blank line is ',', ';', ':', '(', '{', or '}', or if the
+ # # previous line starts a preprocessor block.
+ # prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
+ # if (not Search(r'[,;:}{()]\s*$', prevline) and
+ # not Match(r'\s*#', prevline) and
+ # os.path.splitext(filename)[1] != ".hh"):
+ # #not Match(r'\s*}\s*', prevline) and
+ # #not Match(r'^\s*{\s*&', prevline)):
+ # error(filename, linenum, 'whitespace/braces', 4,
+ # '{ should never be at the end of the previous line')
+
+ # An else clause should not be on the same line as the preceding closing brace.
+ if Match(r'\s*}\s*else\b\s*(?:if\b|\{|$)', line):
+ # prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
+ #if Match(r'\s*}\s*$', line):
+ error(filename, linenum, 'whitespace/newline', 4,
+ 'An else should not appear on the same line as the preceding }')
+ if Match(r'\s*else.*{$', line):
+ error(filename, linenum, 'whitespace/newline', 4,
+ 'An else should not appear on the same line as the next {')
+
+ # If braces come on one side of an else, they should be on both.
+ # However, we have to worry about "else if" that spans multiple lines!
+ # if Search(r'else if\s*\(', line): # could be multi-line if
+ # brace_on_left = bool(Search(r'}\s*else if\s*\(', line))
+ # # find the ( after the if
+ # pos = line.find('else if')
+ # pos = line.find('(', pos)
+ # if pos > 0:
+ # (endline, _, endpos) = CloseExpression(clean_lines, linenum, pos)
+ # brace_on_right = endline[endpos:].find('{') != -1
+ # if brace_on_left != brace_on_right: # must be brace after if
+ # error(filename, linenum, 'readability/braces', 5,
+ # 'If an else has a brace on one side, it should have it on both')
+ # elif Search(r'}\s*else[^{]*$', line) or Match(r'[^}]*else\s*{', line):
+ # error(filename, linenum, 'readability/braces', 5,
+ # 'If an else has a brace on one side, it should have it on both')
+
+ # Likewise, an else should never have the else clause on the same line
+ if Search(r'\belse [^\s{]', line) and not Search(r'\belse if\b', line):
+ error(filename, linenum, 'whitespace/newline', 4,
+ 'Else clause should never be on same line as else (use 2 lines)')
+
+ # In the same way, a do/while should never be on one line
+ if Match(r'\s*do [^\s{]', line):
+ error(filename, linenum, 'whitespace/newline', 4,
+ 'do/while clauses should not be on a single line')
+
+ # Check single-line if/else bodies. The style guide says 'curly braces are not
+ # required for single-line statements'. We additionally allow multi-line,
+ # single statements, but we reject anything with more than one semicolon in
+ # it. This means that the first semicolon after the if should be at the end of
+ # its line, and the line after that should have an indent level equal to or
+ # lower than the if. We also check for ambiguous if/else nesting without
+ # braces.
+ if_else_match = Search(r'\b(if\s*\(|else\b)', line)
+ if if_else_match and not Match(r'\s*#', line):
+ if_indent = GetIndentLevel(line)
+ endline, endlinenum, endpos = line, linenum, if_else_match.end()
+ if_match = Search(r'\bif\s*\(', line)
+ if if_match:
+ # This could be a multiline if condition, so find the end first.
+ pos = if_match.end() - 1
+ (endline, endlinenum, endpos) = CloseExpression(clean_lines, linenum, pos)
+ # Check for an opening brace, either directly after the if or on the next
+ # line. If found, this isn't a single-statement conditional.
+ if (not Match(r'\s*{', endline[endpos:])
+ and not (Match(r'\s*$', endline[endpos:])
+ and endlinenum < (len(clean_lines.elided) - 1)
+ and Match(r'\s*{', clean_lines.elided[endlinenum + 1]))):
+ while (endlinenum < len(clean_lines.elided)
+ and ';' not in clean_lines.elided[endlinenum][endpos:]):
+ endlinenum += 1
+ endpos = 0
+ if endlinenum < len(clean_lines.elided):
+ endline = clean_lines.elided[endlinenum]
+ # We allow a mix of whitespace and closing braces (e.g. for one-liner
+ # methods) and a single \ after the semicolon (for macros)
+ endpos = endline.find(';')
+ if not Match(r';[\s}]*(\\?)$', endline[endpos:]):
+ # Semicolon isn't the last character, there's something trailing
+ error(filename, linenum, 'readability/braces', 4,
+ 'If/else bodies with multiple statements require braces')
+ elif endlinenum < len(clean_lines.elided) - 1:
+ # Make sure the next line is dedented
+ next_line = clean_lines.elided[endlinenum + 1]
+ next_indent = GetIndentLevel(next_line)
+ # With ambiguous nested if statements, this will error out on the
+ # if that *doesn't* match the else, regardless of whether it's the
+ # inner one or outer one.
+ if (if_match and Match(r'\s*else\b', next_line)
+ and next_indent != if_indent):
+ error(filename, linenum, 'readability/braces', 4,
+ 'Else clause should be indented at the same level as if. '
+ 'Ambiguous nested if/else chains require braces.')
+ elif next_indent > if_indent:
+ error(filename, linenum, 'readability/braces', 4,
+ 'If/else bodies with multiple statements require braces')
+
+
+def CheckTrailingSemicolon(filename, clean_lines, linenum, error):
+ """Looks for redundant trailing semicolon.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+
+ line = clean_lines.elided[linenum]
+
+ # Block bodies should not be followed by a semicolon. Due to C++11
+ # brace initialization, there are more places where semicolons are
+ # required than not, so we use a whitelist approach to check these
+ # rather than a blacklist. These are the places where "};" should
+ # be replaced by just "}":
+ # 1. Some flavor of block following closing parenthesis:
+ # for (;;) {};
+ # while (...) {};
+ # switch (...) {};
+ # Function(...) {};
+ # if (...) {};
+ # if (...) else if (...) {};
+ #
+ # 2. else block:
+ # if (...) else {};
+ #
+ # 3. const member function:
+ # Function(...) const {};
+ #
+ # 4. Block following some statement:
+ # x = 42;
+ # {};
+ #
+ # 5. Block at the beginning of a function:
+ # Function(...) {
+ # {};
+ # }
+ #
+ # Note that naively checking for the preceding "{" will also match
+ # braces inside multi-dimensional arrays, but this is fine since
+ # that expression will not contain semicolons.
+ #
+ # 6. Block following another block:
+ # while (true) {}
+ # {};
+ #
+ # 7. End of namespaces:
+ # namespace {};
+ #
+ # These semicolons seems far more common than other kinds of
+ # redundant semicolons, possibly due to people converting classes
+ # to namespaces. For now we do not warn for this case.
+ #
+ # Try matching case 1 first.
+ match = Match(r'^(.*\)\s*)\{', line)
+ if match:
+ # Matched closing parenthesis (case 1). Check the token before the
+ # matching opening parenthesis, and don't warn if it looks like a
+ # macro. This avoids these false positives:
+ # - macro that defines a base class
+ # - multi-line macro that defines a base class
+ # - macro that defines the whole class-head
+ #
+ # But we still issue warnings for macros that we know are safe to
+ # warn, specifically:
+ # - TEST, TEST_F, TEST_P, MATCHER, MATCHER_P
+ # - TYPED_TEST
+ # - INTERFACE_DEF
+ # - EXCLUSIVE_LOCKS_REQUIRED, SHARED_LOCKS_REQUIRED, LOCKS_EXCLUDED:
+ #
+ # We implement a whitelist of safe macros instead of a blacklist of
+ # unsafe macros, even though the latter appears less frequently in
+ # google code and would have been easier to implement. This is because
+ # the downside for getting the whitelist wrong means some extra
+ # semicolons, while the downside for getting the blacklist wrong
+ # would result in compile errors.
+ #
+ # In addition to macros, we also don't want to warn on compound
+ # literals and lambdas.
+ closing_brace_pos = match.group(1).rfind(')')
+ opening_parenthesis = ReverseCloseExpression(
+ clean_lines, linenum, closing_brace_pos)
+ if opening_parenthesis[2] > -1:
+ line_prefix = opening_parenthesis[0][0:opening_parenthesis[2]]
+ macro = Search(r'\b([A-Z_]+)\s*$', line_prefix)
+ func = Match(r'^(.*\])\s*$', line_prefix)
+ if ((macro and
+ macro.group(1) not in (
+ 'TEST', 'TEST_F', 'MATCHER', 'MATCHER_P', 'TYPED_TEST',
+ 'EXCLUSIVE_LOCKS_REQUIRED', 'SHARED_LOCKS_REQUIRED',
+ 'LOCKS_EXCLUDED', 'INTERFACE_DEF')) or
+ (func and not Search(r'\boperator\s*\[\s*\]', func.group(1))) or
+ Search(r'\s+=\s*$', line_prefix)):
+ match = None
+ if (match and
+ opening_parenthesis[1] > 1 and
+ Search(r'\]\s*$', clean_lines.elided[opening_parenthesis[1] - 1])):
+ # Multi-line lambda-expression
+ match = None
+
+ else:
+ # Try matching cases 2-3.
+ match = Match(r'^(.*(?:else|\)\s*const)\s*)\{', line)
+ if not match:
+ # Try matching cases 4-6. These are always matched on separate lines.
+ #
+ # Note that we can't simply concatenate the previous line to the
+ # current line and do a single match, otherwise we may output
+ # duplicate warnings for the blank line case:
+ # if (cond) {
+ # // blank line
+ # }
+ prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
+ if prevline and Search(r'[;{}]\s*$', prevline):
+ match = Match(r'^(\s*)\{', line)
+
+ # Check matching closing brace
+ if match:
+ (endline, endlinenum, endpos) = CloseExpression(
+ clean_lines, linenum, len(match.group(1)))
+ if endpos > -1 and Match(r'^\s*;', endline[endpos:]):
+ # Current {} pair is eligible for semicolon check, and we have found
+ # the redundant semicolon, output warning here.
+ #
+ # Note: because we are scanning forward for opening braces, and
+ # outputting warnings for the matching closing brace, if there are
+ # nested blocks with trailing semicolons, we will get the error
+ # messages in reversed order.
+ error(filename, endlinenum, 'readability/braces', 4,
+ "You don't need a ; after a }")
+
+
+def CheckEmptyBlockBody(filename, clean_lines, linenum, error):
+ """Look for empty loop/conditional body with only a single semicolon.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+
+ # Search for loop keywords at the beginning of the line. Because only
+ # whitespaces are allowed before the keywords, this will also ignore most
+ # do-while-loops, since those lines should start with closing brace.
+ #
+ # We also check "if" blocks here, since an empty conditional block
+ # is likely an error.
+ line = clean_lines.elided[linenum]
+ matched = Match(r'\s*(for|while|if)\s*\(', line)
+ if matched:
+ # Find the end of the conditional expression
+ (end_line, end_linenum, end_pos) = CloseExpression(
+ clean_lines, linenum, line.find('('))
+
+ # Output warning if what follows the condition expression is a semicolon.
+ # No warning for all other cases, including whitespace or newline, since we
+ # have a separate check for semicolons preceded by whitespace.
+ if end_pos >= 0 and Match(r';', end_line[end_pos:]):
+ if matched.group(1) == 'if':
+ error(filename, end_linenum, 'whitespace/empty_conditional_body', 5,
+ 'Empty conditional bodies should use {}')
+ elif matched.group(1) != "while":
+ error(filename, end_linenum, 'whitespace/empty_loop_body', 5,
+ 'Empty loop bodies should use {} or continue')
+
+
+def FindCheckMacro(line):
+ """Find a replaceable CHECK-like macro.
+
+ Args:
+ line: line to search on.
+ Returns:
+ (macro name, start position), or (None, -1) if no replaceable
+ macro is found.
+ """
+ for macro in _CHECK_MACROS:
+ i = line.find(macro)
+ if i >= 0:
+ # Find opening parenthesis. Do a regular expression match here
+ # to make sure that we are matching the expected CHECK macro, as
+ # opposed to some other macro that happens to contain the CHECK
+ # substring.
+ matched = Match(r'^(.*\b' + macro + r'\s*)\(', line)
+ if not matched:
+ continue
+ return (macro, len(matched.group(1)))
+ return (None, -1)
+
+
+def CheckCheck(filename, clean_lines, linenum, error):
+ """Checks the use of CHECK and EXPECT macros.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+
+ # Decide the set of replacement macros that should be suggested
+ lines = clean_lines.elided
+ (check_macro, start_pos) = FindCheckMacro(lines[linenum])
+ if not check_macro:
+ return
+
+ # Find end of the boolean expression by matching parentheses
+ (last_line, end_line, end_pos) = CloseExpression(
+ clean_lines, linenum, start_pos)
+ if end_pos < 0:
+ return
+ if linenum == end_line:
+ expression = lines[linenum][start_pos + 1:end_pos - 1]
+ else:
+ expression = lines[linenum][start_pos + 1:]
+ for i in xrange(linenum + 1, end_line):
+ expression += lines[i]
+ expression += last_line[0:end_pos - 1]
+
+ # Parse expression so that we can take parentheses into account.
+ # This avoids false positives for inputs like "CHECK((a < 4) == b)",
+ # which is not replaceable by CHECK_LE.
+ lhs = ''
+ rhs = ''
+ operator = None
+ while expression:
+ matched = Match(r'^\s*(<<|<<=|>>|>>=|->\*|->|&&|\|\||'
+ r'==|!=|>=|>|<=|<|\()(.*)$', expression)
+ if matched:
+ token = matched.group(1)
+ if token == '(':
+ # Parenthesized operand
+ expression = matched.group(2)
+ (end, _) = FindEndOfExpressionInLine(expression, 0, ['('])
+ if end < 0:
+ return # Unmatched parenthesis
+ lhs += '(' + expression[0:end]
+ expression = expression[end:]
+ elif token in ('&&', '||'):
+ # Logical and/or operators. This means the expression
+ # contains more than one term, for example:
+ # CHECK(42 < a && a < b);
+ #
+ # These are not replaceable with CHECK_LE, so bail out early.
+ return
+ elif token in ('<<', '<<=', '>>', '>>=', '->*', '->'):
+ # Non-relational operator
+ lhs += token
+ expression = matched.group(2)
+ else:
+ # Relational operator
+ operator = token
+ rhs = matched.group(2)
+ break
+ else:
+ # Unparenthesized operand. Instead of appending to lhs one character
+ # at a time, we do another regular expression match to consume several
+ # characters at once if possible. Trivial benchmark shows that this
+ # is more efficient when the operands are longer than a single
+ # character, which is generally the case.
+ matched = Match(r'^([^-=!<>()&|]+)(.*)$', expression)
+ if not matched:
+ matched = Match(r'^(\s*\S)(.*)$', expression)
+ if not matched:
+ break
+ lhs += matched.group(1)
+ expression = matched.group(2)
+
+ # Only apply checks if we got all parts of the boolean expression
+ if not (lhs and operator and rhs):
+ return
+
+ # Check that rhs do not contain logical operators. We already know
+ # that lhs is fine since the loop above parses out && and ||.
+ if rhs.find('&&') > -1 or rhs.find('||') > -1:
+ return
+
+ # At least one of the operands must be a constant literal. This is
+ # to avoid suggesting replacements for unprintable things like
+ # CHECK(variable != iterator)
+ #
+ # The following pattern matches decimal, hex integers, strings, and
+ # characters (in that order).
+ lhs = lhs.strip()
+ rhs = rhs.strip()
+ match_constant = r'^([-+]?(\d+|0[xX][0-9a-fA-F]+)[lLuU]{0,3}|".*"|\'.*\')$'
+ if Match(match_constant, lhs) or Match(match_constant, rhs):
+ # Note: since we know both lhs and rhs, we can provide a more
+ # descriptive error message like:
+ # Consider using CHECK_EQ(x, 42) instead of CHECK(x == 42)
+ # Instead of:
+ # Consider using CHECK_EQ instead of CHECK(a == b)
+ #
+ # We are still keeping the less descriptive message because if lhs
+ # or rhs gets long, the error message might become unreadable.
+ error(filename, linenum, 'readability/check', 2,
+ 'Consider using %s instead of %s(a %s b)' % (
+ _CHECK_REPLACEMENT[check_macro][operator],
+ check_macro, operator))
+
+
+def CheckAltTokens(filename, clean_lines, linenum, error):
+ """Check alternative keywords being used in boolean expressions.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Avoid preprocessor lines
+ if Match(r'^\s*#', line):
+ return
+
+ # Last ditch effort to avoid multi-line comments. This will not help
+ # if the comment started before the current line or ended after the
+ # current line, but it catches most of the false positives. At least,
+ # it provides a way to workaround this warning for people who use
+ # multi-line comments in preprocessor macros.
+ #
+ # TODO(unknown): remove this once cpplint has better support for
+ # multi-line comments.
+ if line.find('/*') >= 0 or line.find('*/') >= 0:
+ return
+
+ for match in _ALT_TOKEN_REPLACEMENT_PATTERN.finditer(line):
+ error(filename, linenum, 'readability/alt_tokens', 2,
+ 'Use operator %s instead of %s' % (
+ _ALT_TOKEN_REPLACEMENT[match.group(1)], match.group(1)))
+
+
+def GetLineWidth(line):
+ """Determines the width of the line in column positions.
+
+ Args:
+ line: A string, which may be a Unicode string.
+
+ Returns:
+ The width of the line in column positions, accounting for Unicode
+ combining characters and wide characters.
+ """
+ if isinstance(line, unicode):
+ width = 0
+ for uc in unicodedata.normalize('NFC', line):
+ if unicodedata.east_asian_width(uc) in ('W', 'F'):
+ width += 2
+ elif not unicodedata.combining(uc):
+ width += 1
+ return width
+ else:
+ return len(line)
+
+
+def CheckStyle(filename, clean_lines, linenum, file_extension, nesting_state,
+ error):
+ """Checks rules from the 'C++ style rules' section of cppguide.html.
+
+ Most of these rules are hard to test (naming, comment style), but we
+ do what we can. In particular we check for 2-space indents, line lengths,
+ tab usage, spaces inside code, etc.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ file_extension: The extension (without the dot) of the filename.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+
+ # Don't use "elided" lines here, otherwise we can't check commented lines.
+ # Don't want to use "raw" either, because we don't want to check inside C++11
+ # raw strings,
+ raw_lines = clean_lines.lines_without_raw_strings
+ line = raw_lines[linenum]
+
+ if line.find('\t') != -1:
+ error(filename, linenum, 'whitespace/tab', 1,
+ 'Tab found; better to use spaces')
+
+ # One or three blank spaces at the beginning of the line is weird; it's
+ # hard to reconcile that with 2-space indents.
+ # NOTE: here are the conditions rob pike used for his tests. Mine aren't
+ # as sophisticated, but it may be worth becoming so: RLENGTH==initial_spaces
+ # if(RLENGTH > 20) complain = 0;
+ # if(match($0, " +(error|private|public|protected):")) complain = 0;
+ # if(match(prev, "&& *$")) complain = 0;
+ # if(match(prev, "\\|\\| *$")) complain = 0;
+ # if(match(prev, "[\",=><] *$")) complain = 0;
+ # if(match($0, " <<")) complain = 0;
+ # if(match(prev, " +for \\(")) complain = 0;
+ # if(prevodd && match(prevprev, " +for \\(")) complain = 0;
+ scope_or_label_pattern = r'\s*\w+\s*:\s*\\?$'
+ classinfo = nesting_state.InnermostClass()
+ initial_spaces = 0
+ cleansed_line = clean_lines.elided[linenum]
+ while initial_spaces < len(line) and line[initial_spaces] == ' ':
+ initial_spaces += 1
+ if line and line[-1].isspace():
+ error(filename, linenum, 'whitespace/end_of_line', 4,
+ 'Line ends in whitespace. Consider deleting these extra spaces.')
+ # There are certain situations we allow one space, notably for
+ # section labels, and also lines containing multi-line raw strings.
+ elif ((initial_spaces == 1 or initial_spaces == 3) and
+ not Match(scope_or_label_pattern, cleansed_line) and
+ not (clean_lines.raw_lines[linenum] != line and
+ Match(r'^\s*""', line))):
+ error(filename, linenum, 'whitespace/indent', 3,
+ 'Weird number of spaces at line-start. '
+ 'Are you using a 2-space indent?')
+
+ # Check if the line is a header guard.
+ is_header_guard = False
+ if file_extension == 'h':
+ cppvar = GetHeaderGuardCPPVariable(filename)
+ if (line.startswith('#ifndef %s' % cppvar) or
+ line.startswith('#define %s' % cppvar) or
+ line.startswith('#endif // %s' % cppvar)):
+ is_header_guard = True
+ # #include lines and header guards can be long, since there's no clean way to
+ # split them.
+ #
+ # URLs can be long too. It's possible to split these, but it makes them
+ # harder to cut&paste.
+ #
+ # The "$Id:...$" comment may also get very long without it being the
+ # developers fault.
+ if (not line.startswith('#include') and not is_header_guard and
+ not Match(r'^\s*//.*http(s?)://\S*$', line) and
+ not Match(r'^// \$Id:.*#[0-9]+ \$$', line)):
+ line_width = GetLineWidth(line)
+ extended_length = int((_line_length * 1.25))
+ if line_width > extended_length:
+ error(filename, linenum, 'whitespace/line_length', 4,
+ 'Lines should very rarely be longer than %i characters' %
+ extended_length)
+ elif line_width > _line_length:
+ error(filename, linenum, 'whitespace/line_length', 2,
+ 'Lines should be <= %i characters long' % _line_length)
+
+ if (cleansed_line.count(';') > 1 and
+ # for loops are allowed two ;'s (and may run over two lines).
+ cleansed_line.find('for') == -1 and
+ (GetPreviousNonBlankLine(clean_lines, linenum)[0].find('for') == -1 or
+ GetPreviousNonBlankLine(clean_lines, linenum)[0].find(';') != -1) and
+ # It's ok to have many commands in a switch case that fits in 1 line
+ not ((cleansed_line.find('case ') != -1 or
+ cleansed_line.find('default:') != -1) and
+ cleansed_line.find('break;') != -1)):
+ error(filename, linenum, 'whitespace/newline', 0,
+ 'More than one command on the same line')
+
+ # Some more style checks
+ CheckBraces(filename, clean_lines, linenum, error)
+ CheckTrailingSemicolon(filename, clean_lines, linenum, error)
+ CheckEmptyBlockBody(filename, clean_lines, linenum, error)
+ CheckAccess(filename, clean_lines, linenum, nesting_state, error)
+ CheckSpacing(filename, clean_lines, linenum, nesting_state, error)
+ CheckOperatorSpacing(filename, clean_lines, linenum, error)
+ CheckParenthesisSpacing(filename, clean_lines, linenum, error)
+ CheckCommaSpacing(filename, clean_lines, linenum, error)
+ CheckBracesSpacing(filename, clean_lines, linenum, error)
+ CheckSpacingForFunctionCall(filename, clean_lines, linenum, error)
+ CheckRValueReference(filename, clean_lines, linenum, nesting_state, error)
+ CheckCheck(filename, clean_lines, linenum, error)
+ CheckAltTokens(filename, clean_lines, linenum, error)
+ classinfo = nesting_state.InnermostClass()
+ if classinfo:
+ CheckSectionSpacing(filename, clean_lines, classinfo, linenum, error)
+
+
+_RE_PATTERN_INCLUDE_NEW_STYLE = re.compile(r'#include +"[^/]+\.h"')
+_RE_PATTERN_INCLUDE = re.compile(r'^\s*#\s*include\s*([<"])([^>"]*)[>"].*$')
+# Matches the first component of a filename delimited by -s and _s. That is:
+# _RE_FIRST_COMPONENT.match('foo').group(0) == 'foo'
+# _RE_FIRST_COMPONENT.match('foo.cc').group(0) == 'foo'
+# _RE_FIRST_COMPONENT.match('foo-bar_baz.cc').group(0) == 'foo'
+# _RE_FIRST_COMPONENT.match('foo_bar-baz.cc').group(0) == 'foo'
+_RE_FIRST_COMPONENT = re.compile(r'^[^-_.]+')
+
+
+def _DropCommonSuffixes(filename):
+ """Drops common suffixes like _test.cc or -inl.h from filename.
+
+ For example:
+ >>> _DropCommonSuffixes('foo/foo-inl.h')
+ 'foo/foo'
+ >>> _DropCommonSuffixes('foo/bar/foo.cc')
+ 'foo/bar/foo'
+ >>> _DropCommonSuffixes('foo/foo_internal.h')
+ 'foo/foo'
+ >>> _DropCommonSuffixes('foo/foo_unusualinternal.h')
+ 'foo/foo_unusualinternal'
+
+ Args:
+ filename: The input filename.
+
+ Returns:
+ The filename with the common suffix removed.
+ """
+ for suffix in ('test.cc', 'regtest.cc', 'unittest.cc',
+ 'inl.h', 'impl.h', 'internal.h'):
+ if (filename.endswith(suffix) and len(filename) > len(suffix) and
+ filename[-len(suffix) - 1] in ('-', '_')):
+ return filename[:-len(suffix) - 1]
+ return os.path.splitext(filename)[0]
+
+
+def _IsTestFilename(filename):
+ """Determines if the given filename has a suffix that identifies it as a test.
+
+ Args:
+ filename: The input filename.
+
+ Returns:
+ True if 'filename' looks like a test, False otherwise.
+ """
+ if (filename.endswith('_test.cc') or
+ filename.endswith('_unittest.cc') or
+ filename.endswith('_regtest.cc')):
+ return True
+ else:
+ return False
+
+
+def _ClassifyInclude(fileinfo, include, is_system):
+ """Figures out what kind of header 'include' is.
+
+ Args:
+ fileinfo: The current file cpplint is running over. A FileInfo instance.
+ include: The path to a #included file.
+ is_system: True if the #include used <> rather than "".
+
+ Returns:
+ One of the _XXX_HEADER constants.
+
+ For example:
+ >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'stdio.h', True)
+ _C_SYS_HEADER
+ >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'string', True)
+ _CPP_SYS_HEADER
+ >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/foo.h', False)
+ _LIKELY_MY_HEADER
+ >>> _ClassifyInclude(FileInfo('foo/foo_unknown_extension.cc'),
+ ... 'bar/foo_other_ext.h', False)
+ _POSSIBLE_MY_HEADER
+ >>> _ClassifyInclude(FileInfo('foo/foo.cc'), 'foo/bar.h', False)
+ _OTHER_HEADER
+ """
+ # This is a list of all standard c++ header files, except
+ # those already checked for above.
+ is_cpp_h = include in _CPP_HEADERS or include.find(".hh") > 0
+
+ if is_system:
+ if is_cpp_h:
+ return _CPP_SYS_HEADER
+ else:
+ return _C_SYS_HEADER
+
+ # If the target file and the include we're checking share a
+ # basename when we drop common extensions, and the include
+ # lives in . , then it's likely to be owned by the target file.
+ target_dir, target_base = (
+ os.path.split(_DropCommonSuffixes(fileinfo.RepositoryName())))
+ include_dir, include_base = os.path.split(_DropCommonSuffixes(include))
+ if target_base == include_base and (
+ include_dir == target_dir or
+ include_dir == os.path.normpath(target_dir + '/../public')):
+ return _LIKELY_MY_HEADER
+
+ # If the target and include share some initial basename
+ # component, it's possible the target is implementing the
+ # include, so it's allowed to be first, but we'll never
+ # complain if it's not there.
+ target_first_component = _RE_FIRST_COMPONENT.match(target_base)
+ include_first_component = _RE_FIRST_COMPONENT.match(include_base)
+ if (target_first_component and include_first_component and
+ target_first_component.group(0) ==
+ include_first_component.group(0)):
+ return _POSSIBLE_MY_HEADER
+
+ return _OTHER_HEADER
+
+
+
+def CheckIncludeLine(filename, clean_lines, linenum, include_state, error):
+ """Check rules that are applicable to #include lines.
+
+ Strings on #include lines are NOT removed from elided line, to make
+ certain tasks easier. However, to prevent false positives, checks
+ applicable to #include lines in CheckLanguage must be put here.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ include_state: An _IncludeState instance in which the headers are inserted.
+ error: The function to call with any errors found.
+ """
+ fileinfo = FileInfo(filename)
+ line = clean_lines.lines[linenum]
+
+ # "include" should use the new style "foo/bar.h" instead of just "bar.h"
+ if _RE_PATTERN_INCLUDE_NEW_STYLE.search(line):
+ error(filename, linenum, 'build/include', 4,
+ 'Include the directory when naming .h files')
+
+ # we shouldn't include a file more than once. actually, there are a
+ # handful of instances where doing so is okay, but in general it's
+ # not.
+ match = _RE_PATTERN_INCLUDE.search(line)
+ if match:
+ include = match.group(2)
+ is_system = (match.group(1) == '<')
+ if include in include_state:
+ error(filename, linenum, 'build/include', 4,
+ '"%s" already included at %s:%s' %
+ (include, filename, include_state[include]))
+ else:
+ include_state[include] = linenum
+
+ # We want to ensure that headers appear in the right order:
+ # 1) for foo.cc, foo.h (preferred location)
+ # 2) c system files
+ # 3) cpp system files
+ # 4) for foo.cc, foo.h (deprecated location)
+ # 5) other google headers
+ #
+ # We classify each include statement as one of those 5 types
+ # using a number of techniques. The include_state object keeps
+ # track of the highest type seen, and complains if we see a
+ # lower type after that.
+ error_message = include_state.CheckNextIncludeOrder(
+ _ClassifyInclude(fileinfo, include, is_system))
+ if error_message:
+ error(filename, linenum, 'build/include_order', 4,
+ '%s. Should be: %s.h, c system, c++ system, other.' %
+ (error_message, fileinfo.BaseName()))
+ canonical_include = include_state.CanonicalizeAlphabeticalOrder(include)
+ if not include_state.IsInAlphabeticalOrder(
+ clean_lines, linenum, canonical_include):
+ error(filename, linenum, 'build/include_alpha', 4,
+ 'Include "%s" not in alphabetical order' % include)
+ include_state.SetLastHeader(canonical_include)
+
+ # Look for any of the stream classes that are part of standard C++.
+ match = _RE_PATTERN_INCLUDE.match(line)
+ if match:
+ include = match.group(2)
+ if Match(r'(f|ind|io|i|o|parse|pf|stdio|str|)?stream$', include):
+ # Many unit tests use cout, so we exempt them.
+ if not _IsTestFilename(filename):
+ # Suggest a different header for ostream
+ if include == 'ostream':
+ error(filename, linenum, 'readability/streams', 3,
+ 'For logging, include "base/logging.h" instead of <ostream>.')
+ # else:
+ # error(filename, linenum, 'readability/streams', 3,
+ # 'Streams are highly discouraged.')
+
+
+def _GetTextInside(text, start_pattern):
+ r"""Retrieves all the text between matching open and close parentheses.
+
+ Given a string of lines and a regular expression string, retrieve all the text
+ following the expression and between opening punctuation symbols like
+ (, [, or {, and the matching close-punctuation symbol. This properly nested
+ occurrences of the punctuations, so for the text like
+ printf(a(), b(c()));
+ a call to _GetTextInside(text, r'printf\(') will return 'a(), b(c())'.
+ start_pattern must match string having an open punctuation symbol at the end.
+
+ Args:
+ text: The lines to extract text. Its comments and strings must be elided.
+ It can be single line and can span multiple lines.
+ start_pattern: The regexp string indicating where to start extracting
+ the text.
+ Returns:
+ The extracted text.
+ None if either the opening string or ending punctuation could not be found.
+ """
+ # TODO(unknown): Audit cpplint.py to see what places could be profitably
+ # rewritten to use _GetTextInside (and use inferior regexp matching today).
+
+ # Give opening punctuations to get the matching close-punctuations.
+ matching_punctuation = {'(': ')', '{': '}', '[': ']'}
+ closing_punctuation = set(matching_punctuation.itervalues())
+
+ # Find the position to start extracting text.
+ match = re.search(start_pattern, text, re.M)
+ if not match: # start_pattern not found in text.
+ return None
+ start_position = match.end(0)
+
+ assert start_position > 0, (
+ 'start_pattern must ends with an opening punctuation.')
+ assert text[start_position - 1] in matching_punctuation, (
+ 'start_pattern must ends with an opening punctuation.')
+ # Stack of closing punctuations we expect to have in text after position.
+ punctuation_stack = [matching_punctuation[text[start_position - 1]]]
+ position = start_position
+ while punctuation_stack and position < len(text):
+ if text[position] == punctuation_stack[-1]:
+ punctuation_stack.pop()
+ elif text[position] in closing_punctuation:
+ # A closing punctuation without matching opening punctuations.
+ return None
+ elif text[position] in matching_punctuation:
+ punctuation_stack.append(matching_punctuation[text[position]])
+ position += 1
+ if punctuation_stack:
+ # Opening punctuations left without matching close-punctuations.
+ return None
+ # punctuations match.
+ return text[start_position:position - 1]
+
+
+# Patterns for matching call-by-reference parameters.
+#
+# Supports nested templates up to 2 levels deep using this messy pattern:
+# < (?: < (?: < [^<>]*
+# >
+# | [^<>] )*
+# >
+# | [^<>] )*
+# >
+_RE_PATTERN_IDENT = r'[_a-zA-Z]\w*' # =~ [[:alpha:]][[:alnum:]]*
+_RE_PATTERN_TYPE = (
+ r'(?:const\s+)?(?:typename\s+|class\s+|struct\s+|union\s+|enum\s+)?'
+ r'(?:\w|'
+ r'\s*<(?:<(?:<[^<>]*>|[^<>])*>|[^<>])*>|'
+ r'::)+')
+# A call-by-reference parameter ends with '& identifier'.
+_RE_PATTERN_REF_PARAM = re.compile(
+ r'(' + _RE_PATTERN_TYPE + r'(?:\s*(?:\bconst\b|[*]))*\s*'
+ r'&\s*' + _RE_PATTERN_IDENT + r')\s*(?:=[^,()]+)?[,)]')
+# A call-by-const-reference parameter either ends with 'const& identifier'
+# or looks like 'const type& identifier' when 'type' is atomic.
+_RE_PATTERN_CONST_REF_PARAM = (
+ r'(?:.*\s*\bconst\s*&\s*' + _RE_PATTERN_IDENT +
+ r'|const\s+' + _RE_PATTERN_TYPE + r'\s*&\s*' + _RE_PATTERN_IDENT + r')')
+
+
+def CheckLanguage(filename, clean_lines, linenum, file_extension,
+ include_state, nesting_state, error):
+ """Checks rules from the 'C++ language rules' section of cppguide.html.
+
+ Some of these rules are hard to test (function overloading, using
+ uint32 inappropriately), but we do the best we can.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ file_extension: The extension (without the dot) of the filename.
+ include_state: An _IncludeState instance in which the headers are inserted.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+ # If the line is empty or consists of entirely a comment, no need to
+ # check it.
+ line = clean_lines.elided[linenum]
+ if not line:
+ return
+
+ match = _RE_PATTERN_INCLUDE.search(line)
+ if match:
+ CheckIncludeLine(filename, clean_lines, linenum, include_state, error)
+ return
+
+ # Reset include state across preprocessor directives. This is meant
+ # to silence warnings for conditional includes.
+ if Match(r'^\s*#\s*(?:ifdef|elif|else|endif)\b', line):
+ include_state.ResetSection()
+
+ # Make Windows paths like Unix.
+ fullname = os.path.abspath(filename).replace('\\', '/')
+
+ # Perform other checks now that we are sure that this is not an include line
+ CheckCasts(filename, clean_lines, linenum, error)
+ CheckGlobalStatic(filename, clean_lines, linenum, error)
+ CheckPrintf(filename, clean_lines, linenum, error)
+
+ if file_extension == 'h':
+ # TODO(unknown): check that 1-arg constructors are explicit.
+ # How to tell it's a constructor?
+ # (handled in CheckForNonStandardConstructs for now)
+ # TODO(unknown): check that classes have DISALLOW_EVIL_CONSTRUCTORS
+ # (level 1 error)
+ pass
+
+ # Check if people are using the verboten C basic types. The only exception
+ # we regularly allow is "unsigned short port" for port.
+ if Search(r'\bshort port\b', line):
+ if not Search(r'\bunsigned short port\b', line):
+ error(filename, linenum, 'runtime/int', 4,
+ 'Use "unsigned short" for ports, not "short"')
+ else:
+ match = Search(r'\b(short|long(?! +double)|long long)\b', line)
+ if match:
+ error(filename, linenum, 'runtime/int', 4,
+ 'Use int16/int64/etc, rather than the C type %s' % match.group(1))
+
+ # Check if some verboten operator overloading is going on
+ # TODO(unknown): catch out-of-line unary operator&:
+ # class X {};
+ # int operator&(const X& x) { return 42; } // unary operator&
+ # The trick is it's hard to tell apart from binary operator&:
+ # class Y { int operator&(const Y& x) { return 23; } }; // binary operator&
+ if Search(r'\boperator\s*&\s*\(\s*\)', line):
+ error(filename, linenum, 'runtime/operator', 4,
+ 'Unary operator& is dangerous. Do not use it.')
+
+ # Check for suspicious usage of "if" like
+ # } if (a == b) {
+ if Search(r'\}\s*if\s*\(', line):
+ error(filename, linenum, 'readability/braces', 4,
+ 'Did you mean "else if"? If not, start a new line for "if".')
+
+ # Check for potential format string bugs like printf(foo).
+ # We constrain the pattern not to pick things like DocidForPrintf(foo).
+ # Not perfect but it can catch printf(foo.c_str()) and printf(foo->c_str())
+ # TODO(unknown): Catch the following case. Need to change the calling
+ # convention of the whole function to process multiple line to handle it.
+ # printf(
+ # boy_this_is_a_really_long_variable_that_cannot_fit_on_the_prev_line);
+ printf_args = _GetTextInside(line, r'(?i)\b(string)?printf\s*\(')
+ if printf_args:
+ match = Match(r'([\w.\->()]+)$', printf_args)
+ if match and match.group(1) != '__VA_ARGS__':
+ function_name = re.search(r'\b((?:string)?printf)\s*\(',
+ line, re.I).group(1)
+ error(filename, linenum, 'runtime/printf', 4,
+ 'Potential format string bug. Do %s("%%s", %s) instead.'
+ % (function_name, match.group(1)))
+
+ # Check for potential memset bugs like memset(buf, sizeof(buf), 0).
+ match = Search(r'memset\s*\(([^,]*),\s*([^,]*),\s*0\s*\)', line)
+ if match and not Match(r"^''|-?[0-9]+|0x[0-9A-Fa-f]$", match.group(2)):
+ error(filename, linenum, 'runtime/memset', 4,
+ 'Did you mean "memset(%s, 0, %s)"?'
+ % (match.group(1), match.group(2)))
+
+ # if Search(r'\busing namespace\b', line):
+ # error(filename, linenum, 'build/namespaces', 5,
+ # 'Do not use namespace using-directives. '
+ # 'Use using-declarations instead.')
+
+ # Detect variable-length arrays.
+ match = Match(r'\s*(.+::)?(\w+) [a-z]\w*\[(.+)];', line)
+ if (match and match.group(2) != 'return' and match.group(2) != 'delete' and
+ match.group(3).find(']') == -1):
+ # Split the size using space and arithmetic operators as delimiters.
+ # If any of the resulting tokens are not compile time constants then
+ # report the error.
+ tokens = re.split(r'\s|\+|\-|\*|\/|<<|>>]', match.group(3))
+ is_const = True
+ skip_next = False
+ for tok in tokens:
+ if skip_next:
+ skip_next = False
+ continue
+
+ if Search(r'sizeof\(.+\)', tok): continue
+ if Search(r'arraysize\(\w+\)', tok): continue
+
+ tok = tok.lstrip('(')
+ tok = tok.rstrip(')')
+ if not tok: continue
+ if Match(r'\d+', tok): continue
+ if Match(r'0[xX][0-9a-fA-F]+', tok): continue
+ if Match(r'k[A-Z0-9]\w*', tok): continue
+ if Match(r'(.+::)?k[A-Z0-9]\w*', tok): continue
+ if Match(r'(.+::)?[A-Z][A-Z0-9_]*', tok): continue
+ # A catch all for tricky sizeof cases, including 'sizeof expression',
+ # 'sizeof(*type)', 'sizeof(const type)', 'sizeof(struct StructName)'
+ # requires skipping the next token because we split on ' ' and '*'.
+ if tok.startswith('sizeof'):
+ skip_next = True
+ continue
+ is_const = False
+ break
+ if not is_const:
+ error(filename, linenum, 'runtime/arrays', 1,
+ 'Do not use variable-length arrays. Use an appropriately named '
+ "('k' followed by CamelCase) compile-time constant for the size.")
+
+ # If DISALLOW_EVIL_CONSTRUCTORS, DISALLOW_COPY_AND_ASSIGN, or
+ # DISALLOW_IMPLICIT_CONSTRUCTORS is present, then it should be the last thing
+ # in the class declaration.
+ match = Match(
+ (r'\s*'
+ r'(DISALLOW_(EVIL_CONSTRUCTORS|COPY_AND_ASSIGN|IMPLICIT_CONSTRUCTORS))'
+ r'\(.*\);$'),
+ line)
+ if match and linenum + 1 < clean_lines.NumLines():
+ next_line = clean_lines.elided[linenum + 1]
+ # We allow some, but not all, declarations of variables to be present
+ # in the statement that defines the class. The [\w\*,\s]* fragment of
+ # the regular expression below allows users to declare instances of
+ # the class or pointers to instances, but not less common types such
+ # as function pointers or arrays. It's a tradeoff between allowing
+ # reasonable code and avoiding trying to parse more C++ using regexps.
+ if not Search(r'^\s*}[\w\*,\s]*;', next_line):
+ error(filename, linenum, 'readability/constructors', 3,
+ match.group(1) + ' should be the last thing in the class')
+
+ # Check for use of unnamed namespaces in header files. Registration
+ # macros are typically OK, so we allow use of "namespace {" on lines
+ # that end with backslashes.
+ if (file_extension == 'h'
+ and Search(r'\bnamespace\s*{', line)
+ and line[-1] != '\\'):
+ error(filename, linenum, 'build/namespaces', 4,
+ 'Do not use unnamed namespaces in header files. See '
+ 'http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Namespaces'
+ ' for more information.')
+
+
+def CheckGlobalStatic(filename, clean_lines, linenum, error):
+ """Check for unsafe global or static objects.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Check for people declaring static/global STL strings at the top level.
+ # This is dangerous because the C++ language does not guarantee that
+ # globals with constructors are initialized before the first access.
+ match = Match(
+ r'((?:|static +)(?:|const +))string +([a-zA-Z0-9_:]+)\b(.*)',
+ line)
+ # Remove false positives:
+ # - String pointers (as opposed to values).
+ # string *pointer
+ # const string *pointer
+ # string const *pointer
+ # string *const pointer
+ #
+ # - Functions and template specializations.
+ # string Function<Type>(...
+ # string Class<Type>::Method(...
+ #
+ # - Operators. These are matched separately because operator names
+ # cross non-word boundaries, and trying to match both operators
+ # and functions at the same time would decrease accuracy of
+ # matching identifiers.
+ # string Class::operator*()
+ if (match and
+ not Search(r'\bstring\b(\s+const)?\s*\*\s*(const\s+)?\w', line) and
+ not Search(r'\boperator\W', line) and
+ not Match(r'\s*(<.*>)?(::[a-zA-Z0-9_]+)?\s*\(([^"]|$)', match.group(3))):
+ error(filename, linenum, 'runtime/string', 4,
+ 'For a static/global string constant, use a C style string instead: '
+ '"%schar %s[]".' %
+ (match.group(1), match.group(2)))
+
+ if Search(r'\b([A-Za-z0-9_]*_)\(\1\)', line):
+ error(filename, linenum, 'runtime/init', 4,
+ 'You seem to be initializing a member variable with itself.')
+
+
+def CheckPrintf(filename, clean_lines, linenum, error):
+ """Check for printf related issues.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # When snprintf is used, the second argument shouldn't be a literal.
+ match = Search(r'snprintf\s*\(([^,]*),\s*([0-9]*)\s*,', line)
+ if match and match.group(2) != '0':
+ # If 2nd arg is zero, snprintf is used to calculate size.
+ error(filename, linenum, 'runtime/printf', 3,
+ 'If you can, use sizeof(%s) instead of %s as the 2nd arg '
+ 'to snprintf.' % (match.group(1), match.group(2)))
+
+ # Check if some verboten C functions are being used.
+ if Search(r'\bsprintf\b', line):
+ error(filename, linenum, 'runtime/printf', 5,
+ 'Never use sprintf. Use snprintf instead.')
+ match = Search(r'\b(strcpy|strcat)\b', line)
+ if match:
+ error(filename, linenum, 'runtime/printf', 4,
+ 'Almost always, snprintf is better than %s' % match.group(1))
+
+
+def IsDerivedFunction(clean_lines, linenum):
+ """Check if current line contains an inherited function.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ Returns:
+ True if current line contains a function with "override"
+ virt-specifier.
+ """
+ # Look for leftmost opening parenthesis on current line
+ opening_paren = clean_lines.elided[linenum].find('(')
+ if opening_paren < 0: return False
+
+ # Look for "override" after the matching closing parenthesis
+ line, _, closing_paren = CloseExpression(clean_lines, linenum, opening_paren)
+ return closing_paren >= 0 and Search(r'\boverride\b', line[closing_paren:])
+
+
+def IsInitializerList(clean_lines, linenum):
+ """Check if current line is inside constructor initializer list.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ Returns:
+ True if current line appears to be inside constructor initializer
+ list, False otherwise.
+ """
+ for i in xrange(linenum, 1, -1):
+ line = clean_lines.elided[i]
+ if i == linenum:
+ remove_function_body = Match(r'^(.*)\{\s*$', line)
+ if remove_function_body:
+ line = remove_function_body.group(1)
+
+ if Search(r'\s:\s*\w+[({]', line):
+ # A lone colon tend to indicate the start of a constructor
+ # initializer list. It could also be a ternary operator, which
+ # also tend to appear in constructor initializer lists as
+ # opposed to parameter lists.
+ return True
+ if Search(r'\}\s*,\s*$', line):
+ # A closing brace followed by a comma is probably the end of a
+ # brace-initialized member in constructor initializer list.
+ return True
+ if Search(r'[{};]\s*$', line):
+ # Found one of the following:
+ # - A closing brace or semicolon, probably the end of the previous
+ # function.
+ # - An opening brace, probably the start of current class or namespace.
+ #
+ # Current line is probably not inside an initializer list since
+ # we saw one of those things without seeing the starting colon.
+ return False
+
+ # Got to the beginning of the file without seeing the start of
+ # constructor initializer list.
+ return False
+
+
+def CheckForNonConstReference(filename, clean_lines, linenum,
+ nesting_state, error):
+ """Check for non-const references.
+
+ Separate from CheckLanguage since it scans backwards from current
+ line, instead of scanning forward.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: The function to call with any errors found.
+ """
+ # Do nothing if there is no '&' on current line.
+ line = clean_lines.elided[linenum]
+ if '&' not in line:
+ return
+
+ # If a function is inherited, current function doesn't have much of
+ # a choice, so any non-const references should not be blamed on
+ # derived function.
+ if IsDerivedFunction(clean_lines, linenum):
+ return
+
+ # Long type names may be broken across multiple lines, usually in one
+ # of these forms:
+ # LongType
+ # ::LongTypeContinued &identifier
+ # LongType::
+ # LongTypeContinued &identifier
+ # LongType<
+ # ...>::LongTypeContinued &identifier
+ #
+ # If we detected a type split across two lines, join the previous
+ # line to current line so that we can match const references
+ # accordingly.
+ #
+ # Note that this only scans back one line, since scanning back
+ # arbitrary number of lines would be expensive. If you have a type
+ # that spans more than 2 lines, please use a typedef.
+ if linenum > 1:
+ previous = None
+ if Match(r'\s*::(?:[\w<>]|::)+\s*&\s*\S', line):
+ # previous_line\n + ::current_line
+ previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+[\w<>])\s*$',
+ clean_lines.elided[linenum - 1])
+ elif Match(r'\s*[a-zA-Z_]([\w<>]|::)+\s*&\s*\S', line):
+ # previous_line::\n + current_line
+ previous = Search(r'\b((?:const\s*)?(?:[\w<>]|::)+::)\s*$',
+ clean_lines.elided[linenum - 1])
+ if previous:
+ line = previous.group(1) + line.lstrip()
+ else:
+ # Check for templated parameter that is split across multiple lines
+ endpos = line.rfind('>')
+ if endpos > -1:
+ (_, startline, startpos) = ReverseCloseExpression(
+ clean_lines, linenum, endpos)
+ if startpos > -1 and startline < linenum:
+ # Found the matching < on an earlier line, collect all
+ # pieces up to current line.
+ line = ''
+ for i in xrange(startline, linenum + 1):
+ line += clean_lines.elided[i].strip()
+
+ # Check for non-const references in function parameters. A single '&' may
+ # found in the following places:
+ # inside expression: binary & for bitwise AND
+ # inside expression: unary & for taking the address of something
+ # inside declarators: reference parameter
+ # We will exclude the first two cases by checking that we are not inside a
+ # function body, including one that was just introduced by a trailing '{'.
+ # TODO(unknown): Doesn't account for 'catch(Exception& e)' [rare].
+ if (nesting_state.previous_stack_top and
+ not (isinstance(nesting_state.previous_stack_top, _ClassInfo) or
+ isinstance(nesting_state.previous_stack_top, _NamespaceInfo))):
+ # Not at toplevel, not within a class, and not within a namespace
+ return
+
+ # Avoid preprocessors
+ if Search(r'\\\s*$', line):
+ return
+
+ # Avoid constructor initializer lists
+ if IsInitializerList(clean_lines, linenum):
+ return
+
+ # We allow non-const references in a few standard places, like functions
+ # called "swap()" or iostream operators like "<<" or ">>". Do not check
+ # those function parameters.
+ #
+ # We also accept & in static_assert, which looks like a function but
+ # it's actually a declaration expression.
+ whitelisted_functions = (r'(?:[sS]wap(?:<\w:+>)?|'
+ r'operator\s*[<>][<>]|'
+ r'static_assert|COMPILE_ASSERT'
+ r')\s*\(')
+ if Search(whitelisted_functions, line):
+ return
+ elif not Search(r'\S+\([^)]*$', line):
+ # Don't see a whitelisted function on this line. Actually we
+ # didn't see any function name on this line, so this is likely a
+ # multi-line parameter list. Try a bit harder to catch this case.
+ for i in xrange(2):
+ if (linenum > i and
+ Search(whitelisted_functions, clean_lines.elided[linenum - i - 1])):
+ return
+
+ decls = ReplaceAll(r'{[^}]*}', ' ', line) # exclude function body
+ # for parameter in re.findall(_RE_PATTERN_REF_PARAM, decls):
+ # if not Match(_RE_PATTERN_CONST_REF_PARAM, parameter):
+ # error(filename, linenum, 'runtime/references', 2,
+ # 'Is this a non-const reference? '
+ # 'If so, make const or use a pointer: ' +
+ # ReplaceAll(' *<', '<', parameter))
+
+
+def CheckCasts(filename, clean_lines, linenum, error):
+ """Various cast related checks.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Check to see if they're using an conversion function cast.
+ # I just try to capture the most common basic types, though there are more.
+ # Parameterless conversion functions, such as bool(), are allowed as they are
+ # probably a member operator declaration or default constructor.
+ match = Search(
+ r'(\bnew\s+|\S<\s*(?:const\s+)?)?\b'
+ r'(int|float|double|bool|char|int32|uint32|int64|uint64)'
+ r'(\([^)].*)', line)
+ expecting_function = ExpectingFunctionArgs(clean_lines, linenum)
+ if match and not expecting_function:
+ matched_type = match.group(2)
+
+ # matched_new_or_template is used to silence two false positives:
+ # - New operators
+ # - Template arguments with function types
+ #
+ # For template arguments, we match on types immediately following
+ # an opening bracket without any spaces. This is a fast way to
+ # silence the common case where the function type is the first
+ # template argument. False negative with less-than comparison is
+ # avoided because those operators are usually followed by a space.
+ #
+ # function<double(double)> // bracket + no space = false positive
+ # value < double(42) // bracket + space = true positive
+ matched_new_or_template = match.group(1)
+
+ # Other things to ignore:
+ # - Function pointers
+ # - Casts to pointer types
+ # - Placement new
+ # - Alias declarations
+ matched_funcptr = match.group(3)
+ if (matched_new_or_template is None and
+ not (matched_funcptr and
+ (Match(r'\((?:[^() ]+::\s*\*\s*)?[^() ]+\)\s*\(',
+ matched_funcptr) or
+ matched_funcptr.startswith('(*)'))) and
+ not Match(r'\s*using\s+\S+\s*=\s*' + matched_type, line) and
+ not Search(r'new\(\S+\)\s*' + matched_type, line)):
+ error(filename, linenum, 'readability/casting', 4,
+ 'Using deprecated casting style. '
+ 'Use static_cast<%s>(...) instead' %
+ matched_type)
+
+ if not expecting_function:
+ CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
+ 'static_cast',
+ r'\((int|float|double|bool|char|u?int(16|32|64))\)', error)
+
+ # This doesn't catch all cases. Consider (const char * const)"hello".
+ #
+ # (char *) "foo" should always be a const_cast (reinterpret_cast won't
+ # compile).
+ if CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
+ 'const_cast', r'\((char\s?\*+\s?)\)\s*"', error):
+ pass
+ else:
+ # Check pointer casts for other than string constants
+ CheckCStyleCast(filename, linenum, line, clean_lines.raw_lines[linenum],
+ 'reinterpret_cast', r'\((\w+\s?\*+\s?)\)', error)
+
+ # In addition, we look for people taking the address of a cast. This
+ # is dangerous -- casts can assign to temporaries, so the pointer doesn't
+ # point where you think.
+ match = Search(
+ r'(?:&\(([^)]+)\)[\w(])|'
+ r'(?:&(static|dynamic|down|reinterpret)_cast\b)', line)
+ if match and match.group(1) != '*':
+ # Try a better error message when the & is bound to something
+ # dereferenced by the casted pointer, as opposed to the casted
+ # pointer itself.
+ parenthesis_error = False
+ match = Match(r'^(.*&(?:static|dynamic|down|reinterpret)_cast\b)<', line)
+ if match:
+ _, y1, x1 = CloseExpression(clean_lines, linenum, len(match.group(1)))
+ if x1 >= 0 and clean_lines.elided[y1][x1] == '(':
+ _, y2, x2 = CloseExpression(clean_lines, y1, x1)
+ if x2 >= 0:
+ extended_line = clean_lines.elided[y2][x2:]
+ if y2 < clean_lines.NumLines() - 1:
+ extended_line += clean_lines.elided[y2 + 1]
+ if Match(r'\s*(?:->|\[)', extended_line):
+ parenthesis_error = True
+
+ if parenthesis_error:
+ error(filename, linenum, 'readability/casting', 4,
+ ('Are you taking an address of something dereferenced '
+ 'from a cast? Wrapping the dereferenced expression in '
+ 'parentheses will make the binding more obvious'))
+ else:
+ error(filename, linenum, 'runtime/casting', 4,
+ ('Are you taking an address of a cast? '
+ 'This is dangerous: could be a temp var. '
+ 'Take the address before doing the cast, rather than after'))
+
+
+def CheckCStyleCast(filename, linenum, line, raw_line, cast_type, pattern,
+ error):
+ """Checks for a C-style cast by looking for the pattern.
+
+ Args:
+ filename: The name of the current file.
+ linenum: The number of the line to check.
+ line: The line of code to check.
+ raw_line: The raw line of code to check, with comments.
+ cast_type: The string for the C++ cast to recommend. This is either
+ reinterpret_cast, static_cast, or const_cast, depending.
+ pattern: The regular expression used to find C-style casts.
+ error: The function to call with any errors found.
+
+ Returns:
+ True if an error was emitted.
+ False otherwise.
+ """
+ match = Search(pattern, line)
+ if not match:
+ return False
+
+ # Exclude lines with keywords that tend to look like casts, and also
+ # macros which are generally troublesome.
+ if Match(r'.*\b(?:sizeof|alignof|alignas|[A-Z_]+)\s*$',
+ line[0:match.start(1) - 1]):
+ return False
+
+ # operator++(int) and operator--(int)
+ if (line[0:match.start(1) - 1].endswith(' operator++') or
+ line[0:match.start(1) - 1].endswith(' operator--')):
+ return False
+
+ # A single unnamed argument for a function tends to look like old
+ # style cast. If we see those, don't issue warnings for deprecated
+ # casts, instead issue warnings for unnamed arguments where
+ # appropriate.
+ #
+ # These are things that we want warnings for, since the style guide
+ # explicitly require all parameters to be named:
+ # Function(int);
+ # Function(int) {
+ # ConstMember(int) const;
+ # ConstMember(int) const {
+ # ExceptionMember(int) throw (...);
+ # ExceptionMember(int) throw (...) {
+ # PureVirtual(int) = 0;
+ #
+ # These are functions of some sort, where the compiler would be fine
+ # if they had named parameters, but people often omit those
+ # identifiers to reduce clutter:
+ # (FunctionPointer)(int);
+ # (FunctionPointer)(int) = value;
+ # Function((function_pointer_arg)(int))
+ # <TemplateArgument(int)>;
+ # <(FunctionPointerTemplateArgument)(int)>;
+ remainder = line[match.end(0):]
+ if Match(r'^\s*(?:;|const\b|throw\b|final\b|override\b|=|>|\{|\))',
+ remainder):
+ # Looks like an unnamed parameter.
+
+ # Don't warn on any kind of template arguments.
+ if Match(r'^\s*>', remainder):
+ return False
+
+ # Don't warn on assignments to function pointers, but keep warnings for
+ # unnamed parameters to pure virtual functions. Note that this pattern
+ # will also pass on assignments of "0" to function pointers, but the
+ # preferred values for those would be "nullptr" or "NULL".
+ matched_zero = Match(r'^\s=\s*(\S+)\s*;', remainder)
+ if matched_zero and matched_zero.group(1) != '0':
+ return False
+
+ # Don't warn on function pointer declarations. For this we need
+ # to check what came before the "(type)" string.
+ if Match(r'.*\)\s*$', line[0:match.start(0)]):
+ return False
+
+ # Don't warn if the parameter is named with block comments, e.g.:
+ # Function(int /*unused_param*/);
+ if '/*' in raw_line:
+ return False
+
+ # Passed all filters, issue warning here.
+ error(filename, linenum, 'readability/function', 3,
+ 'All parameters should be named in a function')
+ return True
+
+ # At this point, all that should be left is actual casts.
+ error(filename, linenum, 'readability/casting', 4,
+ 'Using C-style cast. Use %s<%s>(...) instead' %
+ (cast_type, match.group(1)))
+
+ return True
+
+
+def ExpectingFunctionArgs(clean_lines, linenum):
+ """Checks whether where function type arguments are expected.
+
+ Args:
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+
+ Returns:
+ True if the line at 'linenum' is inside something that expects arguments
+ of function types.
+ """
+ line = clean_lines.elided[linenum]
+ return (Match(r'^\s*MOCK_(CONST_)?METHOD\d+(_T)?\(', line) or
+ (linenum >= 2 and
+ (Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\((?:\S+,)?\s*$',
+ clean_lines.elided[linenum - 1]) or
+ Match(r'^\s*MOCK_(?:CONST_)?METHOD\d+(?:_T)?\(\s*$',
+ clean_lines.elided[linenum - 2]) or
+ Search(r'\bstd::m?function\s*\<\s*$',
+ clean_lines.elided[linenum - 1]))))
+
+
+_HEADERS_CONTAINING_TEMPLATES = (
+ ('<deque>', ('deque',)),
+ ('<functional>', ('unary_function', 'binary_function',
+ 'plus', 'minus', 'multiplies', 'divides', 'modulus',
+ 'negate',
+ 'equal_to', 'not_equal_to', 'greater', 'less',
+ 'greater_equal', 'less_equal',
+ 'logical_and', 'logical_or', 'logical_not',
+ 'unary_negate', 'not1', 'binary_negate', 'not2',
+ 'bind1st', 'bind2nd',
+ 'pointer_to_unary_function',
+ 'pointer_to_binary_function',
+ 'ptr_fun',
+ 'mem_fun_t', 'mem_fun', 'mem_fun1_t', 'mem_fun1_ref_t',
+ 'mem_fun_ref_t',
+ 'const_mem_fun_t', 'const_mem_fun1_t',
+ 'const_mem_fun_ref_t', 'const_mem_fun1_ref_t',
+ 'mem_fun_ref',
+ )),
+ ('<limits>', ('numeric_limits',)),
+ ('<list>', ('list',)),
+ ('<map>', ('map', 'multimap',)),
+ ('<memory>', ('allocator',)),
+ ('<queue>', ('queue', 'priority_queue',)),
+ ('<set>', ('set', 'multiset',)),
+ ('<stack>', ('stack',)),
+ ('<string>', ('char_traits', 'basic_string',)),
+ ('<utility>', ('pair',)),
+ ('<vector>', ('vector',)),
+
+ # gcc extensions.
+ # Note: std::hash is their hash, ::hash is our hash
+ ('<hash_map>', ('hash_map', 'hash_multimap',)),
+ ('<hash_set>', ('hash_set', 'hash_multiset',)),
+ ('<slist>', ('slist',)),
+ )
+
+_RE_PATTERN_STRING = re.compile(r'\bstring\b')
+
+_re_pattern_algorithm_header = []
+for _template in ('copy', 'max', 'min', 'min_element', 'sort', 'swap',
+ 'transform'):
+ # Match max<type>(..., ...), max(..., ...), but not foo->max, foo.max or
+ # type::max().
+ _re_pattern_algorithm_header.append(
+ (re.compile(r'[^>.]\b' + _template + r'(<.*?>)?\([^\)]'),
+ _template,
+ '<algorithm>'))
+
+_re_pattern_templates = []
+for _header, _templates in _HEADERS_CONTAINING_TEMPLATES:
+ for _template in _templates:
+ _re_pattern_templates.append(
+ (re.compile(r'(\<|\b)' + _template + r'\s*\<'),
+ _template + '<>',
+ _header))
+
+
+def FilesBelongToSameModule(filename_cc, filename_h):
+ """Check if these two filenames belong to the same module.
+
+ The concept of a 'module' here is a as follows:
+ foo.h, foo-inl.h, foo.cc, foo_test.cc and foo_unittest.cc belong to the
+ same 'module' if they are in the same directory.
+ some/path/public/xyzzy and some/path/internal/xyzzy are also considered
+ to belong to the same module here.
+
+ If the filename_cc contains a longer path than the filename_h, for example,
+ '/absolute/path/to/base/sysinfo.cc', and this file would include
+ 'base/sysinfo.h', this function also produces the prefix needed to open the
+ header. This is used by the caller of this function to more robustly open the
+ header file. We don't have access to the real include paths in this context,
+ so we need this guesswork here.
+
+ Known bugs: tools/base/bar.cc and base/bar.h belong to the same module
+ according to this implementation. Because of this, this function gives
+ some false positives. This should be sufficiently rare in practice.
+
+ Args:
+ filename_cc: is the path for the .cc file
+ filename_h: is the path for the header path
+
+ Returns:
+ Tuple with a bool and a string:
+ bool: True if filename_cc and filename_h belong to the same module.
+ string: the additional prefix needed to open the header file.
+ """
+
+ if not filename_cc.endswith('.cc'):
+ return (False, '')
+ filename_cc = filename_cc[:-len('.cc')]
+ if filename_cc.endswith('_unittest'):
+ filename_cc = filename_cc[:-len('_unittest')]
+ elif filename_cc.endswith('_test'):
+ filename_cc = filename_cc[:-len('_test')]
+ filename_cc = filename_cc.replace('/public/', '/')
+ filename_cc = filename_cc.replace('/internal/', '/')
+
+ if not filename_h.endswith('.h'):
+ return (False, '')
+ filename_h = filename_h[:-len('.h')]
+ if filename_h.endswith('-inl'):
+ filename_h = filename_h[:-len('-inl')]
+ filename_h = filename_h.replace('/public/', '/')
+ filename_h = filename_h.replace('/internal/', '/')
+
+ files_belong_to_same_module = filename_cc.endswith(filename_h)
+ common_path = ''
+ if files_belong_to_same_module:
+ common_path = filename_cc[:-len(filename_h)]
+ return files_belong_to_same_module, common_path
+
+
+def UpdateIncludeState(filename, include_state, io=codecs):
+ """Fill up the include_state with new includes found from the file.
+
+ Args:
+ filename: the name of the header to read.
+ include_state: an _IncludeState instance in which the headers are inserted.
+ io: The io factory to use to read the file. Provided for testability.
+
+ Returns:
+ True if a header was succesfully added. False otherwise.
+ """
+ headerfile = None
+ try:
+ headerfile = io.open(filename, 'r', 'utf8', 'replace')
+ except IOError:
+ return False
+ linenum = 0
+ for line in headerfile:
+ linenum += 1
+ clean_line = CleanseComments(line)
+ match = _RE_PATTERN_INCLUDE.search(clean_line)
+ if match:
+ include = match.group(2)
+ # The value formatting is cute, but not really used right now.
+ # What matters here is that the key is in include_state.
+ include_state.setdefault(include, '%s:%d' % (filename, linenum))
+ return True
+
+
+def CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error,
+ io=codecs):
+ """Reports for missing stl includes.
+
+ This function will output warnings to make sure you are including the headers
+ necessary for the stl containers and functions that you use. We only give one
+ reason to include a header. For example, if you use both equal_to<> and
+ less<> in a .h file, only one (the latter in the file) of these will be
+ reported as a reason to include the <functional>.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ include_state: An _IncludeState instance.
+ error: The function to call with any errors found.
+ io: The IO factory to use to read the header file. Provided for unittest
+ injection.
+ """
+ required = {} # A map of header name to linenumber and the template entity.
+ # Example of required: { '<functional>': (1219, 'less<>') }
+
+ for linenum in xrange(clean_lines.NumLines()):
+ line = clean_lines.elided[linenum]
+ if not line or line[0] == '#':
+ continue
+
+ # String is special -- it is a non-templatized type in STL.
+ matched = _RE_PATTERN_STRING.search(line)
+ if matched:
+ # Don't warn about strings in non-STL namespaces:
+ # (We check only the first match per line; good enough.)
+ prefix = line[:matched.start()]
+ if prefix.endswith('std::') or not prefix.endswith('::'):
+ required['<string>'] = (linenum, 'string')
+
+ for pattern, template, header in _re_pattern_algorithm_header:
+ if pattern.search(line):
+ required[header] = (linenum, template)
+
+ # The following function is just a speed up, no semantics are changed.
+ if not '<' in line: # Reduces the cpu time usage by skipping lines.
+ continue
+
+ for pattern, template, header in _re_pattern_templates:
+ if pattern.search(line):
+ required[header] = (linenum, template)
+
+ # The policy is that if you #include something in foo.h you don't need to
+ # include it again in foo.cc. Here, we will look at possible includes.
+ # Let's copy the include_state so it is only messed up within this function.
+ include_state = include_state.copy()
+
+ # Did we find the header for this file (if any) and succesfully load it?
+ header_found = False
+
+ # Use the absolute path so that matching works properly.
+ abs_filename = FileInfo(filename).FullName()
+
+ # For Emacs's flymake.
+ # If cpplint is invoked from Emacs's flymake, a temporary file is generated
+ # by flymake and that file name might end with '_flymake.cc'. In that case,
+ # restore original file name here so that the corresponding header file can be
+ # found.
+ # e.g. If the file name is 'foo_flymake.cc', we should search for 'foo.h'
+ # instead of 'foo_flymake.h'
+ abs_filename = re.sub(r'_flymake\.cc$', '.cc', abs_filename)
+
+ # include_state is modified during iteration, so we iterate over a copy of
+ # the keys.
+ header_keys = include_state.keys()
+ for header in header_keys:
+ (same_module, common_path) = FilesBelongToSameModule(abs_filename, header)
+ fullpath = common_path + header
+ if same_module and UpdateIncludeState(fullpath, include_state, io):
+ header_found = True
+
+ # If we can't find the header file for a .cc, assume it's because we don't
+ # know where to look. In that case we'll give up as we're not sure they
+ # didn't include it in the .h file.
+ # TODO(unknown): Do a better job of finding .h files so we are confident that
+ # not having the .h file means there isn't one.
+ if filename.endswith('.cc') and not header_found:
+ return
+
+ # All the lines have been processed, report the errors found.
+ for required_header_unstripped in required:
+ template = required[required_header_unstripped][1]
+ if required_header_unstripped.strip('<>"') not in include_state:
+ error(filename, required[required_header_unstripped][0],
+ 'build/include_what_you_use', 4,
+ 'Add #include ' + required_header_unstripped + ' for ' + template)
+
+
+_RE_PATTERN_EXPLICIT_MAKEPAIR = re.compile(r'\bmake_pair\s*<')
+
+
+def CheckMakePairUsesDeduction(filename, clean_lines, linenum, error):
+ """Check that make_pair's template arguments are deduced.
+
+ G++ 4.6 in C++11 mode fails badly if make_pair's template arguments are
+ specified explicitly, and such use isn't intended in any case.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+ match = _RE_PATTERN_EXPLICIT_MAKEPAIR.search(line)
+ if match:
+ error(filename, linenum, 'build/explicit_make_pair',
+ 4, # 4 = high confidence
+ 'For C++11-compatibility, omit template arguments from make_pair'
+ ' OR use pair directly OR if appropriate, construct a pair directly')
+def CheckDefaultLambdaCaptures(filename, clean_lines, linenum, error):
+ """Check that default lambda captures are not used.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # A lambda introducer specifies a default capture if it starts with "[="
+ # or if it starts with "[&" _not_ followed by an identifier.
+ match = Match(r'^(.*)\[\s*(?:=|&[^\w])', line)
+ if match:
+ # Found a potential error, check what comes after the lambda-introducer.
+ # If it's not open parenthesis (for lambda-declarator) or open brace
+ # (for compound-statement), it's not a lambda.
+ line, _, pos = CloseExpression(clean_lines, linenum, len(match.group(1)))
+ if pos >= 0 and Match(r'^\s*[{(]', line[pos:]):
+ error(filename, linenum, 'build/c++11',
+ 4, # 4 = high confidence
+ 'Default lambda captures are an unapproved C++ feature.')
+
+
+
+
+def ProcessLine(filename, file_extension, clean_lines, line,
+ include_state, function_state, nesting_state, error,
+ extra_check_functions=[]):
+ """Processes a single line in the file.
+
+ Args:
+ filename: Filename of the file that is being processed.
+ file_extension: The extension (dot not included) of the file.
+ clean_lines: An array of strings, each representing a line of the file,
+ with comments stripped.
+ line: Number of line being processed.
+ include_state: An _IncludeState instance in which the headers are inserted.
+ function_state: A _FunctionState instance which counts function lines, etc.
+ nesting_state: A NestingState instance which maintains information about
+ the current stack of nested blocks being parsed.
+ error: A callable to which errors are reported, which takes 4 arguments:
+ filename, line number, error level, and message
+ extra_check_functions: An array of additional check functions that will be
+ run on each source line. Each function takes 4
+ arguments: filename, clean_lines, line, error
+ """
+ raw_lines = clean_lines.raw_lines
+ ParseNolintSuppressions(filename, raw_lines[line], line, error)
+ nesting_state.Update(filename, clean_lines, line, error)
+ if nesting_state.InAsmBlock(): return
+ CheckForFunctionLengths(filename, clean_lines, line, function_state, error)
+ CheckForMultilineCommentsAndStrings(filename, clean_lines, line, error)
+ CheckStyle(filename, clean_lines, line, file_extension, nesting_state, error)
+ CheckLanguage(filename, clean_lines, line, file_extension, include_state,
+ nesting_state, error)
+ CheckForNonConstReference(filename, clean_lines, line, nesting_state, error)
+ CheckForNonStandardConstructs(filename, clean_lines, line,
+ nesting_state, error)
+ CheckVlogArguments(filename, clean_lines, line, error)
+ CheckPosixThreading(filename, clean_lines, line, error)
+ CheckInvalidIncrement(filename, clean_lines, line, error)
+ CheckMakePairUsesDeduction(filename, clean_lines, line, error)
+ # CheckDefaultLambdaCaptures(filename, clean_lines, line, error)
+ for check_fn in extra_check_functions:
+ check_fn(filename, clean_lines, line, error)
+
+def FlagCxx11Features(filename, clean_lines, linenum, error):
+ """Flag those c++11 features that we only allow in certain places.
+
+ Args:
+ filename: The name of the current file.
+ clean_lines: A CleansedLines instance containing the file.
+ linenum: The number of the line to check.
+ error: The function to call with any errors found.
+ """
+ line = clean_lines.elided[linenum]
+
+ # Flag unapproved C++11 headers.
+ include = Match(r'\s*#\s*include\s+[<"]([^<"]+)[">]', line)
+ # if include and include.group(1) in ('cfenv',
+ # 'condition_variable',
+ # 'fenv.h',
+ # 'ratio',
+ # 'regex',
+ # 'system_error',
+ # ):
+ # error(filename, linenum, 'build/c++11', 5,
+ # ('<%s> is an unapproved C++11 header.') % include.group(1))
+
+ # The only place where we need to worry about C++11 keywords and library
+ # features in preprocessor directives is in macro definitions.
+ if Match(r'\s*#', line) and not Match(r'\s*#\s*define\b', line): return
+
+ # These are classes and free functions. The classes are always
+ # mentioned as std::*, but we only catch the free functions if
+ # they're not found by ADL. They're alphabetical by header.
+ for top_name in (
+ # type_traits
+ 'alignment_of',
+ 'aligned_union',
+
+ # utility
+ 'forward',
+ ):
+ if Search(r'\bstd::%s\b' % top_name, line):
+ error(filename, linenum, 'build/c++11', 5,
+ ('std::%s is an unapproved C++11 class or function. Send c-style '
+ 'an example of where it would make your code more readable, and '
+ 'they may let you use it.') % top_name)
+
+
+def ProcessFileData(filename, file_extension, lines, error,
+ extra_check_functions=[]):
+ """Performs lint checks and reports any errors to the given error function.
+
+ Args:
+ filename: Filename of the file that is being processed.
+ file_extension: The extension (dot not included) of the file.
+ lines: An array of strings, each representing a line of the file, with the
+ last element being empty if the file is terminated with a newline.
+ error: A callable to which errors are reported, which takes 4 arguments:
+ filename, line number, error level, and message
+ extra_check_functions: An array of additional check functions that will be
+ run on each source line. Each function takes 4
+ arguments: filename, clean_lines, line, error
+ """
+ lines = (['// marker so line numbers and indices both start at 1'] + lines +
+ ['// marker so line numbers end in a known way'])
+
+ include_state = _IncludeState()
+ function_state = _FunctionState()
+ nesting_state = NestingState()
+
+ ResetNolintSuppressions()
+
+ CheckForCopyright(filename, lines, error)
+
+ if file_extension == 'h':
+ CheckForHeaderGuard(filename, lines, error)
+
+ RemoveMultiLineComments(filename, lines, error)
+ clean_lines = CleansedLines(lines)
+ for line in xrange(clean_lines.NumLines()):
+ ProcessLine(filename, file_extension, clean_lines, line,
+ include_state, function_state, nesting_state, error,
+ extra_check_functions)
+ FlagCxx11Features(filename, clean_lines, line, error)
+ nesting_state.CheckCompletedBlocks(filename, error)
+
+ CheckForIncludeWhatYouUse(filename, clean_lines, include_state, error)
+
+ # We check here rather than inside ProcessLine so that we see raw
+ # lines rather than "cleaned" lines.
+ CheckForBadCharacters(filename, lines, error)
+
+ CheckForNewlineAtEOF(filename, lines, error)
+
+
+def ProcessFile(filename, vlevel, extra_check_functions=[]):
+ """Does google-lint on a single file.
+
+ Args:
+ filename: The name of the file to parse.
+
+ vlevel: The level of errors to report. Every error of confidence
+ >= verbose_level will be reported. 0 is a good default.
+
+ extra_check_functions: An array of additional check functions that will be
+ run on each source line. Each function takes 4
+ arguments: filename, clean_lines, line, error
+ """
+
+ _SetVerboseLevel(vlevel)
+
+ lf_lines = []
+ crlf_lines = []
+ try:
+ # Support the UNIX convention of using "-" for stdin. Note that
+ # we are not opening the file with universal newline support
+ # (which codecs doesn't support anyway), so the resulting lines do
+ # contain trailing '\r' characters if we are reading a file that
+ # has CRLF endings.
+ # If after the split a trailing '\r' is present, it is removed
+ # below.
+ if filename == '-':
+ lines = codecs.StreamReaderWriter(sys.stdin,
+ codecs.getreader('utf8'),
+ codecs.getwriter('utf8'),
+ 'replace').read().split('\n')
+ else:
+ lines = codecs.open(filename, 'r', 'utf8', 'replace').read().split('\n')
+
+ # Remove trailing '\r'.
+ # The -1 accounts for the extra trailing blank line we get from split()
+ for linenum in range(len(lines) - 1):
+ if lines[linenum].endswith('\r'):
+ lines[linenum] = lines[linenum].rstrip('\r')
+ crlf_lines.append(linenum + 1)
+ else:
+ lf_lines.append(linenum + 1)
+
+ except IOError:
+ sys.stderr.write(
+ "Skipping input '%s': Can't open for reading\n" % filename)
+ return
+
+ # Note, if no dot is found, this will give the entire filename as the ext.
+ file_extension = filename[filename.rfind('.') + 1:]
+
+ # When reading from stdin, the extension is unknown, so no cpplint tests
+ # should rely on the extension.
+ if filename != '-' and file_extension not in _valid_extensions:
+ sys.stderr.write('Ignoring %s; not a valid file name '
+ '(%s)\n' % (filename, ', '.join(_valid_extensions)))
+ else:
+ ProcessFileData(filename, file_extension, lines, Error,
+ extra_check_functions)
+
+ # If end-of-line sequences are a mix of LF and CR-LF, issue
+ # warnings on the lines with CR.
+ #
+ # Don't issue any warnings if all lines are uniformly LF or CR-LF,
+ # since critique can handle these just fine, and the style guide
+ # doesn't dictate a particular end of line sequence.
+ #
+ # We can't depend on os.linesep to determine what the desired
+ # end-of-line sequence should be, since that will return the
+ # server-side end-of-line sequence.
+ if lf_lines and crlf_lines:
+ # Warn on every line with CR. An alternative approach might be to
+ # check whether the file is mostly CRLF or just LF, and warn on the
+ # minority, we bias toward LF here since most tools prefer LF.
+ for linenum in crlf_lines:
+ Error(filename, linenum, 'whitespace/newline', 1,
+ 'Unexpected \\r (^M) found; better to use only \\n')
+
+ # sys.stderr.write('Done processing %s\n' % filename)
+
+
+def PrintUsage(message):
+ """Prints a brief usage string and exits, optionally with an error message.
+
+ Args:
+ message: The optional error message.
+ """
+ sys.stderr.write(_USAGE)
+ if message:
+ sys.exit('\nFATAL ERROR: ' + message)
+ else:
+ sys.exit(1)
+
+
+def PrintCategories():
+ """Prints a list of all the error-categories used by error messages.
+
+ These are the categories used to filter messages via --filter.
+ """
+ sys.stderr.write(''.join(' %s\n' % cat for cat in _ERROR_CATEGORIES))
+ sys.exit(0)
+
+
+def ParseArguments(args):
+ """Parses the command line arguments.
+
+ This may set the output format and verbosity level as side-effects.
+
+ Args:
+ args: The command line arguments:
+
+ Returns:
+ The list of filenames to lint.
+ """
+ try:
+ (opts, filenames) = getopt.getopt(args, '', ['help', 'output=', 'verbose=',
+ 'counting=',
+ 'filter=',
+ 'root=',
+ 'linelength=',
+ 'extensions='])
+ except getopt.GetoptError:
+ PrintUsage('Invalid arguments.')
+
+ verbosity = _VerboseLevel()
+ output_format = _OutputFormat()
+ filters = ''
+ counting_style = ''
+
+ for (opt, val) in opts:
+ if opt == '--help':
+ PrintUsage(None)
+ elif opt == '--output':
+ if val not in ('emacs', 'vs7', 'eclipse'):
+ PrintUsage('The only allowed output formats are emacs, vs7 and eclipse.')
+ output_format = val
+ elif opt == '--verbose':
+ verbosity = int(val)
+ elif opt == '--filter':
+ filters = val
+ if not filters:
+ PrintCategories()
+ elif opt == '--counting':
+ if val not in ('total', 'toplevel', 'detailed'):
+ PrintUsage('Valid counting options are total, toplevel, and detailed')
+ counting_style = val
+ elif opt == '--root':
+ global _root
+ _root = val
+ elif opt == '--linelength':
+ global _line_length
+ try:
+ _line_length = int(val)
+ except ValueError:
+ PrintUsage('Line length must be digits.')
+ elif opt == '--extensions':
+ global _valid_extensions
+ try:
+ _valid_extensions = set(val.split(','))
+ except ValueError:
+ PrintUsage('Extensions must be comma seperated list.')
+
+ if not filenames:
+ PrintUsage('No files were specified.')
+
+ _SetOutputFormat(output_format)
+ _SetVerboseLevel(verbosity)
+ _SetFilters(filters)
+ _SetCountingStyle(counting_style)
+
+ return filenames
+
+
+def main():
+ filenames = ParseArguments(sys.argv[1:])
+
+ # Change stderr to write with replacement characters so we don't die
+ # if we try to print something containing non-ASCII characters.
+ sys.stderr = codecs.StreamReaderWriter(sys.stderr,
+ codecs.getreader('utf8'),
+ codecs.getwriter('utf8'),
+ 'replace')
+
+ _cpplint_state.ResetErrorCounts()
+ for filename in filenames:
+ ProcessFile(filename, _cpplint_state.verbose_level)
+ _cpplint_state.PrintErrorCounts()
+
+ sys.exit(_cpplint_state.error_count > 0)
+
+
+if __name__ == '__main__':
+ main()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ignition-msgs.git
More information about the debian-science-commits
mailing list