commit 2df0ddb0b81ec4af6ef306919664e508cf72c869
Author: sschulz <sschulz@techfak.uni-bielefeld.de>
Date:   Wed Oct 19 14:11:10 2016 +0200

    moved to github

diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index 89ea7a6..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,216 +0,0 @@
-cmake_minimum_required(VERSION 2.8.3)
-project(humotion)
-
-set(ENV{ROS_LANG_DISABLE} "genjava")
-
-set(ROS_BUILD_TYPE Debug)
-
-################################################################
-# check for ROS support:
-find_package(catkin REQUIRED COMPONENTS
-    roscpp
-    std_msgs
-    sensor_msgs
-    message_generation
-    genmsg
-    dynamic_reconfigure
-)
-
-IF (NOT catkin_FOUND)
-  MESSAGE(FATAL_ERROR "Error: could not find ROS middleware!")
-ENDIF (NOT catkin_FOUND)
-
-INCLUDE(FindPkgConfig)
-
-##libreflexxes
-#IF (libreflexxes_DIR)
-#  MESSAGE("using libreflexxes_DIR as override ('${libreflexxes_DIR}')")
-#  SET(REFLEXXES_PREFIX ${libreflexxes_DIR})
-#  SET(REFLEXXES_LIBRARY "ReflexxesTypeII")
-#ELSE ()
-  PKG_CHECK_MODULES(REFLEXXES REQUIRED libReflexxesTypeII>=1.2.3)
-  IF (NOT REFLEXXES_FOUND)
-    message(FATAL_ERROR "Error: could not find lib libReflexxesTypeII")
-  ENDIF ()
-#ENDIF ()
-
-
-SET(REFLEXXES_LIBRARY_DIRS "${REFLEXXES_PREFIX}/lib")
-SET(REFLEXXES_INCLUDE_DIRS "${REFLEXXES_PREFIX}/include")
-#resolve to absolute library filename
-#or is there an easier way to get the absolute lib filename from pkg config files?!
-find_library(REFLEXXES_LIBRARY NAMES ${REFLEXXES_LIBRARIES} HINTS ${REFLEXXES_LIBRARY_DIRS})
-
-MESSAGE("-- using libReflexxesTypeII version ${REFLEXXES_VERSION} from ${REFLEXXES_INCLUDE_DIRS} and ${REFLEXXES_LIBRARY_DIRS}")
-MESSAGE("-- will link against ${REFLEXXES_LIBRARY}")
-
-set(CMAKE_CXX_FLAGS "-g -Wall")
-add_definitions ("-Wall")
-
-#######################################
-## Declare ROS messages and services ##
-#######################################
-
-add_message_files(
-        FILES
-        gaze.msg
-        position_lcr.msg
-        mouth.msg
-)
-
-## Generate added messages and services with any dependencies listed here
-generate_messages(
-        DEPENDENCIES
-        std_msgs
-        humotion
-)
-
-# add dynamic reconfigure api
-generate_dynamic_reconfigure_options(
-  cfg/humotion.cfg
-)
-
-#
-###################################
-## catkin specific configuration ##
-###################################
-## The catkin_package macro generates cmake config files for your package
-## Declare things to be passed to dependent projects
-## INCLUDE_DIRS: uncomment this if you package contains header files
-## LIBRARIES: libraries you create in this project that dependent projects also need
-## CATKIN_DEPENDS: catkin_packages dependent projects also need
-## DEPENDS: system dependencies of this project that dependent projects also need
-catkin_package(
-    INCLUDE_DIRS include
-    LIBRARIES humotion
-    #CATKIN_DEPENDS message_runtime
-    #DEPENDS system_lib
-)
-
-###########
-## Build ##
-###########
-
-## Specify additional locations of header files
-## Your package locations should be listed before other locations
-include_directories(BEFORE ${Boost_INCLUDE_DIRS} ${REFLEXXES_INCLUDE_DIRS})
-include_directories(BEFORE include)
-
-#make sure to use ros messages from current build
-include_directories(BEFORE ${CATKIN_DEVEL_PREFIX}/include)
-
-#this should be appended:
-include_directories(${catkin_INCLUDE_DIRS})
-
-#link_directories (${Boost_LIBRARY_DIRS} ${REFLEXXES_LIBRARY_DIRS} ${catkin_LIBRARY_DIRS})
-
-## Declare a cpp library
-add_library(${PROJECT_NAME}
-    src/client/client.cpp
-    src/client/middleware.cpp
-    src/client/middleware_ros.cpp
-
-    src/server/server.cpp
-    src/server/config.cpp
-    src/server/middleware.cpp
-    src/server/middleware_ros.cpp
-    src/server/controller.cpp
-    src/server/joint_interface.cpp
-    src/server/motion_generator.cpp
-    src/server/gaze_motion_generator.cpp
-    src/server/reflexxes_motion_generator.cpp
-    src/server/mouth_motion_generator.cpp
-    src/server/eye_motion_generator.cpp
-    src/server/eyelid_motion_generator.cpp
-    src/server/eyebrow_motion_generator.cpp
-    src/server/neck_motion_generator.cpp
-
-    src/mouth_state.cpp
-    src/gaze_state.cpp
-    src/timestamp.cpp
-    src/timestamped_list.cpp
-)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-
-## Add cmake target dependencies of the executable/library
-## as an example, message headers may need to be generated before nodes
-add_dependencies(${PROJECT_NAME} ${catkin_EXPORTED_TARGETS} ${PROJECT_NAME}_gencpp ${PROJECT_NAME}_gencfg)
-
-## Specify libraries to link a library or executable target against
-target_link_libraries(${PROJECT_NAME}
-    ${Boost_LIBRARIES}
-    ${catkin_LIBRARIES}
-    ${REFLEXXES_LIBRARY}
-)
-
-set_property(TARGET ${PROJECT_NAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-#############
-## Install ##
-#############
-
-# all install targets should use catkin DESTINATION variables
-# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
-
-## Mark executable scripts (Python etc.) for installation
-## in contrast to setup.py, you can choose the destination
-# install(PROGRAMS
-#   scripts/my_python_script
-#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-# )
-
-## Mark executables and/or libraries for installation
-install(TARGETS ${PROJECT_NAME}
-    ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-    LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-    RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
-)
-## Mark cpp header files for installation
-install(DIRECTORY include/humotion/
-    DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
-)
-
-#############
-## Testing ##
-#############
-## Add gtest based cpp test target and link libraries
-catkin_add_gtest(${PROJECT_NAME}-test-server test/server.cpp)
-if(TARGET ${PROJECT_NAME}-test-server)
-target_link_libraries(${PROJECT_NAME}-test-server ${PROJECT_NAME})
-endif()
-catkin_add_gtest(${PROJECT_NAME}-test-client test/client.cpp)
-if(TARGET ${PROJECT_NAME}-test-client)
-target_link_libraries(${PROJECT_NAME}-test-client ${PROJECT_NAME})
-endif()
-catkin_add_gtest(${PROJECT_NAME}-test-timestamp test/timestamp.cpp)
-if(TARGET ${PROJECT_NAME}-test-timestamp)
-target_link_libraries(${PROJECT_NAME}-test-timestamp ${PROJECT_NAME})
-endif()
-
-### Add folders to be run by python nosetests
-# catkin_add_nosetests(test)
-
-
-#finally build (some) examples
-#add_subdirectory(./examples)
-
-
-#################
-## style guide ##
-#################
-set(ENABLE_CPPLINT 1)
-include(${CMAKE_CURRENT_SOURCE_DIR}/stylecheck/CpplintWrapper.cmake)
-CPPLINT_RECURSIVE(cpplint_include
-  ${CMAKE_CURRENT_SOURCE_DIR}/include
-  ${CMAKE_CURRENT_SOURCE_DIR}/include
-  ${CMAKE_CURRENT_BINARY_DIR}/include)
-CPPLINT_RECURSIVE(cpplint_src
-  ${CMAKE_CURRENT_SOURCE_DIR}/src
-  ${CMAKE_CURRENT_SOURCE_DIR}/src
-  ${CMAKE_CURRENT_BINARY_DIR}/src)
-add_dependencies(${PROJECT_NAME} cpplint_src cpplint_include)
-
-#workaround for qtcreator ide integration. do not remove!
-file(GLOB_RECURSE NODE_DUMMY_TARGETS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.cfg *.yaml *.xml *.launch)
-add_custom_target(_dummy_target SOURCES ${NODE_DUMMY_TARGETS})
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 65c5ca8..0000000
--- a/COPYING
+++ /dev/null
@@ -1,165 +0,0 @@
-                   GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
-  This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
-  0. Additional Definitions.
-
-  As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
-  "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
-  An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
-  A "Combined Work" is a work produced by combining or linking an
-Application with the Library.  The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
-  The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
-  The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
-  1. Exception to Section 3 of the GNU GPL.
-
-  You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
-  2. Conveying Modified Versions.
-
-  If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
-   a) under this License, provided that you make a good faith effort to
-   ensure that, in the event an Application does not supply the
-   function or data, the facility still operates, and performs
-   whatever part of its purpose remains meaningful, or
-
-   b) under the GNU GPL, with none of the additional permissions of
-   this License applicable to that copy.
-
-  3. Object Code Incorporating Material from Library Header Files.
-
-  The object code form of an Application may incorporate material from
-a header file that is part of the Library.  You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
-   a) Give prominent notice with each copy of the object code that the
-   Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the object code with a copy of the GNU GPL and this license
-   document.
-
-  4. Combined Works.
-
-  You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
-   a) Give prominent notice with each copy of the Combined Work that
-   the Library is used in it and that the Library and its use are
-   covered by this License.
-
-   b) Accompany the Combined Work with a copy of the GNU GPL and this license
-   document.
-
-   c) For a Combined Work that displays copyright notices during
-   execution, include the copyright notice for the Library among
-   these notices, as well as a reference directing the user to the
-   copies of the GNU GPL and this license document.
-
-   d) Do one of the following:
-
-       0) Convey the Minimal Corresponding Source under the terms of this
-       License, and the Corresponding Application Code in a form
-       suitable for, and under terms that permit, the user to
-       recombine or relink the Application with a modified version of
-       the Linked Version to produce a modified Combined Work, in the
-       manner specified by section 6 of the GNU GPL for conveying
-       Corresponding Source.
-
-       1) Use a suitable shared library mechanism for linking with the
-       Library.  A suitable mechanism is one that (a) uses at run time
-       a copy of the Library already present on the user's computer
-       system, and (b) will operate properly with a modified version
-       of the Library that is interface-compatible with the Linked
-       Version.
-
-   e) Provide Installation Information, but only if you would otherwise
-   be required to provide such information under section 6 of the
-   GNU GPL, and only to the extent that such information is
-   necessary to install and execute a modified version of the
-   Combined Work produced by recombining or relinking the
-   Application with a modified version of the Linked Version. (If
-   you use option 4d0, the Installation Information must accompany
-   the Minimal Corresponding Source and Corresponding Application
-   Code. If you use option 4d1, you must provide the Installation
-   Information in the manner specified by section 6 of the GNU GPL
-   for conveying Corresponding Source.)
-
-  5. Combined Libraries.
-
-  You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
-   a) Accompany the combined library with a copy of the same work based
-   on the Library, uncombined with any other library facilities,
-   conveyed under the terms of this License.
-
-   b) Give prominent notice with the combined library that part of it
-   is a work based on the Library, and explaining where to find the
-   accompanying uncombined form of the same work.
-
-  6. Revised Versions of the GNU Lesser General Public License.
-
-  The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
-  Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
-  If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
diff --git a/README.md b/README.md
index 1983f2f..319e52e 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,4 @@
 # [hu]man [motion] low-level robot ontrol library
 
-this is the low level robot control software to allow
-human like motion generation on a humanoid robotic head
-
+this has been moved to github. see
+https://github.com/CentralLabFacilities/humotion
diff --git a/cfg/humotion.cfg b/cfg/humotion.cfg
deleted file mode 100755
index 19e0217..0000000
--- a/cfg/humotion.cfg
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-import re
-PACKAGE = "humotion"
-from dynamic_reconfigure.parameter_generator_catkin import *
-
-def fetch_default(param_name):
-    for line in open("../src/server/config.cpp"):
-        if param_name in line:
-            result = re.findall("=\s*([\d\w.]+);", line)
-            print result
-            if result:
-                return result[0]
-            else:
-                print("ERROR: could not find parameter %s in config.cpp" % (param_name))
-                sys.exit(1)
-
-def add_entry(group, param_name, descr, min, max):
-    default_str = fetch_default(param_name)
-    default_val = float(default_str)
-    if (default_val > max):
-        print("ERROR: default value %f for %s exceeds max value (%f)" % (default_val, param_name, max))
-        sys.exit(1)
-    if (default_val < min):
-        print("ERROR: default value %f for %s is under min value (%f)" % (default_val, param_name, min))
-        sys.exit(1)
-
-    group.add(param_name, double_t, 0, descr, default_val, min, max)
-
-def add_entry_bool(group, param_name, descr):
-    default = fetch_default(param_name)
-
-    default_val = True
-    if (default == "false"):
-        default_val = False
-
-    group.add(param_name, bool_t, 0, descr, default_val)
-
-
-gen = ParameterGenerator()
-
-debug_group = gen.add_group("debug")
-add_entry_bool(debug_group, "publish_internals", "publish debugging data on different topics")
-
-general_group = gen.add_group("thresholds")
-add_entry(general_group, "threshold_velocity_eye_saccade", "velocity threshold for eye saccade detection (in deg/s)", 1.0, 30.0)
-add_entry(general_group, "threshold_angle_neck_saccade", "magnitude of gaze change that triggers neck saccade (in deg)", 1.0, 30.0)
-add_entry(general_group, "threshold_angle_omr_limit", "threshold for a deflection that triggers a correction neck saccade (in percent of OMR)", 0.1, 1.0)
-
-neck_group = gen.add_group("neck")
-add_entry(neck_group, "scale_velocity_neck", "scaling factor for neck velocity (in percent, 1.0 = full human velocities)", 0.1, 1.0)
-add_entry(neck_group, "scale_acceleration_neck", "scaling factor for neck acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
-add_entry(neck_group, "limit_velocity_neck", "limit for neck velocity (in deg/s)", 100.0, 800.0)
-add_entry(neck_group, "limit_acceleration_neck", "limit for neck acceleration (in deg/s^2)", 100.0, 10000.0)
-
-eye_group = gen.add_group("eye")
-add_entry(eye_group, "scale_velocity_eye", "scaling factor for eye velocity (in percent, 1.0 = full human velocities)",  0.1, 1.0)
-add_entry(eye_group, "scale_acceleration_eye", "scaling factor for eye acceleration (in percent, 1.0 = full human acceleration)", 0.1, 1.0)
-add_entry(eye_group, "limit_velocity_eye", "limit for eye velocity (in deg/s)", 100.0, 1000.0)
-add_entry(eye_group, "limit_acceleration_eye", "limit for eye acceleration (in deg/s^2)", 100.0, 80000.0)
-add_entry_bool(eye_group, "use_neck_target_instead_of_position_eye", "use neck target in difference calc instead of real position")
-
-
-eyeblink_group = gen.add_group("eyeblink")
-add_entry(eyeblink_group, "eyeblink_duration", "duration for an eyeblink (in seconds)", 0.01, 1.0)
-add_entry(eyeblink_group, "eyeblink_periodic_distribution_lower", "lower bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0)
-add_entry(eyeblink_group, "eyeblink_periodic_distribution_upper", "upper bound for probalistic eyeblink distribution (in seconds)", 0.1, 100.0)
-add_entry(eyeblink_group, "eyeblink_probability_after_saccade", "probability for an eyeblink after a saccade (in percent)", 0.01, 1.0)
-add_entry(eyeblink_group, "eyeblink_blocked_time", "blocking time for further eyeblinks (in seconds)", 0.1, 100.0)
-
-eyelids_group = gen.add_group("eyelids")
-add_entry_bool(eyelids_group, "eyelids_follow_eyemotion", "should the eyelids follow the eye tilt motion?")
-
-breath_group = gen.add_group("breath")
-add_entry(breath_group, "breath_period", "duration for a full breath periond: inhale, pause and exhale (in seconds)", 1.0, 100.0)
-add_entry(breath_group, "breath_amplitude", "amplitude for breath animation (in deg)", 0.0, 10.0)
-
-exit(gen.generate(PACKAGE, "humotion", "humotion"))
-
diff --git a/examples/demo_korg_slider/CMakeLists.txt b/examples/demo_korg_slider/CMakeLists.txt
deleted file mode 100644
index 14aad42..0000000
--- a/examples/demo_korg_slider/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-SET( PROJECT_NAME demo_korg_slider )
-PROJECT( ${PROJECT_NAME} )
-# set (CMAKE_VERBOSE_MAKEFILE true)
-#profiling
-#set(CMAKE_CXX_FLAGS "-Wall -g -pg")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-
-
-set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /homes/sschulz/src/ros_workspace/install/share/humotion/cmake/)
-# set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /homes/sschulz/src/ros_workspace/install/lib/pkg_config)
-
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
-INCLUDE(FindPkgConfig)
-
-# search for Boost version 1.34
-find_package( Boost 1.40 COMPONENTS thread program_options system filesystem regex )
-link_directories ( ${Boost_LIBRARY_DIRS}  )
-include_directories ( ${Boost_INCLUDE_DIRS} )
-# message(${Boost_LIBRARIES})
-
-
-
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(BINDIR "${PREFIX}/bin")
-SET(INCLUDEDIR "${PREFIX}/include")
-SET(MANDIR "${PREFIX}/man")
-SET(LIBDIR "${PREFIX}/lib")
-SET(DATADIR "${PREFIX}/share/${NAME}")
-
-find_package(humotion 0.0.1)
-IF (humotion_FOUND)
-	message("> using humotion includes from " ${humotion_INCLUDE_DIRS})
-ELSE (humotion_FOUND)
-	message(FATAL_ERROR "> error: can not find libhumotion")
-endif (humotion_FOUND)
-
-SET(SRC_FILES
-	korg_input.cpp
-)
-
-LINK_DIRECTORIES(${LIBDIR} ${humotion_LIBRARY_DIRS} )
-INCLUDE_DIRECTORIES( ${humotion_INCLUDE_DIRS} )
-
-ADD_EXECUTABLE( ${PROJECT_NAME} main.cpp ${SRC_FILES})
-TARGET_LINK_LIBRARIES(  ${PROJECT_NAME} ${Boost_LIBRARIES} ${Boost_LIBS}  ${humotion_LIBRARIES} portmidi porttime) 
-
-
-#FILE(GLOB conf_files "${CMAKE_CURRENT_SOURCE_DIR}/*.mcfg")
-#install (FILES ${conf_files} DESTINATION etc/xsc2)
-
-install (TARGETS ${PROJECT_NAME} DESTINATION bin )
-set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
-set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)
-
diff --git a/examples/demo_korg_slider/korg_input.cpp b/examples/demo_korg_slider/korg_input.cpp
deleted file mode 100644
index 94db141..0000000
--- a/examples/demo_korg_slider/korg_input.cpp
+++ /dev/null
@@ -1,282 +0,0 @@
-#include "korg_input.h"
-#include <assert.h>
-#include <stdlib.h>
-
-#define DEBUG_SHOW_MIDI_DEVICES 1
-#define DEBUG_INCOMING_DATA 1
-
-//defines for portmidi
-#define INPUT_BUFFER_SIZE 100
-#define OUTPUT_BUFFER_SIZE 0
-#define DRIVER_INFO NULL
-#define TIME_PROC ((int32_t (*)(void *)) Pt_Time)
-#define TIME_INFO NULL
-#define TIME_START Pt_Start(1, 0, 0) /* timer started w/millisecond accuracy */
-
-//! constructor
-KorgInput::KorgInput(){
-	midi = NULL;
-	//first try old device:
-	device_open = open_device();
-	for(int i=0; i<256; i++){
-		data[i] = 64;
-		data_new[i] = false;
-	}
-}
-
-//! destructor
-KorgInput::~KorgInput(){
-	if (device_open){
-		//close
-		Pm_Close(midi);
-	}
-}
-
-//! fetch device id
-//! \param char array with device name
-//! \return id of device, or -1 if not found
-int KorgInput::fetch_device_id(const char *name, bool output=false){
-	//fetch device id:
-	int midi_device_id = -1;
-	
-	for (int i = 0; i < Pm_CountDevices(); i++) {
-		const PmDeviceInfo *info = Pm_GetDeviceInfo(i);
-		if (DEBUG_SHOW_MIDI_DEVICES) printf("%d: %s, %s\n", i, info->interf, info->name);
-		
-		if (output){
-			if (info->output) {
-				if (strcmp(info->name, name) == 0){
-					midi_device_id = i;
-				}
-			}
-		}else{
-			if (info->input) {
-				if (strcmp(info->name, name) == 0){
-					midi_device_id = i;
-				}
-			}
-		}
-	}
-	
-	return midi_device_id;
-}
-
-//! open device
-//! \return true if device is found, false otherwise
-bool KorgInput::open_device(){
-	PmEvent buffer[1];
-	
-	//standard is type1:
-	device_type = NANO_KONTROL;
-
-	int midi_device_id = fetch_device_id("nanoKONTROL MIDI 1");
-	int midi_device_id_out = fetch_device_id("nanoKONTROL MIDI 1", true);
-	if (midi_device_id == -1){
-		device_type = NANO_KONTROL2;
-		midi_device_id = fetch_device_id("nanoKONTROL2 MIDI 1");
-		midi_device_id_out = fetch_device_id("nanoKONTROL2 MIDI 1", true);
-	}
-	
-	
-	if (midi_device_id == -1){
-		printf("> can not open device (input). Error: device not found\n");
-		return false;
-	}
-	
-	if (midi_device_id_out == -1){
-		printf("> can not open output device\n");
-		return false;
-	}
-	
-	//success, found device
-	printf("> found korg controller with id %d (%s)\n",midi_device_id,device_type==NANO_KONTROL?"nanoKONTROL":"nanoKONTROL2");
-	printf("> if setting leds on/off does not work, make sure to set led mode to external with the korg windows software\n");
-	
-	//open input
-	Pm_OpenInput(&midi, midi_device_id, DRIVER_INFO, INPUT_BUFFER_SIZE, TIME_PROC, TIME_INFO);
-	
-	//open output
-	Pm_OpenOutput(&midi_out, midi_device_id_out, DRIVER_INFO, OUTPUT_BUFFER_SIZE, NULL, NULL, 0); 
- 
-
-
-
-	//set filter
-	Pm_SetFilter(midi, PM_FILT_ACTIVE | PM_FILT_CLOCK | PM_FILT_SYSEX);
-	Pm_SetFilter(midi_out, PM_FILT_ACTIVE | PM_FILT_CLOCK | PM_FILT_SYSEX);
-	
-	//clear buffer with unfiltered messages
-	//printf("> clearing buffer\n");
-	//while (Pm_Poll(midi)) {
-		//Pm_Read(midi, buffer, 1);
-	//}
-	printf("> init done \n");
-	
-	//disable all leds:
-// 	for(unsigned char id = 0; id<127; id++){
-// 		Pm_WriteShort(midi_out, TIME_PROC(TIME_INFO), Pm_Message(0xB0, id, 0));
-// 		usleep(10*1000);
-// 	}
-	
-	//fancy animation:
-	for(unsigned char id = 0; id<80+4; id++){
-		if (id<127) Pm_WriteShort(midi_out, TIME_PROC(TIME_INFO), Pm_Message(0xB0, id, 127));
-		if (id>4)   Pm_WriteShort(midi_out, TIME_PROC(TIME_INFO), Pm_Message(0xB0, id-4, 0));
-		usleep(25*1000);
-	}
-	
-// 	for(unsigned char id = 0; id<127; id++){
-// 		Pm_WriteShort(midi_out, TIME_PROC(TIME_INFO), Pm_Message(0xB0, id, 0));
-// 	}
-// 	
-	return true;
-}
-
-//! device opened sucessfully
-//! \return true if device is open and working
-bool KorgInput::device_available(){
-	return device_open;
-}
-
-
-//! fetch new data
-//! \return int count how many datasets were fetched
-int KorgInput::fetch_data(){
-	int new_data_fetched = 0;
-	//poll all data:
-	while(Pm_Poll(midi)){
-		//new data fetch sucessfull? build up dataset:
-		if (fetch_single()){
-			new_data_fetched++;
-		}
-	}
-
-	if (new_data_fetched > 0){
-		printf("> fetched %d datasets\n",new_data_fetched);
-	}
-	
-	return new_data_fetched;
-}
-
-bool KorgInput::fetch_single(){
-	PmEvent buffer[1];
-	
-	//poll data:
-	PmError status = Pm_Poll(midi);
-	
-	if (status) {
-		int length = Pm_Read(midi,buffer, 1);
-		if (length > 0) {
-			//store incoming data:
-			if (Pm_MessageStatus(buffer[0].message) == 0xb0){
-				unsigned int idx = Pm_MessageData1(buffer[0].message) & 0xFF;
-				data[idx] = Pm_MessageData2(buffer[0].message) & 0xFF;
-				data_new[idx] = true;
-			}
-			
-			if (DEBUG_INCOMING_DATA){
-				printf("> incoming message: time %ld, %2lx %2lx %2lx\n",
-					(long) buffer[0].timestamp,
-					(long) Pm_MessageStatus(buffer[0].message),
-					(long) Pm_MessageData1(buffer[0].message),
-					(long) Pm_MessageData2(buffer[0].message));
-			}
-			
-			return true;
-		} else {
-			printf("> error, message len <= 0?!\n");
-			return false;
-		}
-	}
-	
-}
-
-//! access buffered data
-//! \param index of data channel to fetch
-//! \return unsigned char value for data channel <index> (0..127)
-unsigned char KorgInput::get_buffered_raw_value(unsigned char index){
-	return data[index];
-}
-
-//! fetch a value + new flag & clear
-//! \param idx index
-//! \param uchar ptr to data
-//! \return true if new data available
-bool KorgInput::get_and_reset(unsigned char idx, unsigned char *val){
-	//fetch state & reset:
-	bool new_data = data_new[idx];
-	data_new[idx] = false;
-	
-	//override data only if new val arrived:
-	if (new_data){
-		*val = get_buffered_raw_value(idx);
-	}	
-	
-	return new_data;
-}
-
-//! access slider 
-//! \param slider index 0..8
-//! \param uchar ptr to value
-//! \return bool if new value arrived
-bool KorgInput::get_slider(unsigned char index, unsigned char *val){
-	assert(index <= 8);
-	if (device_type == NANO_KONTROL){
-		switch(index){
-			default: 
-				
-				return get_and_reset(0x02 + index, val);
-			case(5):
-			case(6):
-				return get_and_reset(0x02 + index + 1, val);
-			case(7):
-			case(8):
-				return get_and_reset(0x02 + index + 3, val);
-		}
-	}else{
-		//NANO_KONTROL2
-		return get_and_reset(index, val);
-	}
-}
-
-//! access button 
-//! \param button index 
-//! \param uchar ptr to value
-//! \return bool if new value arrived
-bool KorgInput::get_button(unsigned char index, unsigned char *val){
-	assert(index <= 127);
-	
-	if (device_type == NANO_KONTROL){
-		printf("> NANO_KONTROL NOT SUPPORTED, different layout of buttons! exiting\n");
-		exit(1);
-		/*if (row == 0){
-			return get_and_reset(0x17+index, val);
-		}else if (row == 1){
-			printf("> NANO_KONTROL does not have center row. ignored\n");
-			return false;
-		}else{
-			return get_and_reset(0x21+index, val);
-		}*/
-	}else{
-		//NANO_KONTROL2 - fetch button value
-		return get_and_reset(index, val);
-	}
-}
-
-//! access pot 
-//! \param pot index 0..8
-//! \param unsigned char ptr to value (0..127)
-//! \param bool true if new data available
-bool KorgInput::get_pot(unsigned char index, unsigned char *val){
-	assert(index <= 8);
-	if (device_type == NANO_KONTROL){
-		return get_and_reset(0x0E + index, val);
-	}else{
-		//NANO_KONTROL2
-		return get_and_reset(0x10 + index, val);
-	}
-}
-
-void  KorgInput::set_led(unsigned char index, bool status){
-	Pm_WriteShort(midi_out, TIME_PROC(TIME_INFO), Pm_Message(0xB0, index, status?127:0));
-}
\ No newline at end of file
diff --git a/examples/demo_korg_slider/korg_input.h b/examples/demo_korg_slider/korg_input.h
deleted file mode 100644
index 96f7064..0000000
--- a/examples/demo_korg_slider/korg_input.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#pragma once
-
-#include <portmidi.h>
-#include <porttime.h>
-#include <cstdio>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-class KorgInput{
-public:
-	KorgInput();
-	~KorgInput();
-	
-	bool  get_slider(unsigned char index, unsigned char *val);
-	bool  get_pot(unsigned char index, unsigned char *val);
-	bool  get_button(unsigned char index, unsigned char *val);
-	void  set_led(unsigned char index, bool status);
-	
-	bool get_and_reset(unsigned char idx, unsigned char *val);
-	void set_pot(unsigned char index, int value);
-	
-	int  fetch_data();
-	bool device_available();
-	
-	
-private:
-	int resolve_id();
-	
-	unsigned char data[256];
-	bool data_new[256];
-	int device_type;
-	enum DEVICE_TYPE {NANO_KONTROL, NANO_KONTROL2};
-	bool open_device();
-	bool fetch_single();
-	int fetch_device_id(const char*, bool);
-	unsigned char get_buffered_raw_value(unsigned char index);
-	
-	bool device_open;
-	PmStream * midi;
-	PmStream * midi_out;
-};
\ No newline at end of file
diff --git a/examples/demo_korg_slider/main.cpp b/examples/demo_korg_slider/main.cpp
deleted file mode 100644
index b756860..0000000
--- a/examples/demo_korg_slider/main.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-#include <cstdio>
-#include <stdio.h>
-#include <string.h>
-
-
-#include "korg_input.h"
-#include "humotion/client/client.h"
-#include "boost/date_time/posix_time/posix_time.hpp"
-#include <boost/thread/thread_time.hpp>
-#include <boost/thread/thread.hpp>
-
-using namespace boost;
-humotion::GazeState last_awake_state;
-bool awake_state;
-
-enum JOINT_SLIDER_ID{
-	MOUTH_POSITION_LEFT=0,
-	MOUTH_POSITION_CENTER,
-	MOUTH_POSITION_RIGHT,
-	PAN,
-	TILT
-	//NECK_ROLL,
-};
-
-enum JOINT_POTI_ID{
-	MOUTH_OPENING_LEFT=0,
-	MOUTH_OPENING_CENTER,
-	MOUTH_OPENING_RIGHT,
-	EYE_VERGENCE,
-	EYELID_OPENING_UPPER,
-	EYELID_OPENING_LOWER,
-	EYEBROW_RIGHT,
-	EYEBROW_LEFT
-};
-
-
-
-float to_float(unsigned char val){
-	return ((float)(val))/127.0;
-}
-
-void slidervalues_to_mouthstate(KorgInput *input, humotion::MouthState *result){
-	unsigned char tmp;
-	
-	//do not handle updates when not awake
-	if (!awake_state){
-		return;
-	}
-	
-	if (input->get_slider(MOUTH_POSITION_LEFT,  &tmp))result->position_left   = 0.0 + 40.0 * (1.0-to_float(tmp));
-	if (input->get_slider(MOUTH_POSITION_CENTER,  &tmp))result->position_center = 0.0 + 40.0 * (1.0-to_float(tmp));
-	if (input->get_slider(MOUTH_POSITION_RIGHT,  &tmp))result->position_right  = 0.0 + 40.0 * (1.0-to_float(tmp));
-
-	if (input->get_pot(MOUTH_OPENING_LEFT,  &tmp)) result->opening_left   = 40.0 * to_float(tmp);
-	if (input->get_pot(MOUTH_OPENING_CENTER,  &tmp)) result->opening_center= 40.0 * to_float(tmp);
-	if (input->get_pot(MOUTH_OPENING_RIGHT,  &tmp)) result->opening_right  = 40.0 * to_float(tmp);
-
-	//printf("OOO %4.2f %4.2f\n",result.opening_center, result.position_center);
-}
-
-void wake_up(humotion::GazeState *result){
-	if (awake_state){
-		//already awake, return
-		return;
-	}
-	
-	//restore last awake state
-	*result = last_awake_state;
-	//force reopening
-	result->eyeblink_request_left  = 10;
-	result->eyeblink_request_right = 10;
-	
-	awake_state = true;
-}
-
-void sleep(humotion::GazeState *result){
-	if (!awake_state){
-		//already sleeping, return
-		return;
-	}
-	
-	//store last awake state
-	last_awake_state = *result;
-	awake_state = false;
-	
-	//override values:
-	result->pan  = 0.0;
-	result->tilt = -20.0;
-	result->roll = 0.0;
-	
-	//result->eyelid_opening = 0.0;
-	result->eyebrow_left  = 0.0;
-	result->eyebrow_right = 0.0;
-	
-	result->eyeblink_request_left = -1;
-	result->eyeblink_request_right = -1;
-	
-	
-}
-
-void slidervalues_to_gazestate(KorgInput *input, humotion::GazeState *result){
-	unsigned char tmp;
-	
-	//PLAY
-	if (input->get_button(0x29, &tmp)){
-		if (tmp != 0){
-			wake_up(result);
-		}
-	}
-	
-	//STOP
-	if (input->get_button(0x2A, &tmp)){
-		if (tmp != 0){
-			sleep(result);
-		}
-	}
-	
-	//do not handle updates when not awake
-	if (!awake_state){
-		return;
-	}
-	
-	if (input->get_slider(PAN,  &tmp)) result->pan  = -50.0 + 100.0 * to_float(tmp);
-	if (input->get_slider(TILT, &tmp)) result->tilt = -40.0 + 80.0 * to_float(tmp);
-	result->roll = 0.0;
-	
-	if (input->get_pot(EYELID_OPENING_UPPER, &tmp)) result->eyelid_opening_upper = 0.0 + 120.0*to_float(tmp);
-	if (input->get_pot(EYELID_OPENING_LOWER, &tmp)) result->eyelid_opening_lower = 0.0 + 120.0*to_float(tmp);
-
-	
-	if (input->get_pot(EYEBROW_LEFT,  &tmp)) result->eyebrow_left  = 60.0 - 120.0*to_float(tmp);
-	if (input->get_pot(EYEBROW_RIGHT,  &tmp)) result->eyebrow_right = 60.0 - 120.0*to_float(tmp);
-	
-	if (input->get_pot(EYE_VERGENCE,  &tmp)) result->vergence = -20.0 * to_float(tmp);
-	
-	
-	//check for blink requests: 
-	if (input->get_button(0x24, &tmp)){
-		if (tmp != 0){
-			//blink left
-			result->eyeblink_request_left = 300;
-		}
-	}
-	if (input->get_button(0x44, &tmp)){
-		if (tmp != 0){
-			result->eyeblink_request_right = 300;
-		}
-	}
-	if (input->get_button(0x34, &tmp)){
-		if (tmp != 0){
-			//blink both
-			result->eyeblink_request_right = 150;
-			result->eyeblink_request_left  = 150;
-		}
-	}
-	
-	//printf("PTR = %3.1f %3.1f %3.1f\n",result->pan,result->tilt,result->roll);
-}
-
-int main(int argc, char **argv){
-	humotion::MouthState mouth_state;
-	humotion::GazeState gaze_state;
-	awake_state = true;
-	
-	if (argc != 2){
-		printf("> ERROR: invalid parameter count.\n\nusage: %s <scope>\n       (e.g. %s /flobi)\n\n",argv[0],argv[0]);
-		exit(EXIT_FAILURE);
-	}
-
-	printf("> starting korg kontrol demo. please make sure the korg device is connected via usb\n");
-	
-	KorgInput *kinput = new KorgInput();
-	
-	if (!kinput->device_available()){
-		printf("> no korg kontrol device found on usb bus... exiting\n");
-		return 0;
-	}
-	
-	//set led status for blink requests:
-	kinput->set_led(0x24, true);
-	kinput->set_led(0x34, true);
-	kinput->set_led(0x44, true);
-	
-	//set led for stop/play
-	kinput->set_led(0x29, true);
-	kinput->set_led(0x2A, true);
-	
-	
-	//human motion connection:
-	humotion::client::Client *client = new humotion::client::Client(argv[1], "ROS");
-	
-	//send values to human motion server
-	float loop_delay = 1000.0 / 50.0; //run with 50Hz
-	
-	boost::system_time timeout = get_system_time() + posix_time::milliseconds(loop_delay);
-	
-	while(client->ok()){
-		//allow middleware to process data
-		client->tick();
-		
-		//clear previous eyeblinks
-		gaze_state.eyeblink_request_left  = 0;
-		gaze_state.eyeblink_request_right = 0;
-	
-		//handle slider data
-		if (kinput->fetch_data() > 0){
-			//debug
-			mouth_state.dump();
-			gaze_state.dump();
-			printf("\n");
-
-			//transfer values to robot:
-			slidervalues_to_mouthstate(kinput, &mouth_state);
-			slidervalues_to_gazestate(kinput, &gaze_state);
-		} 
-		
-		//printf("BLINK: %d %d\n",gaze_state.eyeblink_request_left, gaze_state.eyeblink_request_right);
-		
-		//periodically send mouth & gaze target
-		client->update_mouth_target(mouth_state);
-		client->update_gaze_target(gaze_state);
-		client->send_all();
-		
-		thread::sleep(timeout);
-		timeout = get_system_time() + posix_time::milliseconds(loop_delay);
-
-	}
-	
-}
diff --git a/examples/meka/CMakeLists.txt b/examples/meka/CMakeLists.txt
deleted file mode 100644
index c078734..0000000
--- a/examples/meka/CMakeLists.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-PROJECT(meka_humotion_server)
-cmake_minimum_required(VERSION 2.8)
-SET(MAIN ${PROJECT_NAME})
-
-set(ENV{ROS_LANG_DISABLE} "genjava")
-set(ROS_BUILD_TYPE Debug)
-
-################################################################
-# check for ROS support:
-find_package(catkin REQUIRED COMPONENTS roscpp std_msgs sensor_msgs message_generation genmsg)
-IF (catkin_FOUND)
-    set(ROS_FOUND 1)
-    message(STATUS "ROS Support is ON")
-    add_definitions(-DROS_SUPPORT=1)
-ENDIF (catkin_FOUND)
-
-IF (NOT catkin_FOUND)
-  message(FATAL_ERROR "Error: could not find ROS!")
-ENDIF ()
-
-FIND_PACKAGE(Boost REQUIRED COMPONENTS system thread)
-FIND_PACKAGE(humotion REQUIRED)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-#add_message_files(
-#    FILES
-#)
-
-#generate_messages(
-#    DEPENDENCIES
-#    std_msgs
-#)
-
-#hack to allow sub dir calls work
-
-catkin_package(
-    INCLUDE_DIRS include
-    LIBRARIES humotion
-    #CATKIN_DEPENDS message_runtime
-    #DEPENDS system_lib
-)
-
-include_directories( ${catkin_INCLUDE_DIRS})
-
-# add include directories
-INCLUDE_DIRECTORIES(${YARP_INCLUDE_DIRS} ${ICUB_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} include/)
-link_directories(${Boost_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS})
-
-# add required linker flags
-
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ICUB_LINK_FLAGS}")
-file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h)
-
-#add_dependencies(${MAIN} ${catkin_EXPORTED_TARGETS})
-ADD_EXECUTABLE(${MAIN} src/main.cpp src/mekajointinterface.cpp ${DUMMY_HEADER_LIST})
-
-TARGET_LINK_LIBRARIES(${MAIN} ${Boost_LIBRARIES} ${catkin_LIBRARIES} ${humotion_LIBRARIES})
-set_property(TARGET ${MAIN} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-
-#INSTALL(TARGETS ${MAIN} DESTINATION bin)
-install(TARGETS ${MAIN}
-    ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-    LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
-    RUNTIME DESTINATION bin 
-)
-
diff --git a/examples/meka/include/mekajointinterface.h b/examples/meka/include/mekajointinterface.h
deleted file mode 100644
index 61767cf..0000000
--- a/examples/meka/include/mekajointinterface.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#pragma once
-#include <humotion/server/joint_interface.h>
-#include <humotion/server/server.h>
-#include <boost/bimap.hpp>
-
-#include "ros/ros.h"
-#include "sensor_msgs/JointState.h"
-#include "trajectory_msgs/JointTrajectory.h"
-
-#include <m3meka_msgs/M3ControlStates.h>
-
-class MekaJointInterface : public humotion::server::JointInterface{
-public:
-    MekaJointInterface(std::string _input_scope, std::string control_scope, std::string _output_scope);
-    ~MekaJointInterface();
-
-    //void fetch_position(Device *dev, double timestamp);
-    //void fetch_speed(Device *dev, double timestamp);
-    //void fetch_position(int id, double value, double timestamp);
-    //void fetch_speed(int id, double value, double timestamp);
-    void run();
-
-    static const int MAIN_LOOP_FREQUENCY = 50;
-
-protected:
-    void disable_joint(int e);
-    void publish_target(int e, float position, float velocity);
-    void enable_joint(int e);
-    void execute_motion();
-
-private:
-    void incoming_controlstate(const m3meka_msgs::M3ControlStates &control_state);
-    void incoming_jointstates(const sensor_msgs::JointState & msg);
-    void store_dummy_data(int id, humotion::Timestamp timestamp);
-    void store_min_max(int id, float min, float max);
-    ros::Subscriber joint_state_subscriber;
-    ros::Subscriber control_state_subscriber;
-    ros::Publisher target_publisher;
-
-    void set_eyelid_angle(double angle);
-    void set_eyebrow_angle(int id);
-    void set_mouth();
-
-    //iCubDataReceiver *icub_data_receiver;
-    void init_joints();
-    double lid_angle;
-    int lid_opening_previous;
-    int previous_mouth_state;
-
-    std::string input_scope;
-    std::string control_scope;
-    std::string output_scope;
-
-    float last_pos_eye_vergence;
-    float last_pos_eye_pan;
-    float last_vel_eye_vergence;
-    float last_vel_eye_pan;
-
-    bool controller_enabled;
-
-    void store_joint(int id, float value);
-    void set_target_in_positionmode(int id, double value);
-    void set_target_in_velocitymode(int id, double value);
-
-
-    int convert_enum_to_motorid(int e);
-    int convert_motorid_to_enum(int id);
-
-
-    typedef boost::bimap<int, int > enum_id_bimap_t;
-    typedef enum_id_bimap_t::value_type enum_id_bimap_entry_t;
-    enum_id_bimap_t enum_id_bimap;
-};
diff --git a/examples/meka/package.xml b/examples/meka/package.xml
deleted file mode 100644
index 0d361fe..0000000
--- a/examples/meka/package.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<package>
-  <name>meka_humotion_server</name>
-  <version>0.0.1</version>
-  <description>humotion server for the mekabot</description>
-
-  <!-- One maintainer tag required, multiple allowed, one person per tag --> 
-  <maintainer email="sschulz@todo.todo">Simon Schulz</maintainer>
-
-
-  <!-- One license tag required, multiple allowed, one license per tag -->
-  <!-- Commonly used license strings: -->
-  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
-  <license>TODO</license>
-
-
-  <!-- Url tags are optional, but mutiple are allowed, one per tag -->
-  <!-- Optional attribute type can be: website, bugtracker, or repository -->
-  <!-- Example: -->
-  <url type="website">https://projects.cit-ec.uni-bielefeld.de/git/flobidev.core.git</url> -->
-
-
-  <!-- Author tags are optional, mutiple are allowed, one per tag -->
-  <!-- Authors do not have to be maintianers, but could be -->
-  <!-- Example: -->
-  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->
-
-
-  <!-- The *_depend tags are used to specify dependencies -->
-  <!-- Dependencies can be catkin packages or system dependencies -->
-  <!-- Examples: -->
-  <!-- Use build_depend for packages you need at compile time: -->
-  <!-- Use buildtool_depend for build tool packages: -->
-  <!--   <buildtool_depend>catkin</buildtool_depend> -->
-  <!-- Use run_depend for packages you need at runtime: -->
-  <!-- <run_depend>message_runtime</run_depend> -->
-  <!-- Use test_depend for packages you need only for testing: -->
-  <!--   <test_depend>gtest</test_depend> -->
-  <buildtool_depend>catkin</buildtool_depend>
-  <build_depend>roscpp</build_depend>
-  <build_depend>std_msgs</build_depend>
-  <!-- <run_depend>roscpp</run_depend> -->
-  <!-- <run_depend>std_msgs</run_depend> -->
-
-  <!--<build_depend>actionlib</build_depend>
-  <build_depend>actionlib_msgs</build_depend>
-  <run_depend>actionlib</run_depend> -->
-  <!-- <run_depend>actionlib_msgs</run_depend> -->
-
-  <!-- The export tag contains other, unspecified, tags -->
-  <export>
-    <!-- You can specify that this package is a metapackage here: -->
-    <!-- <metapackage/> -->
-
-    <!-- Other tools can request additional information be placed here -->
-
-  </export>
-</package>
diff --git a/examples/meka/src/main.cpp b/examples/meka/src/main.cpp
deleted file mode 100644
index a75618c..0000000
--- a/examples/meka/src/main.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <stdio.h>
-#include <humotion/server/server.h>
-#include <string>
-#include <iostream>
-//#include "meka_data_receiver.h"
-#include "mekajointinterface.h"
-
-using namespace std;
-
-int main(int argc, char *argv[]){
-    /*Property params;
-    params.fromCommand(argc, argv);
-
-    if (!params.check("robot")){
-        fprintf(stderr, "Please specify the name of the robot\n");
-        fprintf(stderr, "--robot name (e.g. icub or icubSim)\n");
-        return -1;
-    }
-
-    string robotName=params.find("robot").asString().c_str();
-    string scope="/"+robotName;
-
-*/
-
-    if (argc != 5){
-        printf("> ERROR: invalid number of parameters passed to server!\n\n");
-        printf("usage   : %s <humotion base topic> <jointstates topic> <controlstates topic> <control output topic>\n\n",argv[0]);
-        printf("example : %s /meka /joint_states  /meka_roscontrol_state_manager/state /meka_roscontrol/head_position_trajectory_controller/command)\n\n",argv[0]);
-        exit(EXIT_FAILURE);
-    }
-
-    //create humotion interface
-    string humotion_scope      = argv[1];
-    string jointstates_scope   = argv[2];
-    string controlstates_scope = argv[3];
-    string control_scope       = argv[4];
-
-
-    MekaJointInterface *jointinterface = new MekaJointInterface(jointstates_scope, controlstates_scope, control_scope);
-    humotion::server::Server *humotion_server = new humotion::server::Server(humotion_scope, "ROS", jointinterface);
-
-    //finally run it
-    jointinterface->run();
-
-    while(humotion_server->ok()){
-        usleep(100000);
-    }
-
-    printf("> ros connection died, will exit now\n");
-
-    return 0;
-}
diff --git a/examples/meka/src/mekajointinterface.cpp b/examples/meka/src/mekajointinterface.cpp
deleted file mode 100644
index 6d9aeb5..0000000
--- a/examples/meka/src/mekajointinterface.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-#include "mekajointinterface.h"
-
-using std::cout;
-using std::cerr;
-
-using humotion::Timestamp;
-
-//WARNING: DO NOT CHANGE THIS; VELOCITYMODE IS NOT YET IMPLEMENTED
-#define POSITION_CONTROL 1
-
-void MekaJointInterface::incoming_controlstate(const m3meka_msgs::M3ControlStates &control_state){
-    //incoming controller status
-    for (unsigned int i = 0; i<control_state.group_name.size(); i++){
-        if (control_state.group_name[i] == "head"){
-            //enable/disable based on controller status
-            if (control_state.state[i] == m3meka_msgs::M3ControlStates::START){
-                //controller up and running
-                if (!controller_enabled){
-                    printf("> incoming control state (%d), enabling jointstate output\n",control_state.state[i]);
-                    controller_enabled = true;
-                }
-            }else{
-                //controller in estop/stopped etc
-                if (controller_enabled){
-                    printf("> incoming control state (%d), DISABLING jointstate output\n",control_state.state[i]);
-                    controller_enabled = false;
-                }
-            }
-        }
-    }
-}
-
-void MekaJointInterface::incoming_jointstates(const sensor_msgs::JointState & msg){
-    //fetch current timestamp
-    Timestamp timestamp = Timestamp(msg.header.stamp.toSec());
-
-    //iterate through incoming joints and filter out joints we need:
-    for(int i=0; i<msg.name.size(); i++){
-
-        std::string name = msg.name[i];
-        //printf("incoming data for joint '%s'\n", name.c_str());
-
-        int id = -1;
-        if (name == "head_j1"){
-            id = ID_NECK_PAN;
-        }else if(name == "head_j0"){
-            id = ID_NECK_TILT;
-        }
-
-        //store data:
-        if (id != -1){
-            //printf("> storing joint data for joint id %d\n", id);
-            if (i >= msg.position.size()){
-                printf("> joint state msg is missing position data for joint '%s'...\n", name.c_str());
-                return;
-            }
-            if (i >= msg.velocity.size()){
-                //printf("> joint state msg is missing velocity data for joint '%s'...\n", name.c_str());
-                //exit(EXIT_FAILURE);
-                return;
-            }
-            //ok, safe to access data
-            if (id == ID_NECK_PAN){
-                //joint is inverted
-                JointInterface::store_incoming_position(id, -180.0 / M_PI * msg.position[i], timestamp);
-                JointInterface::store_incoming_velocity(id, -180.0 / M_PI * msg.velocity[i], timestamp);
-            }else if (id == ID_NECK_TILT){
-                JointInterface::store_incoming_position(id, 180.0 / M_PI * msg.position[i], timestamp);
-                JointInterface::store_incoming_velocity(id, 180.0 / M_PI * msg.velocity[i], timestamp);
-            }
-        }
-    }
-
-    //dummy data uses current time
-    timestamp = Timestamp::now();
-
-    //store dummy positions for joints we do not know about:
-    store_dummy_data(ID_LIP_LEFT_UPPER, timestamp);
-    store_dummy_data(ID_LIP_LEFT_LOWER, timestamp);
-    store_dummy_data(ID_LIP_CENTER_UPPER, timestamp);
-    store_dummy_data(ID_LIP_CENTER_LOWER, timestamp);
-    store_dummy_data(ID_LIP_RIGHT_UPPER, timestamp);
-    store_dummy_data(ID_LIP_RIGHT_LOWER, timestamp);
-
-    store_dummy_data(ID_NECK_ROLL, timestamp);
-    store_dummy_data(ID_EYES_BOTH_UD, timestamp);
-    store_dummy_data(ID_EYES_LEFT_LR, timestamp);
-    store_dummy_data(ID_EYES_RIGHT_LR, timestamp);
-    store_dummy_data(ID_EYES_LEFT_LID_LOWER, timestamp);
-    store_dummy_data(ID_EYES_LEFT_LID_UPPER, timestamp);
-    store_dummy_data(ID_EYES_LEFT_BROW, timestamp);
-    store_dummy_data(ID_EYES_RIGHT_LID_LOWER, timestamp);
-    store_dummy_data(ID_EYES_RIGHT_LID_UPPER, timestamp);
-    store_dummy_data(ID_EYES_RIGHT_BROW, timestamp);
-
-}
-
-void MekaJointInterface::store_dummy_data(int id, Timestamp timestamp){
-    JointInterface::store_incoming_position(id, 0.0, timestamp);
-    JointInterface::store_incoming_velocity(id, 0.0, timestamp);
-}
-
-//! constructor
-MekaJointInterface::MekaJointInterface(std::string _input_scope, std::string control_scope, std::string _output_scope) : humotion::server::JointInterface(){
-    input_scope = _input_scope;
-    output_scope = _output_scope;
-
-    controller_enabled = false;
-
-    //subscribe to meka joint states
-    int argc = 0;
-    ros::init(argc, (char**)NULL, "meka_humotion");
-    ros::NodeHandle n;
-
-    printf("> listening on jointstates on '%s'\n",input_scope.c_str());
-    joint_state_subscriber = n.subscribe(input_scope, 150, &MekaJointInterface::incoming_jointstates, this);
-
-    printf("> listening on controlstates on '%s'\n",control_scope.c_str());
-    control_state_subscriber = n.subscribe(control_scope, 150, &MekaJointInterface::incoming_controlstate, this);
-
-    printf("> sending targets on '%s'\n", output_scope.c_str());
-    target_publisher = n.advertise<trajectory_msgs::JointTrajectory>(output_scope, 100);
-
-    //tell humotion about min/max joint values:
-    init_joints();
-}
-
-//! destructor
-MekaJointInterface::~MekaJointInterface(){
-}
-
-
-
-void MekaJointInterface::run(){
-   ros::spin();
-}
-
-//! set the target position of a joint
-//! \param enum id of joint
-//! \param float value
-void MekaJointInterface::publish_target(int e, float position, float velocity){
-   //we do this in execute motion for all joints at once...
-}
-
-
-//! actually execute the scheduled motion commands
-void MekaJointInterface::execute_motion(){
-    if (controller_enabled){
-        //build msg
-        trajectory_msgs::JointTrajectory msg;
-        msg.joint_names.push_back("head_j0");
-        msg.joint_names.push_back("head_j1");
-
-        trajectory_msgs::JointTrajectoryPoint p;
-        p.positions.push_back(get_target_position(ID_NECK_TILT) * M_PI / 180.0);
-        //pan joint is inverted!
-        p.positions.push_back(-get_target_position(ID_NECK_PAN) * M_PI / 180.0);
-        //printf("targets pan=%4.1f tilt=%4.1f (eye p %4.1f t %4.2f)\n",joint_target[ID_NECK_TILT],joint_target[ID_NECK_PAN],joint_target[ID_EYES_LEFT_LR],joint_target[ID_EYES_BOTH_UD]);
-
-        p.time_from_start = ros::Duration(1.2 * 1.0 / humotion::server::Server::MOTION_UPDATERATE);
-
-        msg.points.push_back(p);
-
-        target_publisher.publish(msg);
-    }
-}
-
-
-//! prepare and enable a joint
-//! NOTE: this should also prefill the min/max positions for this joint
-//! \param the enum id of a joint
-void MekaJointInterface::enable_joint(int e){
-    //meka does not support this, joints are always enabled
-}
-
-//! shutdown and disable a joint
-//! \param the enum id of a joint
-void MekaJointInterface::disable_joint(int e){
-    //meka does not support this, joints are always enabled
-}
-
-void MekaJointInterface::store_min_max(int id, float min, float max){
-    joint_min[id] = min;
-    joint_max[id] = max;
-}
-
-void MekaJointInterface::init_joints(){
-    store_min_max(ID_NECK_TILT, -37, 1);
-    store_min_max(ID_NECK_PAN, -70, 70);
-
-    store_min_max(ID_NECK_ROLL, -1, 1);
-    store_min_max(ID_EYES_BOTH_UD, -1, 1);
-    store_min_max(ID_EYES_LEFT_LR, -1, 1);
-    store_min_max(ID_EYES_RIGHT_LR, -1, 1);
-    store_min_max(ID_EYES_LEFT_LID_UPPER, -1, 1);
-    store_min_max(ID_EYES_LEFT_LID_LOWER, -1, 1);
-    store_min_max(ID_EYES_RIGHT_LID_UPPER, -1, 1);
-    store_min_max(ID_EYES_RIGHT_LID_LOWER, -1, 1);
-    store_min_max(ID_EYES_LEFT_BROW, -1, 1);
-    store_min_max(ID_EYES_RIGHT_BROW, -1, 1);
-    store_min_max(ID_LIP_CENTER_UPPER, -1, 1);
-    store_min_max(ID_LIP_CENTER_LOWER, -1, 1);
-    store_min_max(ID_LIP_LEFT_UPPER, -1, 1);
-    store_min_max(ID_LIP_LEFT_LOWER, -1, 1);
-    store_min_max(ID_LIP_RIGHT_UPPER, -1, 1);
-    store_min_max(ID_LIP_RIGHT_LOWER, -1, 1);
-}
-
diff --git a/examples/yarp_icub/CMakeLists.txt b/examples/yarp_icub/CMakeLists.txt
deleted file mode 100644
index 80b0bc6..0000000
--- a/examples/yarp_icub/CMakeLists.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-PROJECT(humotion_yarp_icub)
-cmake_minimum_required(VERSION 2.8)
-
-FIND_PACKAGE(YARP)
-FIND_PACKAGE(ICUB)
-FIND_PACKAGE(Boost REQUIRED COMPONENTS system thread)
-FIND_PACKAGE(humotion)
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
-
-# add include directories
-INCLUDE_DIRECTORIES(${YARP_INCLUDE_DIRS} ${ICUB_INCLUDE_DIRS} ${humotion_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} include/)
-link_directories(${Boost_LIBRARY_DIRS} ${humotion_LIBRARY_DIRS})
-
-# add required linker flags
-SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ICUB_LINK_FLAGS}")
-SET(MAIN icub_humotion_server)
-
-file(GLOB DUMMY_HEADER_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} include/*.h)
-
-ADD_EXECUTABLE(${MAIN} src/main.cpp src/icub_jointinterface.cpp src/icub_faceinterface.cpp src/icub_data_receiver.cpp ${DUMMY_HEADER_LIST})
-
-# we now add the YARP and iCub libraries to our project.
-TARGET_LINK_LIBRARIES(${MAIN} ${Boost_LIBRARIES} ${YARP_LIBRARIES} ${ICUB_LIBRARIES} ${humotion_LIBRARIES})
-set_property(TARGET ${MAIN} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE)
-
-INSTALL(TARGETS ${MAIN} DESTINATION bin)
-
-
-#################
-## style guide ##
-#################
-SET(CPPLINT_CMAKE ${CMAKE_CURRENT_SOURCE_DIR}/../../stylecheck/CpplintWrapper.cmake)
-
-if(EXISTS "${CPPLINT_CMAKE}")
-  set(ENABLE_CPPLINT 1)
-  include(${CPPLINT_CMAKE})
-  CPPLINT_RECURSIVE(cpplint_include
-    ${CMAKE_CURRENT_SOURCE_DIR}/include
-    ${CMAKE_CURRENT_SOURCE_DIR}/include
-    ${CMAKE_CURRENT_BINARY_DIR}/include)
-  CPPLINT_RECURSIVE(cpplint_src
-    ${CMAKE_CURRENT_SOURCE_DIR}/src
-    ${CMAKE_CURRENT_SOURCE_DIR}/src
-    ${CMAKE_CURRENT_BINARY_DIR}/src)
-  add_dependencies(${MAIN} cpplint_src cpplint_include)
-else ()
-  message(WARNING "Could not find cpplint cmake file. Will not do code stylecheck!")
-endif ()
-#workaround for qtcreator ide integration. do not remove!
-file(GLOB_RECURSE NODE_DUMMY_TARGETS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.h *.cfg *.yaml *.xml *.launch)
-add_custom_target(_dummy_target SOURCES ${NODE_DUMMY_TARGETS})
-
diff --git a/examples/yarp_icub/include/humotion_yarp_icub/icub_data_receiver.h b/examples/yarp_icub/include/humotion_yarp_icub/icub_data_receiver.h
deleted file mode 100644
index 669fa35..0000000
--- a/examples/yarp_icub/include/humotion_yarp_icub/icub_data_receiver.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_DATA_RECEIVER_H_
-#define EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_DATA_RECEIVER_H_
-
-#include <humotion/server/joint_interface.h>
-#include <humotion/server/server.h>
-
-#include <boost/bimap.hpp>
-#include <yarp/dev/ControlBoardInterfaces.h>
-#include <yarp/dev/IControlLimits2.h>
-#include <yarp/dev/PolyDriver.h>
-#include <yarp/os/Network.h>
-#include <yarp/os/Property.h>
-#include <yarp/os/RateThread.h>
-#include <yarp/os/Time.h>
-#include <yarp/sig/Vector.h>
-
-#include "humotion_yarp_icub/icub_jointinterface.h"
-
-// forward declaration to solve loop
-class iCubJointInterface;
-
-class iCubDataReceiver : public yarp::os::RateThread{
- public:
-    iCubDataReceiver(int period, iCubJointInterface *icub_jointinterface);
-    bool threadInit();
-    void threadRelease();
-    void run();
-
- private:
-    void store_incoming_position(int icub_id, double value, humotion::Timestamp timestamp);
-    void store_incoming_velocity(int icub_id, double velocity, humotion::Timestamp timestamp);
-    yarp::sig::Vector calculate_velocities(yarp::sig::Vector positions,
-                              yarp::sig::Vector timestamps);
-
-    void dump_incoming_data();
-
-    float target_eye_pan_;
-    float target_eye_vergence_;
-
-    float target_eye_pan_velocity_;
-    float target_eye_vergence_velocity_;
-
-    yarp::sig::Vector positions_;
-    yarp::sig::Vector timestamps_;
-    yarp::sig::Vector velocities_;
-    yarp::sig::Vector commands_;
-
-    yarp::sig::Vector previous_positions_;
-    yarp::sig::Vector previous_timestamps_;
-
-    iCubJointInterface *icub_jointinterface_;
-    yarp::dev::IEncodersTimed *iencs_;
-};
-
-#endif  // EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_DATA_RECEIVER_H_
diff --git a/examples/yarp_icub/include/humotion_yarp_icub/icub_faceinterface.h b/examples/yarp_icub/include/humotion_yarp_icub/icub_faceinterface.h
deleted file mode 100644
index 029aefb..0000000
--- a/examples/yarp_icub/include/humotion_yarp_icub/icub_faceinterface.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-#ifndef EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_FACEINTERFACE_H_
-#define EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_FACEINTERFACE_H_
-
-#include "humotion_yarp_icub/icub_jointinterface.h"
-
-#include <yarp/dev/ControlBoardInterfaces.h>
-#include <yarp/os/Network.h>
-
-#include <string>
-
-class iCubFaceInterface {
- public:
-    explicit iCubFaceInterface(std::string scope);
-    ~iCubFaceInterface();
-
-
-    void set_eyelid_angle(float angle);
-    void set_eyebrow_angle(int id, float *target_angle);
-    void set_mouth(float *target_angle);
-
- private:
-    double lid_angle;
-    int lid_opening_previous;
-    int previous_mouth_state;
-    double target_angle_previous[iCubJointInterface::ICUB_JOINT_ID_ENUM_SIZE];
-    std::string scope;
-    yarp::os::BufferedPort<yarp::os::Bottle> emotion_port;
-};
-
-#endif  // EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_FACEINTERFACE_H_
diff --git a/examples/yarp_icub/include/humotion_yarp_icub/icub_jointinterface.h b/examples/yarp_icub/include/humotion_yarp_icub/icub_jointinterface.h
deleted file mode 100644
index a68ac22..0000000
--- a/examples/yarp_icub/include/humotion_yarp_icub/icub_jointinterface.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_JOINTINTERFACE_H_
-#define EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_JOINTINTERFACE_H_
-
-#include "humotion_yarp_icub/icub_data_receiver.h"
-
-#include <humotion/server/joint_interface.h>
-#include <humotion/server/server.h>
-
-#include <boost/bimap.hpp>
-#include <yarp/dev/ControlBoardInterfaces.h>
-#include <yarp/dev/IControlLimits2.h>
-#include <yarp/dev/IControlMode.h>
-#include <yarp/dev/PolyDriver.h>
-#include <yarp/os/Network.h>
-#include <yarp/os/Port.h>
-#include <yarp/os/Property.h>
-#include <yarp/os/RateThread.h>
-#include <yarp/os/Time.h>
-#include <yarp/sig/Vector.h>
-
-#include <string>
-#include <vector>
-
-class iCubDataReceiver;
-class iCubFaceInterface;
-
-class iCubJointInterface : public humotion::server::JointInterface{
- public:
-    explicit iCubJointInterface(std::string scope);
-    ~iCubJointInterface();
-
-    void run();
-
-    int convert_icub_jointid_to_humotion(int id);
-    int convert_humotion_jointid_to_icub(int id);
-
-    enum JOINT_ID_ENUM{
-        ICUB_ID_NECK_TILT = 0,
-        ICUB_ID_NECK_ROLL = 1,
-        ICUB_ID_NECK_PAN  = 2,
-        ICUB_ID_EYES_BOTH_UD = 3,
-        ICUB_ID_EYES_PAN = 4,
-        ICUB_ID_EYES_VERGENCE = 5,
-        ICUB_ID_EYES_LEFT_LID_LOWER,
-        ICUB_ID_EYES_LEFT_LID_UPPER,
-        ICUB_ID_EYES_RIGHT_LID_LOWER,
-        ICUB_ID_EYES_RIGHT_LID_UPPER,
-        ICUB_ID_EYES_LEFT_BROW,
-        ICUB_ID_EYES_RIGHT_BROW,
-        ICUB_ID_LIP_LEFT_UPPER,
-        ICUB_ID_LIP_LEFT_LOWER,
-        ICUB_ID_LIP_CENTER_UPPER,
-        ICUB_ID_LIP_CENTER_LOWER,
-        ICUB_ID_LIP_RIGHT_UPPER,
-        ICUB_ID_LIP_RIGHT_LOWER,
-        ICUB_JOINT_ID_ENUM_SIZE
-    };
-
-    yarp::dev::PolyDriver *get_yarp_polydriver() { return &yarp_polydriver_; }
-
-    static const int MAIN_LOOP_FREQUENCY = 50;
-
- protected:
-    void disable_joint(int e);
-    void publish_target(int e, float position, float velocity);
-    void enable_joint(int e);
-    void execute_motion();
-
- private:
-    bool running_in_simulation_;
-    yarp::dev::PolyDriver yarp_polydriver_;
-
-    std::vector<double> pv_mix_last_error_;
-    std::vector<double> pv_mix_pid_p_;
-    std::vector<double> pv_mix_pid_d_;
-
-    // yarp views
-    yarp::dev::IVelocityControl *yarp_ivel_;
-    yarp::dev::IPositionControl *yarp_ipos_;
-    yarp::dev::IControlLimits *yarp_ilimits_;
-    yarp::dev::IAmplifierControl *yarp_amp_;
-    yarp::dev::IPidControl *yarp_pid_;
-    yarp::dev::IControlMode *yarp_icontrol_;
-
-    yarp::sig::Vector yarp_commands_;
-
-    float target_angle_[ICUB_JOINT_ID_ENUM_SIZE];
-    float target_velocity_[ICUB_JOINT_ID_ENUM_SIZE];
-
-
-    void init_controller();
-    void init_id_map();
-    void init_pv_mix_pid();
-    void insert_icupid_to_humotionid_mapping(int icubid, int humotionid);
-
-
-    void store_icub_joint_target(int icub_id, float position, float velocity);
-
-
-    void set_joint_enable_state(int e, bool enabled);
-
-    iCubDataReceiver *icub_data_receiver;
-    void init_joints();
-
-    std::string scope;
-
-    void store_min_max(yarp::dev::IControlLimits *ilimits, int icub_id);
-
-    void set_target_in_velocitymode(int id);
-
-    iCubFaceInterface *face_interface_;
-
-    typedef boost::bimap<int, int > enum_id_bimap_t;
-    typedef enum_id_bimap_t::value_type enum_id_bimap_entry_t;
-    enum_id_bimap_t enum_id_bimap;
-};
-
-#endif  // EXAMPLES_YARP_ICUB_INCLUDE_HUMOTION_YARP_ICUB_ICUB_JOINTINTERFACE_H_
diff --git a/examples/yarp_icub/src/icub_data_receiver.cpp b/examples/yarp_icub/src/icub_data_receiver.cpp
deleted file mode 100644
index 434c0b7..0000000
--- a/examples/yarp_icub/src/icub_data_receiver.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <boost/format.hpp>
-#include <humotion/server/joint_interface.h>
-#include <yarp/os/Property.h>
-
-#include <string>
-
-#include "humotion_yarp_icub/icub_data_receiver.h"
-
-using std::cout;
-using std::cerr;
-using std::string;
-
-using humotion::server::JointInterface;
-using humotion::Timestamp;
-
-using yarp::dev::IEncodersTimed;
-using yarp::sig::Vector;
-
-#define ICUB_DATA_RECEIVER_USE_ENCODERSPEED 0
-#define ICUB_DATA_RECEIVER_DUMP_DATA 0
-
-//! constructor
-//! \param period_ms for the yarp rate thread
-//! \param icub_jointinterface
-iCubDataReceiver::iCubDataReceiver(int period_ms, iCubJointInterface *icub_jointinterface)
-    : yarp::os::RateThread(period_ms) {
-
-    // store pointer to icub jointinterface
-    icub_jointinterface_ = icub_jointinterface;
-
-    // fetch iencs view from yarp
-    yarp::dev::PolyDriver *poly_driver = icub_jointinterface->get_yarp_polydriver();
-    bool success = poly_driver->view(iencs_);
-    if (!success) {
-        cerr << "ERROR: polydriver failed to init iencs view\n";
-        exit(EXIT_FAILURE);
-    }
-
-    // resize data storage vectors to match the number of axes
-    int joints;
-    iencs_->getAxes(&joints);
-    positions_.resize(joints);
-    velocities_.resize(joints);
-    timestamps_.resize(joints);
-}
-
-//! yarp rate thread initializer
-bool iCubDataReceiver::threadInit() {
-    return true;
-}
-
-//! yarp thread release function
-void iCubDataReceiver::threadRelease() {
-}
-
-//! manully calculate joint velocities (instead of using joint encoder speeds)
-//! \param positions vector with current encoder position
-//! \param timestamps vector with the associated timestamps
-//! \return velocities as vector
-Vector iCubDataReceiver::calculate_velocities(Vector positions, Vector timestamps) {
-    Vector velocities;
-    velocities.resize(positions.size());
-
-    if (previous_positions_.size() == 0) {
-        // first run, no valid old position available, return zero velocities
-        // by setting all all elements to zero
-        velocities = 0.0;
-    } else {
-        // calculate speed based on positions:
-        for (int i=0; i < positions.size(); i++) {
-            float diff = positions[i] - previous_positions_[i];
-            float timediff = timestamps[i] - previous_timestamps_[i];
-            // calc speed:
-            velocities[i] = diff / timediff;
-        }
-    }
-
-    previous_positions_ = positions;
-    previous_timestamps_ = timestamps;
-
-    return velocities;
-}
-
-//! main loop routine, called by yarp rate thread
-void iCubDataReceiver::run() {
-    float velocity;
-    Timestamp timestamp;
-
-    // grab pos+vel data:
-    iencs_->getEncodersTimed(positions_.data(), timestamps_.data());
-
-    #if ICUB_DATA_RECEIVER_USE_ENCODERSPEED
-    // fetch data from icub. NOTE: make sure to enable the vel broadcast in the ini file!
-    if (!iencs_->getEncoderSpeeds(velocities_.data())) {
-        cout << "Failed to fetch encoder speeds...\n";
-        return;
-    }
-    #else
-    // manually calculate the speed based on old position:
-    velocities_ = calculate_velocities(positions_, timestamps_);
-    #endif
-
-    // publish data to humotion
-    for (int i = 0; i < positions_.size(); i++) {
-        // convert to humotion timestamp
-        timestamp = Timestamp(timestamps_[i]);
-        // store position values
-        store_incoming_position(i, positions_[i], timestamp);
-        // store velocity
-        store_incoming_velocity(i, velocities_[i], timestamp);
-    }
-
-    // small hack to tell humotion to update the lid angle
-    // fixme: use real id
-    timestamp = Timestamp::now();
-    store_incoming_position(100, 0.0, timestamp);
-
-    #if ICUB_DATA_RECEIVER_DUMP_DATA
-    dump_incoming_data();
-    #endif
-}
-
-//! store incoming position for a given icub joint
-//! \param icub _id icub joint id
-//! \param position
-//! \param timestamp
-void iCubDataReceiver::store_incoming_position(int icub_id, double position, Timestamp timestamp) {
-    // cout << "store_incoming_position(icub=" << icub_id << ", " << position << ")\n";
-
-    // store joint position in humotion backend
-    if ((icub_id == iCubJointInterface::ICUB_ID_EYES_PAN) ||
-            (icub_id == iCubJointInterface::ICUB_ID_EYES_VERGENCE)) {
-        // the icub handles eyes differently
-        // instead of using seperate left/right pan the icub uses
-        // a combined pan angle and vergence. therfore we have to convert this here:
-        if (icub_id == iCubJointInterface::ICUB_ID_EYES_PAN) {
-            target_eye_pan_ = position;
-        } else {
-            target_eye_vergence_ = -position;
-        }
-
-        float right = target_eye_pan_ + target_eye_vergence_/2.0;
-        float left  = target_eye_pan_ - target_eye_vergence_/2.0;
-
-        icub_jointinterface_->store_incoming_position(JointInterface::ID_EYES_LEFT_LR,
-                                                     left, timestamp);
-        icub_jointinterface_->store_incoming_position(JointInterface::ID_EYES_RIGHT_LR,
-                                                     right, timestamp);
-    } else if (icub_id == 100) {
-        // HACK
-        // icub_jointinterface->store_incoming_position(ID_EYES_RIGHT_LID_UPPER,
-        //                                             lid_angle, timestamp);
-    } else {
-        if (icub_id == iCubJointInterface::ID_NECK_PAN) {
-            // icub uses an inverted neck pan specification
-            position = -position;
-        }
-
-        // known configured mapping between joint ids
-        int humotion_id = icub_jointinterface_->convert_icub_jointid_to_humotion(icub_id);
-        icub_jointinterface_->store_incoming_position(humotion_id, position, timestamp);
-    }
-}
-
-//! store incoming velocity for a given icub joint
-//! \param icub_id icub joint id
-//! \param velocity
-//! \param timestamp
-void iCubDataReceiver::store_incoming_velocity(int icub_id, double velocity, Timestamp timestamp) {
-    // cout << "store_incoming_velocity(icub=" << icub_id << ", " << velocity << ")\n";
-
-    // store joint position in humotion backend
-    if ((icub_id == iCubJointInterface::ICUB_ID_EYES_PAN) ||
-            (icub_id == iCubJointInterface::ICUB_ID_EYES_VERGENCE)) {
-        // the icub handles eyes differently
-        // instead of using seperate left/right pan the icub uses
-        // a combined pan angle and vergence. therfore we have to convert this here:
-        if (icub_id == iCubJointInterface::ICUB_ID_EYES_PAN) {
-            target_eye_pan_velocity_ = velocity;
-        } else {
-            target_eye_vergence_velocity_ = -velocity;
-        }
-
-        float right = target_eye_pan_velocity_ + target_eye_vergence_velocity_/2.0;
-        float left  = target_eye_pan_velocity_ - target_eye_vergence_velocity_/2.0;
-
-        icub_jointinterface_->store_incoming_velocity(JointInterface::ID_EYES_LEFT_LR,
-                                                     left, timestamp);
-        icub_jointinterface_->store_incoming_velocity(JointInterface::ID_EYES_RIGHT_LR,
-                                                     right, timestamp);
-    } else if (icub_id == 100) {
-        // HACK
-        // icub_jointinterface->store_incoming_position(ID_EYES_RIGHT_LID_UPPER,
-        //                                             lid_angle, timestamp);
-    } else {
-        if (icub_id == iCubJointInterface::ID_NECK_PAN) {
-            // icub uses an inverted neck pan specification
-            velocity = -velocity;
-        }
-
-        // known configured mapping between joint ids
-        int humotion_id = icub_jointinterface_->convert_icub_jointid_to_humotion(icub_id);
-        icub_jointinterface_->store_incoming_velocity(humotion_id, velocity, timestamp);
-    }
-}
-
-//! helper for debugging purposes, feed this data into gnuplot for visual inspection
-void iCubDataReceiver::dump_incoming_data() {
-    // use gnuplot for viz:
-    // ./icub_humotion_server --robot icub | grep "INCOMING" |tee  log
-    // @gnuplot: plot "log" using 0:1 w l t "p neck tilt", "log" using 0:2 w l t "v neck tilt", \
-    //                "log" using 0:5 w l t "p neck pan", "log" using 0:6 w l t "v neck pan", \
-    //                "log" using 0:7 w l t "p eyes ud", "log" using 0:8 w l t "v eyes ud", \
-    //                "log" using 0:9 w l t "p eyes vergence", "log" using 0:10 w l t "v eyes verg"
-    cout << "\n";
-            // publish data to humotion
-    for (int i = 0; i < positions_.size(); i++) {
-        cout << positions_[i] << " ";
-        cout << velocities_[i] << " ";
-    }
-    cout << " #INCOMING_DATA_DUMP\n";
-}
-
-
diff --git a/examples/yarp_icub/src/icub_faceinterface.cpp b/examples/yarp_icub/src/icub_faceinterface.cpp
deleted file mode 100644
index 67c1351..0000000
--- a/examples/yarp_icub/src/icub_faceinterface.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion_yarp_icub/icub_faceinterface.h"
-
-#include <boost/format.hpp>
-#include <algorithm>
-#include <string>
-
-using yarp::os::Network;
-using yarp::os::Bottle;
-using std::cout;
-using std::cerr;
-using std::string;
-
-//! constructor
-iCubFaceInterface::iCubFaceInterface(std::string _scope) {
-    scope = _scope;
-
-    // attach to facial expressions:
-    std::string emotion_scope = scope + "/face/raw/in";
-    cout << "opening connection to '"<< emotion_scope << "'\n";
-
-    bool init_ok = true;
-    // open emotion port
-    std::string emotion_port_out = "/emotionwriter";
-    if (!emotion_port.open(emotion_port_out.c_str())) {
-        cerr << "ERROR: failed to open emotion port '" << emotion_port_out << "'\n";
-        init_ok = false;
-    }
-    if (!Network::connect(emotion_port_out.c_str(), emotion_scope.c_str())) {
-        cerr << "ERROR: failed to connect to emotion port '" << emotion_port_out << "'\n";
-        init_ok = false;
-    }
-
-    if (!init_ok) {
-        cerr << "ERROR: failed to set up emotion component\n";
-        cerr << "       please make sure that the faceExpressions yarpdev is started\n";
-        cerr << "       (e.g.  yarpdev --name /icub/face/raw --device serial ... is running)\n";
-        exit(EXIT_FAILURE);
-    }
-}
-
-//! destructor
-iCubFaceInterface::~iCubFaceInterface() {
-}
-
-//! special command to set eyelid angle
-//! \param angle in degrees
-void iCubFaceInterface::set_eyelid_angle(float angle) {
-    if (emotion_port.getOutputCount() > 0) {
-        // try to set the value based on the upper one
-        // some guesses from the sim: S30 = 0° / S40 = 10°
-        int opening = (25.0 + 0.8*angle);
-        opening = std::min(48, std::max(24, opening));
-
-        if (opening == lid_opening_previous) {
-            // no update necessary
-            return;
-        }
-
-        lid_angle = angle;
-        lid_opening_previous = opening;
-
-        char buf[20];
-        snprintf(buf, sizeof(buf), "S%2d", opening);
-
-        // cout << "SETTING EYELID '" << buf << "' (" << angle << " -> " << opening << "\n";
-        Bottle &cmd = emotion_port.prepare();
-        cmd.clear();
-        cmd.addString(buf);
-        // NOTE: writeStrict is important in order not to loose packets
-        emotion_port.writeStrict();
-    } else {
-        cerr << "ERROR: no icub emotion output\n";
-        exit(EXIT_FAILURE);
-    }
-}
-
-//! special command to set the eyebrow angle
-//! \param id {0=left, 1=right)
-//! \param angle in degrees
-void iCubFaceInterface::set_eyebrow_angle(int id, float *target_angle) {
-    if (emotion_port.getOutputCount() > 0) {
-        double angle = target_angle[id];
-        int icub_val = 0;
-
-        // swap rotation direction for eyebrow
-        if (id == iCubJointInterface::ICUB_ID_EYES_LEFT_BROW) {
-            angle = -angle;
-        }
-
-        // convert to icub representation
-        if (angle < -20) {
-            icub_val = 1;
-        } else if (angle < 10) {
-            icub_val = 2;
-        } else if (angle < 20) {
-            icub_val = 4;
-        } else {
-            icub_val = 8;
-        }
-
-        // make sure to update only on new values
-        if (icub_val == target_angle_previous[id]) {
-                // no updata necessary
-                return;
-        }
-
-        // store actual value
-        target_angle_previous[id] = icub_val;
-
-
-        std::string cmd_s;
-        if (id == iCubJointInterface::ICUB_ID_EYES_LEFT_BROW) {
-            cmd_s = "L0" + boost::lexical_cast<std::string>(icub_val);
-        } else {
-            cmd_s = "R0" + boost::lexical_cast<std::string>(icub_val);
-        }
-
-        // cout << "SETTING EYEBROW " << id << " (" << angle << " -> " << cmd_s << ")\n";
-
-        Bottle &cmd = emotion_port.prepare();
-        cmd.clear();
-        cmd.addString(cmd_s);
-        // NOTE: writeStrict is important in order not to loose packets
-        emotion_port.writeStrict();
-    } else {
-        cerr << "ERROR: no icub emotion output\n";
-        exit(EXIT_FAILURE);
-    }
-}
-
-void iCubFaceInterface::set_mouth(float *target_angle) {
-    // convert from 6DOF mouth displacement to icub leds:
-    int led_value = 0;
-
-    // fetch center opening
-    double center_opening = target_angle[iCubJointInterface::ICUB_ID_LIP_CENTER_LOWER] -
-            target_angle[iCubJointInterface::ICUB_ID_LIP_CENTER_UPPER];
-    bool mouth_open = (center_opening > 15.0) ? true : false;
-
-    // side of mouth high or low?
-    double center_avg = (target_angle[iCubJointInterface::ICUB_ID_LIP_CENTER_LOWER] +
-            target_angle[iCubJointInterface::ICUB_ID_LIP_CENTER_UPPER])/2.0;
-    double left_avg   = (target_angle[iCubJointInterface::ICUB_ID_LIP_LEFT_LOWER] +
-            target_angle[iCubJointInterface::ICUB_ID_LIP_LEFT_UPPER])/2.0;
-    double right_avg  = (target_angle[iCubJointInterface::ICUB_ID_LIP_RIGHT_LOWER] +
-            target_angle[iCubJointInterface::ICUB_ID_LIP_RIGHT_UPPER])/2.0;
-
-    // happy, neutral or sad?
-    double diff_l = center_avg - left_avg;
-    double diff_r = center_avg - right_avg;
-    double diff   = (diff_l+diff_r)/2.0;
-
-    if (diff > 2.0) {
-        if (mouth_open) {
-            led_value = 0x14;
-        } else {
-            if (diff > 2.6) {
-                led_value = 0x0A;
-            } else {
-                led_value = 0x0B;
-            }
-        }
-    } else if (diff < -3.0) {
-        if (mouth_open) {
-            led_value = 0x06;
-        } else {
-            led_value = 0x18;
-        }
-    } else if (diff < -2.0) {
-        if (mouth_open) {
-            led_value = 0x04;  // 0x25;
-        } else {
-            led_value = 0x08;
-        }
-    } else {
-        if (mouth_open) {
-            led_value = 0x16;
-        } else {
-            led_value = 0x08;
-        }
-    }
-
-
-    if (led_value == previous_mouth_state) {
-        // no update necessary
-        return;
-    }
-
-    previous_mouth_state = led_value;
-
-    // convert to string
-    char buf[10];
-    snprintf(buf, sizeof(buf), "M%02X", led_value);
-
-    /*
-    cout << "sending mouth " << buf << "\n";
-    cout << boost::format("  mouth angles: %3.2f %3.2f %3.2f\n")
-            % target_angle[ICUB_ID_LIP_LEFT_UPPER]
-            % target_angle[ICUB_ID_LIP_CENTER_UPPER]
-            % target_angle[ICUB_ID_LIP_RIGHT_UPPER];
-    cout << boost::format("  mouth         %3.2f %3.2f %3.2f\n")
-            % target_angle[ICUB_ID_LIP_LEFT_LOWER]
-            % target_angle[ICUB_ID_LIP_CENTER_LOWER]
-            % target_angle[ICUB_ID_LIP_RIGHT_LOWER];
-    cout << boost::format("  mouth  open=%3.2f diff=%3.2f\n")
-            % center_opening
-            % diff;
-    */
-
-    // add mouth
-    Bottle &cmd = emotion_port.prepare();
-    cmd.clear();
-    cmd.addString(buf);
-    // NOTE: writeStrict is important in order not to loose packets
-    emotion_port.writeStrict();
-
-/*
-    //store joint values which we do not handle on icub here:
-    double timestamp = get_timestamp_ms();
-    JointInterface::store_incoming_position(ID_LIP_LEFT_UPPER,   target_angle[ICUB_ID_LIP_LEFT_UPPER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_LEFT_LOWER,   target_angle[ICUB_ID_LIP_LEFT_LOWER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_CENTER_UPPER, target_angle[ICUB_ID_LIP_CENTER_UPPER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_CENTER_LOWER, target_angle[ICUB_ID_LIP_CENTER_LOWER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_RIGHT_UPPER,  target_angle[ICUB_ID_LIP_RIGHT_UPPER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_RIGHT_LOWER,  target_angle[ICUB_ID_LIP_RIGHT_LOWER], timestamp);
-*/
-}
diff --git a/examples/yarp_icub/src/icub_jointinterface.cpp b/examples/yarp_icub/src/icub_jointinterface.cpp
deleted file mode 100644
index 71d78e7..0000000
--- a/examples/yarp_icub/src/icub_jointinterface.cpp
+++ /dev/null
@@ -1,543 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion_yarp_icub/icub_faceinterface.h"
-#include "humotion_yarp_icub/icub_jointinterface.h"
-
-#include <yarp/os/Property.h>
-#include <string>
-
-using std::cout;
-using std::cerr;
-using std::string;
-
-//! constructor
-iCubJointInterface::iCubJointInterface(string _scope) : humotion::server::JointInterface() {
-    scope = _scope;
-
-    // running in sim?
-    if (scope == "/icubSim") {
-        cout << "> icub simulation detected\n";
-        running_in_simulation_ = true;
-    } else {
-        running_in_simulation_ = false;
-    }
-
-
-    // add mappings from icub ids to humotion ids
-    init_id_map();
-
-    // initialise the pd controller for the velocity and position mixer
-    init_pv_mix_pid();
-
-    // intantiate the face interface
-    face_interface_ = new iCubFaceInterface(scope);
-
-    // intantiate the polydriver
-    yarp::os::Property options;
-    options.put("device", "remote_controlboard");
-    options.put("local", "/local/head");
-    options.put("remote", scope + "/head");
-    yarp_polydriver_.open(options);
-
-    // fetch yarp views:
-    bool success = true;
-    // success &= yarp_polydriver_.view(yarp_iencs_);
-    success &= yarp_polydriver_.view(yarp_ipos_);
-    success &= yarp_polydriver_.view(yarp_ivel_);
-    success &= yarp_polydriver_.view(yarp_ilimits_);
-    success &= yarp_polydriver_.view(yarp_pid_);
-    success &= yarp_polydriver_.view(yarp_amp_);
-
-    if (!success) {
-        cout << "ERROR: failed to fetch one or more yarp views... exiting\n";
-        exit(EXIT_FAILURE);
-    }
-
-
-    // tell humotion about min/max joint values:
-    init_joints();
-
-    // initialise joint controller
-    init_controller();
-}
-
-//! destructor
-iCubJointInterface::~iCubJointInterface() {
-    // stop controller on exit
-    yarp_ivel_->stop();
-    yarp_ipos_->stop();
-}
-
-//! init the controller that allows to write target angles or velocities
-void iCubJointInterface::init_controller() {
-    int number_of_joints;
-
-    if (running_in_simulation_) {
-        // running in simulation, use position control mode as velocity seems unsupported right now
-        yarp_ipos_->getAxes(&number_of_joints);
-
-        // prepare to set ref accel
-        // yarp_commands_.resize(number_of_joints);
-        // yarp_commands_ = 200000.0;
-        // yarp_ipos_->setRefAccelerations(yarp_commands_.data());
-
-        // enable position control
-        yarp_ipos_->setPositionMode();
-    } else {
-        // use velocity controller, first fetch no of axes:
-        yarp_ivel_->getAxes(&number_of_joints);
-
-        // set ref acceleration to a value for all axes:
-        yarp_commands_.resize(number_of_joints);
-        yarp_commands_ = 1e6;
-        yarp_ivel_->setRefAccelerations(yarp_commands_.data());
-
-        // finally enable velocity control mode
-        yarp_ivel_->setVelocityMode();
-    }
-}
-
-//! initialise icub joint id to humotion joint id mappings
-void iCubJointInterface::init_id_map() {
-        insert_icupid_to_humotionid_mapping(ICUB_ID_LIP_LEFT_UPPER,   ID_LIP_LEFT_UPPER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_LIP_LEFT_LOWER,   ID_LIP_LEFT_LOWER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_LIP_CENTER_UPPER, ID_LIP_CENTER_UPPER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_LIP_CENTER_LOWER, ID_LIP_CENTER_LOWER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_LIP_RIGHT_UPPER,  ID_LIP_RIGHT_UPPER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_LIP_RIGHT_LOWER,  ID_LIP_RIGHT_LOWER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_NECK_PAN,    ID_NECK_PAN);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_NECK_TILT,   ID_NECK_TILT);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_NECK_ROLL,   ID_NECK_ROLL);
-        //
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_PAN,   ID_EYES_LEFT_LR);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_VERGENCE,   ID_EYES_RIGHT_LR);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_BOTH_UD,   ID_EYES_BOTH_UD);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_LEFT_LID_LOWER, ID_EYES_LEFT_LID_LOWER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_LEFT_LID_UPPER, ID_EYES_LEFT_LID_UPPER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_LEFT_BROW, ID_EYES_LEFT_BROW);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_RIGHT_LID_LOWER, ID_EYES_RIGHT_LID_LOWER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_RIGHT_LID_UPPER, ID_EYES_RIGHT_LID_UPPER);
-        insert_icupid_to_humotionid_mapping(ICUB_ID_EYES_RIGHT_BROW, ID_EYES_RIGHT_BROW);
-}
-
-//! initialize the position and velocity mixer PD controller
-void iCubJointInterface::init_pv_mix_pid() {
-    // init control variables and last error variable for the internal
-    // position and velocity mixer PD controller:
-    pv_mix_pid_p_.resize(ICUB_JOINT_ID_ENUM_SIZE);
-    pv_mix_pid_d_.resize(ICUB_JOINT_ID_ENUM_SIZE);
-    pv_mix_last_error_.resize(ICUB_JOINT_ID_ENUM_SIZE);
-
-    enum_id_bimap_t::const_iterator it;
-    for (it = enum_id_bimap.begin(); it != enum_id_bimap.end(); ++it) {
-        int id = it->left;
-        pv_mix_pid_p_[id] = 5.5;
-        pv_mix_pid_d_[id] = 0.3;
-        pv_mix_last_error_[id] = 0.0;
-    }
-}
-
-//! add mapping from icub joint ids to humotion ids
-//! this might look strange at the first sight but we need to have a generic
-//! way to acces joints from libhumotion. therefore the lib uses its enum with ID_* enum ids
-//! to access the joints. now we need to define a mapping to map those to the icub motor ids.
-void iCubJointInterface::insert_icupid_to_humotionid_mapping(int icubid, int humotionid) {
-    enum_id_bimap.insert(enum_id_bimap_entry_t(icubid, humotionid));
-}
-
-void iCubJointInterface::run() {
-    float loop_duration_ms = 1000.0 / MAIN_LOOP_FREQUENCY;
-    iCubDataReceiver *data_receiver = new iCubDataReceiver(loop_duration_ms, this);
-    data_receiver->start();
-}
-
-//! stores the target position & velocity of a given joint
-//! \param enum id of joint
-//! \param float value
-void iCubJointInterface::publish_target(int humotion_id, float position, float velocity) {
-    // special handler for eye joints
-    if ((humotion_id == JointInterface::ID_EYES_LEFT_LR) ||
-        (humotion_id == JointInterface::ID_EYES_RIGHT_LR)) {
-        // the icub has a combined pan angle for both eyes, so seperate this:
-        float target_position_left  = get_target_position(JointInterface::ID_EYES_LEFT_LR);
-        float target_position_right = get_target_position(JointInterface::ID_EYES_RIGHT_LR);
-        float target_velocity_left  = get_target_velocity(JointInterface::ID_EYES_LEFT_LR);
-        float target_velocity_right = get_target_velocity(JointInterface::ID_EYES_RIGHT_LR);
-
-
-        // calculate target angles
-        float target_position_pan      = (target_position_right + target_position_left) / 2;
-        float target_position_vergence = (target_position_right - target_position_left);
-
-        /*cout << "LR " << target_position_left << " " << target_position_right <<
-                " PAN " << target_position_pan << " VERGENCE " << target_position_vergence << "\n";*/
-
-        // calculate target velocities
-        // for now just use the same velocity for pan and vergence
-        float target_velocity_pan = (target_velocity_left + target_velocity_right) / 2.0;
-        float target_velocity_vergence = target_velocity_left - target_velocity_right;
-
-        store_icub_joint_target(ICUB_ID_EYES_PAN,
-                                target_position_pan, target_velocity_pan);
-        store_icub_joint_target(ICUB_ID_EYES_VERGENCE,
-                                target_position_vergence, target_velocity_vergence);
-    } else {
-        // convert to icub joint id
-        int icub_id = convert_humotion_jointid_to_icub(humotion_id);
-        // store target data
-        store_icub_joint_target(icub_id, position, velocity);
-    }
-}
-
-
-//! set the target data for a given icub joint
-//! \param id of joint
-//! \param float value of position
-void iCubJointInterface::store_icub_joint_target(int icub_id, float position, float velocity) {
-    // cout << "store_icub_joint_target(" << icub_id << ", " << position << ", ..)\n";
-
-    if ((icub_id == ICUB_ID_NECK_PAN) || (icub_id == ICUB_ID_EYES_VERGENCE)) {
-        // icub uses an inverted neck pan specification
-        position = -position;
-        velocity = -velocity;
-    }
-
-    // store values
-    target_angle_[icub_id] = position;
-    target_velocity_[icub_id] = velocity;
-}
-
-//! execute a move in velocity mode
-//! \param id of joint
-//! \param angle
-void iCubJointInterface::set_target_in_velocitymode(int icub_id) {
-    // fetch humotion id from icub joint id
-    int humotion_id = convert_icub_jointid_to_humotion(icub_id);
-
-    // fetch the target velocity
-    float target_velocity = target_velocity_[icub_id];
-
-    float vmax = 350.0;
-    if (target_velocity > vmax)  target_velocity = vmax;
-    if (target_velocity < -vmax) target_velocity = -vmax;
-
-    // execute:
-    if ((icub_id != ICUB_ID_NECK_PAN)
-        && (icub_id != ICUB_ID_EYES_BOTH_UD)
-        && (icub_id != ICUB_ID_NECK_TILT)
-        && (icub_id != ICUB_ID_EYES_PAN)
-        && (icub_id != ICUB_ID_EYES_VERGENCE)
-        // && (icub_id != ICUB_ID_NECK_TILT)
-            ) {
-        // limit to some joints for debugging...
-        return;
-    }
-
-    // we now add a pd control loop for velocity moves in order to handle position errors
-    // FIXME: add position interpolation into future. this requires to enable the velocity
-    //        broadcast in the torso and head ini file and fetch that velocity in the
-    //        icub_data_receiver as well. TODO: check if the can bus has enough bandwidth for that
-
-    // first: fetch the timstamp of the last known position
-    humotion::Timestamp data_ts = get_ts_position(humotion_id).get_last_timestamp();
-
-    // fetch current position & velocity
-    float current_position = get_ts_position(humotion_id).get_interpolated_value(data_ts);
-    float current_velocity = get_ts_speed(humotion_id).get_interpolated_value(data_ts);
-
-    // the icub has a combined eye pan actuator, therefore
-    // we have to calculate pan angle and vergence based on the left and right target angles:
-    if (icub_id == ICUB_ID_EYES_PAN) {
-        // fetch timestamp
-        data_ts = get_ts_position(ID_EYES_LEFT_LR).get_last_timestamp();
-
-        // get the left and right positions
-        float pos_left  = get_ts_position(ID_EYES_LEFT_LR).get_interpolated_value(data_ts);
-        float pos_right = get_ts_position(ID_EYES_RIGHT_LR).get_interpolated_value(data_ts);
-        current_position = (pos_left + pos_right) / 2.0;
-
-        // same for velocities:
-        float vel_left  = get_ts_speed(ID_EYES_LEFT_LR).get_interpolated_value(data_ts);
-        float vel_right = get_ts_speed(ID_EYES_RIGHT_LR).get_interpolated_value(data_ts);
-        current_velocity = (vel_left + vel_right) / 2.0;
-
-    } else if (icub_id == ICUB_ID_EYES_VERGENCE) {
-        // fetch timestamp
-        data_ts = get_ts_position(ID_EYES_LEFT_LR).get_last_timestamp();
-
-        // get the left and right positions
-        float pos_left  = get_ts_position(ID_EYES_LEFT_LR).get_interpolated_value(data_ts);
-        float pos_right = get_ts_position(ID_EYES_RIGHT_LR).get_interpolated_value(data_ts);
-
-        current_position = pos_left - pos_right;
-
-        // same for velocities:
-        float vel_left  = get_ts_speed(ID_EYES_LEFT_LR).get_interpolated_value(data_ts);
-        float vel_right = get_ts_speed(ID_EYES_RIGHT_LR).get_interpolated_value(data_ts);
-        current_velocity = (vel_left - vel_right);
-    }
-
-    // calculate position error:
-    float position_error = target_angle_[icub_id] - current_position;
-
-    // calculate d term
-    float error_d = (position_error - pv_mix_last_error_[icub_id]) / (framerate*1000.0);
-    pv_mix_last_error_[icub_id] = position_error;
-
-    // finally do a PD loop to get the target velocity
-    float pv_mix_velocity = pv_mix_pid_p_[icub_id] * position_error
-                            + pv_mix_pid_p_[icub_id]*error_d
-                            + target_velocity;
-
-
-    /*cout << "\n"
-         << current_position << " "
-         << target_angle_[icub_id] << " "
-         << current_velocity << " "
-         << pv_mix_velocity  << " "
-         << target_velocity  << " "
-         << position_error << " "
-         << " PID" << icub_id << "\n";*/
-
-
-    if (icub_id > ICUB_ID_EYES_VERGENCE) {
-        cerr << "> ERROR: set_target_positionmode(id=" << icub_id << ", ...) not supported\n";
-        return;
-    }
-
-
-    // execute velocity move
-    bool success;
-    int count = 0;
-    do {
-        if (running_in_simulation_) {
-            // running in sim, use position control
-            success = yarp_ipos_->positionMove(icub_id, target_angle_[icub_id]);
-        } else {
-            // use smooth velocity control on real robot
-            success = yarp_ivel_->velocityMove(icub_id, pv_mix_velocity);
-        }
-
-        if (count++ >= 10) {
-            cerr << "ERROR: failed to send motion command! gave up after 10 trials\n";
-            yarp_ivel_->stop();
-            yarp_ipos_->stop();
-            exit(EXIT_FAILURE);
-        }
-    } while (!success);
-}
-
-//! actually execute the scheduled motion commands
-void iCubJointInterface::execute_motion() {
-    // set up neck and eye motion commands in velocitymode
-    for (int i = ICUB_ID_NECK_TILT; i <= ICUB_ID_EYES_VERGENCE; i++) {
-        set_target_in_velocitymode(i);
-    }
-
-    // eyelids: unfortuantely the icub has only 1dof for eyelids
-    // therefore we can only use an opening value
-    float opening_left  = target_angle_[ICUB_ID_EYES_LEFT_LID_UPPER]
-                          - target_angle_[ICUB_ID_EYES_LEFT_LID_LOWER];
-    float opening_right = target_angle_[ICUB_ID_EYES_RIGHT_LID_UPPER]
-                          - target_angle_[ICUB_ID_EYES_RIGHT_LID_LOWER];
-    float opening = (opening_left + opening_right) / 2.0;
-    // send it to icub face if
-    face_interface_->set_eyelid_angle(opening);
-
-    // eyebrows are set using a special command as well:
-    face_interface_->set_eyebrow_angle(ICUB_ID_EYES_LEFT_BROW, target_angle_);
-    face_interface_->set_eyebrow_angle(ICUB_ID_EYES_RIGHT_BROW, target_angle_);
-
-    // mouth
-    face_interface_->set_mouth(target_angle_);
-
-    // store joint values which we do not handle on icub here:
-    humotion::Timestamp timestamp = humotion::Timestamp::now();
-
-    JointInterface::store_incoming_position(ID_LIP_LEFT_UPPER,
-                                            target_angle_[ICUB_ID_LIP_LEFT_UPPER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_LEFT_LOWER,
-                                            target_angle_[ICUB_ID_LIP_LEFT_LOWER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_CENTER_UPPER,
-                                            target_angle_[ICUB_ID_LIP_CENTER_UPPER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_CENTER_LOWER,
-                                            target_angle_[ICUB_ID_LIP_CENTER_LOWER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_RIGHT_UPPER,
-                                            target_angle_[ICUB_ID_LIP_RIGHT_UPPER], timestamp);
-    JointInterface::store_incoming_position(ID_LIP_RIGHT_LOWER,
-                                            target_angle_[ICUB_ID_LIP_RIGHT_LOWER], timestamp);
-}
-
-
-void iCubJointInterface::set_joint_enable_state(int humotion_id, bool enable) {
-    int icub_jointid = convert_humotion_jointid_to_icub(humotion_id);
-/*
-    switch(e){
-        default:
-            break;
-
-    case(ID_NECK_PAN):
-        icub_jointid = ICUB_ID_NECK_PAN;
-        break;
-
-    case(ID_NECK_TILT):
-        icub_jointid = ICUB_ID_NECK_TILT;
-        break;
-
-    case(ID_NECK_ROLL):
-        icub_jointid = ICUB_ID_NECK_ROLL;
-        break;
-
-    case(ID_EYES_BOTH_UD):
-        icub_jointid = ICUB_ID_EYES_BOTH_UD;
-        break;
-
-    // icub handles eyes as pan angle + vergence...
-    // -> hack: left eye enables pan and right eye enables vergence
-    case(ID_EYES_LEFT_LR):
-        icub_jointid = ICUB_ID_EYES_PAN;
-        break;
-
-    case(ID_EYES_RIGHT_LR):
-        icub_jointid = ICUB_ID_EYES_VERGENCE;
-        break;
-    }
-    */
-
-    if ((icub_jointid != -1) && (icub_jointid <= ICUB_ID_EYES_VERGENCE)) {
-        if (!running_in_simulation_) {
-            // only set amp status on real robot. simulation crashes during this call ... :-X
-            if (enable) {
-                yarp_amp_->enableAmp(icub_jointid);
-                yarp_pid_->enablePid(icub_jointid);
-            } else {
-                yarp_pid_->disablePid(icub_jointid);
-                yarp_amp_->disableAmp(icub_jointid);
-            }
-        }
-    }
-}
-
-//! prepare and enable a joint
-//! NOTE: this should also prefill the min/max positions for this joint
-//! \param the enum id of a joint
-void iCubJointInterface::enable_joint(int e) {
-    set_joint_enable_state(e, true);
-}
-
-//! shutdown and disable a joint
-//! \param the enum id of a joint
-void iCubJointInterface::disable_joint(int e)  {
-    set_joint_enable_state(e, false);
-}
-
-void iCubJointInterface::store_min_max(yarp::dev::IControlLimits *ilimits, int icub_id) {
-    double min, max;
-    int humotion_id = convert_icub_jointid_to_humotion(icub_id);
-
-    if (!ilimits->getLimits(icub_id, &min, &max)) {
-        cerr << "ERROR: failed to call getLimits for icub joint " << icub_id << "\n";
-        exit(EXIT_FAILURE);
-    }
-
-    joint_min[humotion_id] = min;
-    joint_max[humotion_id] = max;
-}
-
-//! initialise a joint (set up controller mode etc)
-void iCubJointInterface::init_joints() {
-    store_min_max(yarp_ilimits_, ICUB_ID_NECK_TILT);
-    store_min_max(yarp_ilimits_, ICUB_ID_NECK_ROLL);
-    store_min_max(yarp_ilimits_, ICUB_ID_NECK_PAN);
-    store_min_max(yarp_ilimits_, ICUB_ID_EYES_BOTH_UD);
-
-    // icub handles eyes differently, we have to set pan angle + vergence
-    double pan_min, pan_max, vergence_min, vergence_max;
-    yarp_ilimits_->getLimits(ICUB_ID_EYES_PAN, &pan_min, &pan_max);
-    yarp_ilimits_->getLimits(ICUB_ID_EYES_VERGENCE, &vergence_min, &vergence_max);
-
-    // this is not 100% correct, should be fixed
-    joint_min[ID_EYES_LEFT_LR] = pan_min;  // - vergence_max/2;
-    joint_max[ID_EYES_LEFT_LR] = pan_max;  // - vergence_max/2;
-    joint_min[ID_EYES_RIGHT_LR] = joint_min[ID_EYES_LEFT_LR];
-    joint_max[ID_EYES_RIGHT_LR] = joint_max[ID_EYES_LEFT_LR];
-
-    // eyelids
-    joint_min[ID_EYES_RIGHT_LID_UPPER] = -50;  // 24-30;
-    joint_max[ID_EYES_RIGHT_LID_UPPER] = 50;   // 48-30;
-    // lid_angle = joint_max[ID_EYES_RIGHT_LID_UPPER];
-
-    // eyebrows
-    joint_min[ID_EYES_LEFT_BROW] = -50;
-    joint_max[ID_EYES_LEFT_BROW] = 50;
-    joint_min[ID_EYES_RIGHT_BROW] = joint_min[ID_EYES_LEFT_BROW];
-    joint_max[ID_EYES_RIGHT_BROW] = joint_max[ID_EYES_LEFT_BROW];
-
-    // mouth
-    joint_min[ID_LIP_CENTER_UPPER] = 5;
-    joint_max[ID_LIP_CENTER_UPPER] = 50;
-    joint_min[ID_LIP_CENTER_LOWER] = 5;
-    joint_max[ID_LIP_CENTER_LOWER] = 50;
-    joint_min[ID_LIP_LEFT_UPPER] = 5;
-    joint_max[ID_LIP_LEFT_UPPER] = 50;
-    joint_min[ID_LIP_LEFT_LOWER] = 5;
-    joint_max[ID_LIP_LEFT_LOWER] = 50;
-    joint_min[ID_LIP_RIGHT_UPPER] = 5;
-    joint_max[ID_LIP_RIGHT_UPPER] = 50;
-    joint_min[ID_LIP_RIGHT_LOWER] = 5;
-    joint_max[ID_LIP_RIGHT_LOWER] = 50;
-}
-
-//! conversion table for humotion joint id to icub joint id
-//! \param int value for humotion joint id from JointInterface::JOINT_ID_ENUM
-//! \return int value of icub joint id
-int iCubJointInterface::convert_humotion_jointid_to_icub(int humotion_id) {
-    enum_id_bimap_t::right_const_iterator it = enum_id_bimap.right.find(humotion_id);
-    if (it == enum_id_bimap.right.end()) {
-        // key does not exist
-        cerr << "ERROR: invalid humotion joint id (" << humotion_id <<
-                ") given. can not convert this. exiting\n";
-        exit(EXIT_FAILURE);
-    }
-    return it->second;
-}
-
-
-//! conversion table for icub joint id to humotion joint id
-//! \param  int value of icub joint id
-//! \return int value of humotion joint id from JointInterface::JOINT_ID_ENUM
-int iCubJointInterface::convert_icub_jointid_to_humotion(int icub_id) {
-    enum_id_bimap_t::left_const_iterator it = enum_id_bimap.left.find(icub_id);
-    if (it == enum_id_bimap.left.end()) {
-        // key does not exist
-        cout << "ERROR: invalid icub joint id given. can not convert this. exiting\n";
-        exit(EXIT_FAILURE);
-    }
-    return it->second;
-}
-
diff --git a/examples/yarp_icub/src/main.cpp b/examples/yarp_icub/src/main.cpp
deleted file mode 100644
index c43ef0f..0000000
--- a/examples/yarp_icub/src/main.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <humotion/server/server.h>
-#include <stdio.h>
-#include <yarp/dev/ControlBoardInterfaces.h>
-#include <yarp/dev/PolyDriver.h>
-#include <yarp/os/Network.h>
-#include <yarp/os/Property.h>
-#include <yarp/os/RateThread.h>
-#include <yarp/os/Time.h>
-#include <yarp/sig/Vector.h>
-
-#include <iostream>
-#include <string>
-
-#include "humotion_yarp_icub/icub_data_receiver.h"
-#include "humotion_yarp_icub/icub_jointinterface.h"
-
-using std::cerr;
-using yarp::os::Network;
-using yarp::os::Property;
-
-// using namespace yarp::dev;
-// using namespace yarp::sig;
-// using namespace yarp::os;
-// using namespace std;
-
-
-int main(int argc, char *argv[]) {
-    Network yarp;
-
-    if (!yarp.checkNetwork()) {
-        cerr << "no yarp network, exiting\n";
-        return EXIT_FAILURE;
-    }
-
-    Property params;
-    params.fromCommand(argc, argv);
-
-    if (!params.check("robot")) {
-        cerr << "Please specify the name of the robot\n";
-        cerr << "--robot name (e.g. icub or icubSim)\n";
-        return EXIT_FAILURE;
-    }
-
-    std::string robotName = params.find("robot").asString().c_str();
-    std::string scope = "/" + robotName;
-
-
-    // create humotion interface
-    iCubJointInterface *icub_jointinterface = new iCubJointInterface(scope);
-    humotion::server::Server *humotion_server =
-            new humotion::server::Server("/icub", "ROS", icub_jointinterface);
-
-    icub_jointinterface->run();
-
-
-    // pre-/re-configure some dyn reconfig variables
-    int syscall_result;
-    syscall_result = std::system(("rosrun dynamic_reconfigure dynparam set " + scope +
-                 "/humotion/configuration " +
-                " \"{'use_neck_target_instead_of_position_eye':false, " +
-                "'eyelids_follow_eyemotion':false}\"").c_str());
-
-    if (syscall_result != 0) {
-        std::cerr << "ERROR: failed to set dynamic reconf parameters!" << std::endl;
-        return EXIT_FAILURE;
-    }
-
-    while (humotion_server->ok()) {
-        usleep(1000);
-    }
-
-    return EXIT_SUCCESS;
-}
diff --git a/include/humotion/client/client.h b/include/humotion/client/client.h
deleted file mode 100644
index 9adc471..0000000
--- a/include/humotion/client/client.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_CLIENT_CLIENT_H_
-#define INCLUDE_HUMOTION_CLIENT_CLIENT_H_
-
-#include <cstdint>
-#include <cstdio>
-#include <string>
-
-#include "humotion/client/middleware.h"
-
-namespace humotion {
-namespace client {
-
-class Client {
- public:
-    Client(std::string name, std::string mw);
-    ~Client();
-
-    bool ok();
-    void tick();
-
-    void update_mouth_target(MouthState s, bool send = false);
-    void update_gaze_target(GazeState s, bool send = false);
-
-    void send_all();
-
-
- private:
-    Middleware *middleware_;
-};
-
-}  // namespace client
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_CLIENT_CLIENT_H_
diff --git a/include/humotion/client/middleware.h b/include/humotion/client/middleware.h
deleted file mode 100644
index 5fdaf5a..0000000
--- a/include/humotion/client/middleware.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_H_
-#define INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_H_
-
-#include <cstdint>
-#include <cstdio>
-#include <string>
-
-#include "humotion/gaze_state.h"
-#include "humotion/mouth_state.h"
-
-namespace humotion {
-namespace client {
-
-class Middleware {
- public:
-    explicit Middleware(std::string name);
-    ~Middleware();
-
-    void update_mouth_target(MouthState s, bool send);
-    void update_gaze_target(GazeState s, bool send);
-    void send_all();
-
-    virtual void send_mouth_target() = 0;
-    virtual void send_gaze_target() = 0;
-    virtual bool ok() = 0;
-    virtual void tick() = 0;
-
- protected:
-    MouthState mouth_state_;
-    GazeState gaze_state_;
-    std::string base_scope_;
-};
-
-}  // namespace client
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_H_
diff --git a/include/humotion/client/middleware_ros.h b/include/humotion/client/middleware_ros.h
deleted file mode 100644
index 30e49a1..0000000
--- a/include/humotion/client/middleware_ros.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-#ifndef INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_ROS_H_
-#define INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_ROS_H_
-
-#include <boost/shared_ptr.hpp>
-#include <ros/ros.h>
-
-#include <string>
-
-#include "humotion/client/middleware.h"
-
-namespace humotion {
-namespace client {
-
-class MiddlewareROS : public Middleware {
- public:
-    explicit MiddlewareROS(std::string name);
-    ~MiddlewareROS();
-
-    void send_mouth_target();
-    void send_gaze_target();
-    bool ok();
-    void tick();
-
- private:
-    bool tick_necessary_;
-
-    ros::Publisher mouth_target_publisher_;
-    ros::Publisher gaze_target_publisher_;
-};
-
-}  // namespace client
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_ROS_H_
diff --git a/include/humotion/client/middleware_rsb.h b/include/humotion/client/middleware_rsb.h
deleted file mode 100644
index 13ec1ef..0000000
--- a/include/humotion/client/middleware_rsb.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_RSB_H_
-#define INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_RSB_H_
-// rsb support was dropped
-
-#endif  // INCLUDE_HUMOTION_CLIENT_MIDDLEWARE_RSB_H_
diff --git a/include/humotion/gaze_state.h b/include/humotion/gaze_state.h
deleted file mode 100644
index 28b5edd..0000000
--- a/include/humotion/gaze_state.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_GAZE_STATE_H_
-#define INCLUDE_HUMOTION_GAZE_STATE_H_
-
-#include <math.h>
-
-#include "humotion/timestamp.h"
-
-namespace humotion {
-
-class GazeState {
- public:
-        GazeState();
-        ~GazeState();
-
-        void dump();
-
-        // pan tilt roll
-        float pan;
-        float tilt;
-        float roll;
-
-        float pan_offset;
-        float tilt_offset;
-        float roll_offset;
-
-        // pan,tilt,roll can be relative or absolute
-        int gaze_type;
-
-        // when was this target requested?
-        Timestamp timestamp;
-
-        // is this relative or absolute
-        enum GAZE_STATE_TYPE{
-            GAZETYPE_ABSOLUTE = 0,
-            GAZETYPE_RELATIVE = 1,
-            GAZETYPE_OVERRIDE = 2
-        };
-
-        // eye vergence
-        float vergence;
-
-        // eyelid opening angle
-        float eyelid_opening_upper;
-        float eyelid_opening_lower;
-
-        // eyebrow angles
-        float eyebrow_left;
-        float eyebrow_right;
-
-        // eyeblink request
-        int eyeblink_request_left;
-        int eyeblink_request_right;
-        static const int EYEBLINK_TIME_DEFAULT = 150;  // in ms
-
-        float distance_pt_abs(GazeState b) {
-            float dist_pan = (b.pan + b.pan_offset) - (pan + pan_offset);
-            float dist_tilt = (b.tilt + b.tilt_offset) - (tilt + tilt_offset);
-            return sqrt(pow(dist_pan, 2.0) + pow(dist_tilt, 2.0));
-        }
-
-        float distance_tilt_abs(GazeState b) {
-            float dist_tilt = (b.tilt + b.tilt_offset) - (tilt + tilt_offset);
-            return fabs(dist_tilt);
-        }
-
-        float distance_pan_abs(GazeState b) {
-            float dist_pan = (b.pan + b.pan_offset) - (pan + pan_offset);
-            return fabs(dist_pan);
-        }
-};
-
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_GAZE_STATE_H_
diff --git a/include/humotion/mouth_state.h b/include/humotion/mouth_state.h
deleted file mode 100644
index fb33c11..0000000
--- a/include/humotion/mouth_state.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_MOUTH_STATE_H_
-#define INCLUDE_HUMOTION_MOUTH_STATE_H_
-
-#include <string>
-
-namespace humotion {
-
-class MouthState {
- public:
-        MouthState();
-        ~MouthState();
-
-        void dump();
-
-        float opening_left;
-        float opening_center;
-        float opening_right;
-
-        float position_left;
-        float position_center;
-        float position_right;
-};
-
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_MOUTH_STATE_H_
diff --git a/include/humotion/server/config.h b/include/humotion/server/config.h
deleted file mode 100644
index 62af23f..0000000
--- a/include/humotion/server/config.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-
-#ifndef INCLUDE_HUMOTION_SERVER_CONFIG_H_
-#define INCLUDE_HUMOTION_SERVER_CONFIG_H_
-
-#include <map>
-#include <string>
-
-namespace humotion {
-namespace server {
-
-typedef std::map<std::string, float> debug_data_t;
-
-class Config {
- public:
-    Config();
-    ~Config();
-    void init_defaults();
-
-    // ********************************************************
-    // NOTE: See config.cpp for explanations and default values
-    // ********************************************************
-
-    // publish debug information
-    bool publish_internals;
-
-    // saccade detection thresholds
-    float threshold_velocity_eye_saccade;
-    float threshold_angle_neck_saccade;
-    float threshold_angle_omr_limit;
-
-
-    // neck motion generation configuration
-    float scale_velocity_neck;
-    float scale_acceleration_neck;
-    float limit_velocity_neck;
-    float limit_acceleration_neck;
-
-    // eye motion generation configuration
-    float scale_velocity_eye;
-    float scale_acceleration_eye;
-    float limit_velocity_eye;
-    float limit_acceleration_eye;
-    bool use_neck_target_instead_of_position_eye;
-
-    // parameters fo the breathing pattern
-    float breath_period;
-    float breath_amplitude;
-
-    // parameters for eyelids
-    bool eyelids_follow_eyemotion;
-
-    // parameters for eye blinking
-    float eyeblink_duration;
-    float eyeblink_periodic_distribution_lower;
-    float eyeblink_periodic_distribution_upper;
-    float eyeblink_probability_after_saccade;
-    float eyeblink_blocked_time;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_CONFIG_H_
diff --git a/include/humotion/server/controller.h b/include/humotion/server/controller.h
deleted file mode 100644
index 4ea4f63..0000000
--- a/include/humotion/server/controller.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_CONTROLLER_H_
-#define INCLUDE_HUMOTION_SERVER_CONTROLLER_H_
-
-#include <string>
-#include <vector>
-
-#include "humotion/gaze_state.h"
-#include "humotion/mouth_state.h"
-#include "humotion/server/config.h"
-#include "humotion/server/joint_interface.h"
-#include "humotion/server/motion_generator.h"
-#include "humotion/timestamp.h"
-
-namespace humotion {
-namespace server {
-
-class Controller {
- public:
-    explicit Controller(JointInterface *j);
-    ~Controller();
-
-    void init_motion_generators();
-    void calculate_targets();
-    void publish_targets();
-    debug_data_t get_debug_data();
-
-    void set_gaze_target(GazeState s);
-    void set_mouth_target(MouthState s);
-    void set_activated(void);
-    Config* get_config();
-
- private:
-    int bla;
-    debug_data_t debug_data_;
-    void store_debug_data(std::string name, float value);
-
-    void add_motion_generator(MotionGenerator *m);
-    GazeState relative_gaze_to_absolute_gaze(GazeState relative);
-
-    typedef std::vector<MotionGenerator *> motion_generator_vector_t;
-    motion_generator_vector_t motion_generator_vector_;
-
-    JointInterface *joint_interface_;
-    Config *config_;
-
-    bool activated_;
-
-    Timestamp last_known_absolute_timestamp_;
-    double last_known_absolute_target_pan_;
-    double last_known_absolute_target_tilt_;
-    double last_known_absolute_target_roll_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_CONTROLLER_H_
diff --git a/include/humotion/server/eye_motion_generator.h b/include/humotion/server/eye_motion_generator.h
deleted file mode 100644
index 5626402..0000000
--- a/include/humotion/server/eye_motion_generator.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_EYE_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_EYE_MOTION_GENERATOR_H_
-
-#include "humotion/server/gaze_motion_generator.h"
-#include "humotion/timestamped_list.h"
-
-namespace humotion {
-namespace server {
-
-class EyeMotionGenerator : public GazeMotionGenerator {
- public:
-    EyeMotionGenerator(JointInterface *j, Config *cfg);
-    ~EyeMotionGenerator();
-
-    void calculate_targets();
-    void publish_targets();
-
-
-    // static const float SACCADE_SPEED_THRESHOLD;
- private:
-    void setup_eyemotion(int dof, float target, float current_position,
-                         float current_velocity, Timestamp timestamp);
-
-    TimestampedList tsl_gaze_target_pan_;
-    TimestampedList tsl_gaze_target_tilt_;
-    TimestampedList tsl_gaze_target_vergence_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_EYE_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/eyebrow_motion_generator.h b/include/humotion/server/eyebrow_motion_generator.h
deleted file mode 100644
index 4dbd2e4..0000000
--- a/include/humotion/server/eyebrow_motion_generator.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_EYEBROW_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_EYEBROW_MOTION_GENERATOR_H_
-
-#include "humotion/server/motion_generator.h"
-
-namespace humotion {
-namespace server {
-
-class EyebrowMotionGenerator : public MotionGenerator {
- public:
-    explicit EyebrowMotionGenerator(JointInterface *j, Config *cfg);
-    ~EyebrowMotionGenerator();
-    void calculate_targets();
-    void publish_targets();
-
- private:
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_EYEBROW_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/eyelid_motion_generator.h b/include/humotion/server/eyelid_motion_generator.h
deleted file mode 100644
index c674bd2..0000000
--- a/include/humotion/server/eyelid_motion_generator.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_EYELID_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_EYELID_MOTION_GENERATOR_H_
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/thread/thread_time.hpp>
-
-#include "humotion/server/eye_motion_generator.h"
-
-namespace humotion {
-namespace server {
-
-class EyelidMotionGenerator : public EyeMotionGenerator {
- public:
-    EyelidMotionGenerator(JointInterface *j, Config *cfg);
-    ~EyelidMotionGenerator();
-
-    void calculate_targets();
-    void publish_targets();
-
-
-
- private:
-    void start_external_eyeblinks(int duration_left, int duration_right);
-    void process_saccadic_eyeblinks();
-    void process_periodic_eyeblinks();
-    void handle_eyeblink_timeout();
-    void override_lids_for_eyeblink();
-    void check_for_saccade();
-    void start_eyeblink(int side, int duration);
-
-    void close_eyelid(int joint_id);
-
-    enum SIDE_ID {
-        LEFT = 0,
-        RIGHT
-    };
-
-    bool saccade_blink_active_;
-    bool saccade_blink_requested_;
-
-    bool eyeblink_active_[2];
-    bool eyelid_closed_[2];
-
-    boost::system_time periodic_blink_start_time_;
-    boost::system_time eyeblink_timeout_[2];
-    boost::system_time eyeblink_blocked_timeout_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_EYELID_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/gaze_motion_generator.h b/include/humotion/server/gaze_motion_generator.h
deleted file mode 100644
index c1c78b9..0000000
--- a/include/humotion/server/gaze_motion_generator.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_GAZE_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_GAZE_MOTION_GENERATOR_H_
-
-#include "humotion/server/reflexxes_motion_generator.h"
-#include "humotion/timestamped_list.h"
-
-namespace humotion {
-namespace server {
-
-class GazeMotionGenerator : public ReflexxesMotionGenerator {
- public:
-    GazeMotionGenerator(JointInterface *j, Config *cfg, int dof, float t);
-    ~GazeMotionGenerator();
-
-    void set_gaze_target(GazeState s);
-
- protected:
-    GazeState get_current_gaze();
-
-    bool get_eye_saccade_active();
-    bool neck_saccade_requested;
-    bool neck_saccade_omr;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_GAZE_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/joint_interface.h b/include/humotion/server/joint_interface.h
deleted file mode 100644
index 0242b65..0000000
--- a/include/humotion/server/joint_interface.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_JOINT_INTERFACE_H_
-#define INCLUDE_HUMOTION_SERVER_JOINT_INTERFACE_H_
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/thread/mutex.hpp>
-#include <boost/thread/thread.hpp>
-#include <boost/thread/thread_time.hpp>
-
-#include <cstdint>
-#include <cstdio>
-#include <map>
-#include <string>
-
-#include "humotion/gaze_state.h"
-#include "humotion/mouth_state.h"
-#include "humotion/timestamped_list.h"
-
-namespace humotion {
-namespace server {
-
-// forward declaration to solve include loop
-class Controller;
-
-
-class JointInterface {
- public:
-    JointInterface();
-    ~JointInterface();
-
-    void set_target(int joint_id, float position, float velocity);
-    float get_target_position(int joint_id);
-    float get_target_velocity(int joint_id);
-
-    void publish_target(int joint_id);
-    virtual void publish_target(int joint_id, float position, float velocity) = 0;
-    virtual void execute_motion() = 0;
-
-    typedef std::map<int, TimestampedList> joint_tsl_map_t;
-
-    TimestampedList get_ts_position(int joint_id);
-    TimestampedList get_ts_speed(int joint_id);
-
-    void set_framerate(float f);
-
-    void enable_mouth_joints();
-    void disable_mouth_joints();
-    bool mouth_target_input_active();
-
-    void enable_gaze_joints();
-    void disable_gaze_joints();
-    bool gaze_target_input_active();
-
-    float get_joint_min(int joint_id);
-    float get_joint_max(int joint_id);
-
-    void dump_angles();
-
-    unsigned int get_and_clear_incoming_position_count();
-
-    enum JOINT_ID_ENUM{
-        ZERO = 0,
-        ID_LIP_LEFT_UPPER,
-        ID_LIP_LEFT_LOWER,
-        ID_LIP_CENTER_UPPER,
-        ID_LIP_CENTER_LOWER,
-        ID_LIP_RIGHT_UPPER,
-        ID_LIP_RIGHT_LOWER,
-        ID_NECK_PAN,
-        ID_NECK_TILT,
-        ID_NECK_ROLL,
-        ID_EYES_LEFT_LR,
-        ID_EYES_RIGHT_LR,
-        ID_EYES_BOTH_UD,
-        ID_EYES_LEFT_LID_LOWER,
-        ID_EYES_LEFT_LID_UPPER,
-        ID_EYES_RIGHT_LID_LOWER,
-        ID_EYES_RIGHT_LID_UPPER,
-        ID_EYES_LEFT_BROW,
-        ID_EYES_RIGHT_BROW,
-        ID_DUMMY_0,
-        ID_DUMMY_1,
-        ID_DUMMY_2,
-        JOINT_ID_ENUM_SIZE
-    };
-
-    bool get_joint_position_map_empty();
-
-    void store_incoming_position(int joint_id, float position, Timestamp timestamp);
-    void store_incoming_velocity(int joint_id, float velocity, Timestamp timestamp);
-
- protected:
-    virtual void enable_joint(int id) = 0;
-    virtual void disable_joint(int id) = 0;
-    float framerate;
-
-    float joint_min[JOINT_ID_ENUM_SIZE];
-    float joint_max[JOINT_ID_ENUM_SIZE];
-
-
-
- private:
-    float joint_target_position_[JOINT_ID_ENUM_SIZE];
-    float joint_target_velocity_[JOINT_ID_ENUM_SIZE];
-
-    boost::mutex joint_ts_position_map_access_mutex_;
-    boost::mutex joint_ts_speed_map_access_mutex_;
-    joint_tsl_map_t joint_ts_position_map_;
-    joint_tsl_map_t joint_ts_speed_map_;
-
-    bool mouth_enabled_;
-    bool gaze_enabled_;
-    unsigned int incoming_position_count_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_JOINT_INTERFACE_H_
diff --git a/include/humotion/server/middleware.h b/include/humotion/server/middleware.h
deleted file mode 100644
index e20b662..0000000
--- a/include/humotion/server/middleware.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_MIDDLEWARE_H_
-#define INCLUDE_HUMOTION_SERVER_MIDDLEWARE_H_
-
-#include <cstdint>
-#include <cstdio>
-#include <map>
-#include <string>
-#include <utility>
-
-#include "humotion/gaze_state.h"
-#include "humotion/mouth_state.h"
-#include "humotion/server/controller.h"
-
-namespace humotion {
-namespace server {
-
-class Middleware {
- public:
-    Middleware(std::string name, Controller *c);
-    ~Middleware();
-
-    virtual bool ok() = 0;
-    virtual void tick() = 0;
-
-    virtual void publish_debug_dataset(debug_data_t) = 0;
-
- protected:
-    Controller *controller_;
-    std::string base_scope_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_MIDDLEWARE_H_
diff --git a/include/humotion/server/middleware_ros.h b/include/humotion/server/middleware_ros.h
deleted file mode 100644
index 44d4b3e..0000000
--- a/include/humotion/server/middleware_ros.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_MIDDLEWARE_ROS_H_
-#define INCLUDE_HUMOTION_SERVER_MIDDLEWARE_ROS_H_
-
-#include <boost/shared_ptr.hpp>
-#include <dynamic_reconfigure/server.h>
-#include <ros/ros.h>
-
-#include <map>
-#include <string>
-#include <utility>
-
-#include "humotion/gaze.h"
-#include "humotion/humotionConfig.h"
-#include "humotion/mouth.h"
-#include "humotion/server/middleware.h"
-
-namespace humotion {
-namespace server {
-
-class MiddlewareROS : public Middleware {
- public:
-    MiddlewareROS(std::string name, Controller *c);
-    ~MiddlewareROS();
-    bool ok();
-    void tick();
-
-    void dynamic_reconfigure_callback(const humotion::humotionConfig &config, uint32_t level);
-    void publish_debug_dataset(debug_data_t);
-
- private:
-    void publish_debug_data(std::string name, float value);
-
-    void incoming_mouth_target(const humotion::mouth::ConstPtr& msg);
-    void incoming_gaze_target(const humotion::gaze::ConstPtr& msg);
-    void attach_to_reconfiguration_server(ros::NodeHandle priv_nodehandle);
-    void debug_initialize();
-
-    bool tick_necessary_;
-    bool debug_initialized_;
-
-    ros::Subscriber mouth_target_subscriber_;
-    ros::Subscriber gaze_target_subscriber_;
-
-    ros::NodeHandle nh_;
-
-    typedef std::map<std::string, ros::Publisher> debug_topic_map_t;
-    debug_topic_map_t debug_topic_map;
-
-    dynamic_reconfigure::Server<humotion::humotionConfig> *reconf_server_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_MIDDLEWARE_ROS_H_
diff --git a/include/humotion/server/middleware_rsb.h b/include/humotion/server/middleware_rsb.h
deleted file mode 100644
index ab8ecdc..0000000
--- a/include/humotion/server/middleware_rsb.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_MIDDLEWARE_RSB_H_
-#define INCLUDE_HUMOTION_SERVER_MIDDLEWARE_RSB_H_
-// rsb support was dropped
-
-#endif  // INCLUDE_HUMOTION_SERVER_MIDDLEWARE_RSB_H_
diff --git a/include/humotion/server/motion_generator.h b/include/humotion/server/motion_generator.h
deleted file mode 100644
index 1664539..0000000
--- a/include/humotion/server/motion_generator.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_MOTION_GENERATOR_H_
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-#include <map>
-#include <string>
-
-#include "humotion/server/config.h"
-#include "humotion/server/joint_interface.h"
-
-namespace humotion {
-namespace server {
-
-class MotionGenerator {
- public:
-    MotionGenerator(JointInterface *j, Config *cfg);
-    ~MotionGenerator();
-
-    virtual void calculate_targets() = 0;
-    virtual void publish_targets() = 0;
-
-    virtual void set_gaze_target(GazeState s);
-    virtual void set_mouth_target(MouthState s);
-
-    debug_data_t get_debug_data();
-
-
- protected:
-    Config *config;
-    debug_data_t debug_data_;
-    void store_debug_data(std::string name, float value);
-
-    float get_current_position(int joint_id);
-    float get_current_speed(int joint_id);
-    humotion::Timestamp get_timestamped_state(int joint_id, float *position, float *velocity);
-
-    float limit_target(int joint_id, float val);
-    bool mouth_target_input_active();
-    bool gaze_target_input_active();
-
-    JointInterface *joint_interface_;
-
-    // gaze
-    GazeState  requested_gaze_state_;
-    boost::system_time last_gaze_target_update_;
-
-    // mouth
-    MouthState requested_mouth_target_;
-    boost::system_time last_mouth_target_update_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/mouth_motion_generator.h b/include/humotion/server/mouth_motion_generator.h
deleted file mode 100644
index 4b22e37..0000000
--- a/include/humotion/server/mouth_motion_generator.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_MOUTH_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_MOUTH_MOTION_GENERATOR_H_
-
-#include "humotion/server/motion_generator.h"
-
-namespace humotion {
-namespace server {
-
-class MouthMotionGenerator : public MotionGenerator {
- public:
-    MouthMotionGenerator(JointInterface *j, Config *cfg);
-    ~MouthMotionGenerator();
-    void calculate_targets();
-    void publish_targets();
-
- private:
-    void calculate_mouth_target(int upper, int lower);
-    float mouthstate_to_opening(MouthState m, int e);
-    float mouthstate_to_position(MouthState m, int e);
-    void update_mouth_target(int upper_id, int lower_id);
-
-    // minimum mouth opening
-    static const float MOUTH_MIN_OPENING;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_MOUTH_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/neck_motion_generator.h b/include/humotion/server/neck_motion_generator.h
deleted file mode 100644
index ee94b34..0000000
--- a/include/humotion/server/neck_motion_generator.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_NECK_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_NECK_MOTION_GENERATOR_H_
-#include "humotion/server/gaze_motion_generator.h"
-
-namespace humotion {
-namespace server {
-
-class NeckMotionGenerator : public GazeMotionGenerator {
- public:
-    NeckMotionGenerator(JointInterface *j, Config *cfg);
-    ~NeckMotionGenerator();
-    void calculate_targets();
-    void publish_targets();
-    void setup_neckmotion(int dof, float target, float current_position,
-                          float current_velocity, Timestamp timestamp);
-
- private:
-    float get_breath_offset();
-
-    GazeState previous_neck_target_;
-    GazeState  requested_neck_state_;
-    bool neck_saccade_reached_goal_;
-    bool neck_saccade_active_;
-    float breath_time_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_NECK_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/reflexxes_motion_generator.h b/include/humotion/server/reflexxes_motion_generator.h
deleted file mode 100644
index 553c5da..0000000
--- a/include/humotion/server/reflexxes_motion_generator.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_REFLEXXES_MOTION_GENERATOR_H_
-#define INCLUDE_HUMOTION_SERVER_REFLEXXES_MOTION_GENERATOR_H_
-
-#include <ReflexxesAPI.h>
-#include <RMLPositionFlags.h>
-#include <RMLPositionInputParameters.h>
-#include <RMLPositionOutputParameters.h>
-
-#include "humotion/server/motion_generator.h"
-
-namespace humotion {
-namespace server {
-
-class ReflexxesMotionGenerator : public MotionGenerator{
- public:
-    ReflexxesMotionGenerator(JointInterface *j, Config *cfg, int dof, float t);
-    ~ReflexxesMotionGenerator();
-
- protected:
-    void reflexxes_set_input(int dof, float target,
-                             float current_position, float current_velocity,
-                             Timestamp timestamp, float max_speed, float max_accel);
-    void reflexxes_calculate_profile();
-
-    //*****************************************
-    ReflexxesAPI *reflexxes_api;
-    RMLPositionInputParameters *reflexxes_position_input;
-    RMLPositionOutputParameters *reflexxes_position_output;
-    RMLPositionFlags reflexxes_motion_flags;
-    //*****************************************
-    int dof_count;
-
- private:
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_REFLEXXES_MOTION_GENERATOR_H_
diff --git a/include/humotion/server/server.h b/include/humotion/server/server.h
deleted file mode 100644
index 3112f2e..0000000
--- a/include/humotion/server/server.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_SERVER_SERVER_H_
-#define INCLUDE_HUMOTION_SERVER_SERVER_H_
-
-#include <boost/thread/thread.hpp>
-#include <ros/ros.h>
-
-#include <cstdint>
-#include <cstdio>
-#include <string>
-
-#include "humotion/server/controller.h"
-#include "humotion/server/middleware.h"
-
-namespace humotion {
-namespace server {
-
-class Server {
- public:
-    Server(std::string name, std::string mw, JointInterface *_joint_interface);
-    ~Server();
-    bool ok();
-    static const float MOTION_UPDATERATE;
-
- private:
-    void start_motion_generation_thread();
-    void motion_generation_thread();
-    boost::thread *motion_generation_thread_ptr_;
-
-    Middleware *middleware_;
-    Controller *controller_;
-    JointInterface *joint_interface_;
-};
-
-}  // namespace server
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_SERVER_SERVER_H_
diff --git a/include/humotion/timestamp.h b/include/humotion/timestamp.h
deleted file mode 100644
index b605522..0000000
--- a/include/humotion/timestamp.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_TIMESTAMP_H_
-#define INCLUDE_HUMOTION_TIMESTAMP_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <string>
-
-namespace humotion {
-
-class Timestamp {
- public:
-    Timestamp(void);
-    Timestamp(uint32_t _sec, uint32_t _nsec);
-    explicit Timestamp(double dsec);
-
-    void set(uint32_t _sec, uint32_t _nsec);
-    void set(Timestamp a);
-
-    static Timestamp now(void);
-
-    bool is_null(void);
-    double to_seconds(void);
-
-    bool operator>  (const Timestamp &cmp) const;
-    bool operator<= (const Timestamp &cmp) const;
-    bool operator<  (const Timestamp &cmp) const;
-    bool operator>= (const Timestamp &cmp) const;
-    bool operator== (const Timestamp &cmp) const;
-    bool operator!= (const Timestamp &cmp) const;
-
-    uint32_t sec;
-    uint32_t nsec;
-};
-
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_TIMESTAMP_H_
diff --git a/include/humotion/timestamped_float.h b/include/humotion/timestamped_float.h
deleted file mode 100644
index 87778a6..0000000
--- a/include/humotion/timestamped_float.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_TIMESTAMPED_FLOAT_H_
-#define INCLUDE_HUMOTION_TIMESTAMPED_FLOAT_H_
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string>
-#include "humotion/timestamp.h"
-
-namespace humotion {
-
-class TimestampedFloat {
- public:
-    TimestampedFloat() : timestamp(0, 0) {
-        value = 0.0;
-    }
-
-    TimestampedFloat(Timestamp ts, float val) {
-        timestamp = ts;
-        value = val;
-    }
-
-    Timestamp timestamp;
-    float value;
-};
-
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_TIMESTAMPED_FLOAT_H_
diff --git a/include/humotion/timestamped_list.h b/include/humotion/timestamped_list.h
deleted file mode 100644
index 0daf71b..0000000
--- a/include/humotion/timestamped_list.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#ifndef INCLUDE_HUMOTION_TIMESTAMPED_LIST_H_
-#define INCLUDE_HUMOTION_TIMESTAMPED_LIST_H_
-
-#include <boost/thread/mutex.hpp>
-
-#include <list>
-
-#include "humotion/timestamp.h"
-#include "humotion/timestamped_float.h"
-
-namespace humotion {
-class TimestampedList {
- public:
-    // defaults to 10 seconds, this is way too much but should do
-    explicit TimestampedList(unsigned int size = 10*100);
-    TimestampedList(TimestampedList const &l);
-
-    typedef std::list<TimestampedFloat> timestamped_float_list_t;
-
-    void insert(Timestamp ts, float val);
-    float get_interpolated_value(Timestamp target_ts);
-    float get_newest_value();
-    static void run_tests();
-    void copy_tsf_list_to(timestamped_float_list_t *target);
-    Timestamp get_last_timestamp();
-    Timestamp get_first_timestamp();
-
- private:
-    mutable boost::mutex access_mutex_;
-    float interpolate(TimestampedFloat a, TimestampedFloat b, Timestamp timestamp);
-    timestamped_float_list_t tsf_list_;
-};
-
-}  // namespace humotion
-
-#endif  // INCLUDE_HUMOTION_TIMESTAMPED_LIST_H_
diff --git a/msg/gaze.msg b/msg/gaze.msg
deleted file mode 100644
index 9318c06..0000000
--- a/msg/gaze.msg
+++ /dev/null
@@ -1,25 +0,0 @@
-Header header
-
-#type of pan/tilt/roll targets
-time gaze_timestamp
-int32 gaze_type
-int32 GAZETYPE_ABSOLUTE=0
-int32 GAZETYPE_RELATIVE=1
-
-float32 pan
-float32 tilt
-float32 roll
-float32 vergence
-
-float32 pan_offset
-float32 tilt_offset
-float32 roll_offset
-
-float32 eyelid_opening_upper
-float32 eyelid_opening_lower
-
-float32 eyebrow_left
-float32 eyebrow_right
-
-int32 eyeblink_request_left
-int32 eyeblink_request_right
diff --git a/msg/mouth.msg b/msg/mouth.msg
deleted file mode 100644
index a0c80c6..0000000
--- a/msg/mouth.msg
+++ /dev/null
@@ -1,4 +0,0 @@
-Header header
-
-position_lcr position
-position_lcr opening
diff --git a/msg/position_lcr.msg b/msg/position_lcr.msg
deleted file mode 100644
index 4f1a746..0000000
--- a/msg/position_lcr.msg
+++ /dev/null
@@ -1,3 +0,0 @@
-float32 left
-float32 center
-float32 right
diff --git a/msg/state.msg b/msg/state.msg
deleted file mode 100644
index b8588d7..0000000
--- a/msg/state.msg
+++ /dev/null
@@ -1,13 +0,0 @@
-Header header
-
-float32 gaze_pan_l
-float32 gaze_pan_r
-float32 gaze_tilt
-
-float32 mouth_opening_left
-float32 mouth_opening_center
-float32 mouth_opening_right
-
-float32 mouth_position_left
-float32 mouth_position_center
-float32 mouth_position_right
diff --git a/package.xml b/package.xml
deleted file mode 100644
index 8c236ed..0000000
--- a/package.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0"?>
-<package>
-  <name>humotion</name>
-  <version>0.0.1</version>
-  <description>the human motion library</description>
-
-  <!-- One maintainer tag required, multiple allowed, one person per tag --> 
-  <maintainer email="sschulz@todo.todo">Simon Schulz</maintainer>
-
-
-  <!-- One license tag required, multiple allowed, one license per tag -->
-  <!-- Commonly used license strings: -->
-  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
-  <license>TODO</license>
-
-
-  <!-- Url tags are optional, but mutiple are allowed, one per tag -->
-  <!-- Optional attribute type can be: website, bugtracker, or repository -->
-  <!-- Example: -->
-  <url type="website">https://projects.cit-ec.uni-bielefeld.de/git/flobidev.core.git</url> -->
-
-
-  <!-- Author tags are optional, mutiple are allowed, one per tag -->
-  <!-- Authors do not have to be maintianers, but could be -->
-  <!-- Example: -->
-  <!-- <author email="jane.doe@example.com">Jane Doe</author> -->
-
-
-  <!-- The *_depend tags are used to specify dependencies -->
-  <!-- Dependencies can be catkin packages or system dependencies -->
-  <!-- Examples: -->
-  <!-- Use build_depend for packages you need at compile time: -->
-  <!-- <build_depend>message_generation</build_depend> -->
-  <!-- Use buildtool_depend for build tool packages: -->
-  <!--   <buildtool_depend>catkin</buildtool_depend> -->
-  <!-- Use run_depend for packages you need at runtime: -->
-  <!-- <run_depend>message_runtime</run_depend> -->
-  <!-- Use test_depend for packages you need only for testing: -->
-  <!--   <test_depend>gtest</test_depend> -->
-  <buildtool_depend>catkin</buildtool_depend>
-  <build_depend>roscpp</build_depend>
-  <build_depend>std_msgs</build_depend>
-  <!-- <run_depend>roscpp</run_depend> -->
-  <!-- <run_depend>std_msgs</run_depend> -->
-
-  <!--<build_depend>actionlib</build_depend>
-  <build_depend>actionlib_msgs</build_depend>
-  <run_depend>actionlib</run_depend> -->
-  <!-- <run_depend>actionlib_msgs</run_depend> -->
-
-  <!-- The export tag contains other, unspecified, tags -->
-  <export>
-    <!-- You can specify that this package is a metapackage here: -->
-    <!-- <metapackage/> -->
-
-    <!-- Other tools can request additional information be placed here -->
-
-  </export>
-</package>
diff --git a/src/client/client.cpp b/src/client/client.cpp
deleted file mode 100644
index 8d08930..0000000
--- a/src/client/client.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <boost/algorithm/string.hpp>
-#include <string>
-
-#include "humotion/client/client.h"
-#include "humotion/client/middleware_ros.h"
-
-// using namespace std;
-// using namespace boost;
-// using namespace humotion;
-using humotion::client::Client;
-
-//! constructor
-//! open a new client instance.
-Client::Client(std::string scope, std::string mw) {
-    // convert mw to uppercase
-    boost::to_upper(mw);
-
-    printf("> initializing humotion client (on %s, middleware=%s)\n", scope.c_str(), mw.c_str());
-
-    // start middleware
-    if (mw == "ROS") {
-        middleware_ = new humotion::client::MiddlewareROS(scope);
-    } else {
-        printf("> ERROR: invalid mw '%s' given. RSB support was droppd. please use ROS\n\n",
-               mw.c_str());
-        exit(EXIT_FAILURE);
-    }
-}
-
-//! destructor
-Client::~Client() {
-}
-
-//! check if connection is ok
-//! \return true if conn is alive
-bool Client::ok() {
-    return middleware_->ok();
-}
-
-//! do a single middleware tick:
-void Client::tick() {
-    middleware_->tick();
-}
-
-//! set mouth position
-//! \param MouthState m to set
-//! \param send data to server (optional, use manual call to send_*() to trigger update on server)
-void Client::update_mouth_target(MouthState m, bool send) {
-    middleware_->update_mouth_target(m, send);
-}
-
-//! set gaze direction
-//! \param GazeState m to set
-//! \param send data to server (optional, use manual call to send_*() to trigger update on server)
-void Client::update_gaze_target(GazeState s, bool send) {
-    middleware_->update_gaze_target(s, send);
-}
-
-
-//! send all targets to server
-void Client::send_all() {
-    middleware_->send_all();
-}
-
diff --git a/src/client/middleware.cpp b/src/client/middleware.cpp
deleted file mode 100644
index 0ad84ec..0000000
--- a/src/client/middleware.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/client/middleware.h"
-#include <string>
-
-// using namespace std;
-// using namespace humotion;
-// using namespace humotion::client;
-
-using humotion::client::Middleware;
-
-//! constructor
-//! open a new Middleware instance.
-Middleware::Middleware(std::string scope) {
-    base_scope_ = scope;
-}
-
-//! destructor
-Middleware::~Middleware() {
-}
-
-
-//! set mouth position
-//! \param MouthState m to set
-//! \param send data to server (optional, use manual call to send_*() to trigger update on server)
-void Middleware::update_mouth_target(MouthState m, bool send) {
-    mouth_state_ = m;
-    if (send) {
-        send_mouth_target();
-    }
-}
-
-//! set gaze target
-//! \param GazeState m to set
-//! \param send data to server (optional, use manual call to send_*() to trigger update on server)
-void Middleware::update_gaze_target(GazeState s, bool send) {
-    gaze_state_ = s;
-    if (send) {
-        send_gaze_target();
-    }
-}
-
-
-//! send all targets to server
-void Middleware::send_all() {
-    send_mouth_target();
-    send_gaze_target();
-}
-
diff --git a/src/client/middleware_ros.cpp b/src/client/middleware_ros.cpp
deleted file mode 100644
index 9247baa..0000000
--- a/src/client/middleware_ros.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <boost/algorithm/string/classification.hpp>
-#include <string>
-
-#include "humotion/client/middleware_ros.h"
-#include "humotion/gaze.h"
-#include "humotion/mouth.h"
-
-
-// using namespace std;
-// using namespace boost;
-// using namespace humotion;
-using humotion::client::MiddlewareROS;
-
-//! constructor
-MiddlewareROS::MiddlewareROS(std::string scope) : Middleware(scope) {
-    // start ros core
-    if (!ros::isInitialized()) {
-        tick_necessary_ = true;
-        std::string node_name = "humotion_client__"+ base_scope_;
-        node_name.erase(std::remove(node_name.begin(), node_name.end(), '/'), node_name.end());
-
-        ros::M_string no_remapping;
-        ros::init(no_remapping, node_name);
-    } else {
-        // another ros thread already takes care of spinning
-        tick_necessary_ = false;
-    }
-
-    // create node handle
-    ros::NodeHandle n;
-
-    // set up publishers
-    mouth_target_publisher_ = n.advertise<humotion::mouth>(base_scope_ +
-                                                          "/humotion/mouth/target", 100);
-    gaze_target_publisher_  = n.advertise<humotion::gaze>(base_scope_ +
-                                                         "/humotion/gaze/target", 100);
-}
-
-//! destructor
-MiddlewareROS::~MiddlewareROS() {
-}
-
-//! connection ok?
-//! \return true if conn is alive
-bool MiddlewareROS::ok() {
-    return ros::ok();
-}
-
-//! do a single tick
-void MiddlewareROS::tick() {
-    if (tick_necessary_) {
-        ros::spinOnce();
-    }
-}
-
-
-//! send mouth target to server
-void MiddlewareROS::send_mouth_target() {
-    // build target packet
-    humotion::mouth msg;
-
-    // set timestamp
-    msg.header.stamp = ros::Time::now();
-
-    msg.position.left   = mouth_state_.position_left;
-    msg.position.center = mouth_state_.position_center;
-    msg.position.right  = mouth_state_.position_right;
-
-    msg.opening.left   = mouth_state_.opening_left;
-    msg.opening.center = mouth_state_.opening_center;
-    msg.opening.right  = mouth_state_.opening_right;
-
-
-    // add position to send queue
-    mouth_target_publisher_.publish(msg);
-
-    // allow ros to handle data
-    tick();
-}
-
-//! send mouth target to server
-void MiddlewareROS::send_gaze_target() {
-    // build target packet
-    humotion::gaze msg;
-
-    // set timestamp
-    msg.header.stamp = ros::Time::now();
-
-    msg.pan   = gaze_state_.pan;
-    msg.tilt  = gaze_state_.tilt;
-    msg.roll  = gaze_state_.roll;
-    msg.vergence = gaze_state_.vergence;
-
-    msg.pan_offset = gaze_state_.pan_offset;
-    msg.tilt_offset = gaze_state_.tilt_offset;
-    msg.roll_offset = gaze_state_.roll_offset;
-
-    msg.eyelid_opening_upper = gaze_state_.eyelid_opening_upper;
-    msg.eyelid_opening_lower = gaze_state_.eyelid_opening_lower;
-
-    msg.eyebrow_left = gaze_state_.eyebrow_left;
-    msg.eyebrow_right = gaze_state_.eyebrow_right;
-
-    msg.eyeblink_request_left = gaze_state_.eyeblink_request_left;
-    msg.eyeblink_request_right = gaze_state_.eyeblink_request_right;
-
-    if (gaze_state_.gaze_type == GazeState::GAZETYPE_ABSOLUTE) {
-        msg.gaze_type = humotion::gaze::GAZETYPE_ABSOLUTE;
-    } else {
-        msg.gaze_type = humotion::gaze::GAZETYPE_RELATIVE;
-    }
-    msg.gaze_timestamp.sec = gaze_state_.timestamp.sec;
-    msg.gaze_timestamp.nsec = gaze_state_.timestamp.nsec;
-
-    // add position to send queue
-    gaze_target_publisher_.publish(msg);
-
-    // allow ros to handle data
-    tick();
-}
-
diff --git a/src/client/middleware_rsb.cpp b/src/client/middleware_rsb.cpp
deleted file mode 100644
index 1500cea..0000000
--- a/src/client/middleware_rsb.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "client/middleware_rsb.h"
-
-#ifdef RSB_SUPPORT
-
-#define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1
-#include <rsb/converter/ProtocolBufferConverter.h>
-#include <rsb/converter/Repository.h>
-#include <rsb/Factory.h>
-#include <rsb/Listener.h>
-#include <rsb/MetaData.h>
-#include <rsb/patterns/RemoteServer.h>
-#include <string>
-
-#include "humotion/gaze.h"
-#include "humotion/mouth.h"
-
-// using namespace std;
-// using namespace rsb;
-// using namespace boost;
-// using namespace humotion;
-using humotion::client::MiddlewareRSB;
-
-//! constructor
-MiddlewareRSB::MiddlewareRSB(string scope) : Middleware(scope) {
-    printf("> registering converters\n");
-
-    try {
-        // converter for GazeTarget
-        rsb::converter::Converter<string>::Ptr gazeTargetConverter(
-                    new rsb::converter::ProtocolBufferConverter<rst::robot::HumotionGazeTarget>());
-        rsb::converter::converterRepository<string>()->registerConverter(gazeTargetConverter);
-    } catch (std::invalid_argument e) {
-        printf("> it seems like a converter for rst::robot::HumotionGazeTarget "
-               "is already registered. fine, will not add another converter\n");
-    }
-
-    try {
-        // converter for MouthTarget
-        rsb::converter::Converter<string>::Ptr mouthTargetConverter(
-                    new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
-        rsb::converter::converterRepository<std::string>()->registerConverter(mouthTargetConverter);
-    } catch (std::invalid_argument e) {
-        printf("> it seems like a converter for rst::robot::MouthTarget is "
-               "already registered. fine, will not add another converter\n");
-    }
-
-
-    // first get a factory instance that is used to create RSB domain objects
-    Factory &factory = getFactory();
-
-    // create informer
-    mouth_target_informer = factory.createInformer<rst::robot::MouthTarget>
-            (base_scope + "/humotion/mouth/target");
-    gaze_target_informer  = factory.createInformer<rst::robot::HumotionGazeTarget>
-            (base_scope + "/humotion/gaze/target");
-
-    printf("> MiddlewareRSB initialised\n");
-}
-
-//! destructor
-MiddlewareRSB::~MiddlewareRSB() {
-}
-
-//! connection ok?
-//! \return true if conn is alive
-bool MiddlewareRSB::ok() {
-    return true;
-}
-
-//! do a single tick
-void MiddlewareRSB::tick() {
-    // nothing to do
-}
-
-
-//! send mouth target to server
-void MiddlewareRSB::send_mouth_target() {
-    // build target packet
-    boost::shared_ptr<rst::robot::MouthTarget> request(new rst::robot::MouthTarget());
-
-    request->set_position_left(mouth_state.position_left);
-    request->set_position_center(mouth_state.position_center);
-    request->set_position_right(mouth_state.position_right);
-
-    request->set_opening_left(mouth_state.opening_left);
-    request->set_opening_center(mouth_state.opening_center);
-    request->set_opening_right(mouth_state.opening_right);
-
-
-    mouth_target_informer->publish(request);
-}
-
-//! send mouth target to server
-void MiddlewareRSB::send_gaze_target(int gaze_type) {
-    // build target packet
-    boost::shared_ptr<rst::robot::HumotionGazeTarget> request(new rst::robot::HumotionGazeTarget());
-
-    request->set_pan(gaze_state.pan);
-    request->set_tilt(gaze_state.tilt);
-    request->set_roll(gaze_state.roll);
-    request->set_vergence(gaze_state.vergence);
-
-    request->set_pan_offset(gaze_state.pan_offset);
-    request->set_tilt_offset(gaze_state.tilt_offset);
-    request->set_roll_offset(gaze_state.roll_offset);
-
-    request->set_eyelid_opening_upper(gaze_state.eyelid_opening_upper);
-    request->set_eyelid_opening_lower(gaze_state.eyelid_opening_lower);
-
-    request->set_eyebrow_left(gaze_state.eyebrow_left);
-    request->set_eyebrow_right(gaze_state.eyebrow_right);
-
-    request->set_eyeblink_request_left(gaze_state.eyeblink_request_left);
-    request->set_eyeblink_request_right(gaze_state.eyeblink_request_right);
-
-    if (gaze_state.type == GazeState::ABSOLUTE) {
-        request->set_type(rst::robot::HumotionGazeTarget::ABSOLUTE);
-    } else {
-        request->set_type(rst::robot::HumotionGazeTarget::RELATIVE);
-    }
-
-
-    // add position to send queue
-    gaze_target_informer->publish(request);
-}
-
-#endif
diff --git a/src/gaze_state.cpp b/src/gaze_state.cpp
deleted file mode 100644
index 9a4550d..0000000
--- a/src/gaze_state.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <stdio.h>
-
-#include "humotion/gaze_state.h"
-
-using humotion::GazeState;
-
-GazeState::GazeState() {
-    pan = 0.0;
-    tilt = 0.0;
-    roll = 0.0;
-    vergence = 0.0;
-
-    pan_offset = 0.0;
-    tilt_offset = 0.0;
-    roll_offset = 0.0;
-
-    eyelid_opening_upper = 35.0;
-    eyelid_opening_lower = 35.0;
-
-    eyebrow_left   = -3.0;
-    eyebrow_right  = 3.0;
-
-    gaze_type = GAZETYPE_ABSOLUTE;
-
-    eyeblink_request_right = 0;
-    eyeblink_request_left  = 0;
-}
-
-GazeState::~GazeState() {
-}
-
-void GazeState::dump() {
-    // dump values to stdout
-    printf("> GAZE STATE: %4.2f [%2.1f] %4.2f [%2.1f] %4.2f [%2.1f] (PTR) vergence=%4.2f "
-           "eyelid_opening=%4.2f/%4.2f eyebrows = %4.2f %4.2f type=%s [ts=%.3f] "
-           "eyeblink_requests=%d %d\n",
-           pan, pan_offset, tilt, tilt_offset, roll, roll_offset, vergence,
-           eyelid_opening_upper, eyelid_opening_lower,
-           eyebrow_left, eyebrow_right,
-           (gaze_type == GAZETYPE_ABSOLUTE?"absolute":(gaze_type == GAZETYPE_RELATIVE?"relative":
-                (gaze_type == GAZETYPE_OVERRIDE?"override":"!INVALID!"))),
-           timestamp.to_seconds(),
-           eyeblink_request_left, eyeblink_request_right);
-}
diff --git a/src/mouth_state.cpp b/src/mouth_state.cpp
deleted file mode 100644
index f0c9382..0000000
--- a/src/mouth_state.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <stdio.h>
-
-#include "humotion/mouth_state.h"
-
-using humotion::MouthState;
-
-MouthState::MouthState() {
-    opening_left = 0.0;
-    opening_center = 0.0;
-    opening_right = 0.0;
-
-    position_left = 0.0;
-    position_center = 0.0;
-    position_right = 0.0;
-}
-
-MouthState::~MouthState() {
-}
-
-void MouthState::dump() {
-    // dump values to stdout
-    printf("> MOUTH STATE: %4.2f (%4.2f) %4.2f (%4.2f) %4.2f (%4.2f)  [= pos (opening)]\n",
-           position_left, opening_left,
-           position_center, opening_center,
-           position_right, opening_right);
-}
diff --git a/src/server/config.cpp b/src/server/config.cpp
deleted file mode 100644
index 1712c5d..0000000
--- a/src/server/config.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/config.h"
-
-using humotion::server::Config;
-
-Config::Config() {
-    init_defaults();
-}
-
-
-Config::~Config() {
-}
-
-void Config::init_defaults() {
-    // publish internal debug data as topics?
-    publish_internals = false;
-
-    // saccade detection thresholds:
-    // 1) velocity threshold, values above this value trigger an eye saccade
-    //    value is given in deg/s
-    threshold_velocity_eye_saccade = 15.0;
-
-    // 2) angular threshold, a target change higher than this value will trigger a neck saccade
-    //    value is given in deg
-    threshold_angle_neck_saccade = 15.0;
-
-    // 3) eyes reaching ocolumotor limits will trigger correction saccade
-    //    value given in percent (NOTE: 1.0 = 100%)
-    threshold_angle_omr_limit = 0.35;
-
-
-    // neck motion generation configuration
-    // humotion calculates neck velocities based on the linear equation Hmax from
-    // [Guitton87] "Gaze control in humans: eye-head coordination during orienting movements ..."
-    // In order to allow better adaption to the robot capabilities humotion allows to
-    // scale the calculated velocity, value is given in percent (NOTE: 1.0 = 100% human velocity)
-    scale_velocity_neck = 0.45;
-
-    // scale acceleration
-    scale_acceleration_neck = 0.55;
-
-    // additionally humotion allows to limit the maximum velocity, value is given in deg/s
-    limit_velocity_neck = 700.0;
-
-    // limit the maximum acceleration, value is given in deg/s^2
-    limit_acceleration_neck = 1000.0;
-
-    // eye motion generation configuration
-    // scale the calculated velocity, value is given in percent (NOTE: 1.0 = 100% human velocity)
-    scale_velocity_eye = 0.45;
-
-    // scale acceleration
-    scale_acceleration_eye = 1.0;
-
-    // additionally humotion allows to limit the maximum velocity, value is given in deg/s
-    limit_velocity_eye = 700.0;
-
-    // limit the maximum acceleration, value is given in deg/s^2
-    limit_acceleration_eye = 80000;
-
-    // calculate the overall target distance based on neck target instead of using the real neck
-    // position
-    use_neck_target_instead_of_position_eye = true;
-
-    // parameters fo the breathing pattern
-    // healthy adult human: 12-15 breaths/min (see e.g. "Ganong's review of medical physiology")
-    // total breathe: 60/12-15 = 3-5s
-    // inhale 1.5-2s
-    // exhale 1.5-2s
-    // pause      2s
-    // overall period given in seconds
-    breath_period = 4.5;  // = 1.5 + 1.5 + 1.5 for inhale, pause & exhale
-    // amplitude given in degrees
-    breath_amplitude = 1.0;
-
-
-    // params for eyelid motion
-    // should the eyelids follow the eyeball?
-    eyelids_follow_eyemotion = true;
-
-
-    // parameters for eye blinking
-    // duration for one eyeblink, value is given in seconds
-    eyeblink_duration = 0.15;
-
-    // occurance of periodic eyeblinks, uniformly distributed over the given range
-    // typical values for a human are one blink every 2...10s
-    // values are given in seconds
-    eyeblink_periodic_distribution_lower = 2.0;
-    eyeblink_periodic_distribution_upper = 10.0;
-
-    // probability that one eye saccade causes an eyeblink, value given in percent
-    // for humans this is up to 95%, this gets quite annoying on the robot so the default is lower
-    eyeblink_probability_after_saccade = 0.33;
-
-    // blocking time where further eyeblinks are suppressed, value given in seconds
-    eyeblink_blocked_time = 1.0;
-}
diff --git a/src/server/controller.cpp b/src/server/controller.cpp
deleted file mode 100644
index f2fdce0..0000000
--- a/src/server/controller.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <string>
-
-#include "humotion/server/controller.h"
-#include "humotion/server/eye_motion_generator.h"
-#include "humotion/server/eyebrow_motion_generator.h"
-#include "humotion/server/eyelid_motion_generator.h"
-#include "humotion/server/mouth_motion_generator.h"
-#include "humotion/server/neck_motion_generator.h"
-#include "humotion/timestamp.h"
-
-
-// using namespace std;
-// using namespace humotion;
-// using namespace humotion::server;
-
-using humotion::server::Controller;
-using humotion::server::Config;
-using humotion::server::debug_data_t;
-
-//! constructor
-Controller::Controller(JointInterface *j) {
-    activated_ = false;
-    joint_interface_ = j;
-
-    config_ = new Config();
-}
-
-//! destructor
-Controller::~Controller() {
-}
-
-//! initialise motion generators
-void Controller::init_motion_generators() {
-    // NOTE: the order of these generators is important!
-    //       (i.e. the neck generator must be added after the eye generator!)
-
-    // eye motion generation:
-    add_motion_generator(new EyeMotionGenerator(joint_interface_, config_));
-
-    // eyelid motion generator
-    add_motion_generator(new EyelidMotionGenerator(joint_interface_, config_));
-
-    // neck motion generator
-    add_motion_generator(new NeckMotionGenerator(joint_interface_, config_));
-
-    // mouth motion generator
-    add_motion_generator(new MouthMotionGenerator(joint_interface_, config_));
-
-    // eyebrow motion generator
-    add_motion_generator(new EyebrowMotionGenerator(joint_interface_, config_));
-}
-
-//! add a single motion genrator
-void Controller::add_motion_generator(MotionGenerator *m) {
-    motion_generator_vector_.push_back(m);
-}
-
-//! calculate target angles for all motion generators:
-void Controller::calculate_targets() {
-    Controller::motion_generator_vector_t::iterator it;
-    for (it = motion_generator_vector_.begin(); it < motion_generator_vector_.end(); it++) {
-        MotionGenerator *mg = *it;
-        // calculate targets
-        mg->calculate_targets();
-    }
-}
-
-debug_data_t Controller::get_debug_data() {
-    debug_data_t debug_data;
-
-    Controller::motion_generator_vector_t::iterator it;
-    for (it = motion_generator_vector_.begin(); it < motion_generator_vector_.end(); it++) {
-        MotionGenerator *mg = *it;
-        // fetch and append debug data
-        debug_data_t dataset = mg->get_debug_data();
-        debug_data.insert(dataset.begin(), dataset.end());
-    }
-
-    // fetch data from controller as well
-    debug_data_t controller_dataset = debug_data_;
-    debug_data.insert(controller_dataset.begin(), controller_dataset.end());
-
-    return debug_data;
-}
-
-//! store debug data
-void Controller::store_debug_data(std::string name, float value) {
-    debug_data_[name] = value;
-}
-
-//! publish all target angles to the devices:
-//! NOTE: this is done in an extra loop to have a low delay between consequent sets:
-void Controller::publish_targets() {
-    Controller::motion_generator_vector_t::iterator it;
-    for (it = motion_generator_vector_.begin(); it < motion_generator_vector_.end(); it++) {
-        (*it)->publish_targets();
-    }
-}
-
-humotion::GazeState Controller::relative_gaze_to_absolute_gaze(humotion::GazeState relative) {
-    double pan, tilt, roll;
-    double neck_pan = 0.0;
-    double neck_tilt = 0.0;
-
-    humotion::GazeState absolute_gaze = relative;
-
-    // incoming gaze state wants to set a relative gaze angle
-    // in order to calc the new absolute gaze, we need to go back
-    // in time and find out where the head was pointing at that specific time:
-    Timestamp relative_target_timestamp = relative.timestamp;
-
-    // check if this timestamp allows a valid conversion:
-    Timestamp history_begin =
-            joint_interface_->get_ts_position(JointInterface::ID_NECK_PAN).get_first_timestamp();
-    Timestamp history_end   =
-            joint_interface_->get_ts_position(JointInterface::ID_NECK_PAN).get_last_timestamp();
-
-    // printf("> incoming: %f, history is %f to %f\n",relative_target_timestamp.to_seconds(),
-    // history_begin.to_seconds(), history_end.to_seconds());
-
-    // our history keeps the last n elements in a timestamped list
-    if ((relative_target_timestamp < history_begin) || (history_begin.is_null())) {
-        // when the incoming data is older than that it makes no sense
-        // to do any guesswork and try to calculate a valid absolute target
-        // therefore we will use the last known targets (see below)
-        // in case we did not see this timestamp before, show a warning:
-        if (last_known_absolute_timestamp_ != relative_target_timestamp) {
-            printf("> WARNING: restored/guessed absolute target for unknown timestamp %f (tsmap = [%f - %f])"
-                   "[this should only happen during startup]\n", relative_target_timestamp.to_seconds(),
-                   history_begin.to_seconds(),
-                   history_end.to_seconds()
-                   );
-            last_known_absolute_target_pan_ = 0.0;
-            last_known_absolute_target_tilt_ = 0.0;
-            last_known_absolute_target_roll_ = 0.0;
-        }
-    } else {
-        // all fine, we can reconstruct the absolute target
-        // fetch head / camera pose during that timestamp
-        neck_pan  = joint_interface_->get_ts_position(
-                JointInterface::ID_NECK_PAN).get_interpolated_value(relative_target_timestamp);
-        double eye_l_pan = joint_interface_->get_ts_position(
-                JointInterface::ID_EYES_LEFT_LR).get_interpolated_value(relative_target_timestamp);
-        double eye_r_pan = joint_interface_->get_ts_position(
-                JointInterface::ID_EYES_RIGHT_LR).get_interpolated_value(relative_target_timestamp);
-        last_known_absolute_target_pan_       = neck_pan + (eye_l_pan + eye_r_pan)/2.0;
-        //
-        neck_tilt = joint_interface_->get_ts_position(
-                JointInterface::ID_NECK_TILT).get_interpolated_value(relative_target_timestamp);
-        double eye_tilt  = joint_interface_->get_ts_position(
-                JointInterface::ID_EYES_BOTH_UD).get_interpolated_value(relative_target_timestamp);
-        last_known_absolute_target_tilt_      = neck_tilt + eye_tilt;
-        //
-        last_known_absolute_target_roll_      = joint_interface_->get_ts_position(
-                JointInterface::ID_NECK_ROLL).get_interpolated_value(relative_target_timestamp);
-
-        // safe this timestamp as known:
-        last_known_absolute_timestamp_ = relative_target_timestamp;
-    }
-
-    pan  = last_known_absolute_target_pan_;
-    tilt = last_known_absolute_target_tilt_;
-    roll = last_known_absolute_target_roll_;
-
-    // substract offsets
-    pan  -= relative.pan_offset;
-    tilt -= relative.tilt_offset;
-    roll -= relative.roll_offset;
-
-    // build up absolute target
-    absolute_gaze.gaze_type  = GazeState::GAZETYPE_ABSOLUTE;
-    absolute_gaze.pan   = pan + relative.pan;
-    absolute_gaze.tilt  = tilt + relative.tilt;
-    absolute_gaze.roll  = roll + relative.roll;
-    // printf("pan  now = %4.1f, rel=%4.1f ===> %4.2f\n", pan, relative.pan, absolute_gaze.pan);
-    // printf("tilt now = %4.1f, rel=%4.1f ===> %4.2f\n", tilt, relative.tilt, absolute_gaze.tilt);
-
-    // update the timestamp. this gaze target is now absolute, set appropriate timestamp
-    //printf("%f %f %f 333\n", absolute_gaze.pan, absolute_gaze.tilt, absolute_gaze.roll);
-    //absolute_gaze.tilt = 0.0;
-    //absolute_gaze.roll = 0.0;
-
-    //absolute_gaze.roll = absolute_gaze.pan; //0.012;
-    absolute_gaze.timestamp = Timestamp::now();
-
-    // store debug data:
-    // this is the position we had at the ts of the relative target
-    store_debug_data("controller/pan_neck_position_at_relative_ts", neck_pan);
-    store_debug_data("controller/pan_overall_position_at_relative_ts", last_known_absolute_target_pan_);
-    // this is the relative movement that was requested
-    store_debug_data("controller/pan_target_relative", relative.pan);
-    // this is the calculated overall target
-    store_debug_data("controller/pan_target", absolute_gaze.pan);
-
-    // FIXME: use ros TF for that calculation...
-    // see http://wiki.ros.org/tf/Tutorials/Time%20travel%20with%20tf%20%28C%2B%2B%29
-    // ros::Time past = now - ros::Duration(5.0);
-    // listener.waitForTransform("/turtle2", now,J "/turtle1", past, "/world", ros::Duration(1.0));
-    // listener.lookupTransform("/turtle2", now, "/turtle1", past, "/world", transform);
-    // absolute_gaze.dump();
-
-    return absolute_gaze;
-}
-
-//! activate controller
-void Controller::set_activated(void) {
-    activated_ = true;
-}
-
-//! update gaze target:
-//! \param GazeState with target values for the overall gaze
-void Controller::set_gaze_target(humotion::GazeState new_gaze_target) {
-    if (!activated_) {
-        // not yet initialized, ignore incoming targets
-        return;
-    }
-
-    humotion::GazeState target_gaze;
-    // new_gaze_target.dump();
-
-    // relative or absolute gaze update?
-    if (new_gaze_target.gaze_type == GazeState::GAZETYPE_RELATIVE) {
-        // relative gaze target -> calculate target angles
-        target_gaze = relative_gaze_to_absolute_gaze(new_gaze_target);
-    } else {
-        // already absolute gaze, set this
-        target_gaze = new_gaze_target;
-    }
-
-    Controller::motion_generator_vector_t::iterator it;
-    for (it = motion_generator_vector_.begin(); it < motion_generator_vector_.end(); it++) {
-        (*it)->set_gaze_target(target_gaze);
-    }
-}
-
-//! update mouth state:
-//! \param MouthState with target values for the mouth joints
-void Controller::set_mouth_target(MouthState s) {
-    if (!activated_) {
-        // not yet initialized, ignore incoming targets
-        return;
-    }
-
-    Controller::motion_generator_vector_t::iterator it;
-    for (it = motion_generator_vector_.begin(); it < motion_generator_vector_.end(); it++) {
-        (*it)->set_mouth_target(s);
-    }
-}
-
-//! access the configuration
-Config* Controller::get_config() {
-    return config_;
-}
diff --git a/src/server/eye_motion_generator.cpp b/src/server/eye_motion_generator.cpp
deleted file mode 100644
index a6bee22..0000000
--- a/src/server/eye_motion_generator.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/eye_motion_generator.h"
-#include "humotion/server/server.h"
-
-// using namespace std;
-// using namespace humotion;
-// using namespace humotion::server;
-
-using humotion::server::EyeMotionGenerator;
-
-//! constructor
-EyeMotionGenerator::EyeMotionGenerator(JointInterface *j, Config *cfg) :
-    GazeMotionGenerator(j, cfg, 3, 1.0/Server::MOTION_UPDATERATE) {
-}
-
-
-//! destructor
-EyeMotionGenerator::~EyeMotionGenerator() {
-}
-
-//! set up an eyemotion profile
-//! this will use speed and acceleration calc formulas from literature:
-//! \param dof id of joint
-//! \param target angle
-//! \param current angle
-void EyeMotionGenerator::setup_eyemotion(int dof, float target,
-                                         float current_position,
-                                         float current_velocity,
-                                         humotion::Timestamp timestamp) {
-    // get distance to target:
-    float distance_abs = fabs(target - current_position);
-
-    // get max speed: factor can be found in encyc britannica:
-    // "linear.... being 300° per second for 10° and 500° per second for 30°" (max=700)
-    float max_velocity = fmin(700.0, 10.0*distance_abs + 200.0);
-
-    // scale and limit max speed
-    max_velocity = max_velocity * config->scale_velocity_eye;
-    max_velocity = fmin(max_velocity, config->limit_velocity_eye);
-
-    // max accel: use data from:
-    // "Speed and Accuracy of Saccadic Eye Movements:
-    //      Characteristics of Impulse Variability in the Oculomotor System"
-    // http://www-personal.umich.edu/~kornblum/files/journal_exp_psych_HPP_15-3.pdf [table 2]
-    float max_accel = fmin(80000.0, 1526.53*distance_abs + 10245.4);
-
-    // scale and limit max acceleration
-    max_accel = max_accel * config->scale_acceleration_eye;
-    max_accel = fmin(max_accel, config->limit_acceleration_eye);
-
-    // feed reflexxes api with data
-    reflexxes_set_input(dof, target, current_position, current_velocity,
-                        timestamp, max_velocity, max_accel);
-}
-
-//! calculate joint targets
-void EyeMotionGenerator::calculate_targets() {
-    // use the target values for a faster response
-    float neck_pan_now  = 0.0;
-    float neck_tilt_now = 0.0;
-
-    if (config->use_neck_target_instead_of_position_eye) {
-        // position calc based on target
-        neck_pan_now = joint_interface_->get_target_position(JointInterface::ID_NECK_PAN);
-        neck_tilt_now = joint_interface_->get_target_position(JointInterface::ID_NECK_TILT);
-    } else {
-        // position calc based on real position
-        neck_pan_now =
-                joint_interface_->get_ts_position(JointInterface::ID_NECK_PAN).get_newest_value();
-        neck_tilt_now =
-                joint_interface_->get_ts_position(JointInterface::ID_NECK_TILT).get_newest_value();
-    }
-
-    // calculate target angles for the eyes
-    // right eye is dominant -> direct output
-    float eye_pan_r_target = (requested_gaze_state_.pan + requested_gaze_state_.vergence/2.0)
-            - (neck_pan_now);
-
-    // left eye is non dominant -> filtered output: TODO: activate low pass filtered output
-    // FIXME: USE LOWPASS FILTER HERE --> output_angle[angle_names::EYE_PAN_L]
-    //        + 0.1 * (eye_pan_l_target - output_angle[angle_names::EYE_PAN_L]) etc;
-    float eye_pan_l_target = (requested_gaze_state_.pan - requested_gaze_state_.vergence/2.0)
-            - (neck_pan_now);
-
-    // tilt
-    float eye_tilt_target = requested_gaze_state_.tilt - (neck_tilt_now);
-
-    // check and take care of limits
-    eye_pan_l_target = limit_target(JointInterface::ID_EYES_LEFT_LR, eye_pan_l_target);
-    eye_pan_r_target = limit_target(JointInterface::ID_EYES_RIGHT_LR, eye_pan_r_target);
-    eye_tilt_target = limit_target(JointInterface::ID_EYES_BOTH_UD, eye_tilt_target);
-
-    // fetch current dataset
-    float eye_pan_l_now, eye_pan_r_now, eye_tilt_now;
-    float eye_pan_l_speed, eye_pan_r_speed, eye_tilt_speed;
-
-    humotion::Timestamp eye_pan_l_ts = get_timestamped_state(
-                JointInterface::ID_EYES_LEFT_LR,
-                &eye_pan_l_now,
-                &eye_pan_l_speed);
-
-    humotion::Timestamp eye_pan_r_ts = get_timestamped_state(
-                JointInterface::ID_EYES_RIGHT_LR,
-                &eye_pan_r_now,
-                &eye_pan_r_speed);
-
-    humotion::Timestamp eye_tilt_ts = get_timestamped_state(
-                JointInterface::ID_EYES_BOTH_UD,
-                &eye_tilt_now,
-                &eye_tilt_speed);
-
-    // pass paramaters to reflexxes api
-    setup_eyemotion(0, eye_pan_l_target, eye_pan_l_now, eye_pan_l_speed, eye_pan_l_ts);
-    setup_eyemotion(1, eye_pan_r_target, eye_pan_r_now, eye_pan_r_speed, eye_pan_r_ts);
-    setup_eyemotion(2, eye_tilt_target, eye_tilt_now, eye_tilt_speed,    eye_tilt_ts);
-
-    // cout << "EYE MOTION 2 " << eye_tilt_target << " now=" << eye_tilt_now << "\n";
-
-    // call reflexxes to handle profile calculation
-    reflexxes_calculate_profile();
-
-    // tell the joint about the new values
-    joint_interface_->set_target(JointInterface::ID_EYES_LEFT_LR,
-                                reflexxes_position_output->NewPositionVector->VecData[0],
-                                reflexxes_position_output->NewVelocityVector->VecData[0]);
-    joint_interface_->set_target(JointInterface::ID_EYES_RIGHT_LR,
-                                reflexxes_position_output->NewPositionVector->VecData[1],
-                                reflexxes_position_output->NewVelocityVector->VecData[1]);
-    joint_interface_->set_target(JointInterface::ID_EYES_BOTH_UD,
-                                reflexxes_position_output->NewPositionVector->VecData[2],
-                                reflexxes_position_output->NewVelocityVector->VecData[2]);
-
-    // store debug data:
-    store_debug_data("eye/neck_pan_now", neck_pan_now);
-    store_debug_data("eye/neck_tilt_now", neck_tilt_now);
-    store_debug_data("eye/eye_pan_r_target", eye_pan_r_target);
-    store_debug_data("eye/eye_pan_l_target", eye_pan_l_target);
-    store_debug_data("eye/eye_tilt_target", eye_tilt_target);
-
-    store_debug_data("eye/gaze_target_pan", requested_gaze_state_.pan);
-    store_debug_data("eye/gaze_target_tilt", requested_gaze_state_.tilt);
-
-    store_debug_data("eye/eye_pan_r_now", eye_pan_r_now);
-    store_debug_data("eye/eye_pan_l_now", eye_pan_l_now);
-    store_debug_data("eye/eye_tilt_now", eye_tilt_now);
-
-    store_debug_data("eye/output_l_lr", reflexxes_position_output->NewPositionVector->VecData[0]);
-    store_debug_data("eye/output_r_lr", reflexxes_position_output->NewPositionVector->VecData[1]);
-    store_debug_data("eye/output_ud",   reflexxes_position_output->NewPositionVector->VecData[2]);
-}
-
-
-//! pubish the calculated targets to the joint subsystem
-void EyeMotionGenerator::publish_targets() {
-    // publish values if there is an active gaze input within the last timerange
-    if (gaze_target_input_active()) {
-        joint_interface_->publish_target(JointInterface::ID_EYES_LEFT_LR);
-        joint_interface_->publish_target(JointInterface::ID_EYES_RIGHT_LR);
-        joint_interface_->publish_target(JointInterface::ID_EYES_BOTH_UD);
-    }
-}
diff --git a/src/server/eyebrow_motion_generator.cpp b/src/server/eyebrow_motion_generator.cpp
deleted file mode 100644
index 1e921bd..0000000
--- a/src/server/eyebrow_motion_generator.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/eyebrow_motion_generator.h"
-#include "humotion/server/server.h"
-
-// using namespace std;
-// using namespace humotion;
-// using namespace humotion::server;
-
-using humotion::server::EyebrowMotionGenerator;
-
-//! constructor
-EyebrowMotionGenerator::EyebrowMotionGenerator(JointInterface *j, Config *cfg) :
-    MotionGenerator(j, cfg) {
-}
-
-
-//! destructor
-EyebrowMotionGenerator::~EyebrowMotionGenerator() {
-}
-
-//! calculate joint targets
-void EyebrowMotionGenerator::calculate_targets() {
-    // printf("> humotion: calculating eyebrow targets\n");
-    float eyebrow_left_target = requested_gaze_state_.eyebrow_left;
-    float eyebrow_right_target = requested_gaze_state_.eyebrow_right;
-
-    // store targets
-    joint_interface_->set_target(JointInterface::ID_EYES_LEFT_BROW, eyebrow_left_target, 0.0);
-    joint_interface_->set_target(JointInterface::ID_EYES_RIGHT_BROW, eyebrow_right_target, 0.0);
-}
-
-//! publish targets to motor boards:
-void EyebrowMotionGenerator::publish_targets() {
-    // publish values if there is an active gaze input within the last timerange
-    if (gaze_target_input_active()) {
-        joint_interface_->publish_target(JointInterface::ID_EYES_LEFT_BROW);
-        joint_interface_->publish_target(JointInterface::ID_EYES_RIGHT_BROW);
-    }
-}
diff --git a/src/server/eyelid_motion_generator.cpp b/src/server/eyelid_motion_generator.cpp
deleted file mode 100644
index ba6b223..0000000
--- a/src/server/eyelid_motion_generator.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/eyelid_motion_generator.h"
-#include "humotion/server/server.h"
-
-// using namespace boost;
-// using namespace std;
-// using namespace humotion;
-// using namespace humotion::server;
-
-using humotion::server::EyelidMotionGenerator;
-using humotion::server::Config;
-
-//! constructor
-EyelidMotionGenerator::EyelidMotionGenerator(JointInterface *j, Config *cfg) :
-    EyeMotionGenerator(j, cfg) {
-    saccade_blink_active_ = false;
-    saccade_blink_requested_ = false;
-
-    for (int i = 0; i < 2; i++) {
-        eyelid_closed_[i] = false;
-        eyeblink_active_[i] = false;
-        eyeblink_timeout_[i] = boost::get_system_time();
-    }
-
-    eyeblink_blocked_timeout_ = boost::get_system_time();
-}
-
-//! destructor
-EyelidMotionGenerator::~EyelidMotionGenerator() {
-}
-
-
-//! calculate joint targets
-//! \TODO: make up motion twice as slow as down motion
-void EyelidMotionGenerator::calculate_targets() {
-    // printf("> humotion: calculating eyelid targets\n");
-
-    // fetch current angles
-    float eye_tilt_now  = get_current_position(JointInterface::ID_EYES_BOTH_UD);
-
-    float eyelid_target = 0.0;
-    if (config->eyelids_follow_eyemotion) {
-        // the eyelids shoudl follow the eye motion
-        // therefore copy the eyeballs tilt position
-        eyelid_target = eye_tilt_now;
-    }
-
-    // calculate left eyelid targets
-    float eyelid_upper_left_target = eyelid_target + requested_gaze_state_.eyelid_opening_upper;
-    float eyelid_lower_left_target = eyelid_target - requested_gaze_state_.eyelid_opening_lower;
-
-    // calculate right eyelid targets
-    float eyelid_upper_right_target = eyelid_target + requested_gaze_state_.eyelid_opening_upper;
-    float eyelid_lower_right_target = eyelid_target - requested_gaze_state_.eyelid_opening_lower;
-
-    // limit target angles
-    eyelid_upper_left_target  = limit_target(JointInterface::ID_EYES_LEFT_LID_UPPER,
-                                             eyelid_upper_left_target);
-    eyelid_lower_left_target  = limit_target(JointInterface::ID_EYES_LEFT_LID_LOWER,
-                                             eyelid_lower_left_target);
-    eyelid_upper_right_target = limit_target(JointInterface::ID_EYES_RIGHT_LID_UPPER,
-                                             eyelid_upper_right_target);
-    eyelid_lower_right_target = limit_target(JointInterface::ID_EYES_RIGHT_LID_LOWER,
-                                             eyelid_lower_right_target);
-
-    // (temporarily) store the target
-    joint_interface_->set_target(JointInterface::ID_EYES_LEFT_LID_UPPER,
-                                eyelid_upper_left_target, 0.0);
-    joint_interface_->set_target(JointInterface::ID_EYES_LEFT_LID_LOWER,
-                                eyelid_lower_left_target, 0.0);
-    joint_interface_->set_target(JointInterface::ID_EYES_RIGHT_LID_UPPER,
-                                eyelid_upper_right_target, 0.0);
-    joint_interface_->set_target(JointInterface::ID_EYES_RIGHT_LID_LOWER,
-                                eyelid_lower_right_target, 0.0);
-
-    // check for saccade
-    check_for_saccade();
-
-    // is there a blink request?
-    start_external_eyeblinks(requested_gaze_state_.eyeblink_request_left,
-                             requested_gaze_state_.eyeblink_request_right);
-
-    // do we have a saccade & do we want to exec an eyeblink?
-    process_saccadic_eyeblinks();
-
-    // execute for periodic eyeblinks every ? ms
-    process_periodic_eyeblinks();
-
-    // close eyes again after a given timeout
-    handle_eyeblink_timeout();
-
-    // eyeblinks override position target (if necessary)
-    override_lids_for_eyeblink();
-}
-
-//! process any external blink requests
-void EyelidMotionGenerator::start_external_eyeblinks(int duration_left, int duration_right) {
-    // manual eyeblinks will ALWAYs get executed as we use
-    // a negative block timeout (=timeout has already passed)
-    if ((duration_left != 0) || (duration_right != 0)) {
-        eyeblink_blocked_timeout_ = boost::get_system_time() - boost::posix_time::seconds(100);
-    }
-
-
-    if (duration_left == 0) {
-        // nothing to do
-    } else if (duration_left < 0) {
-        // infinite sleep -> close
-        eyelid_closed_[LEFT] = true;
-    } else {
-        // timeout sleep
-        start_eyeblink(LEFT, duration_left);
-        eyelid_closed_[LEFT] = false;
-    }
-
-    if (duration_right == 0) {
-        // nothing to do
-    } else if (duration_right < 0) {
-        // infinite sleep -> close
-        eyelid_closed_[RIGHT] = true;
-    } else {
-        // timeout sleep
-        start_eyeblink(RIGHT, duration_right);
-        eyelid_closed_[RIGHT] = false;
-    }
-}
-
-//! process saccadic blink requests
-//! -> when we do a saccade, the chances to blink are much higher
-void EyelidMotionGenerator::process_saccadic_eyeblinks() {
-    if (saccade_blink_requested_) {
-        // every n-th's saccade requests an eyeblink
-        float frnd = static_cast <float> (std::rand()) / static_cast <float> (RAND_MAX);
-        if (frnd <= config->eyeblink_probability_after_saccade) {
-            printf("> saccadic eyeblink:\n");
-            start_eyeblink(LEFT, config->eyeblink_duration * 1000.0);
-            start_eyeblink(RIGHT, config->eyeblink_duration * 1000.0);
-        }
-        saccade_blink_requested_ = false;
-    }
-}
-
-//! process periodic blink requests
-//! -> we want to have an eyeblink every n...m seconds
-void EyelidMotionGenerator::process_periodic_eyeblinks() {
-    if (eyeblink_active_[LEFT] || eyeblink_active_[RIGHT]) {
-        float range = config->eyeblink_periodic_distribution_upper
-                - config->eyeblink_periodic_distribution_lower;
-
-        // random number 0...1
-        float frnd = static_cast <float> (std::rand()) / static_cast <float> (RAND_MAX);
-
-        // calculate next timeout for a new periodic eyeblink
-        float seconds_to_next_blink =
-                config->eyeblink_periodic_distribution_lower  + frnd * range;
-
-        periodic_blink_start_time_ = boost::get_system_time()
-                + boost::posix_time::seconds(seconds_to_next_blink);
-    }
-
-    if (boost::get_system_time() > periodic_blink_start_time_) {
-        // printf("> periodic eyeblink:\n");
-        start_eyeblink(LEFT, config->eyeblink_duration * 1000.0);
-        start_eyeblink(RIGHT, config->eyeblink_duration * 1000.0);
-    }
-}
-
-//! handle eyeblink timeouts.
-//! this function will actually re-open the eyes after a predefined time
-void EyelidMotionGenerator::handle_eyeblink_timeout() {
-    boost::system_time now = boost::get_system_time();
-
-    // take care of re-opening eye timeout
-    for (int i=LEFT; i <= RIGHT; i++) {
-        if (eyeblink_active_[i]) {
-            if (now >= eyeblink_timeout_[i]) {
-                eyeblink_active_[i] = false;
-            }
-        }
-    }
-
-    // take care of blocking time
-    if (eyeblink_active_[LEFT] || eyeblink_active_[RIGHT]) {
-        eyeblink_blocked_timeout_ = boost::get_system_time()
-                + boost::posix_time::seconds(config->eyeblink_blocked_time);
-    }
-}
-
-//! override eyelid positions
-//! this will override (=close) the eyelids for all possible eyeblink requests
-void EyelidMotionGenerator::override_lids_for_eyeblink() {
-    // close the requested eyelids
-    if (eyeblink_active_[LEFT] || eyelid_closed_[LEFT]) {
-        close_eyelid(JointInterface::ID_EYES_LEFT_LID_UPPER);
-        close_eyelid(JointInterface::ID_EYES_LEFT_LID_LOWER);
-    }
-    if (eyeblink_active_[RIGHT] || eyelid_closed_[RIGHT]) {
-        close_eyelid(JointInterface::ID_EYES_RIGHT_LID_UPPER);
-        close_eyelid(JointInterface::ID_EYES_RIGHT_LID_LOWER);
-    }
-}
-
-
-
-//! overwrite the intermediate target to close the given eyelid:
-void EyelidMotionGenerator::close_eyelid(int joint_id) {
-    float value = 0.0;
-
-    // set upper to minimal allowed value (=as closed as possible) + a small offset
-    // set lower to the same value (instead of max) in order to avoid collisions
-    switch (joint_id) {
-    default:
-        // no eyelid -> return
-        return;
-
-    case(JointInterface::ID_EYES_LEFT_LID_UPPER):
-    case(JointInterface::ID_EYES_LEFT_LID_LOWER):
-        // use the upper value + 10 deg as close state:
-        value = joint_interface_->get_joint_min(JointInterface::ID_EYES_LEFT_LID_UPPER) + 10.0;
-        // overwrite last target_
-        joint_interface_->set_target(joint_id, value, 0.0);
-        break;
-
-    case(JointInterface::ID_EYES_RIGHT_LID_UPPER):
-    case(JointInterface::ID_EYES_RIGHT_LID_LOWER):
-        // use the upper value + 10 deg as close state:
-        value = joint_interface_->get_joint_min(JointInterface::ID_EYES_RIGHT_LID_UPPER) + 10.0;
-        // overwrite last target_
-        joint_interface_->set_target(joint_id, value, 0.0);
-        break;
-    }
-}
-
-//! start an eyeblink request
-//! this will actually set a flag and a timeout for reopening the given eyelid pair again
-//! \param int id of side (LEFT or RIGHT)
-void EyelidMotionGenerator::start_eyeblink(int side, int duration) {
-    // cout << "BLOCKED UNTIL " << eyeblink_blocked_timeout << "\n";
-    if (boost::get_system_time() < eyeblink_blocked_timeout_) {
-        // return if we are still in the block time
-        return;
-    }
-    // request for n ms eyeblink:
-    eyeblink_timeout_[side] = boost::get_system_time() + boost::posix_time::milliseconds(duration);
-
-    eyeblink_active_[side] = true;
-}
-
-//! check if there is an ongoing saccade:
-void EyelidMotionGenerator::check_for_saccade() {
-    if (get_eye_saccade_active()) {
-        // this is a saccade, check if not already in saccade:
-        if (!saccade_blink_active_) {
-            // this is a new saccade! restart blink timer
-            saccade_blink_requested_ = true;
-            saccade_blink_active_ = true;
-        }
-    } else {
-        saccade_blink_active_ = false;
-    }
-}
-
-
-//! publish targets to motor boards:
-void EyelidMotionGenerator::publish_targets() {
-    // publish values if there is an active gaze input within the last timerange
-    if (gaze_target_input_active()) {
-        joint_interface_->publish_target(JointInterface::ID_EYES_LEFT_LID_UPPER);
-        joint_interface_->publish_target(JointInterface::ID_EYES_LEFT_LID_LOWER);
-        joint_interface_->publish_target(JointInterface::ID_EYES_RIGHT_LID_UPPER);
-        joint_interface_->publish_target(JointInterface::ID_EYES_RIGHT_LID_LOWER);
-    }
-}
diff --git a/src/server/gaze_motion_generator.cpp b/src/server/gaze_motion_generator.cpp
deleted file mode 100644
index d67fff6..0000000
--- a/src/server/gaze_motion_generator.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/gaze_motion_generator.h"
-#include "humotion/server/server.h"
-
-using humotion::server::GazeMotionGenerator;
-using humotion::server::Config;
-
-//! constructor
-GazeMotionGenerator::GazeMotionGenerator(JointInterface *j, Config *cfg, int dof, float t)
-    : ReflexxesMotionGenerator(j, cfg, dof, t) {
-}
-
-//! destructor
-GazeMotionGenerator::~GazeMotionGenerator() {
-}
-
-//! update gaze target:
-//! \param GazeState with target values for the overall gaze
-void GazeMotionGenerator::set_gaze_target(GazeState new_gaze_target) {
-    if (requested_gaze_state_.gaze_type == GazeState::GAZETYPE_RELATIVE) {
-        printf("> ERROR: gaze targets should be converted to absolute before calling this\n");
-        exit(EXIT_FAILURE);
-    }
-
-    // check magnitude of gaze change to detect eye-neck saccades
-    float dist = fabs(requested_gaze_state_.distance_pt_abs(new_gaze_target));
-
-    // check requested speed
-    float speed = fabs(requested_gaze_state_.distance_pt_abs(new_gaze_target))
-            / (new_gaze_target.timestamp.to_seconds()-requested_gaze_state_.timestamp.to_seconds());
-
-    // check magnitude and speed of gaze change to detect eye-neck saccades
-    if (dist > config->threshold_angle_neck_saccade) {
-        // the next saccade has to use neck motion as well
-        if (speed > config->threshold_velocity_eye_saccade) {
-            neck_saccade_requested = true;
-        }
-    } else {
-        neck_saccade_requested = false;
-    }
-
-    // check for eye getting close to ocolomotor range
-    // actually it makes more sense to trigger the neck saccade based on
-    // the target getting out of the OMR
-    float eye_target_l  = joint_interface_->get_target_position(JointInterface::ID_EYES_LEFT_LR);
-    float eye_target_r  = joint_interface_->get_target_position(JointInterface::ID_EYES_RIGHT_LR);
-    float eye_target_ud = joint_interface_->get_target_position(JointInterface::ID_EYES_BOTH_UD);
-
-    // min/max bounds
-    float left_min  = config->threshold_angle_omr_limit *
-            joint_interface_->get_joint_min(JointInterface::ID_EYES_LEFT_LR);
-    float left_max  = config->threshold_angle_omr_limit *
-            joint_interface_->get_joint_max(JointInterface::ID_EYES_LEFT_LR);
-    float right_min = config->threshold_angle_omr_limit *
-            joint_interface_->get_joint_min(JointInterface::ID_EYES_RIGHT_LR);
-    float right_max = config->threshold_angle_omr_limit *
-            joint_interface_->get_joint_max(JointInterface::ID_EYES_RIGHT_LR);
-    float ud_min    = config->threshold_angle_omr_limit *
-            joint_interface_->get_joint_min(JointInterface::ID_EYES_BOTH_UD);
-    float ud_max    = config->threshold_angle_omr_limit *
-            joint_interface_->get_joint_max(JointInterface::ID_EYES_BOTH_UD);
-
-    if (
-            (eye_target_l < left_min) || (eye_target_l > left_max) ||
-            (eye_target_r < right_min) || (eye_target_r > right_max) ||
-            (eye_target_ud < ud_min) || (eye_target_ud > ud_max)) {
-        // the eyeball gets close to OMR, activate a neck compensation motion
-        neck_saccade_omr = true;
-    } else {
-        neck_saccade_omr = false;
-    }
-
-    // use base class set method
-    MotionGenerator::set_gaze_target(new_gaze_target);
-}
-
-//! check if an eye saccade is active:
-bool GazeMotionGenerator::get_eye_saccade_active() {
-    bool saccade_active;
-
-    float speed_left  = joint_interface_->get_ts_speed(
-                JointInterface::ID_EYES_LEFT_LR).get_newest_value();
-    float speed_right = joint_interface_->get_ts_speed(
-                JointInterface::ID_EYES_RIGHT_LR).get_newest_value();
-    float speed_tilt  = joint_interface_->get_ts_speed(
-                JointInterface::ID_EYES_BOTH_UD).get_newest_value();
-
-    float speed_total_l = sqrt(speed_left*speed_left + speed_tilt*speed_tilt);
-    float speed_total_r = sqrt(speed_right*speed_right + speed_tilt*speed_tilt);
-
-    // thresholding
-    if ((speed_total_l > config->threshold_velocity_eye_saccade) ||
-            (speed_total_r > config->threshold_velocity_eye_saccade)) {
-        // this is a saccade
-        saccade_active = true;
-    } else {
-        saccade_active = false;
-    }
-
-    return saccade_active;
-}
-
-//! get overall gaze
-humotion::GazeState GazeMotionGenerator::get_current_gaze() {
-    // shortcut, makes the following easier to read
-    JointInterface *j = joint_interface_;
-
-    GazeState gaze = requested_gaze_state_;
-
-    gaze.pan = j->get_ts_position(JointInterface::ID_NECK_PAN).get_newest_value() +
-            (j->get_ts_position(JointInterface::ID_EYES_LEFT_LR).get_newest_value()
-             + j->get_ts_position(JointInterface::ID_EYES_RIGHT_LR).get_newest_value())/2.0;
-    gaze.tilt = j->get_ts_position(JointInterface::ID_NECK_TILT).get_newest_value()
-            + j->get_ts_position(JointInterface::ID_EYES_BOTH_UD).get_newest_value();
-    gaze.roll = j->get_ts_position(JointInterface::ID_NECK_ROLL).get_newest_value();
-
-    gaze.vergence = j->get_ts_position(JointInterface::ID_EYES_LEFT_LR).get_newest_value()
-            - j->get_ts_position(JointInterface::ID_EYES_RIGHT_LR).get_newest_value();
-
-    return gaze;
-}
diff --git a/src/server/joint_interface.cpp b/src/server/joint_interface.cpp
deleted file mode 100644
index 4d5f85a..0000000
--- a/src/server/joint_interface.cpp
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/joint_interface.h"
-#include "humotion/server/controller.h"
-
-using boost::mutex;
-using humotion::server::JointInterface;
-
-//! constructor
-JointInterface::JointInterface() {
-    framerate = 50.0;
-    mouth_enabled_ = false;
-    gaze_enabled_  = false;
-}
-
-//! destructor
-JointInterface::~JointInterface() {
-}
-
-//! set joint target position
-//! \param joint_id of joint
-//! \param float position
-void JointInterface::set_target(int joint_id, float position, float velocity) {
-    assert(joint_id < JOINT_ID_ENUM_SIZE);
-
-    // update current value
-    joint_target_position_[joint_id] = position;
-    joint_target_velocity_[joint_id] = velocity;
-}
-
-//! fetch target position
-//! \param joint_id of joint
-float JointInterface::get_target_position(int joint_id) {
-    assert(joint_id < JOINT_ID_ENUM_SIZE);
-    return joint_target_position_[joint_id];
-}
-
-//! fetch target velocity
-//! \param joint_id of joint
-float JointInterface::get_target_velocity(int joint_id) {
-    assert(joint_id < JOINT_ID_ENUM_SIZE);
-    return joint_target_velocity_[joint_id];
-}
-
-//! incoming position data
-//! \param joint name
-//! \param position
-//! \param timestamp when the position was measured
-void JointInterface::store_incoming_position(int joint_id, float position, Timestamp timestamp) {
-    // lock the tsd_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock sl(joint_ts_position_map_access_mutex_);
-
-    //printf("> humotion: incoming joint position for joint id 0x%02X "
-    //"= %4.2f (ts=%.2f)\n",joint_id,position,timestamp.to_seconds());
-    joint_ts_position_map_[joint_id].insert(timestamp, position);
-
-    incoming_position_count_++;
-}
-
-//! return incoming position data count & clear this counter
-//! this can be used as a keep alive status check
-//! \return number of incoming joint positions since the last call
-unsigned int JointInterface::get_and_clear_incoming_position_count() {
-    unsigned int i = incoming_position_count_;
-    incoming_position_count_ = 0;
-    return i;
-}
-
-//! incoming speed data
-//! \param joint name
-//! \param speed
-//! \param timestamp when the position was measured
-void JointInterface::store_incoming_velocity(int joint_id, float velocity, Timestamp timestamp) {
-    // lock the tsd_list for this access. by doing this we assure
-    // that no other thread accessing this element can disturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(joint_ts_speed_map_access_mutex_);
-
-    // printf("> humotion: incoming joint velocity for joint id 0x%02X = %4.2f "
-    // "(ts=%.2f)\n",joint_id,velocity,timestamp.to_seconds());
-    joint_ts_speed_map_[joint_id].insert(timestamp, velocity);
-}
-
-//! return the timestamped float for the given joints position
-humotion::TimestampedList JointInterface::get_ts_position(int joint_id) {
-    // lock the tsd_list for this access. by doing this we assure
-    // that no other thread accessing this element can disturb the
-    // following atomic instructions
-    mutex::scoped_lock sl(joint_ts_position_map_access_mutex_);
-
-    // search map
-    joint_tsl_map_t::iterator it = joint_ts_position_map_.find(joint_id);
-
-    if (it == joint_ts_position_map_.end()) {
-        printf("> humotion: no ts_position for joint id 0x%02X found\n", joint_id);
-        return TimestampedList();
-    }
-
-    // ok fine, we found the requested value
-    return it->second;
-}
-
-//! return the timestamped float for the given joints speed
-humotion::TimestampedList JointInterface::get_ts_speed(int joint_id) {
-    // lock the tsd_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions
-    mutex::scoped_lock sl(joint_ts_speed_map_access_mutex_);
-
-    // search map
-    joint_tsl_map_t::iterator it = joint_ts_speed_map_.find(joint_id);
-
-    if (it == joint_ts_speed_map_.end()) {
-        printf("> humotion: no ts_speed for joint id 0x%02X found\n", joint_id);
-        return humotion::TimestampedList();
-    }
-
-    // ok fine, we found our value
-    return it->second;
-}
-
-//! set framerate
-void JointInterface::set_framerate(float f) {
-    framerate = f;
-}
-
-//! enable all mouth joints
-void JointInterface::enable_mouth_joints() {
-    // already enabled? skip this
-    if (mouth_enabled_) {
-        return;
-    }
-
-    printf("> humotion: ENABLING MOUTH JOINTS\n");
-    enable_joint(ID_LIP_LEFT_UPPER);
-    enable_joint(ID_LIP_LEFT_LOWER);
-    enable_joint(ID_LIP_CENTER_UPPER);
-    enable_joint(ID_LIP_CENTER_LOWER);
-    enable_joint(ID_LIP_RIGHT_UPPER);
-    enable_joint(ID_LIP_RIGHT_LOWER);
-    mouth_enabled_ = true;
-}
-
-
-//! disable all mouth joints
-void JointInterface::disable_mouth_joints() {
-    // already disabled? skip this
-    if (!mouth_enabled_) {
-        return;
-    }
-
-    printf("> humotion: DISABLING MOUTH JOINTS\n");
-    disable_joint(ID_LIP_LEFT_UPPER);
-    disable_joint(ID_LIP_LEFT_LOWER);
-    disable_joint(ID_LIP_CENTER_UPPER);
-    disable_joint(ID_LIP_CENTER_LOWER);
-    disable_joint(ID_LIP_RIGHT_UPPER);
-    disable_joint(ID_LIP_RIGHT_LOWER);
-    mouth_enabled_ = false;
-}
-
-//! enable all gaze joints
-void JointInterface::enable_gaze_joints() {
-    // already enabled? skip this
-    if (gaze_enabled_) {
-        return;
-    }
-
-    printf("> humotion: ENABLING GAZE JOINTS\n");
-    enable_joint(ID_EYES_LEFT_LR);
-    enable_joint(ID_EYES_RIGHT_LR);
-    enable_joint(ID_EYES_BOTH_UD);
-
-    enable_joint(ID_EYES_LEFT_LID_UPPER);
-    enable_joint(ID_EYES_LEFT_LID_LOWER);
-    enable_joint(ID_EYES_RIGHT_LID_UPPER);
-    enable_joint(ID_EYES_RIGHT_LID_LOWER);
-
-    enable_joint(ID_EYES_LEFT_BROW);
-    enable_joint(ID_EYES_RIGHT_BROW);
-
-    enable_joint(ID_NECK_PAN);
-    enable_joint(ID_NECK_TILT);
-    enable_joint(ID_NECK_ROLL);
-
-    gaze_enabled_ = true;
-}
-
-//! disable all gaze joints
-void JointInterface::disable_gaze_joints() {
-    // already disabled? skip this
-    if (!gaze_enabled_) {
-        return;
-    }
-
-    printf("> humotion: DISABLING GAZE JOINTS\n");
-    disable_joint(ID_EYES_LEFT_LR);
-    disable_joint(ID_EYES_RIGHT_LR);
-    disable_joint(ID_EYES_BOTH_UD);
-
-    disable_joint(ID_EYES_LEFT_LID_UPPER);
-    disable_joint(ID_EYES_LEFT_LID_LOWER);
-    disable_joint(ID_EYES_RIGHT_LID_UPPER);
-    disable_joint(ID_EYES_RIGHT_LID_LOWER);
-
-    disable_joint(ID_EYES_LEFT_BROW);
-    disable_joint(ID_EYES_RIGHT_BROW);
-
-    disable_joint(ID_NECK_PAN);
-    disable_joint(ID_NECK_TILT);
-    disable_joint(ID_NECK_ROLL);
-
-    gaze_enabled_ = false;
-}
-
-//! fetch maximum allowed joint position
-//! \return max position
-float JointInterface::get_joint_max(int joint_id) {
-    assert((joint_id > 0) && (joint_id < JOINT_ID_ENUM_SIZE));
-    return joint_max[joint_id];
-}
-
-//! fetch minimum allowed joint position
-//! \return min position
-float JointInterface::get_joint_min(int joint_id) {
-    assert((joint_id > 0) && (joint_id < JOINT_ID_ENUM_SIZE));
-    return joint_min[joint_id];
-}
-
-//! check if joint position map is empty
-//! \return true if empty
-bool JointInterface::get_joint_position_map_empty() {
-    return (joint_ts_position_map_.empty());
-}
-
-//! call the virtual store function with given position and velocities
-void JointInterface::publish_target(int joint_id) {
-    publish_target(joint_id, joint_target_position_[joint_id], joint_target_velocity_[joint_id]);
-}
diff --git a/src/server/middleware.cpp b/src/server/middleware.cpp
deleted file mode 100644
index 7163e2b..0000000
--- a/src/server/middleware.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <string>
-
-#include "humotion/server/middleware.h"
-
-using humotion::server::Middleware;
-
-//! constructor
-//! open a new Middleware instance.
-Middleware::Middleware(std::string scope, Controller *c) {
-    controller_ = c;
-    base_scope_ = scope;
-}
-
-//! destructor
-Middleware::~Middleware() {
-}
-
diff --git a/src/server/middleware_ros.cpp b/src/server/middleware_ros.cpp
deleted file mode 100644
index a5fc261..0000000
--- a/src/server/middleware_ros.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <boost/algorithm/string/classification.hpp>
-
-#include <std_msgs/Float32.h>
-#include <string>
-
-#include "humotion/server/middleware_ros.h"
-
-using humotion::server::MiddlewareROS;
-
-//! constructor
-MiddlewareROS::MiddlewareROS(std::string scope, Controller *c)
-    : Middleware(scope, c), nh_(scope + "/humotion") {
-    ROS_DEBUG_STREAM_NAMED("MiddlewareROS", "will use ros middleware");
-    debug_initialized_ = false;
-
-    // start ros core?
-    if (ros::isInitialized()) {
-        // oh another process is doing ros comm, fine, we do not need to call it
-        tick_necessary_ = false;
-    } else {
-        // we have to take care of ros
-        ROS_DEBUG_STREAM_NAMED("MiddlewareROS", "no active ros middleware, will call ros::init() "
-               "now and we will call tick() periodically!\n");
-
-        std::string node_name = scope;
-        node_name.erase(std::remove(node_name.begin(), node_name.end(), '/'), node_name.end());
-
-        ROS_DEBUG_STREAM_NAMED("MiddlewareROS", "registering on ROS as node " << node_name.c_str());
-
-        ros::M_string no_remapping;
-        ros::init(no_remapping, node_name);
-        tick_necessary_ = true;
-    }
-
-    // create node handle
-    ros::NodeHandle pnh("~");
-
-    // set up subscribers
-    mouth_target_subscriber_ = nh_.subscribe("mouth/target", 150,
-                                          &MiddlewareROS::incoming_mouth_target ,
-                                          this, ros::TransportHints().unreliable());
-    gaze_target_subscriber_  = nh_.subscribe("gaze/target",  150,
-                                          &MiddlewareROS::incoming_gaze_target,
-                                          this, ros::TransportHints().unreliable());
-
-    // set up dynamic reconfiguration service
-    attach_to_reconfiguration_server(pnh);
-}
-
-//! callback for incoming dynamic reconfigure requests:
-void MiddlewareROS::dynamic_reconfigure_callback(const humotion::humotionConfig &dyn_config,
-                                                  uint32_t level) {
-    // fetch config
-    humotion::server::Config *config = controller_->get_config();
-
-    // debug
-    config->publish_internals = dyn_config.publish_internals;
-
-    // saccade detection thresholds
-    config->threshold_velocity_eye_saccade = dyn_config.threshold_velocity_eye_saccade;
-    config->threshold_angle_neck_saccade = dyn_config.threshold_angle_neck_saccade;
-    config->threshold_angle_omr_limit = dyn_config.threshold_angle_omr_limit;
-
-    config->use_neck_target_instead_of_position_eye =
-            dyn_config.use_neck_target_instead_of_position_eye;
-
-    // neck motion generation configuration
-    config->scale_velocity_neck = dyn_config.scale_velocity_neck;
-    config->scale_acceleration_neck = dyn_config.scale_acceleration_neck;
-    config->limit_velocity_neck = dyn_config.limit_velocity_neck;
-    config->limit_acceleration_neck = dyn_config.limit_acceleration_neck;
-
-    // eye motion generation configuration
-    config->scale_velocity_eye = dyn_config.scale_velocity_eye;
-    config->scale_acceleration_eye = dyn_config.scale_acceleration_eye;
-    config->limit_velocity_eye = dyn_config.limit_velocity_eye;
-    config->limit_acceleration_eye = dyn_config.limit_acceleration_eye;
-
-    // parameters fo the breathing pattern
-    config->breath_period = dyn_config.breath_period;
-    config->breath_amplitude = dyn_config.breath_amplitude;
-
-    // parameters for eyelids
-    config->eyelids_follow_eyemotion = dyn_config.eyelids_follow_eyemotion;
-
-    // parameters for eye blinking
-    config->eyeblink_duration = dyn_config.eyeblink_duration;
-    config->eyeblink_periodic_distribution_lower = dyn_config.eyeblink_periodic_distribution_lower;
-    config->eyeblink_periodic_distribution_upper = dyn_config.eyeblink_periodic_distribution_upper;
-    config->eyeblink_probability_after_saccade = dyn_config.eyeblink_probability_after_saccade;
-    config->eyeblink_blocked_time = dyn_config.eyeblink_blocked_time;
-}
-
-//! attach to dynamic reconfigure server
-void MiddlewareROS::attach_to_reconfiguration_server(ros::NodeHandle priv_nodehandle) {
-    ROS_DEBUG_STREAM_NAMED("MiddlewareROS", "connecting to dynamic reconfiguration server");
-
-    ros::NodeHandle reconf_node(priv_nodehandle, "humotion/configuration");
-
-    reconf_server_ = new dynamic_reconfigure::Server<humotion::humotionConfig>(reconf_node);
-    reconf_server_->setCallback(boost::bind(
-                                    &MiddlewareROS::dynamic_reconfigure_callback, this, _1, _2));
-}
-
-//! destructor
-MiddlewareROS::~MiddlewareROS() {
-}
-
-//! connection ok?
-//! \return true if conn is alive
-bool MiddlewareROS::ok() {
-    return ros::ok();
-}
-
-//! do a single tick
-void MiddlewareROS::tick() {
-    if (tick_necessary_) {
-        ros::spinOnce();
-    }
-}
-
-//! init debug dataset publishers
-void MiddlewareROS::debug_initialize() {
-    if (debug_initialized_) {
-        return;
-    }
-
-    debug_initialized_ = true;
-}
-
-//! publish a debug dataset
-void MiddlewareROS::publish_debug_dataset(debug_data_t debug_data) {
-    if (!controller_->get_config()->publish_internals) {
-        // no debugging data enabled, return
-        return;
-    }
-
-    debug_initialize();
-
-    // iterate over all debug variables and publish them
-    debug_data_t::iterator it;
-    for (it = debug_data.begin(); it != debug_data.end(); it++) {
-        publish_debug_data(it->first, it->second);
-    }
-}
-
-void MiddlewareROS::publish_debug_data(std::string name, float value) {
-    debug_topic_map_t::iterator it = debug_topic_map.find(name);
-    if (it == debug_topic_map.end()) {
-        // we have no publisher for this dataset, create one:
-        ROS_DEBUG_STREAM("creating debug output stream " << name);
-        ros::Publisher pub =  nh_.advertise<std_msgs::Float32>("debug_data/" + name, 1000);
-
-        std::pair<debug_topic_map_t::iterator, bool> ret;
-        ret = debug_topic_map.insert(std::pair<std::string, ros::Publisher>(name, pub));
-        it = ret.first;
-    }
-
-    // in any case, it is now the publisher we want  so publish data now
-    std_msgs::Float32 msg;
-    msg.data = value;
-
-    // std::cout  << "DEBUG HUMOTION " << name << " " << value << std::endl;
-
-    // send it
-    it->second.publish(msg);
-}
-
-//! callback to handle incoming mouth  target
-void MiddlewareROS::incoming_mouth_target(const humotion::mouth::ConstPtr& msg) {
-    // printf("> incoming mouth_target\n");
-    MouthState mouth_state;
-
-    mouth_state.position_left   = msg->position.left;
-    mouth_state.position_center = msg->position.center;
-    mouth_state.position_right  = msg->position.right;
-
-    mouth_state.opening_left   = msg->opening.left;
-    mouth_state.opening_center = msg->opening.center;
-    mouth_state.opening_right  = msg->opening.right;
-
-    controller_->set_mouth_target(mouth_state);
-}
-
-
-//! callback to handle incoming gaze  target
-void MiddlewareROS::incoming_gaze_target(const humotion::gaze::ConstPtr& msg) {
-    GazeState gaze_state;
-    // printf("> incoming gaze_target [P:%3.1f, T:%3.1f, R:%3.1f] %d = %s\n",
-    //          msg->pan, msg->tilt, msg->roll, msg->type,
-    //          msg->type==humotion::gaze::GAZETYPE_ABSOLUTE?"ABSOLUTE":"RELATIVE");
-
-    gaze_state.pan  = msg->pan;
-    gaze_state.tilt = msg->tilt;
-    gaze_state.roll = msg->roll;
-    gaze_state.vergence = msg->vergence;
-
-    gaze_state.pan_offset  = msg->pan_offset;
-    gaze_state.tilt_offset = msg->tilt_offset;
-    gaze_state.roll_offset = msg->roll_offset;
-
-    gaze_state.eyelid_opening_upper = msg->eyelid_opening_upper;
-    gaze_state.eyelid_opening_lower = msg->eyelid_opening_lower;
-
-    gaze_state.eyebrow_left = msg->eyebrow_left;
-    gaze_state.eyebrow_right = msg->eyebrow_right;
-
-    gaze_state.eyeblink_request_left = msg->eyeblink_request_left;
-    gaze_state.eyeblink_request_right = msg->eyeblink_request_right;
-
-    if (msg->gaze_type == humotion::gaze::GAZETYPE_ABSOLUTE) {
-        gaze_state.gaze_type = GazeState::GAZETYPE_ABSOLUTE;
-    } else {
-        gaze_state.gaze_type = GazeState::GAZETYPE_RELATIVE;
-    }
-
-    gaze_state.timestamp.set(msg->gaze_timestamp.sec, msg->gaze_timestamp.nsec);
-
-    controller_->set_gaze_target(gaze_state);
-}
-
diff --git a/src/server/middleware_rsb.cpp b/src/server/middleware_rsb.cpp
deleted file mode 100644
index 7c03d27..0000000
--- a/src/server/middleware_rsb.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "server/middleware_rsb.h"
-
-#ifdef RSB_SUPPORT
-
-
-#define BOOST_SIGNALS_NO_DEPRECATION_WARNING 1
-#include <rsb/converter/ProtocolBufferConverter.h>
-#include <rsb/converter/Repository.h>
-#include <rsb/Factory.h>
-#include <rsb/Listener.h>
-#include <rsb/MetaData.h>
-#include <rsb/patterns/RemoteServer.h>
-
-#include <string>
-
-// using namespace std;
-// using namespace boost;
-// using namespace humotion;
-// using namespace humotion::server;
-// using namespace rsb;
-// using namespace rsb::patterns;
-
-WARNING:
-// RSB interface might be deprtecated and needs some backporting
-// from the ROS code. [todo]
-
-//! constructor
-MiddlewareRSB::MiddlewareRSB(string scope, Controller *c) : Middleware(scope, c) {
-    printf("> using RSB middleware\n");
-    printf("> registering converters\n");
-
-    // converter for GazeTarget
-    rsb::converter::Converter<string>::Ptr gazeTargetConverter(
-                new rsb::converter::ProtocolBufferConverter<rst::robot::HumotionGazeTarget>());
-    rsb::converter::converterRepository<string>()->registerConverter(gazeTargetConverter);
-
-    // converter for MouthTarget
-    rsb::converter::Converter<string>::Ptr mouthTargetConverter(
-                new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
-    rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
-
-    // first get a factory instance that is used to create RSB domain objects
-    Factory &factory = getFactory();
-
-    // create listeners
-    mouth_target_listener = factory.createListener(base_scope + "/humotion/mouth/target");
-    mouth_target_listener->addHandler(HandlerPtr(
-                                  new DataFunctionHandler<rst::robot::MouthTarget>(
-                                  boost::bind(&MiddlewareRSB::incoming_mouth_target, this, _1))));
-
-    gaze_target_listener  = factory.createListener(base_scope + "/humotion/gaze/target");
-    gaze_target_listener->addHandler(HandlerPtr(
-                                  new EventFunctionHandler(
-                                  boost::bind(&MiddlewareRSB::incoming_gaze_target, this, _1))));
-
-    // informer->publish(gaze_target);
-    printf("> MiddlewareRSB initialised\n");
-}
-
-
-//! destructor
-MiddlewareRSB::~MiddlewareRSB() {
-}
-
-//! connection ok?
-//! \return true if conn is alive
-bool MiddlewareRSB::ok() {
-    return true;
-}
-
-//! do a single tick
-void MiddlewareRSB::tick() {
-    // nothing to do
-}
-
-//! callback to handle incoming mouth  target
-void MiddlewareRSB::incoming_mouth_target(boost::shared_ptr<rst::robot::MouthTarget> msg) {
-    // printf("> incoming mouth_target\n");
-    MouthState mouth_state;
-
-    mouth_state.position_left   = msg->position_left();
-    mouth_state.position_center = msg->position_center();
-    mouth_state.position_right  = msg->position_right();
-
-    mouth_state.opening_left   = msg->opening_left();
-    mouth_state.opening_center = msg->opening_center();
-    mouth_state.opening_right  = msg->opening_right();
-
-    controller->set_mouth_target(mouth_state);
-}
-
-//! callback to handle incoming gaze  target
-void MiddlewareRSB::incoming_gaze_target(rsb::EventPtr event) {
-    // printf("> incoming gaze_target [P:%3.1f, T:%3.1f, R:%3.1f]\n",
-    // msg->pan(), msg->tilt(), msg->roll());
-
-    boost::shared_ptr<void> ev_data = event->getData();
-    rst::robot::HumotionGazeTarget *msg = (rst::robot::HumotionGazeTarget*) ev_data.get();
-
-    GazeState gaze_state;
-
-    if (msg->gaze_type() == rst::robot::HumotionGazeTarget::ABSOLUTE) {
-        gaze_state.gaze_type = GazeState::ABSOLUTE;
-    } else {
-        gaze_state.gaze_type = GazeState::RELATIVE;
-    }
-
-    gaze_state.pan  = msg->pan();
-    gaze_state.tilt = msg->tilt();
-    gaze_state.roll = msg->roll();
-    gaze_state.vergence = msg->vergence();
-
-    gaze_state.pan_offset  = msg->pan_offset();
-    gaze_state.tilt_offset = msg->tilt_offset();
-    gaze_state.roll_offset = msg->roll_offset();
-
-    gaze_state.eyelid_opening_upper = msg->eyelid_opening_upper();
-    gaze_state.eyelid_opening_lower = msg->eyelid_opening_lower();
-
-    gaze_state.eyebrow_left = msg->eyebrow_left();
-    gaze_state.eyebrow_right = msg->eyebrow_right();
-
-    gaze_state.eyeblink_request_left = msg->eyeblink_request_left();
-    gaze_state.eyeblink_request_right = msg->eyeblink_request_right();
-
-    gaze_state.timestamp = msg->gaze_timestamp();
-    // FIXME: convert RSB timestamp to our representation
-    // event->getMetaData().getCreateTime() / 1000.0;
-    // createTime() returns milliseconds -> convert to seconds
-
-    controller->set_gaze_target(gaze_state);
-}
-
-#endif
diff --git a/src/server/motion_generator.cpp b/src/server/motion_generator.cpp
deleted file mode 100644
index 4c10da9..0000000
--- a/src/server/motion_generator.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <boost/date_time/posix_time/posix_time.hpp>
-
-#include <utility>
-
-#include "humotion/server/motion_generator.h"
-
-using humotion::server::MotionGenerator;
-using humotion::server::Config;
-using humotion::server::debug_data_t;
-
-//! constructor
-MotionGenerator::MotionGenerator(JointInterface *j, Config *cfg) {
-    config = cfg;
-    joint_interface_ = j;
-    last_mouth_target_update_ = boost::posix_time::ptime(boost::posix_time::min_date_time);
-    last_gaze_target_update_  = boost::posix_time::ptime(boost::posix_time::min_date_time);
-}
-
-
-//! destructor
-MotionGenerator::~MotionGenerator() {
-}
-
-//! return all accumulated debug data
-debug_data_t MotionGenerator::get_debug_data() {
-    return debug_data_;
-}
-
-//! store debug data
-void MotionGenerator::store_debug_data(std::string name, float value) {
-    debug_data_[name] = value;
-}
-
-//! fetch the latest position and velocity and return the timestamp of that dataset
-//! \param joint id
-//! \param pointer to position variable
-//! \param pointer to velocity variable
-//! \return Timestamp of this dataset
-humotion::Timestamp MotionGenerator::get_timestamped_state(int joint_id,
-                                                           float *position, float *velocity) {
-    humotion::Timestamp stamp_p = joint_interface_->get_ts_position(joint_id).get_last_timestamp();
-    humotion::Timestamp stamp_v = joint_interface_->get_ts_speed(joint_id).get_last_timestamp();
-    humotion::Timestamp stamp;
-
-    if (stamp_v < stamp_p) {
-        // right now there is no velocity with that timestamp yet, therefore use the velocity ts
-        // for both:
-        stamp = stamp_v;
-    } else {
-        // both are available at the position ts, use that one
-        stamp = stamp_p;
-    }
-
-    // fetch data
-    *position = joint_interface_->get_ts_position(joint_id).get_interpolated_value(stamp);
-    *velocity = joint_interface_->get_ts_speed(joint_id).get_interpolated_value(stamp);
-    return stamp;
-}
-
-//! fetch the latest (=current) speed of a joint
-//! \param joint_id
-//! \return float value of joint speed
-float MotionGenerator::get_current_speed(int joint_id) {
-    return joint_interface_->get_ts_speed(joint_id).get_newest_value();
-}
-
-//! fetch the latest (=current) position of a joint
-//! \param joint_id
-//! \return float value of joint position
-float MotionGenerator::get_current_position(int joint_id) {
-    /*Timestamp tsl = joint_interface->get_ts_position(joint_id).get_last_timestamp();
-    Timestamp now = Timestamp::now();
-    Timestamp diff=now-tsl;
-    printf("TIME DIFF %fs %fns\n",diff.sec, diff.nsec);*/
-
-    return joint_interface_->get_ts_position(joint_id).get_newest_value();
-}
-
-//! update gaze target:
-//! \param GazeState with target values for the overall gaze
-void MotionGenerator::set_gaze_target(GazeState new_gaze_target) {
-    // store value for next iteration
-    requested_gaze_state_        = new_gaze_target;
-
-    // keep track if the gaze targets are comming in regulary
-    last_gaze_target_update_ = boost::get_system_time();
-}
-
-//! update mouth state:
-//! \param MouthState with target values for the mouth joints
-void MotionGenerator::set_mouth_target(MouthState s) {
-    // store value
-    requested_mouth_target_ = s;
-
-    // keep track if the mouth targets are comming in regulary
-    last_mouth_target_update_ = boost::get_system_time();
-}
-
-
-//! was there incoming gaze data the last second?
-//! \return true if there was data incoming in the last second, false otherwise
-bool MotionGenerator::gaze_target_input_active() {
-    if (last_gaze_target_update_  + boost::posix_time::milliseconds(1000)
-            > boost::get_system_time() ) {
-        // incoming data -> if gaze is disabled, enable it!
-        joint_interface_->enable_gaze_joints();
-        return true;
-    }
-
-    // else: no incoming data, disable!
-    joint_interface_->disable_gaze_joints();
-    return false;
-}
-
-//! was there incoming mouth data the last second?
-//! \return true if there was data incoming in the last second, false otherwise
-bool MotionGenerator::mouth_target_input_active() {
-    if (last_mouth_target_update_ + boost::posix_time::milliseconds(1000)
-            > boost::get_system_time() ) {
-        // incoming data -> if mouth is disabled, enable it!
-        joint_interface_->enable_mouth_joints();
-        return true;
-    }
-
-    // else: no incoming data, disable!
-    joint_interface_->disable_mouth_joints();
-    return false;
-}
-
-//! limit target to min/max bounds:
-float MotionGenerator::limit_target(int joint_id, float val) {
-    assert(joint_id < JointInterface::JOINT_ID_ENUM_SIZE);
-
-    // fetch min/max for joint:
-    float min = joint_interface_->get_joint_min(joint_id);
-    float max = joint_interface_->get_joint_max(joint_id);
-
-    if (max < min) {
-        printf("> ERROR: how can min (%4.2f) be bigger than max (%4.2f)?? EXITING NOW\n", min, max);
-        printf("> HINT : did you initialize the joints' min/max positions properly?\n");
-        exit(0);
-    }
-
-    val = fmin(val, max);
-    val = fmax(val, min);
-
-    return val;
-}
-
diff --git a/src/server/mouth_motion_generator.cpp b/src/server/mouth_motion_generator.cpp
deleted file mode 100644
index 0d8d449..0000000
--- a/src/server/mouth_motion_generator.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/mouth_motion_generator.h"
-
-using humotion::server::MouthMotionGenerator;
-using humotion::server::Config;
-
-// minimum mouth opening
-const float MouthMotionGenerator::MOUTH_MIN_OPENING = 7.0;  // mm
-
-//! constructor
-MouthMotionGenerator::MouthMotionGenerator(JointInterface *j, Config *cfg) :
-    MotionGenerator(j, cfg) {
-}
-
-//! destructor
-MouthMotionGenerator::~MouthMotionGenerator() {
-}
-
-//! calculate joint targets
-void MouthMotionGenerator::calculate_targets() {
-    // printf("> humotion: calculating mouth targets\n");
-    update_mouth_target(JointInterface::ID_LIP_LEFT_UPPER,   JointInterface::ID_LIP_LEFT_LOWER);
-    update_mouth_target(JointInterface::ID_LIP_CENTER_UPPER, JointInterface::ID_LIP_CENTER_LOWER);
-    update_mouth_target(JointInterface::ID_LIP_RIGHT_UPPER,  JointInterface::ID_LIP_RIGHT_LOWER);
-}
-
-//! calculate mouth target angles for a given combination of upper/lower joints
-//! \param int upper joint id
-//! \param int lower joint id
-void MouthMotionGenerator::update_mouth_target(int upper_id, int lower_id) {
-    // fetch min/max for joints
-    float min_upper = joint_interface_->get_joint_min(upper_id);
-    float max_lower = joint_interface_->get_joint_max(lower_id);
-    float min_opening = MOUTH_MIN_OPENING;
-
-    // fetch position & opening for joint, parameter is only used to
-    // determine LEFT/CENTER/RIGHT. upper/lower plays no role here
-    float position = mouthstate_to_position(requested_mouth_target_, upper_id);
-    float opening  = min_opening + mouthstate_to_opening(requested_mouth_target_, upper_id);
-
-    // check opening larger than minimum
-    if (opening < min_opening) {
-        // oops, not safe to move to this opening, abort move!
-        // printf("> invalid opening (%f)\n", opening);
-        opening = min_opening;
-    }
-
-    float unsafe_target_upper = position - opening/2.0;
-    float unsafe_target_lower = position + opening/2.0;
-
-    // now check if this would exceed the allowed limits for that joint
-    float distance_min_upper = unsafe_target_upper - min_upper;
-    if (distance_min_upper < 0) {
-        // oops, we will get to close to the safe border, abort move!
-        // printf("> collision on TOP [u=%4.2f l=%4.2f]\n",unsafe_target_upper,unsafe_target_lower);
-        unsafe_target_upper = min_upper;
-        unsafe_target_lower = unsafe_target_upper + opening;
-    }
-
-    float distance_max_lower = max_lower - unsafe_target_lower;
-    if (distance_max_lower < 0) {
-        // oops, we will get to close to the safe border, abort move!
-        // printf("> collision on BOT[u=%4.2f l=%4.2f]\n",unsafe_target_upper,unsafe_target_lower);
-        unsafe_target_lower = max_lower;
-        unsafe_target_upper = unsafe_target_lower - opening;
-    }
-
-    // tell the joint about the new values
-    joint_interface_->set_target(upper_id, unsafe_target_upper, 0.0);
-    joint_interface_->set_target(lower_id, unsafe_target_lower, 0.0);
-}
-
-
-//! extract opening from mouth state for given joint enum id
-//! \param MouthState m
-//! \param int enum with joint id
-float MouthMotionGenerator::mouthstate_to_opening(MouthState m, int e) {
-    switch (e) {
-    default: printf("> get_opening(0x%02X): invalid joint enum!\n", e); exit(EXIT_FAILURE);
-    case(JointInterface::ID_LIP_LEFT_UPPER):
-    case(JointInterface::ID_LIP_LEFT_LOWER):
-        return m.opening_left;
-    case(JointInterface::ID_LIP_CENTER_UPPER):
-    case(JointInterface::ID_LIP_CENTER_LOWER):
-        return m.opening_center;
-    case(JointInterface::ID_LIP_RIGHT_UPPER):
-    case(JointInterface::ID_LIP_RIGHT_LOWER):
-        return m.opening_right;
-    }
-}
-
-//! extract position from mouth state for given joint enum id
-//! \param MouthState m
-//! \param int enum with joint id
-float MouthMotionGenerator::mouthstate_to_position(MouthState m, int e) {
-    switch (e) {
-    default: printf("> get_position(0x%02X): invalid joint enum!\n", e); exit(EXIT_FAILURE);
-    case(JointInterface::ID_LIP_LEFT_UPPER):
-    case(JointInterface::ID_LIP_LEFT_LOWER):
-        return m.position_left;
-    case(JointInterface::ID_LIP_CENTER_UPPER):
-    case(JointInterface::ID_LIP_CENTER_LOWER):
-        return m.position_center;
-    case(JointInterface::ID_LIP_RIGHT_UPPER):
-    case(JointInterface::ID_LIP_RIGHT_LOWER):
-        return m.position_right;
-    }
-}
-
-//! publish targets to motor boards:
-void MouthMotionGenerator::publish_targets() {
-    // publish values if there is an active gaze input within the last timerange
-    if (mouth_target_input_active()) {
-        joint_interface_->publish_target(JointInterface::ID_LIP_LEFT_UPPER);
-        joint_interface_->publish_target(JointInterface::ID_LIP_LEFT_LOWER);
-        joint_interface_->publish_target(JointInterface::ID_LIP_CENTER_UPPER);
-        joint_interface_->publish_target(JointInterface::ID_LIP_CENTER_LOWER);
-        joint_interface_->publish_target(JointInterface::ID_LIP_RIGHT_UPPER);
-        joint_interface_->publish_target(JointInterface::ID_LIP_RIGHT_LOWER);
-    }
-}
-
diff --git a/src/server/neck_motion_generator.cpp b/src/server/neck_motion_generator.cpp
deleted file mode 100644
index 256211a..0000000
--- a/src/server/neck_motion_generator.cpp
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <cmath>
-
-#include "humotion/server/gaze_motion_generator.h"
-#include "humotion/server/neck_motion_generator.h"
-#include "humotion/server/server.h"
-
-using humotion::server::NeckMotionGenerator;
-using humotion::server::Config;
-
-//! constructor
-NeckMotionGenerator::NeckMotionGenerator(JointInterface *j, Config *cfg) :
-    GazeMotionGenerator(j, cfg, 3, 1.0/Server::MOTION_UPDATERATE) {
-    breath_time_ = 0.0;
-}
-
-
-//! destructor
-NeckMotionGenerator::~NeckMotionGenerator() {
-}
-
-//! get a breath offset angle
-//! @return float of breath offset value
-float NeckMotionGenerator::get_breath_offset() {
-    // we want to have a constant acceleration
-    // -> triangular wave as speeds -> (x<0.5)? 2*x*x:  1- 2*(1-x)**2 = 4x - 2x**2 - 1
-    float breath_offset = 0.0;
-
-    // 0...1 -> move up, 1..2 -> return, 2..3 -> still
-    float breath_time_normalized = (breath_time_ * 3)/config->breath_period;
-
-    if (breath_time_normalized <= 0.5) {
-        // accelerated motion
-        breath_offset = config->breath_amplitude * (2.0 * pow(breath_time_normalized, 2));
-    } else if (breath_time_normalized <= 1.0) {
-        // deaccelerate
-        breath_offset = config->breath_amplitude * (1.0 - 2.0
-                                                    * pow(1.0 - breath_time_normalized, 2));
-    } else if (breath_time_normalized <= 1.5) {
-        // accelerate again
-        breath_offset = config->breath_amplitude * (1.0 - (2.0 * pow(breath_time_normalized-1, 2)));
-    } else if (breath_time_normalized <= 2.0) {
-        breath_offset = config->breath_amplitude * (2.0 * pow(2.0 - breath_time_normalized, 2));
-    } else if (breath_time_normalized <= 3.0) {
-        // pause for some time
-        breath_offset = 0;
-    }
-
-    // fetch next time
-    breath_time_ += 1.0/Server::MOTION_UPDATERATE;
-
-    if (breath_time_ >= config->breath_period) {
-        breath_time_ -= config->breath_period;
-    }
-
-    return breath_offset;
-}
-
-
-//! calculate joint targets
-void NeckMotionGenerator::calculate_targets() {
-    // fetch current dataset
-    float neck_pan_now, neck_tilt_now, neck_roll_now;
-    float neck_pan_speed, neck_tilt_speed, neck_roll_speed;
-
-    humotion::Timestamp neck_pan_ts = get_timestamped_state(JointInterface::ID_NECK_PAN,
-                                                            &neck_pan_now,
-                                                            &neck_pan_speed);
-
-    humotion::Timestamp neck_tilt_ts = get_timestamped_state(JointInterface::ID_NECK_TILT,
-                                                            &neck_tilt_now,
-                                                            &neck_tilt_speed);
-
-    humotion::Timestamp neck_roll_ts = get_timestamped_state(JointInterface::ID_NECK_ROLL,
-                                                            &neck_roll_now,
-                                                            &neck_roll_speed);
-
-    // reached target?
-    float goal_diff   = fabs(get_current_gaze().distance_pt_abs(requested_gaze_state_));
-    float target_diff = fabs(requested_gaze_state_.distance_pt_abs(previous_neck_target_));
-
-    // printf("GOAL DIFF = %f TARGET DIFF = %f\n",goal_diff,target_diff);
-    // get_current_gaze().dump();
-    // requested_gaze_state.dump();
-
-    // check if new target
-    // close to goal?
-    if ( (neck_saccade_active_) && (goal_diff < 1.0) ) {
-        neck_saccade_reached_goal_ = true;
-    }
-
-    if (neck_saccade_active_) {
-        previous_neck_target_ = requested_gaze_state_;
-    }
-
-    // if we get a new target now, we can stop the neck saccade
-    if (target_diff > .1) {
-        if (neck_saccade_reached_goal_) {
-            // joint_interface->neck_saccade_done();
-            neck_saccade_active_ = false;
-            neck_saccade_reached_goal_ = false;
-        }
-    }
-
-    if (neck_saccade_requested) {
-        neck_saccade_active_ = true;
-    }
-
-    // check if this is a small or big saccade
-    if (neck_saccade_active_ || neck_saccade_omr) {
-        // full saccade with neck motion -> update neck target
-        requested_neck_state_ = requested_gaze_state_;
-    }
-
-    // get targets: this is the sum of stored neck target and up-to-date offset:
-    float neck_pan_target  = requested_neck_state_.pan  + requested_gaze_state_.pan_offset;
-    float neck_tilt_target = requested_neck_state_.tilt + requested_gaze_state_.tilt_offset;
-
-    // roll is always equal to requested gaze (not neck) state
-    float neck_roll_target = requested_gaze_state_.roll + requested_gaze_state_.roll_offset;
-
-    // add breath wave to tilt
-    neck_tilt_target += get_breath_offset();
-
-    //neck_roll_target = 0.0;
-    //printf("%f %f %f %f ROLL\n", neck_pan_target, neck_roll_target, neck_roll_now, neck_roll_speed);
-
-    // pass parameters to reflexxes api
-    setup_neckmotion(0, neck_pan_target,  neck_pan_now,  neck_pan_speed,  neck_pan_ts);
-    setup_neckmotion(1, neck_tilt_target, neck_tilt_now, neck_tilt_speed, neck_tilt_ts);
-    setup_neckmotion(2, neck_roll_target, neck_roll_now, neck_roll_speed, neck_roll_ts);
-
-
-    // call reflexxes to handle profile calculation
-    reflexxes_calculate_profile();
-
-    // tell the joint if about the new values
-    joint_interface_->set_target(JointInterface::ID_NECK_PAN,
-                                reflexxes_position_output->NewPositionVector->VecData[0],
-                                reflexxes_position_output->NewVelocityVector->VecData[0]);
-
-    joint_interface_->set_target(JointInterface::ID_NECK_TILT,
-                                reflexxes_position_output->NewPositionVector->VecData[1],
-                                reflexxes_position_output->NewVelocityVector->VecData[1]);
-
-    joint_interface_->set_target(JointInterface::ID_NECK_ROLL,
-                                reflexxes_position_output->NewPositionVector->VecData[2],
-                                reflexxes_position_output->NewVelocityVector->VecData[2]);
-
-    //printf("%f %f %f RRR\n", );
-
-    /*printf("\n%f %f %f %f %f DBG\n",
-            neck_pan_now, neck_pan_target,
-            reflexxes_position_output->NewPositionVector->VecData[0],
-            joint_interface_->get_ts_speed(JointInterface::ID_NECK_PAN).get_newest_value(),
-            reflexxes_position_output->NewVelocityVector->VecData[0]
-            );*/
-
-    /*printf("\n%f %f %f %f %f #GAZELOG\n",
-            boost::get_system_time().time_of_day().total_milliseconds()/1000.0,
-            requested_gaze_state_.pan + requested_gaze_state_.pan_offset,
-            get_current_gaze().pan,
-            (get_current_position(JointInterface::ID_EYES_LEFT_LR) + get_current_position(JointInterface::ID_EYES_RIGHT_LR))/2.0,
-            get_current_position(JointInterface::ID_NECK_PAN));*/
-
-    // store debug data:
-    store_debug_data("neck/neck_pan_now", neck_pan_now);
-    store_debug_data("neck/neck_tilt_now", neck_tilt_now);
-    store_debug_data("neck/neck_pan_target", neck_pan_target);
-    store_debug_data("neck/neck_tilt_target", neck_tilt_target);
-
-    store_debug_data("neck/gaze_target_pan", requested_gaze_state_.pan);
-    store_debug_data("neck/gaze_target_tilt", requested_gaze_state_.tilt);
-
-    store_debug_data("neck/output_pan", reflexxes_position_output->NewPositionVector->VecData[0]);
-    store_debug_data("neck/output_tilt", reflexxes_position_output->NewPositionVector->VecData[1]);
-}
-
-//! publish targets to motor boards:
-void NeckMotionGenerator::publish_targets() {
-    // publish values if there is an active gaze input within the last timerange
-    if (gaze_target_input_active()) {
-        joint_interface_->publish_target(JointInterface::ID_NECK_PAN);
-        joint_interface_->publish_target(JointInterface::ID_NECK_TILT);
-        joint_interface_->publish_target(JointInterface::ID_NECK_ROLL);
-    }
-}
-
-
-//! set up neck motion profile
-//! this will use speed and acceleration calc formulas from literature:
-//! \param dof id of joint
-//! \param target angle
-//! \param current angle
-void NeckMotionGenerator::setup_neckmotion(int dof, float target, float current_position,
-                                           float current_velocity, humotion::Timestamp timestamp) {
-    // get distance to target
-    float distance_abs = fabs(target - current_position);
-
-
-    // get max speed: according to the equation Hmax from [guitton87] there is a linear relation
-    // between distance_abs and v_max_head:
-    // v_max = 4.39 * d_total + 106.0 (in degrees)
-    float max_velocity = 4.39 * distance_abs + 106.0;
-
-    // scale and limit max speed:
-    max_velocity = max_velocity * config->scale_velocity_neck;
-    max_velocity = fmin(max_velocity, config->limit_velocity_neck);
-
-    // max accel: assuming linear acceleration we have:
-
-    /* v ^  _
-    *   |  / \
-    *   | /   \
-    *   |/_____\___> t
-    */
-    // d_total = 2 * 1/2 * a * (t_total/2)^2 = 1/4 * a * t_total^2
-    // as we use linear accel we have
-    // v_max = a * t_total/2  --> t_total = 2*v_max / a
-    // combine both
-    // d_total = 1/4 * a * 4 * vmax^2 / a^2 = v_max^2 / a
-    // d_total = a * 2 * d_total / (v_max^2)
-    // and therefore
-    // a = v_max^2 / d_total
-    float max_accel = 1.0;
-
-    if (distance_abs > 0.0) {
-        max_accel = pow(max_velocity, 2) / distance_abs;
-    }
-
-    // scale and limit acceleration
-    max_accel = max_accel * config->scale_acceleration_neck;
-    max_accel = fmin(max_accel, config->limit_acceleration_neck);
-
-    // printf("MAX SPEED %4.2f / max accel %4.2f\n",max_speed, max_accel);
-    // printf("%f %f %f ", distance_abs, max_velocity, max_accel);
-
-    // feed reflexxes api with data
-    reflexxes_set_input(dof, target, current_position, current_velocity,
-                        timestamp, max_velocity, max_accel);
-}
diff --git a/src/server/reflexxes_motion_generator.cpp b/src/server/reflexxes_motion_generator.cpp
deleted file mode 100644
index 49e3312..0000000
--- a/src/server/reflexxes_motion_generator.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include "humotion/server/eye_motion_generator.h"
-
-using humotion::server::ReflexxesMotionGenerator;
-using humotion::server::Config;
-
-//! constructor
-ReflexxesMotionGenerator::ReflexxesMotionGenerator(JointInterface *j, Config *c, int dof, float t) :
-    MotionGenerator(j, c) {
-    dof_count = dof;
-
-    // create Reflexxes API for <dof> DOF actuator
-    reflexxes_api = new ReflexxesAPI(dof, t);
-    reflexxes_position_input  = new RMLPositionInputParameters(dof);
-    reflexxes_position_output = new RMLPositionOutputParameters(dof);
-
-    // synchronize phase
-    reflexxes_motion_flags.SynchronizationBehavior =
-            //RMLPositionFlags::NO_SYNCHRONIZATION;
-            RMLPositionFlags::PHASE_SYNCHRONIZATION_IF_POSSIBLE;
-}
-
-//! destructor
-ReflexxesMotionGenerator::~ReflexxesMotionGenerator() {
-}
-
-//! feed motion generator with target data:
-//! \param dof id
-//! \param target angle
-//! \param max_speed max reachable speed during accel
-//! \param max_accel max allowable acceleration
-void ReflexxesMotionGenerator::reflexxes_set_input(int dof, float target,
-                                                   float current_position, float current_velocity,
-                                                   humotion::Timestamp timestamp,
-                                                   float max_speed, float max_accel) {
-    assert(dof < dof_count);
-
-    // set up reflexxes control loop
-    reflexxes_position_input->TargetPositionVector->VecData[dof]  = target;
-    reflexxes_position_input->SelectionVector->VecData[dof]       = true;
-    reflexxes_position_input->MaxVelocityVector->VecData[dof]     = max_speed;
-    reflexxes_position_input->MaxAccelerationVector->VecData[dof] = max_accel;
-
-    // target speed is zero (really?)
-    reflexxes_position_input->TargetVelocityVector->VecData[dof]  = 0.0;
-
-    // safety: libreflexxes does not like zero accellerations...
-    if (reflexxes_position_input->MaxAccelerationVector->VecData[dof] == 0.0) {
-            reflexxes_position_input->MaxAccelerationVector->VecData[dof] = 0.0001;
-    }
-}
-
-
-//! calculate motion profile
-
-void ReflexxesMotionGenerator::reflexxes_calculate_profile() {
-    int res = reflexxes_api->RMLPosition(*reflexxes_position_input,
-                                         reflexxes_position_output, reflexxes_motion_flags);
-
-    if (res < 0) {
-        if (res == ReflexxesAPI::RML_ERROR_INVALID_INPUT_VALUES) {
-            printf("> ReflexxesMotionGenerator --> RML_ERROR_INVALID_INPUT_VALUES error\n");
-        } else {
-            printf("> ReflexxesMotionGenerator --> UNKNOWN_ERROR: reflexxes error %d\n", res);
-        }
-    }
-
-    // feed back values
-    for (int i = 0; i < dof_count; i++) {
-        reflexxes_position_input->CurrentPositionVector->VecData[i]     =
-                reflexxes_position_output->NewPositionVector->VecData[i];
-
-        reflexxes_position_input->CurrentVelocityVector->VecData[i]     =
-                reflexxes_position_output->NewVelocityVector->VecData[i];
-
-        reflexxes_position_input->CurrentAccelerationVector->VecData[i] =
-                reflexxes_position_output->NewAccelerationVector->VecData[i];
-    }
-}
diff --git a/src/server/server.cpp b/src/server/server.cpp
deleted file mode 100644
index ca9b658..0000000
--- a/src/server/server.cpp
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <boost/algorithm/string.hpp>
-
-#include <string>
-
-#include "humotion/server/middleware_ros.h"
-#include "humotion/server/server.h"
-
-using humotion::server::Server;
-
-//! set up constant for updaterate (50Hz)
-const float Server::MOTION_UPDATERATE = 50.0;
-
-//! constructor
-//! open a new server instance.
-Server::Server(std::string scope, std::string mw, JointInterface *_joint_interface) {
-    // convert mw to uppercase
-    boost::to_upper(mw);
-
-    printf("> initializing humotion server (on %s, middleware=%s)\n", scope.c_str(), mw.c_str());
-
-    // store pointer to joint interface
-    joint_interface_ = _joint_interface;
-
-    // tell joint interface our framerate
-    joint_interface_->set_framerate(MOTION_UPDATERATE);
-
-    // create controller
-    controller_ = new Controller(joint_interface_);
-    controller_->init_motion_generators();
-
-    // start middleware
-    if (mw == "ROS") {
-        middleware_ = new MiddlewareROS(scope, controller_);
-    } else {
-        printf("> ERROR: invalid mw '%s' given. RSB support was dropped. Please use ROS\n\n",
-               mw.c_str());
-        exit(EXIT_FAILURE);
-    }
-
-    // start motion generation thread
-    start_motion_generation_thread();
-}
-
-//! destructor
-Server::~Server() {
-}
-
-//! middleware still running?
-bool Server::ok() {
-    return middleware_->ok();
-}
-
-//! start main thread
-void Server::start_motion_generation_thread() {
-    motion_generation_thread_ptr_ = new boost::thread(boost::bind(
-                                                         &Server::motion_generation_thread, this));
-}
-
-//! main thread that handles all data in/out
-//! this thread will take care of gathering all input data and
-//! then generate the output targets at a fixed rate of \sa MOTION_UPDATERATE
-void Server::motion_generation_thread() {
-    unsigned int incoming_data_count_invalid = 0;
-
-    printf("> started motion generation thread\n");
-
-    // calculate loop delay
-    float loop_delay = 1000.0 / MOTION_UPDATERATE;
-    boost::system_time timeout = boost::get_system_time() +
-                                 boost::posix_time::milliseconds(loop_delay);
-    printf("> one loop = %3.1fms\n", loop_delay);
-
-    // wait for incoming joint data
-    while (middleware_->ok()) {
-        // mw tick
-        middleware_->tick();
-
-        unsigned int incoming_data_count =
-                joint_interface_->get_and_clear_incoming_position_count();
-
-        if (incoming_data_count == 0) {
-            incoming_data_count_invalid++;
-            if (incoming_data_count_invalid >= MOTION_UPDATERATE) {
-                printf("> waiting for valid incoming joint data (position+velocity)\n");
-                incoming_data_count_invalid = 0;
-            }
-        } else {
-            // fine, joint data is arriving, exit waiting loop
-            break;
-        }
-
-        boost::thread::sleep(timeout);
-        timeout = boost::get_system_time() + boost::posix_time::milliseconds(loop_delay);
-    }
-
-    printf("> joint data arrived, control loop active.\n");
-    controller_->set_activated();
-
-    // fine, data is arriving, activate and run control loop
-    while (middleware_->ok()) {
-        // mw tick
-        middleware_->tick();
-
-
-        // calculate all targets
-        controller_->calculate_targets();
-
-        // do some logging
-        middleware_->publish_debug_dataset(controller_->get_debug_data());
-
-        // publish data to joints
-        controller_->publish_targets();
-
-        // finally execute the movement
-        joint_interface_->execute_motion();
-
-        // check if we received joint information in the last step
-        unsigned int incoming_data_count =
-                joint_interface_->get_and_clear_incoming_position_count();
-
-        if (incoming_data_count == 0) {
-            // printf("> WARNING: no incoming joint data during the last iteration...\n");
-            incoming_data_count_invalid++;
-            if (incoming_data_count_invalid >= MOTION_UPDATERATE) {
-                printf("> ERROR: no incoming joint data for >1 second -> will exit now\n");
-                exit(EXIT_FAILURE);
-            }
-        } else {
-            incoming_data_count_invalid = 0;
-        }
-
-        boost::thread::sleep(timeout);
-        timeout = boost::get_system_time() + boost::posix_time::milliseconds(loop_delay);
-    }
-
-    printf("> motion generation thread exited.\n");
-}
diff --git a/src/timestamp.cpp b/src/timestamp.cpp
deleted file mode 100644
index 109b221..0000000
--- a/src/timestamp.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <math.h>
-
-#include "humotion/timestamp.h"
-
-using humotion::Timestamp;
-
-Timestamp::Timestamp(void) {
-    // init of an empty timestamp will be assigned to the current system time
-    set(now());
-}
-
-Timestamp::Timestamp(uint32_t _sec, uint32_t _nsec) {
-    set(_sec, _nsec);
-}
-
-Timestamp::Timestamp(double dsec) {
-    double fsec, fnsec;
-    fnsec = modf(dsec , &fsec);
-    sec  = fsec;
-    nsec = fnsec * 1000000000.0;
-}
-
-Timestamp Timestamp::now(void) {
-    struct timespec tp;
-    clock_gettime(CLOCK_REALTIME, &tp);
-    return Timestamp(tp.tv_sec, tp.tv_nsec);
-}
-
-void Timestamp::set(uint32_t _sec, uint32_t _nsec) {
-    sec  = _sec;
-    nsec = _nsec;
-}
-
-void Timestamp::set(Timestamp a) {
-    set(a.sec, a.nsec);
-}
-
-double Timestamp::to_seconds(void) {
-    return sec + (static_cast<double>(nsec))/1000000000.0;
-}
-
-bool Timestamp::operator<= (const Timestamp &cmp) const {
-    if (sec < cmp.sec) {
-        return true;
-    } else if (sec > cmp.sec) {
-        return false;
-    } else {  // (a.sec == b.sec)
-        // seconds are equal, check nsec:
-        return (nsec <= cmp.nsec);
-    }
-}
-
-bool Timestamp::is_null(void) {
-    return (sec == 0) && (nsec == 0);
-}
-
-bool Timestamp::operator< (const Timestamp &cmp) const {
-    if (sec < cmp.sec) {
-        return true;
-    } else if (sec > cmp.sec) {
-        return false;
-    } else {  // (a.sec == b.sec)
-        // seconds are equal, check nsec:
-        return (nsec < cmp.nsec);
-    }
-}
-
-bool Timestamp::operator>= (const Timestamp &cmp) const {
-    if (sec > cmp.sec) {
-        return true;
-    } else if (sec < cmp.sec) {
-        return false;
-    } else {  // (a.sec == b.sec)
-        // seconds are equal, check nsec:
-        return (nsec >= cmp.nsec);
-    }
-}
-
-bool Timestamp::operator> (const Timestamp &cmp) const {
-    if (sec > cmp.sec) {
-        return true;
-    } else if (sec < cmp.sec) {
-        return false;
-    } else {  // (a.sec == b.sec)
-        // seconds are equal, check nsec:
-        return (nsec > cmp.nsec);
-    }
-}
-
-bool Timestamp::operator== (const Timestamp &cmp) const {
-    return (sec == cmp.sec) && (nsec == cmp.nsec);
-}
-
-bool Timestamp::operator!= (const Timestamp &cmp) const {
-    return !(*this == cmp);
-}
-
diff --git a/src/timestamped_list.cpp b/src/timestamped_list.cpp
deleted file mode 100644
index 1384eaf..0000000
--- a/src/timestamped_list.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
-* This file is part of humotion
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/humotion
-*
-* This file may be licensed under the terms of the
-* GNU Lesser General Public License Version 3 (the ``LGPL''),
-* or (at your option) any later version.
-*
-* Software distributed under the License is distributed
-* on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
-* express or implied. See the LGPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the LGPL along with this
-* program. If not, go to http://www.gnu.org/licenses/lgpl.html
-* or write to the Free Software Foundation, Inc.,
-* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*
-* The development of this software was supported by the
-* Excellence Cluster EXC 277 Cognitive Interaction Technology.
-* The Excellence Cluster EXC 277 is a grant of the Deutsche
-* Forschungsgemeinschaft (DFG) in the context of the German
-* Excellence Initiative.
-*/
-
-#include <assert.h>
-
-#include "humotion/timestamped_list.h"
-
-using boost::mutex;
-using humotion::TimestampedList;
-
-TimestampedList::TimestampedList(unsigned int s) {
-    // initialize the list to its desired size:
-    TimestampedFloat now(Timestamp::now(), 0.0);
-    tsf_list_.resize(s, now);
-}
-
-TimestampedList::TimestampedList(TimestampedList const &l) {
-    // lock the tsf_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(l.access_mutex_);
-
-    // now do a deep copy with locking!
-    tsf_list_ = l.tsf_list_;
-}
-
-void TimestampedList::copy_tsf_list_to(timestamped_float_list_t *target) {
-    // lock the tsf_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(access_mutex_);
-
-    *target = tsf_list_;
-}
-
-
-humotion::Timestamp TimestampedList::get_first_timestamp() {
-    // lock the tsf_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(access_mutex_);
-
-    if (tsf_list_.empty()) {
-        return Timestamp(0, 0);
-    }
-
-    timestamped_float_list_t::iterator it = tsf_list_.begin();
-    return it->timestamp;
-}
-
-humotion::Timestamp TimestampedList::get_last_timestamp() {
-    // lock the tsf_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(access_mutex_);
-
-    if (tsf_list_.empty()) {
-        return Timestamp(0, 0);
-    }
-
-    timestamped_float_list_t::iterator it = tsf_list_.end();
-    it--;
-    return it->timestamp;
-}
-
-void TimestampedList::insert(Timestamp timestamp, float val) {
-    // erase first element:
-    tsf_list_.pop_front();
-    tsf_list_.push_back(TimestampedFloat(timestamp, val));
-    // printf("insert [%5.3f] = %5.1f\n",timestamp,val);
-}
-
-float TimestampedList::get_newest_value() {
-    // lock the tsf_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(access_mutex_);
-
-    if (tsf_list_.empty()) {
-        printf("> WARNING: requested newest value from empty list, returning 0.0\n");
-        return 0.0;
-    }
-
-    timestamped_float_list_t::iterator it = tsf_list_.end();
-    it--;
-    return it->value;
-}
-
-float TimestampedList::get_interpolated_value(Timestamp target_ts) {
-    // lock the tsf_list for this access. by doing this we assure
-    // that no other thread accessing this element can diturb the
-    // following atomic instructions:
-    mutex::scoped_lock scoped_lock(access_mutex_);
-
-    TimestampedFloat previous;
-    // printf("> latency %3.2fms\n", (Timestamped().to_seconds() - target_ts.to_seconds())*1000.0);
-
-    for ( timestamped_float_list_t::iterator it = tsf_list_.begin(); it != tsf_list_.end(); ++it ) {
-        if (it->timestamp == target_ts) {
-            // perfect match, return this value
-            return it->value;
-        } else if (it->timestamp > target_ts) {
-            // ok found close target
-            if (it == tsf_list_.begin()) {
-                // no preceding element
-                printf("> warning, timestamp %6.3f smaller than first element %6.3f in timestamped"
-                       "list. this should not happen (increase ts buffer?)\n",
-                       target_ts.to_seconds(), tsf_list_.begin()->timestamp.to_seconds());
-                return it->value;
-            } else {
-                // do interpolation
-                return interpolate(*it, previous, target_ts);
-            }
-        }
-        previous = *it;
-    }
-
-    // we reached the end, return the last value
-    printf("> warning: found no timestamp >= than %f in timestamped list...\n",
-           target_ts.to_seconds());
-    printf("           this should not happen as images will always be behind\n");
-    printf("           the motor data. returning most recent value (ts=%f)\n",
-           previous.timestamp.to_seconds());
-
-    return previous.value;
-}
-
-float TimestampedList::interpolate(TimestampedFloat a, TimestampedFloat b, Timestamp timestamp) {
-    // a->timestamp < timestamp <= b->timestamp
-    double dist_a = timestamp.to_seconds() - a.timestamp.to_seconds();
-    double dist_b = b.timestamp.to_seconds() - timestamp.to_seconds();
-    double dist   = dist_a + dist_b;
-
-    float interpolation = a.value + (dist_a / dist) * (b.value - a.value);
-    return interpolation;
-}
-
-
-// tests
-void TimestampedList::run_tests() {
-    int size = 10;
-    TimestampedList list(size);
-
-    for (int i = 0; i < size; i++) {
-        list.insert(Timestamp(i * 100.0, 0), i*10.0);
-    }
-
-    // test algorithm:
-
-    // test exact match:
-    for (int i =0 ; i < size; i++) {
-        Timestamp ts(i*100.0, 0);
-        printf("> testing get_interpolated_value(%f) == %f (value read back = %f)\n",
-               ts.to_seconds(), i*10.0, list.get_interpolated_value(ts));
-        assert(list.get_interpolated_value(ts) == i*10.0);
-    }
-    printf("passed test 1\n");
-
-    assert(list.get_interpolated_value(Timestamp(0.0, 0)) == 0.0);
-    assert(list.get_interpolated_value(Timestamp(110.0, 0)) == 11.0);
-    assert(list.get_interpolated_value(Timestamp(150.0, 0)) == 15.0);
-    assert(list.get_interpolated_value(Timestamp(999990.0, 0)) == 90.0);
-
-    printf("passed test 2\n");
-
-    list.insert(Timestamp(1000.0, 0), 200.0);
-    list.insert(Timestamp(1300.0, 0), -100.0);
-    assert(list.get_interpolated_value(Timestamp(1100, 0)) == 100.0);
-    assert(list.get_interpolated_value(Timestamp(1200, 0)) == 0.0);
-    assert(list.get_interpolated_value(Timestamp(1300, 0)) == -100.0);
-    assert(list.get_interpolated_value(Timestamp(1250, 0)) == -50.0);
-
-    printf("passed test 3\n");
-    exit(EXIT_SUCCESS);
-}
diff --git a/stylecheck/CpplintWrapper.cmake b/stylecheck/CpplintWrapper.cmake
deleted file mode 100644
index 9464f77..0000000
--- a/stylecheck/CpplintWrapper.cmake
+++ /dev/null
@@ -1,84 +0,0 @@
-# We use Google's cpplint for style checking.
-# This is optional and graceful; meaning we do not quit building even if there are warnings.
-# We are not that pedantic. However, we will keep an eye on the count of warnings.
-# Related parameters:
-#   Setting variable ENABLE_CPPLINT to true will enable cpplint.
-set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5 2.4) # Prefer Python-2
-find_package(PythonInterp)
-if(PYTHONINTERP_FOUND)
-    message(STATUS "Found Python. Python version is ${PYTHON_VERSION_STRING}.")
-    if(${PYTHON_VERSION_MAJOR} EQUAL 3)
-        message(WARNING "OUCH! The Python found is Python 3. Cpplint.py doesn't run on it so far.")
-        message(WARNING "Cpplint won't detect errors. Install Python 2 to fix this issue.")
-    endif(${PYTHON_VERSION_MAJOR} EQUAL 3)
-    if(ENABLE_CPPLINT)
-        set(RUN_CPPLINT true)
-    else(ENABLE_CPPLINT)
-        message(STATUS "ENABLE_CPPLINT was not given. Skipped running cpplint")
-        set(RUN_CPPLINT false)
-    endif(ENABLE_CPPLINT)
-else(PYTHONINTERP_FOUND)
-    message(STATUS "python executable not found. Skipped running cpplint")
-    set(RUN_CPPLINT false)
-endif(PYTHONINTERP_FOUND)
-
-# Followings are our coding convention.
-set(LINT_FILTER) # basically everything Google C++ Style recommends. Except...
-
-# This the only rule cpplint.py disables by default. Enable it.
-# However, the default implementation of build/include_alpha in cpplint.py is a bit sloppy.
-# It doesn't correctly take care of "/" in include.
-# Thus we changed cpplint.py for this.
-set(LINT_FILTER ${LINT_FILTER},+build/include_alpha)
-
-# for logging and debug printing, we do need streams
-set(LINT_FILTER ${LINT_FILTER},-readability/streams)
-
-# We use C++11 with some restrictions.
-# set(LINT_FILTER ${LINT_FILTER},-build/c++11)
-# 
-
-# Consider disabling them if they cause too many false positives.
-# set(LINT_FILTER ${LINT_FILTER},-build/include_what_you_use)
-# set(LINT_FILTER ${LINT_FILTER},-build/include_order)
-
-mark_as_advanced(LINT_FILTER)
-
-set(LINT_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/cpplint.py")
-mark_as_advanced(LINT_SCRIPT)
-set(LINT_WRAPPER "${CMAKE_CURRENT_LIST_DIR}/cpplint-wrapper.py")
-mark_as_advanced(LINT_WRAPPER)
-
-# 100 chars per line, which is suggested as an option in the style guide
-set(LINT_LINELENGTH 100)
-mark_as_advanced(LINT_LINELENGTH)
-
-# Registers a CMake target to run cpplint over all files in the given folder.
-# Parameters:
-#  target_name:
-#    The name of the target to define. Your program should depend on it to invoke cpplint.
-#  src_folder:
-#    The folder to recursively run cpplint.
-#  root_folder:
-#    The root folder used to determine desired include-guard comments.
-#  bin_folder:
-#    The temporary build folder to store a cpplint history file.
-function(CPPLINT_RECURSIVE target_name src_folder root_folder bin_folder)
-    if(RUN_CPPLINT)
-        message(STATUS "${target_name}: src=${src_folder}, root=${root_folder}, bin=${bin_folder}")
-        file(MAKE_DIRECTORY ${bin_folder})
-        add_custom_target(${target_name}
-                     COMMAND
-                        ${PYTHON_EXECUTABLE} ${LINT_WRAPPER}
-                        --cpplint-file=${LINT_SCRIPT}
-                        --history-file=${bin_folder}/.lint_history
-                        --linelength=${LINT_LINELENGTH}
-                        --filter=${LINT_FILTER}
-                        --root=${root_folder}
-                        ${src_folder}
-                     WORKING_DIRECTORY ${bin_folder}
-                     COMMENT "[CPPLINT-Target] ${src_folder}")
-    else(RUN_CPPLINT)
-        add_custom_target(${target_name} COMMAND ${CMAKE_COMMAND} -E echo NoLint)
-    endif(RUN_CPPLINT)
-endfunction(CPPLINT_RECURSIVE)
diff --git a/stylecheck/cpplint-wrapper.py b/stylecheck/cpplint-wrapper.py
deleted file mode 100644
index 7ccb1eb..0000000
--- a/stylecheck/cpplint-wrapper.py
+++ /dev/null
@@ -1,225 +0,0 @@
-#!/usr/bin/python
-## Copyright (c) 2014, Hewlett-Packard Development Company, LP.
-## The license and distribution terms for this file are placed in LICENSE.txt.
-# Wraps Google's cpplint.py for a few additional features;
-# 1) Recursively look for files to check. cpplint.py might do this out of box in future.
-# 2) Control whether we return a non-zero exit code if there are style errros (--style-error arg).
-# 3) Skip checking a file that had no warnings previously and has not changed since then.
-import getopt
-import os
-import json
-import re
-import string
-import subprocess
-import sys
-import time
-import unicodedata
-
-
-wrapper_usage = """
-Syntax: cpplint-wrapper.py
-        [--style-error]
-        [--excludes=<excluded folder name regex>]
-        [--extensions=<file extension regex>]
-        [--cpplint-file=<path of cpplint.py>]
-        [--history-file=<path of history file that describes the result of previous run>]
-        [other flags for cpplint, which are directly passed to cpplint]
-        <file/folder> [path] ...
-
-  Flags specific to cpplint-wrapper:
-
-    style-error
-      If specified, this python script returns a non-zero exit code if there are some
-      style warnings (which is the cpplint's behavior). Default is false.
-
-    excludes
-      If specified, files/folders whose names meet this regex are skipped.
-      Default is "(\.git|\.svn)".
-
-    extensions
-      If specified, files whose extensions meet this regex are verified by cpplint.
-      Default is "\.(c|h|cc|cpp|hpp)$".
-
-    cpplint-file
-      If specified, the path of cpplint.py. Default is "cpplint.py" (in working folder).
-
-    history-file
-      If specified, the path of history file to skip files that had no changes.
-      Default is ".lint_history" (in working folder)
-
-    file/folder
-      Required argument. The file(s) or folder(s) to recursively look for target files to
-      run cpplint on.
-"""
-
-style_error = False
-excludes = '(\.git|\.svn)'
-excludes_regex = re.compile(excludes);
-extensions = '\.(c|h|cc|cpp|hpp)$'
-extensions_regex = re.compile(extensions);
-cpplint_file = 'cpplint.py'
-history_file = '.lint_history'
-
-def print_usage(wrong_parameter):
-    sys.stderr.write(wrapper_usage)
-    if wrong_parameter:
-        sys.exit('\Wrong Parameter: ' + wrong_parameter)
-    else:
-        sys.exit(1)
-
-def parse_arguments(args):
-    (opts, names) = getopt.getopt(args, '', ['help',
-                                             'style-error', 'excludes=', 'extensions=',
-                                             'cpplint-file=', 'history-file=',
-                                             # followings are for cpplint
-                                             'output=', 'verbose=', 'counting=', 'filter=',
-                                             'root=', 'linelength='])
-    cpplint_arguments = []
-    for (opt, val) in opts:
-        if opt == '--help':
-            print_usage(None)
-        elif opt == '--style-error':
-            global style_error
-            style_error = True
-        elif opt == '--excludes':
-            global excludes
-            global excludes_regex
-            excludes = val
-            excludes_regex = re.compile(excludes);
-        elif opt == '--extensions':
-            global extensions
-            global extensions_regex
-            extensions = val
-            extensions_regex = re.compile(extensions);
-        elif opt == '--cpplint-file':
-            global cpplint_file
-            cpplint_file = val
-        elif opt == '--history-file':
-            global history_file
-            history_file = val
-        else:
-            cpplint_arguments.append(opt + '=' + val)
-
-    if not names:
-        print_usage('No files/folders were specified.')
-
-    return (names, cpplint_arguments)
-
-def get_files_recursive(folder, out_files):
-    for name in os.listdir(folder):
-        if excludes_regex.search(name) is None:
-            path = os.path.join(folder, name)
-            if os.path.isfile(path):
-                if extensions_regex.search(name) is not None:
-                    out_files.append(path)
-            else:
-                get_files_recursive(path, out_files)
-
-def compute_dir_index(files):
-    """ Return a tuple containing a dictionary: filepath => last
-    """
-    index = {}
-    start = time.time()
-    for f in files:
-        index[f] = str(os.path.getmtime(f))
-    end = time.time()
-    sys.stdout.write('cpplint-wrapper: Checked timestamp of ' + str(len(files)) + ' files in '
-                      + str(end - start) + ' sec.\n')
-
-    return index
-
-def store_dir_index(index, path):
-    start = time.time()
-    f = open(path, 'w')
-    json.dump(index, f)
-    f.close()
-    end = time.time()
-    sys.stdout.write('cpplint-wrapper: Wrote ' + path + ' (' + str(len(index)) + ' entries) in ' + str(end - start) + ' sec.\n')
-
-def load_dir_index(path):
-    start = time.time()
-    f = open(path, 'r')
-    idx = json.load(f)
-    f.close()
-    end = time.time()
-    sys.stdout.write('cpplint-wrapper: Read ' + path + ' (' + str(len(idx)) + ' entries) in ' + str(end - start) + ' sec.\n')
-    return idx
-
-def compute_diff(files, index_base, index_now):
-    new_index = {}
-
-    for f in files:
-        if not f in index_base or index_base[f] != index_now[f]:
-            new_index[f] = index_now[f]
-    return new_index
-
-def exec_cpplint(files, cpplint_arguments):
-    if not files:
-        sys.stdout.write('No files to check\n')
-        return False
-
-    # run cpplint only for files that have been changed or had some warning previously
-    index_last = {}
-    if os.path.isfile(history_file):
-        index_last = load_dir_index(history_file)
-    index_now = compute_dir_index(files)
-    index_now = compute_diff(files, index_last, index_now)
-    if not index_now:
-        sys.stdout.write('cpplint-wrapper: No files have been changed\n')
-        return False
-
-    args = [sys.executable, cpplint_file]
-    args.append('--extensions=c,cc,cpp,h,hpp,cu,cuh') # cpplint's default extensions lack "hpp"
-    args += cpplint_arguments
-    for f in index_now:
-        args.append(f)
-
-    sys.stdout.write('Launching cpplint for ' + str(len(index_now)) + ' files.\n')
-    # sys.stdout.write('arguments: ' + ' '.join(args) + '\n')
-    # sys.stdout.write('Launching cpplint (' + cpplint_file + ') for ' + str(len(files))
-    #                  + ' files. arguments: ' + ' '.join(args) + '\n')
-    proc = subprocess.Popen(args, bufsize=65536, stderr=subprocess.PIPE, close_fds=True)
-    proc.wait()
-    has_error = False
-    clean_index = {}
-    clean_index.update(index_last)
-    clean_index.update(index_now)
-    for line in proc.stderr:
-        # This is annoying. Why cpplint writes this to _stderr_??
-        if not line.startswith("Done processing "):
-            has_error = True
-## eg.
-## /home/kimurhid/projects/foedus_code/foedus-core/include/foedus/cache/cache_hashtable.hpp:205:  Namespace should be terminated with "// namespace cache"  [readability/namespace] [5]
-## We parse the line and remember the file to be excluded from the "clean" list
-            if line.find(':') > 0:
-              f = line[:line.find(':')]
-              if f in clean_index:
-                del clean_index[f]
-            if sys.stderr.isatty():
-              sys.stderr.write('\033[93m' + line + '\033[0m') # Put a color that stands out
-            else:
-              sys.stderr.write(line) # If the client (kdevelop?) doesn't support, avoid it.
-
-    # store the clean list to speed up next execution
-    store_dir_index(clean_index, history_file)
-
-    return has_error
-
-def main():
-    (names, cpplint_arguments) = parse_arguments(sys.argv[1:])
-    files = []
-    for name in names:
-        if os.path.isfile(name):
-            files.append(name)
-        else:
-            get_files_recursive(name, files)
-
-    has_error = exec_cpplint(files, cpplint_arguments)
-    if has_error and style_error:
-        sys.stderr.write('There was cpplint error(s) and --style-error was specified. non-zero exit code.\n')
-        sys.exit(1)
-    else:
-        sys.exit(0)
-
-if __name__ == '__main__':
-    main()
diff --git a/stylecheck/cpplint.py b/stylecheck/cpplint.py
deleted file mode 100644
index ccc25d4..0000000
--- a/stylecheck/cpplint.py
+++ /dev/null
@@ -1,6323 +0,0 @@
-#!/usr/bin/env 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
-
-    cpplint.py supports per-directory configurations specified in CPPLINT.cfg
-    files. CPPLINT.cfg file can contain a number of key=value pairs.
-    Currently the following options are supported:
-
-      set noparent
-      filter=+filter1,-filter2,...
-      exclude_files=regex
-      linelength=80
-
-    "set noparent" option prevents cpplint from traversing directory tree
-    upwards looking for more .cfg files in parent directories. This option
-    is usually placed in the top-level project directory.
-
-    The "filter" option is similar in function to --filter flag. It specifies
-    message filters in addition to the |_DEFAULT_FILTERS| and those specified
-    through --filter command-line flag.
-
-    "exclude_files" allows to specify a regular expression to be matched against
-    a file name. If the expression matches, the file is skipped and not run
-    through liner.
-
-    "linelength" allows to specify the allowed line length for the project.
-
-    CPPLINT.cfg has an effect on files in the same directory and all
-    sub-directories, unless overridden by a nested configuration file.
-
-      Example file:
-        filter=-build/include_order,+build/include_alpha
-        exclude_files=.*\.cc
-
-    The above example disables build/include_order warning and enables
-    build/include_alpha as well as excludes all .cc from being
-    processed by linter, in the current directory (where the .cfg
-    file is located) and all sub-directories.
-"""
-
-# 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/inheritance',
-    'readability/multiline_comment',
-    'readability/multiline_string',
-    'readability/namespace',
-    'readability/nolint',
-    'readability/nul',
-    'readability/strings',
-    'readability/todo',
-    'readability/utf8',
-    'runtime/arrays',
-    'runtime/casting',
-    'runtime/explicit',
-    'runtime/int',
-    'runtime/init',
-    'runtime/invalid_increment',
-    'runtime/member_string_references',
-    'runtime/memset',
-    'runtime/indentation_namespace',
-    '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',
-    ]
-
-# These error categories are no longer enforced by cpplint, but for backwards-
-# compatibility they may still appear in NOLINT comments.
-_LEGACY_ERROR_CATEGORIES = [
-    'readability/streams',
-    ]
-
-# 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',
-    ])
-
-
-# These headers are excluded from [build/include] and [build/include_order]
-# checks:
-# - Anything not following google file name conventions (containing an
-#   uppercase character, such as Python.h or nsStringAPI.h, for example).
-# - Lua headers.
-_THIRD_PARTY_HEADERS_PATTERN = re.compile(
-    r'^(?:[^/]*[A-Z][^/]*\.h|lua\.h|lauxlib\.h|lualib\.h)$')
-
-
-# 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 = {}
-
-# {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', '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.
-  """
-  matched = Search(r'\bNOLINT(NEXTLINE)?\b(\([^)]+\))?', raw_line)
-  if matched:
-    if matched.group(1):
-      suppressed_line = linenum + 1
-    else:
-      suppressed_line = linenum
-    category = matched.group(2)
-    if category in (None, '(*)'):  # => "suppress all"
-      _error_suppressions.setdefault(None, set()).add(suppressed_line)
-    else:
-      if category.startswith('(') and category.endswith(')'):
-        category = category[1:-1]
-        if category in _ERROR_CATEGORIES:
-          _error_suppressions.setdefault(category, set()).add(suppressed_line)
-        elif category not in _LEGACY_ERROR_CATEGORIES:
-          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(object):
-  """Tracks line numbers for includes, and the order in which includes appear.
-
-  include_list contains list of lists of (header, line number) pairs.
-  It's a lists of lists rather than just one flat list to make it
-  easier to update across preprocessor boundaries.
-
-  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):
-    self.include_list = [[]]
-    self.ResetSection('')
-
-  def FindHeader(self, header):
-    """Check if a header has already been included.
-
-    Args:
-      header: header to check.
-    Returns:
-      Line number of previous occurrence, or -1 if the header has not
-      been seen before.
-    """
-    for section_list in self.include_list:
-      for f in section_list:
-        if f[0] == header:
-          return f[1]
-    return -1
-
-  def ResetSection(self, directive):
-    """Reset section checking for preprocessor directive.
-
-    Args:
-      directive: preprocessor directive (e.g. "if", "else").
-    """
-    # The name of the current section.
-    self._section = self._INITIAL_SECTION
-    # The path of last found header.
-    self._last_header = ''
-
-    # Update list of includes.  Note that we never pop from the
-    # include list.
-    if directive in ('if', 'ifdef', 'ifndef'):
-      self.include_list.append([])
-    elif directive in ('else', 'elif'):
-      self.include_list[-1] = []
-
-  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
-        Match(r'^\s*#\s*include\b', 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[:]
-    # backup of filter list. Used to restore the state after each file.
-    self._filters_backup = self.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[:]
-    self.AddFilters(filters)
-
-  def AddFilters(self, filters):
-    """ Adds more filters to the existing list of error-message 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 BackupFilters(self):
-    """ Saves the current filter list to backup storage."""
-    self._filters_backup = self.filters[:]
-
-  def RestoreFilters(self):
-    """ Restores filters previously backed up."""
-    self.filters = self._filters_backup[:]
-
-  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)
-
-def _AddFilters(filters):
-  """Adds more filter overrides.
-
-  Unlike _SetFilters, this function does not reset the current list of filters
-  available.
-
-  Args:
-    filters: A string of comma-separated filters (eg "whitespace/indent").
-             Each filter should start with + or -; else we die.
-  """
-  _cpplint_state.AddFilters(filters)
-
-def _BackupFilters():
-  """ Saves the current filter list to backup storage."""
-  _cpplint_state.BackupFilters()
-
-def _RestoreFilters():
-  """ Restores filters previously backed up."""
-  _cpplint_state.RestoreFilters()
-
-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(object):
-  """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] = '/**/'
-
-
-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 4 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.
-  3) raw_lines member contains all the lines without processing.
-  4) lines_without_raw_strings member is same as raw_lines, but with C++11 raw
-     strings removed.
-  All these 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)
-  # Replace 'c++' with 'cpp'.
-  filename = filename.replace('C++', 'cpp').replace('c++', 'cpp')
-  
-  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'[^a-zA-Z0-9]', '_', file_path_from_root).upper() + '_'
-
-
-def CheckForHeaderGuard(filename, clean_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.
-    clean_lines: A CleansedLines instance containing the file.
-    error: The function to call with any errors found.
-  """
-
-  # Don't check for header guards if there are error suppression
-  # comments somewhere in this file.
-  #
-  # Because this is silencing a warning for a nonexistent line, we
-  # only support the very specific NOLINT(build/header_guard) syntax,
-  # and not the general NOLINT or NOLINT(*) syntax.
-  raw_lines = clean_lines.lines_without_raw_strings
-  for i in raw_lines:
-    if Search(r'//\s*NOLINT\(build/header_guard\)', i):
-      return
-
-  cppvar = GetHeaderGuardCPPVariable(filename)
-
-  ifndef = ''
-  ifndef_linenum = 0
-  define = ''
-  endif = ''
-  endif_linenum = 0
-  for linenum, line in enumerate(raw_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 or not define or ifndef != define:
-    error(filename, 0, 'build/header_guard', 5,
-          'No #ifndef 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, raw_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)
-
-  # Check for "//" comments on endif line.
-  ParseNolintSuppressions(filename, raw_lines[endif_linenum], endif_linenum,
-                          error)
-  match = Match(r'#endif\s*//\s*' + cppvar + r'(_)?\b', endif)
-  if match:
-    if match.group(1) == '_':
-      # Issue low severity warning for deprecated double trailing underscore
-      error(filename, endif_linenum, 'build/header_guard', 0,
-            '#endif line should be "#endif  // %s"' % cppvar)
-    return
-
-  # Didn't find the corresponding "//" comment.  If this file does not
-  # contain any "//" comments at all, it could be that the compiler
-  # only wants "/**/" comments, look for those instead.
-  no_single_line_comments = True
-  for i in xrange(1, len(raw_lines) - 1):
-    line = raw_lines[i]
-    if Match(r'^(?:(?:\'(?:\.|[^\'])*\')|(?:"(?:\.|[^"])*")|[^\'"])*//', line):
-      no_single_line_comments = False
-      break
-
-  if no_single_line_comments:
-    match = Match(r'#endif\s*/\*\s*' + cppvar + r'(_)?\s*\*/', endif)
-    if match:
-      if match.group(1) == '_':
-        # Low severity warning for double trailing underscore
-        error(filename, endif_linenum, 'build/header_guard', 0,
-              '#endif line should be "#endif  /* %s */"' % cppvar)
-      return
-
-  # Didn't find anything
-  error(filename, endif_linenum, 'build/header_guard', 5,
-        '#endif line should be "#endif  // %s"' % cppvar)
-
-
-def CheckHeaderFileIncluded(filename, include_state, error):
-  """Logs an error if a .cc file does not include its header."""
-
-  # Do not check test files
-  if filename.endswith('_test.cc') or filename.endswith('_unittest.cc'):
-    return
-
-  fileinfo = FileInfo(filename)
-  headerfile = filename[0:len(filename) - 2] + 'h'
-  if not os.path.exists(headerfile):
-    return
-  headername = FileInfo(headerfile).RepositoryName()
-  first_include = 0
-  for section_list in include_state.include_list:
-    for f in section_list:
-      if headername in f[0] or f[0] in headername:
-        return
-      if not first_include:
-        first_include = f[1]
-
-  error(filename, first_include, 'build/include', 5,
-        '%s should include its header file %s' % (fileinfo.RepositoryName(),
-                                                  headername))
-
-
-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*).')
-
-
-def IsMacroDefinition(clean_lines, linenum):
-  if Search(r'^#define', clean_lines[linenum]):
-    return True
-
-  if linenum > 0 and Search(r'\\$', clean_lines[linenum - 1]):
-    return True
-
-  return False
-
-
-def IsForwardClassDeclaration(clean_lines, linenum):
-  return Match(r'^\s*(\btemplate\b)*.*class\s+\w+;\s*$', clean_lines[linenum])
-
-
-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
-    self.check_namespace_indentation = False
-
-  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
-    self.check_namespace_indentation = True
-    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):
-    # If there is a DISALLOW macro, it should appear near the end of
-    # the class.
-    seen_last_thing_in_class = False
-    for i in xrange(linenum - 1, self.starting_linenum, -1):
-      match = Search(
-          r'\b(DISALLOW_COPY_AND_ASSIGN|DISALLOW_IMPLICIT_CONSTRUCTORS)\(' +
-          self.name + r'\)',
-          clean_lines.elided[i])
-      if match:
-        if seen_last_thing_in_class:
-          error(filename, i, 'readability/constructors', 3,
-                match.group(1) + ' should be the last thing in the class')
-        break
-
-      if not Match(r'^\s*$', clean_lines.elided[i]):
-        seen_last_thing_in_class = True
-
-    # 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
-    self.check_namespace_indentation = True
-
-  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 not Match((r'};*\s*(//|/\*).*\bnamespace\s+' + re.escape(self.name) +
-                    r'[\*/\.\\\s]*$'),
-                   line):
-        error(filename, linenum, 'readability/namespace', 5,
-              'Namespace should 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 + 1 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 +1 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. Also look for
-  # non-single-argument constructors which are also technically valid, but
-  # strongly suggest something is wrong.
-  explicit_constructor_match = Match(
-      r'\s+(?:inline\s+)?(explicit\s+)?(?:inline\s+)?%s\s*'
-      r'\(((?:[^()]|\([^()]*\))*)\)'
-      % re.escape(base_classname),
-      line)
-
-  if explicit_constructor_match:
-    is_marked_explicit = explicit_constructor_match.group(1)
-
-    if not explicit_constructor_match.group(2):
-      constructor_args = []
-    else:
-      constructor_args = explicit_constructor_match.group(2).split(',')
-
-    # collapse arguments so that commas in template parameter lists and function
-    # argument parameter lists don't split arguments in two
-    i = 0
-    while i < len(constructor_args):
-      constructor_arg = constructor_args[i]
-      while (constructor_arg.count('<') > constructor_arg.count('>') or
-             constructor_arg.count('(') > constructor_arg.count(')')):
-        constructor_arg += ',' + constructor_args[i + 1]
-        del constructor_args[i + 1]
-      constructor_args[i] = constructor_arg
-      i += 1
-
-    defaulted_args = [arg for arg in constructor_args if '=' in arg]
-    noarg_constructor = (not constructor_args or  # empty arg list
-                         # 'void' arg specifier
-                         (len(constructor_args) == 1 and
-                          constructor_args[0].strip() == 'void'))
-    onearg_constructor = ((len(constructor_args) == 1 and  # exactly one arg
-                           not noarg_constructor) or
-                          # all but at most one arg defaulted
-                          (len(constructor_args) >= 1 and
-                           not noarg_constructor and
-                           len(defaulted_args) >= len(constructor_args) - 1))
-    initializer_list_constructor = bool(
-        onearg_constructor and
-        Search(r'\bstd\s*::\s*initializer_list\b', constructor_args[0]))
-    copy_constructor = bool(
-        onearg_constructor and
-        Match(r'(const\s+)?%s(\s*<[^>]*>)?(\s+const)?\s*(?:<\w+>\s*)?&'
-              % re.escape(base_classname), constructor_args[0].strip()))
-
-    if (not is_marked_explicit and
-        onearg_constructor and
-        not initializer_list_constructor and
-        not copy_constructor):
-      if defaulted_args:
-        error(filename, linenum, 'runtime/explicit', 5,
-              'Constructors callable with one argument '
-              'should be marked explicit.')
-      else:
-        error(filename, linenum, 'runtime/explicit', 5,
-              'Single-parameter constructors should be marked explicit.')
-    elif is_marked_explicit and not onearg_constructor:
-      if noarg_constructor:
-        error(filename, linenum, 'runtime/explicit', 5,
-              'Zero-parameter constructors should not be marked explicit.')
-      else:
-        error(filename, linenum, 'runtime/explicit', 0,
-              'Constructors that require multiple arguments '
-              'should not 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) and
-        not Search(r'\bcase\s+\(', 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 CheckForNamespaceIndentation(filename, nesting_state, clean_lines, line,
-                                 error):
-  is_namespace_indent_item = (
-      len(nesting_state.stack) > 1 and
-      nesting_state.stack[-1].check_namespace_indentation and
-      isinstance(nesting_state.previous_stack_top, _NamespaceInfo) and
-      nesting_state.previous_stack_top == nesting_state.stack[-2])
-
-  if ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,
-                                     clean_lines.elided, line):
-    CheckItemIndentationInNamespace(filename, clean_lines.elided,
-                                    line, error)
-
-
-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 // unless
-      # it's a /// or //! Doxygen comment.
-      if (Match(r'//[^ ]*\w', comment) and
-          not Match(r'(///|//\!)(\s+|$)', 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_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.]=', line) or
-       Search(r'=[\w.]', line))
-      and not Search(r'\b(if|while|for) ', line)
-      # Operators taken from [lex.operators] in C++11 standard.
-      and not Search(r'(>=|<=|==|!=|&=|\^=|\|=|\+=|\*=|\/=|\%=)', line)
-      and not Search(r'operator=', 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 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]', ReplaceAll(r'\boperator\s*,\s*\(', 'F(', 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(typenames, 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:
-    typenames: set of type names from template-argument-list.
-    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 known types 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 typenames or
-      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.*)\s+\w(?:\w|::)*(?:<[^<>]*>)?\s*$',
-                       match_symbol.group(1))
-    if match_func:
-      # Check for constructors, which don't have return types.
-      if Search(r'\b(?:explicit|inline)$', 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(typenames, 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 IsDeletedOrDefault(clean_lines, linenum):
-  """Check if current constructor or operator is deleted or default.
-
-  Args:
-    clean_lines: A CleansedLines instance containing the file.
-    linenum: The number of the line to check.
-  Returns:
-    True if this is a deleted or default constructor.
-  """
-  open_paren = clean_lines.elided[linenum].find('(')
-  if open_paren < 0:
-    return False
-  (close_line, _, close_paren) = CloseExpression(
-      clean_lines, linenum, open_paren)
-  if close_paren < 0:
-    return False
-  return Match(r'\s*=\s*(?:delete|default)\b', close_line[close_paren:])
-
-
-def IsRValueAllowed(clean_lines, linenum, typenames):
-  """Check if RValue reference is allowed on a particular line.
-
-  Args:
-    clean_lines: A CleansedLines instance containing the file.
-    linenum: The number of the line to check.
-    typenames: set of type names from template-argument-list.
-  Returns:
-    True if line is within the region where RValue references are allowed.
-  """
-  # Allow region marked by PUSH/POP macros
-  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')
-
-  # Allow operator=
-  line = clean_lines.elided[linenum]
-  if Search(r'\boperator\s*=\s*\(', line):
-    return IsDeletedOrDefault(clean_lines, linenum)
-
-  # Allow constructors
-  match = Match(r'\s*(?:[\w<>]+::)*([\w<>]+)\s*::\s*([\w<>]+)\s*\(', line)
-  if match and match.group(1) == match.group(2):
-    return IsDeletedOrDefault(clean_lines, linenum)
-  if Search(r'\b(?:explicit|inline)\s+[\w<>]+\s*\(', line):
-    return IsDeletedOrDefault(clean_lines, linenum)
-
-  if Match(r'\s*[\w<>]+\s*\(', line):
-    previous_line = 'ReturnType'
-    if linenum > 0:
-      previous_line = clean_lines.elided[linenum - 1]
-    if Match(r'^\s*$', previous_line) or Search(r'[{}:;]\s*$', previous_line):
-      return IsDeletedOrDefault(clean_lines, linenum)
-
-  # Reject types not mentioned in template-argument-list
-  while line:
-    match = Match(r'^.*?(\w+)\s*&&(.*)$', line)
-    if not match:
-      break
-    if match.group(1) not in typenames:
-      return False
-    line = match.group(2)
-
-  # All RValue types that were in template-argument-list should have
-  # been removed by now.  Those were allowed, assuming that they will
-  # be forwarded.
-  #
-  # If there are no remaining RValue types left (i.e. types that were
-  # not found in template-argument-list), flag those as not allowed.
-  return line.find('&&') < 0
-
-
-def GetTemplateArgs(clean_lines, linenum):
-  """Find list of template arguments associated with this function declaration.
-
-  Args:
-    clean_lines: A CleansedLines instance containing the file.
-    linenum: Line number containing the start of the function declaration,
-             usually one line after the end of the template-argument-list.
-  Returns:
-    Set of type names, or empty set if this does not appear to have
-    any template parameters.
-  """
-  # Find start of function
-  func_line = linenum
-  while func_line > 0:
-    line = clean_lines.elided[func_line]
-    if Match(r'^\s*$', line):
-      return set()
-    if line.find('(') >= 0:
-      break
-    func_line -= 1
-  if func_line == 0:
-    return set()
-
-  # Collapse template-argument-list into a single string
-  argument_list = ''
-  match = Match(r'^(\s*template\s*)<', clean_lines.elided[func_line])
-  if match:
-    # template-argument-list on the same line as function name
-    start_col = len(match.group(1))
-    _, end_line, end_col = CloseExpression(clean_lines, func_line, start_col)
-    if end_col > -1 and end_line == func_line:
-      start_col += 1  # Skip the opening bracket
-      argument_list = clean_lines.elided[func_line][start_col:end_col]
-
-  elif func_line > 1:
-    # template-argument-list one line before function name
-    match = Match(r'^(.*)>\s*$', clean_lines.elided[func_line - 1])
-    if match:
-      end_col = len(match.group(1))
-      _, start_line, start_col = ReverseCloseExpression(
-          clean_lines, func_line - 1, end_col)
-      if start_col > -1:
-        start_col += 1  # Skip the opening bracket
-        while start_line < func_line - 1:
-          argument_list += clean_lines.elided[start_line][start_col:]
-          start_col = 0
-          start_line += 1
-        argument_list += clean_lines.elided[func_line - 1][start_col:end_col]
-
-  if not argument_list:
-    return set()
-
-  # Extract type names
-  typenames = set()
-  while True:
-    match = Match(r'^[,\s]*(?:typename|class)(?:\.\.\.)?\s+(\w+)(.*)$',
-                  argument_list)
-    if not match:
-      break
-    typenames.add(match.group(1))
-    argument_list = match.group(2)
-  return typenames
-
-
-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.
-  typenames = GetTemplateArgs(clean_lines, linenum)
-  and_pos = len(match.group(1))
-  if IsRValueType(typenames, clean_lines, nesting_state, linenum, and_pos):
-    if not IsRValueAllowed(clean_lines, linenum, typenames):
-      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)):
-      error(filename, linenum, 'whitespace/braces', 4,
-            '{ should almost always be at the end of the previous line')
-
-  # An else clause should be on the same line as the preceding closing brace.
-  if Match(r'\s*else\b\s*(?:if\b|\{|$)', line):
-    prevline = GetPreviousNonBlankLine(clean_lines, linenum)[0]
-    if Match(r'\s*}\s*$', prevline):
-      error(filename, linenum, 'whitespace/newline', 4,
-            'An else should appear on the same line as the preceding }')
-
-  # 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.
-          # Output a warning if the semicolon is not contained inside
-          # a lambda expression.
-          if not Match(r'^[^{};]*\[[^\[\]]*\][^{}]*\{[^{}]*\}\s*\)*[;,]\s*$',
-                       endline):
-            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
-    #  - Lambdas
-    #  - alignas specifier with anonymous structs:
-    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'\b(?:struct|union)\s+alignas\s*$', line_prefix) 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 {}')
-      else:
-        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 the check macro is followed by something other than a
-  # semicolon, assume users will log their own custom error messages
-  # and don't suggest any replacements.
-  if not Match(r'\s*;', last_line[end_pos:]):
-    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 = 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
-
-  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"
-  # Only do this check if the included header follows google naming
-  # conventions.  If not, assume that it's a 3rd party API that
-  # requires special include conventions.
-  #
-  # We also make an exception for Lua headers, which follow google
-  # naming convention but not the include convention.
-  match = Match(r'#include\s*"([^/]+\.h)"', line)
-  if match and not _THIRD_PARTY_HEADERS_PATTERN.match(match.group(1)):
-    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) == '<')
-    duplicate_line = include_state.FindHeader(include)
-    if duplicate_line >= 0:
-      error(filename, linenum, 'build/include', 4,
-            '"%s" already included at %s:%s' %
-            (include, filename, duplicate_line))
-    elif (include.endswith('.cc') and
-          os.path.dirname(fileinfo.RepositoryName()) != os.path.dirname(include)):
-      error(filename, linenum, 'build/include', 4,
-            'Do not include .cc files from other packages')
-    elif not _THIRD_PARTY_HEADERS_PATTERN.match(include):
-      include_state.include_list[-1].append((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)
-
-
-
-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.
-  match = Match(r'^\s*#\s*(if|ifdef|ifndef|elif|else|endif)\b', line)
-  if match:
-    include_state.ResetSection(match.group(1))
-
-  # 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 declare or disable copy/assign
-    #                (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.")
-
-  # 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]
-
-  # Match two lines at a time to support multiline declarations
-  if linenum + 1 < clean_lines.NumLines() and not Search(r'[;({]', line):
-    line += clean_lines.elided[linenum + 1].strip()
-
-  # 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\s*\(', line):
-    error(filename, linenum, 'runtime/printf', 5,
-          'Never use sprintf. Use snprintf instead.')
-  match = Search(r'\b(strcpy|strcat)\s*\(', 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.
-  """
-  # Scan back a few lines for start of current function
-  for i in xrange(linenum, max(-1, linenum - 10), -1):
-    match = Match(r'^([^()]*\w+)\(', clean_lines.elided[i])
-    if match:
-      # Look for "override" after the matching closing parenthesis
-      line, _, closing_paren = CloseExpression(
-          clean_lines, i, len(match.group(1)))
-      return (closing_paren >= 0 and
-              Search(r'\boverride\b', line[closing_paren:]))
-  return False
-
-
-def IsOutOfLineMethodDefinition(clean_lines, linenum):
-  """Check if current line contains an out-of-line method definition.
-
-  Args:
-    clean_lines: A CleansedLines instance containing the file.
-    linenum: The number of the line to check.
-  Returns:
-    True if current line contains an out-of-line method definition.
-  """
-  # Scan back a few lines for start of current function
-  for i in xrange(linenum, max(-1, linenum - 10), -1):
-    if Match(r'^([^()]*\w+)\(', clean_lines.elided[i]):
-      return Match(r'^[^()]*\w+::\w+\(', clean_lines.elided[i]) is not None
-  return False
-
-
-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
-
-  # Don't warn on out-of-line method definitions, as we would warn on the
-  # in-line declaration, if it isn't marked with 'override'.
-  if IsOutOfLineMethodDefinition(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 initializer lists.  We only need to scan back from the
-  # current line for something that starts with ':'.
-  #
-  # We don't need to check the current line, since the '&' would
-  # appear inside the second set of parentheses on the current line as
-  # opposed to the first set.
-  if linenum > 0:
-    for i in xrange(linenum - 1, max(0, linenum - 10), -1):
-      previous_line = clean_lines.elided[i]
-      if not Search(r'[),]\s*$', previous_line):
-        break
-      if Match(r'^\s*:\s+\S', previous_line):
-        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)
-
-    # Avoid arrays by looking for brackets that come after the closing
-    # parenthesis.
-    if Match(r'\([^()]+\)\s*\[', match.group(3)):
-      return
-
-    # 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, clean_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, clean_lines, linenum, 'const_cast',
-                     r'\((char\s?\*+\s?)\)\s*"', error):
-    pass
-  else:
-    # Check pointer casts for other than string constants
-    CheckCStyleCast(filename, clean_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.
-  #
-  # Some non-identifier character is required before the '&' for the
-  # expression to be recognized as a cast.  These are casts:
-  #   expression = &static_cast<int*>(temporary());
-  #   function(&(int*)(temporary()));
-  #
-  # This is not a cast:
-  #   reference_type&(int* function_param);
-  match = Search(
-      r'(?:[^\w]&\(([^)*][^)]*)\)[\w(])|'
-      r'(?:[^\w]&(static|dynamic|down|reinterpret)_cast\b)', line)
-  if match:
-    # 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, clean_lines, linenum, cast_type, pattern, error):
-  """Checks for a C-style cast by looking for the pattern.
-
-  Args:
-    filename: The name of the current file.
-    clean_lines: A CleansedLines instance containing the file.
-    linenum: The number of the line to check.
-    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.
-  """
-  line = clean_lines.elided[linenum]
-  match = Search(pattern, line)
-  if not match:
-    return False
-
-  # Exclude lines with keywords that tend to look like casts
-  context = line[0:match.start(1) - 1]
-  if Match(r'.*\b(?:sizeof|alignof|alignas|[_A-Z][_A-Z0-9]*)\s*$', context):
-    return False
-
-  # Try expanding current context to see if we one level of
-  # parentheses inside a macro.
-  if linenum > 0:
-    for i in xrange(linenum - 1, max(0, linenum - 5), -1):
-      context = clean_lines.elided[i] + context
-  if Match(r'.*\b[_A-Z][_A-Z0-9]*\s*\((?:\([^()]*\)|[^()])*$', context):
-    return False
-
-  # operator++(int) and operator--(int)
-  if context.endswith(' operator++') or context.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;
-  #   [](int) -> bool {
-  #
-  # 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))
-  #   Function((function_pointer_arg)(int), int param)
-  #   <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*/);
-    raw_line = clean_lines.raw_lines[linenum]
-    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',)),
-    ('<tuple>', ('tuple',)),
-    ('<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_dict, io=codecs):
-  """Fill up the include_dict with new includes found from the file.
-
-  Args:
-    filename: the name of the header to read.
-    include_dict: a dictionary 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 successfully 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)
-      include_dict.setdefault(include, 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 flatten the include_state include_list and copy it into a dictionary.
-  include_dict = dict([item for sublist in include_state.include_list
-                       for item in sublist])
-
-  # Did we find the header for this file (if any) and successfully 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_dict is modified during iteration, so we iterate over a copy of
-  # the keys.
-  header_keys = include_dict.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_dict, 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_dict:
-      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 CheckRedundantVirtual(filename, clean_lines, linenum, error):
-  """Check if line contains a redundant "virtual" function-specifier.
-
-  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.
-  """
-  # Look for "virtual" on current line.
-  line = clean_lines.elided[linenum]
-  virtual = Match(r'^(.*)(\bvirtual\b)(.*)$', line)
-  if not virtual: return
-
-  # Ignore "virtual" keywords that are near access-specifiers.  These
-  # are only used in class base-specifier and do not apply to member
-  # functions.
-  if (Search(r'\b(public|protected|private)\s+$', virtual.group(1)) or
-      Match(r'^\s+(public|protected|private)\b', virtual.group(3))):
-    return
-
-  # Ignore the "virtual" keyword from virtual base classes.  Usually
-  # there is a column on the same line in these cases (virtual base
-  # classes are rare in google3 because multiple inheritance is rare).
-  if Match(r'^.*[^:]:[^:].*$', line): return
-
-  # Look for the next opening parenthesis.  This is the start of the
-  # parameter list (possibly on the next line shortly after virtual).
-  # TODO(unknown): doesn't work if there are virtual functions with
-  # decltype() or other things that use parentheses, but csearch suggests
-  # that this is rare.
-  end_col = -1
-  end_line = -1
-  start_col = len(virtual.group(2))
-  for start_line in xrange(linenum, min(linenum + 3, clean_lines.NumLines())):
-    line = clean_lines.elided[start_line][start_col:]
-    parameter_list = Match(r'^([^(]*)\(', line)
-    if parameter_list:
-      # Match parentheses to find the end of the parameter list
-      (_, end_line, end_col) = CloseExpression(
-          clean_lines, start_line, start_col + len(parameter_list.group(1)))
-      break
-    start_col = 0
-
-  if end_col < 0:
-    return  # Couldn't find end of parameter list, give up
-
-  # Look for "override" or "final" after the parameter list
-  # (possibly on the next few lines).
-  for i in xrange(end_line, min(end_line + 3, clean_lines.NumLines())):
-    line = clean_lines.elided[i][end_col:]
-    match = Search(r'\b(override|final)\b', line)
-    if match:
-      error(filename, linenum, 'readability/inheritance', 4,
-            ('"virtual" is redundant since function is '
-             'already declared as "%s"' % match.group(1)))
-
-    # Set end_col to check whole lines after we are done with the
-    # first line.
-    end_col = 0
-    if Search(r'[^\w]\s*$', line):
-      break
-
-
-def CheckRedundantOverrideOrFinal(filename, clean_lines, linenum, error):
-  """Check if line contains a redundant "override" or "final" virt-specifier.
-
-  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.
-  """
-  # Look for closing parenthesis nearby.  We need one to confirm where
-  # the declarator ends and where the virt-specifier starts to avoid
-  # false positives.
-  line = clean_lines.elided[linenum]
-  declarator_end = line.rfind(')')
-  if declarator_end >= 0:
-    fragment = line[declarator_end:]
-  else:
-    if linenum > 1 and clean_lines.elided[linenum - 1].rfind(')') >= 0:
-      fragment = line
-    else:
-      return
-
-  # Check that at most one of "override" or "final" is present, not both
-  if Search(r'\boverride\b', fragment) and Search(r'\bfinal\b', fragment):
-    error(filename, linenum, 'readability/inheritance', 4,
-          ('"override" is redundant since function is '
-           'already declared as "final"'))
-
-
-
-
-# Returns true if we are at a new block, and it is directly
-# inside of a namespace.
-def IsBlockInNameSpace(nesting_state, is_forward_declaration):
-  """Checks that the new block is directly in a namespace.
-
-  Args:
-    nesting_state: The _NestingState object that contains info about our state.
-    is_forward_declaration: If the class is a forward declared class.
-  Returns:
-    Whether or not the new block is directly in a namespace.
-  """
-  if is_forward_declaration:
-    if len(nesting_state.stack) >= 1 and (
-        isinstance(nesting_state.stack[-1], _NamespaceInfo)):
-      return True
-    else:
-      return False
-
-  return (len(nesting_state.stack) > 1 and
-          nesting_state.stack[-1].check_namespace_indentation and
-          isinstance(nesting_state.stack[-2], _NamespaceInfo))
-
-
-def ShouldCheckNamespaceIndentation(nesting_state, is_namespace_indent_item,
-                                    raw_lines_no_comments, linenum):
-  """This method determines if we should apply our namespace indentation check.
-
-  Args:
-    nesting_state: The current nesting state.
-    is_namespace_indent_item: If we just put a new class on the stack, True.
-      If the top of the stack is not a class, or we did not recently
-      add the class, False.
-    raw_lines_no_comments: The lines without the comments.
-    linenum: The current line number we are processing.
-
-  Returns:
-    True if we should apply our namespace indentation check. Currently, it
-    only works for classes and namespaces inside of a namespace.
-  """
-
-  is_forward_declaration = IsForwardClassDeclaration(raw_lines_no_comments,
-                                                     linenum)
-
-  if not (is_namespace_indent_item or is_forward_declaration):
-    return False
-
-  # If we are in a macro, we do not want to check the namespace indentation.
-  if IsMacroDefinition(raw_lines_no_comments, linenum):
-    return False
-
-  return IsBlockInNameSpace(nesting_state, is_forward_declaration)
-
-
-# Call this method if the line is directly inside of a namespace.
-# If the line above is blank (excluding comments) or the start of
-# an inner namespace, it cannot be indented.
-def CheckItemIndentationInNamespace(filename, raw_lines_no_comments, linenum,
-                                    error):
-  line = raw_lines_no_comments[linenum]
-  if Match(r'^\s+', line):
-    error(filename, linenum, 'runtime/indentation_namespace', 4,
-          'Do not indent within a namespace')
-
-
-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)
-  CheckForNamespaceIndentation(filename, nesting_state, 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)
-  CheckRedundantVirtual(filename, clean_lines, line, error)
-  CheckRedundantOverrideOrFinal(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',
-                                      'future',
-                                      'mutex',
-                                      'thread',
-                                      'chrono',
-                                      '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',
-      ):
-    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)
-
-  RemoveMultiLineComments(filename, lines, error)
-  clean_lines = CleansedLines(lines)
-
-  if file_extension == 'h':
-    CheckForHeaderGuard(filename, clean_lines, error)
-
-  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)
-  
-  # Check that the .cc file has included its header if it exists.
-  if file_extension == 'cc':
-    CheckHeaderFileIncluded(filename, 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 ProcessConfigOverrides(filename):
-  """ Loads the configuration files and processes the config overrides.
-
-  Args:
-    filename: The name of the file being processed by the linter.
-
-  Returns:
-    False if the current |filename| should not be processed further.
-  """
-
-  abs_filename = os.path.abspath(filename)
-  cfg_filters = []
-  keep_looking = True
-  while keep_looking:
-    abs_path, base_name = os.path.split(abs_filename)
-    if not base_name:
-      break  # Reached the root directory.
-
-    cfg_file = os.path.join(abs_path, "CPPLINT.cfg")
-    abs_filename = abs_path
-    if not os.path.isfile(cfg_file):
-      continue
-
-    try:
-      with open(cfg_file) as file_handle:
-        for line in file_handle:
-          line, _, _ = line.partition('#')  # Remove comments.
-          if not line.strip():
-            continue
-
-          name, _, val = line.partition('=')
-          name = name.strip()
-          val = val.strip()
-          if name == 'set noparent':
-            keep_looking = False
-          elif name == 'filter':
-            cfg_filters.append(val)
-          elif name == 'exclude_files':
-            # When matching exclude_files pattern, use the base_name of
-            # the current file name or the directory name we are processing.
-            # For example, if we are checking for lint errors in /foo/bar/baz.cc
-            # and we found the .cfg file at /foo/CPPLINT.cfg, then the config
-            # file's "exclude_files" filter is meant to be checked against "bar"
-            # and not "baz" nor "bar/baz.cc".
-            if base_name:
-              pattern = re.compile(val)
-              if pattern.match(base_name):
-                sys.stderr.write('Ignoring "%s": file excluded by "%s". '
-                                 'File path component "%s" matches '
-                                 'pattern "%s"\n' %
-                                 (filename, cfg_file, base_name, val))
-                return False
-          elif name == 'linelength':
-            global _line_length
-            try:
-                _line_length = int(val)
-            except ValueError:
-                sys.stderr.write('Line length must be numeric.')
-          else:
-            sys.stderr.write(
-                'Invalid configuration option (%s) in file %s\n' %
-                (name, cfg_file))
-
-    except IOError:
-      sys.stderr.write(
-          "Skipping config file '%s': Can't open for reading\n" % cfg_file)
-      keep_looking = False
-
-  # Apply all the accumulated filters in reverse order (top-level directory
-  # config options having the least priority).
-  for filter in reversed(cfg_filters):
-     _AddFilters(filter)
-
-  return True
-
-
-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)
-  _BackupFilters()
-
-  if not ProcessConfigOverrides(filename):
-    _RestoreFilters()
-    return
-
-  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)
-    _RestoreFilters()
-    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)
-  _RestoreFilters()
-
-
-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()
diff --git a/test/client.cpp b/test/client.cpp
deleted file mode 100644
index cb68cd6..0000000
--- a/test/client.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// Bring in my package's API, which is what I'm testing
-#include "humotion/client/client.h"
-#include <gtest/gtest.h>
-#include <string>
-#include <cstdio>
-using namespace std;
-using namespace humotion;
-using namespace humotion::client;
-
-namespace {
-
-//the fixture for testing class Foo.
-class client_Test : public ::testing::Test {
-protected:
-    client_Test() {
-        //set-up work for EACH test here
-        s = new Client("test", "ROS");
-
-    }
-
-    virtual ~client_Test() {
-        //clean-up work that doesn't throw exceptions here
-        delete(s);
-        s = NULL;
-    }
-
-    //if the constructor and destructor are not enough for setting up
-    //and cleaning up each test, you can define the following methods:
-    virtual void SetUp() {
-        //code here will be called immediately after the constructor (right before each test).
-    }
-
-    virtual void TearDown() {
-        //code here will be called immediately after each test (right
-        //before the destructor).
-    }
-
-    //ojects declared here can be used by all tests in the test case for Foo
-    Client *s;
-};
-
-// Tests that the Foo::Bar() method does Abc.
-TEST_F(client_Test, send_mouth_data) {
-
-    MouthState m;
-    for(int i=0; i<100; i++){
-        m.opening_left   = 12.0;
-        m.opening_center = 12.0;
-        m.opening_right  = 12.0;
-        m.position_left   = 10+(20.0*i)/100.0;
-        m.position_center = 10+(20.0*i)/100.0;
-        m.position_right  = 10+(20.0*i)/100.0;
-
-        s->update_mouth_target(m, true);
-    }
-
-    SUCCEED();
-}
-
-// Tests that Foo does Xyz.
-// TEST_F(xsc3_client_cpp_Test, DoesXyz) {
-// 	CheckConnection(xsc3_client);
-// }
-
-}  // namespace
-
-// Run all the tests that were declared with TEST()
-int main(int argc, char **argv){
-    testing::InitGoogleTest(&argc, argv);
-    return RUN_ALL_TESTS();
-}
diff --git a/test/server.cpp b/test/server.cpp
deleted file mode 100644
index 220cb9c..0000000
--- a/test/server.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-// Bring in my package's API, which is what I'm testing
-#include "humotion/server/server.h"
-#include <gtest/gtest.h>
-#include <string>
-#include <cstdio>
-using namespace std;
-using namespace humotion;
-using namespace humotion::server;
-
-namespace {
-
-//the fixture for testing class Foo.
-class server_Test : public ::testing::Test {
-protected:
-	server_Test() {
-		//set-up work for EACH test here
-        s = new Server("test", "ROS", NULL);
-
-	}
-	
-	virtual ~server_Test() {
-		//clean-up work that doesn't throw exceptions here
-		delete(s);
-		s = NULL;
-	}
-	
-	//if the constructor and destructor are not enough for setting up
-	//and cleaning up each test, you can define the following methods:
-	virtual void SetUp() {
-		//code here will be called immediately after the constructor (right before each test).
-	}
-
-	virtual void TearDown() {
-		//code here will be called immediately after each test (right
-		//before the destructor).
-	}
-
-	//ojects declared here can be used by all tests in the test case for Foo
-	Server *s;
-};
-
-void dump_incoming_data(Server *s){
-	SCOPED_TRACE("dump incoming data");
-	
-	//make sure it is not null
-	if (s == NULL){
-		SCOPED_TRACE("server ptr NULL?");
-		FAIL();
-	}
-	
-	//make sure we are connected
-	EXPECT_EQ(s->ok(), true);
-	
-	for(int i=0; i<100000; i++){
-        //s->tick();
-	}
-}
-
-
-// Tests that the Foo::Bar() method does Abc.
-TEST_F(server_Test, dump_incoming_data) {
-	//connected?
-	dump_incoming_data(s);
-//   const string input_filepath = "this/package/testdata/myinputfile.dat";
-//   const string output_filepath = "this/package/testdata/myoutputfile.dat";
-//   Foo f;
-//   EXPECT_EQ(0, f.Bar(input_filepath, output_filepath));
-}
-
-// Tests that Foo does Xyz.
-// TEST_F(xsc3_client_cpp_Test, DoesXyz) {
-// 	CheckConnection(xsc3_client);
-// }
-
-}  // namespace
-
-// Run all the tests that were declared with TEST()
-int main(int argc, char **argv){
-	testing::InitGoogleTest(&argc, argv);
-	return RUN_ALL_TESTS();
-}
diff --git a/test/timestamp.cpp b/test/timestamp.cpp
deleted file mode 100644
index 38c4441..0000000
--- a/test/timestamp.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-// Bring in my package's API, which is what I'm testing
-#include "timestamp.h"
-#include <gtest/gtest.h>
-#include <string>
-#include <cstdio>
-#include <stdio.h>
-#include <unistd.h>
-
-using namespace std;
-using namespace humotion;
-
-namespace {
-
-//the fixture for testing class Foo.
-class timestamp_Test : public ::testing::Test {
-protected:
-    timestamp_Test() {
-        //set-up work for EACH test here
-    }
-
-    virtual ~timestamp_Test() {
-        //clean-up work that doesn't throw exceptions here
-    }
-
-    //if the constructor and destructor are not enough for setting up
-    //and cleaning up each test, you can define the following methods:
-    virtual void SetUp() {
-        //code here will be called immediately after the constructor (right before each test).
-    }
-
-    virtual void TearDown() {
-        //code here will be called immediately after each test (right
-        //before the destructor).
-    }
-
-    //ojects declared here can be used by all tests in the test case for Foo
-};
-
-// Tests that the Foo::Bar() method does Abc.
-TEST_F(timestamp_Test, init_from_values) {
-
-    //check sec/nsec initialiser
-    Timestamp a(1.0, 0.0);
-    ASSERT_EQ(a.to_seconds(), 1.0);
-
-    Timestamp b(999, 123);
-    ASSERT_EQ(b.to_seconds(), 999.0 + 123 / 1000000000.0);
-
-    Timestamp c(666.777);
-    ASSERT_EQ(c.to_seconds(), 666.777);
-    ASSERT_EQ(c.sec, 666);
-    ASSERT_EQ(c.nsec, 0.777 / 1E-9);;
-
-    //test initializer with now()
-    struct timespec tp;
-    clock_gettime(CLOCK_REALTIME, &tp);
-
-    Timestamp ts_d;
-    sleep(1);
-    Timestamp ts_e;
-
-    //they should be at least 1 second apart:
-    double diff = ts_e.to_seconds() - ts_d.to_seconds();
-    ASSERT_GE(diff, 1.0);
-    ASSERT_LE(diff, 2.0);
-
-    //d should also be greater equal that timespec values:
-    ASSERT_GE(ts_d.sec, tp.tv_sec);
-
-    SUCCEED();
-}
-
-TEST_F(timestamp_Test, comparison) {
-
-    //check sec/nsec initialiser
-    Timestamp a(1234567, 89101213);
-    Timestamp b(1234567, 89101213);
-    ASSERT_TRUE(a == b);
-    ASSERT_TRUE(a >= b);
-    ASSERT_TRUE(a <= b);
-    ASSERT_FALSE(a != b);
-    ASSERT_FALSE(a < b);
-    ASSERT_FALSE(a > b);
-
-    //check double initializer
-    Timestamp e(1.234567);
-    Timestamp f(1.234568);
-    ASSERT_FALSE(e == f);
-    ASSERT_FALSE(e >= f);
-    ASSERT_TRUE(e <= f);
-    ASSERT_TRUE(e != f);
-    ASSERT_TRUE(e < f);
-    ASSERT_FALSE(e > f);
-
-    //check now() initializer
-    Timestamp c;
-    sleep(1);
-    Timestamp d;
-    ASSERT_FALSE(c == d);
-    ASSERT_FALSE(c >= d);
-    ASSERT_TRUE(c <= d);
-    ASSERT_TRUE(c != d);
-    ASSERT_TRUE(c < d);
-    ASSERT_FALSE(c > d);
-
-    //ok now test comparisons based on sec:
-    Timestamp g(100, 1234567);
-    Timestamp h(101, 1234567);
-    ASSERT_FALSE(g == h);
-    ASSERT_FALSE(g >= h);
-    ASSERT_TRUE(g <= h);
-    ASSERT_TRUE(g != h);
-    ASSERT_TRUE(g < h);
-    ASSERT_FALSE(g > h);
-
-    //ok now test comparisons based on nsec:
-    {
-        Timestamp i(100, 1234567);
-        Timestamp j(100, 1234568);
-        ASSERT_FALSE(i == j);
-        ASSERT_FALSE(i >= j);
-        ASSERT_TRUE(i <= j);
-        ASSERT_TRUE(i != j);
-        ASSERT_TRUE(i < j);
-        ASSERT_FALSE(i > j);
-    }
-
-    //ok now test comparisons based on sec + nsec:
-    {
-        Timestamp i(100, 1234568);
-        Timestamp j(101, 1234567);
-        ASSERT_FALSE(i == j);
-        ASSERT_FALSE(i >= j);
-        ASSERT_TRUE(i <= j);
-        ASSERT_TRUE(i != j);
-        ASSERT_TRUE(i < j);
-        ASSERT_FALSE(i > j);
-    }
-
-    SUCCEED();
-}
-
-// Tests that Foo does Xyz.
-// TEST_F(xsc3_client_cpp_Test, DoesXyz) {
-// 	CheckConnection(xsc3_client);
-// }
-
-}  // namespace
-
-// Run all the tests that were declared with TEST()
-int main(int argc, char **argv){
-    testing::InitGoogleTest(&argc, argv);
-    return RUN_ALL_TESTS();
-}
