commit f150aab5e67a545824004a49277c82f66c0c4651
Author: Robert Haschke <rhaschke@techfak.uni-bielefeld.de>
Date:   Sat Nov 14 14:57:52 2020 +0100

    clang-format-10

diff --git a/server/src/MiddlewareRSB.cpp b/server/src/MiddlewareRSB.cpp
index ab93250..7b56209 100644
--- a/server/src/MiddlewareRSB.cpp
+++ b/server/src/MiddlewareRSB.cpp
@@ -1,30 +1,30 @@
 /*
-* This file is part of hlrc_server
-*
-* Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
-* http://opensource.cit-ec.de/projects/hlrc_server
-*
-* This file may be licensed under the terms of the
-* GNU General Public License Version 3 (the ``GPL''),
-* 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 GPL for the specific language
-* governing rights and limitations.
-*
-* You should have received a copy of the GPL along with this
-* program. If not, go to http://www.gnu.org/licenses/gpl.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.
-*
-*/
+ * This file is part of hlrc_server
+ *
+ * Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
+ * http://opensource.cit-ec.de/projects/hlrc_server
+ *
+ * This file may be licensed under the terms of the
+ * GNU General Public License Version 3 (the ``GPL''),
+ * 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 GPL for the specific language
+ * governing rights and limitations.
+ *
+ * You should have received a copy of the GPL along with this
+ * program. If not, go to http://www.gnu.org/licenses/gpl.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 "MiddlewareRSB.h"
 
@@ -33,7 +33,7 @@
 #include <rsb/converter/ProtocolBufferConverter.h>
 #include <cstdio>
 
-//CallbackWrapper:
+// CallbackWrapper:
 #include "RSB/GazeCallbackWrapper.h"
 #include "RSB/MouthCallbackWrapper.h"
 #include "RSB/SpeechCallbackWrapper.h"
@@ -45,135 +45,150 @@ using namespace std;
 using namespace rsb;
 using namespace rsb::patterns;
 
-
-MiddlewareRSB::MiddlewareRSB(Arbiter *arbiter, std::string scope) : Middleware(arbiter, scope){
-    init();
+MiddlewareRSB::MiddlewareRSB(Arbiter* arbiter, std::string scope) : Middleware(arbiter, scope) {
+	init();
 }
 
-MiddlewareRSB::~MiddlewareRSB(){
-
+MiddlewareRSB::~MiddlewareRSB() {
 }
 
-void MiddlewareRSB::tick(){
-    //nothing to do
+void MiddlewareRSB::tick() {
+	// nothing to do
 }
 
-void MiddlewareRSB::init(){
-    printf("> registering converters\n");
-
-    //converter for EmotionState
-    try {
-    rsb::converter::Converter<string>::Ptr emotionStateConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::EmotionExpression>());
-    rsb::converter::converterRepository<string>()->registerConverter(emotionStateConverter);
-    } catch (...) {}
-
-    //converter for SoundChunk
-    try {
-    rsb::converter::Converter<string>::Ptr SoundChunkConverter(new rsb::converter::ProtocolBufferConverter<rst::audition::SoundChunk>());
-    rsb::converter::converterRepository<string>()->registerConverter(SoundChunkConverter);
-    } catch (...) {}
-
-    //converter for Utterance
-    try {
-    rsb::converter::Converter<string>::Ptr UtteranceConverter(new rsb::converter::ProtocolBufferConverter<rst::audition::Utterance>());
-    rsb::converter::converterRepository<string>()->registerConverter(UtteranceConverter);
-    } catch (...) {}
-
-    //converter for GazeTarget
-    try {
-    rsb::converter::Converter<string>::Ptr gazeTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::BinocularHeadGaze>());
-    rsb::converter::converterRepository<string>()->registerConverter(gazeTargetConverter);
-    } catch (...) {}
-
-    //converter for MouthTarget
-    //rsb::converter::Converter<string>::Ptr mouthTargetConverter(new rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
-    //rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
-
-    //converter for Animation
-    try {
-    rsb::converter::Converter<string>::Ptr animationConverter(new rsb::converter::ProtocolBufferConverter<rst::animation::HeadAnimation>());
-    rsb::converter::converterRepository<string>()->registerConverter(animationConverter);
-    } catch (...) {}
-
-    //first get a factory instance that is used to create RSB domain objects
-    Factory &factory = getFactory();
-
-    //scope to listen on:
-    string scope = base_scope + "/set/";
-
-    //get server
-    server = factory.createLocalServer(scope);
-
-    //get tts server:
-    string tts_scope = base_scope + "/tts_provider";
-    printf("> registering remote server on %s\n",tts_scope.c_str());
-    tts_server = factory.createRemoteServer(tts_scope);
-
-
-    //create local server with parallel exec strategy (HACK!)
-    rsb::ParticipantConfig config = factory.getDefaultParticipantConfig();
-    rsc::runtime::Properties &properties = config.mutableEventReceivingStrategy().mutableOptions();
-    properties.set<string>("parallelhandlercalls", "1");
-
-    //now we can create a server with parallel execution:
-    server_parallel = factory.createLocalServer(scope, config);
-
-    //this server will now handle/call these methods in multiple threads:
-    server_parallel->registerMethod("animation", LocalServer::CallbackPtr(new AnimationCallbackWrapper(this)));
-
-    //initialise callbacks:
-    init_callbacks();
-
-    //informer->publish(gaze_target);
-    printf("> MiddlewareRSB initialised\n");
+void MiddlewareRSB::init() {
+	printf("> registering converters\n");
+
+	// converter for EmotionState
+	try {
+		rsb::converter::Converter<string>::Ptr emotionStateConverter(
+		   new rsb::converter::ProtocolBufferConverter<rst::animation::EmotionExpression>());
+		rsb::converter::converterRepository<string>()->registerConverter(emotionStateConverter);
+	}
+	catch (...) {
+	}
+
+	// converter for SoundChunk
+	try {
+		rsb::converter::Converter<string>::Ptr SoundChunkConverter(
+		   new rsb::converter::ProtocolBufferConverter<rst::audition::SoundChunk>());
+		rsb::converter::converterRepository<string>()->registerConverter(SoundChunkConverter);
+	}
+	catch (...) {
+	}
+
+	// converter for Utterance
+	try {
+		rsb::converter::Converter<string>::Ptr UtteranceConverter(
+		   new rsb::converter::ProtocolBufferConverter<rst::audition::Utterance>());
+		rsb::converter::converterRepository<string>()->registerConverter(UtteranceConverter);
+	}
+	catch (...) {
+	}
+
+	// converter for GazeTarget
+	try {
+		rsb::converter::Converter<string>::Ptr gazeTargetConverter(
+		   new rsb::converter::ProtocolBufferConverter<rst::animation::BinocularHeadGaze>());
+		rsb::converter::converterRepository<string>()->registerConverter(gazeTargetConverter);
+	}
+	catch (...) {
+	}
+
+	// converter for MouthTarget
+	// rsb::converter::Converter<string>::Ptr mouthTargetConverter(new
+	// rsb::converter::ProtocolBufferConverter<rst::robot::MouthTarget>());
+	// rsb::converter::converterRepository<string>()->registerConverter(mouthTargetConverter);
+
+	// converter for Animation
+	try {
+		rsb::converter::Converter<string>::Ptr animationConverter(
+		   new rsb::converter::ProtocolBufferConverter<rst::animation::HeadAnimation>());
+		rsb::converter::converterRepository<string>()->registerConverter(animationConverter);
+	}
+	catch (...) {
+	}
+
+	// first get a factory instance that is used to create RSB domain objects
+	Factory& factory = getFactory();
+
+	// scope to listen on:
+	string scope = base_scope + "/set/";
+
+	// get server
+	server = factory.createLocalServer(scope);
+
+	// get tts server:
+	string tts_scope = base_scope + "/tts_provider";
+	printf("> registering remote server on %s\n", tts_scope.c_str());
+	tts_server = factory.createRemoteServer(tts_scope);
+
+	// create local server with parallel exec strategy (HACK!)
+	rsb::ParticipantConfig config = factory.getDefaultParticipantConfig();
+	rsc::runtime::Properties& properties = config.mutableEventReceivingStrategy().mutableOptions();
+	properties.set<string>("parallelhandlercalls", "1");
+
+	// now we can create a server with parallel execution:
+	server_parallel = factory.createLocalServer(scope, config);
+
+	// this server will now handle/call these methods in multiple threads:
+	server_parallel->registerMethod("animation", LocalServer::CallbackPtr(new AnimationCallbackWrapper(this)));
+
+	// initialise callbacks:
+	init_callbacks();
+
+	// informer->publish(gaze_target);
+	printf("> MiddlewareRSB initialised\n");
 }
 
-void MiddlewareRSB::init_callback(string name, LocalServer::CallbackPtr callback_ptr){
-    printf("> init_callback(%s%s)\n", server->getScope()->toString().c_str(), name.c_str());
-    server->registerMethod(name, callback_ptr);
+void MiddlewareRSB::init_callback(string name, LocalServer::CallbackPtr callback_ptr) {
+	printf("> init_callback(%s%s)\n", server->getScope()->toString().c_str(), name.c_str());
+	server->registerMethod(name, callback_ptr);
 }
 
-void MiddlewareRSB::init_callbacks(){
-    printf("> registering callbacks (rpc methods)\n");
+void MiddlewareRSB::init_callbacks() {
+	printf("> registering callbacks (rpc methods)\n");
 
-    init_callback("speech",    LocalServer::CallbackPtr(new SpeechCallbackWrapper(this)));
-    init_callback("utterance", LocalServer::CallbackPtr(new UtteranceCallbackWrapper(this)));
-    init_callback("gaze",      LocalServer::CallbackPtr(new GazeCallbackWrapper(this)));
-    ///init_callback("mouth",     LocalServer::CallbackPtr(new MouthCallbackWrapper(this)));
+	init_callback("speech", LocalServer::CallbackPtr(new SpeechCallbackWrapper(this)));
+	init_callback("utterance", LocalServer::CallbackPtr(new UtteranceCallbackWrapper(this)));
+	init_callback("gaze", LocalServer::CallbackPtr(new GazeCallbackWrapper(this)));
+	/// init_callback("mouth",     LocalServer::CallbackPtr(new MouthCallbackWrapper(this)));
 
-    EmotionCallbackWrapper *emotion_cb = new EmotionCallbackWrapper(this);
-    init_callback("defaultEmotion", LocalServer::CallbackPtr(emotion_cb));
-    init_callback("currentEmotion", LocalServer::CallbackPtr(emotion_cb));
+	EmotionCallbackWrapper* emotion_cb = new EmotionCallbackWrapper(this);
+	init_callback("defaultEmotion", LocalServer::CallbackPtr(emotion_cb));
+	init_callback("currentEmotion", LocalServer::CallbackPtr(emotion_cb));
 }
 
-//call a tts system to convert a string to an utterance
-boost::shared_ptr<Utterance> MiddlewareRSB::tts_call(string text){
-    double tts_timeout = 1.0; //seconds. DO NOT CHANGE THIS!
-
-    //build request
-    boost::shared_ptr<std::string> request(new string(text));
-
-    //try to fetch it asynchronously:
-    try{
-        RemoteServer::DataFuture<rst::audition::Utterance> future_ptr = tts_server->callAsync<rst::audition::Utterance>("create_utterance", request);
-
-        //try to fetch the result
-        boost::shared_ptr<rst::audition::Utterance> utterance_ptr = future_ptr.get(tts_timeout);
-
-        //done, return utterance ptr
-        boost::shared_ptr<Utterance> utterance(new UtteranceRSB(*(utterance_ptr.get())));
-        printf("> done. got utterance (text=%s)\n",utterance->get_text().c_str());
-        return utterance;
-
-    }catch(rsc::threading::FutureTimeoutException e){
-        printf("> error: tts_call timed out after %3.1f seconds.\n", tts_timeout);
-    }catch(rsc::threading::FutureTaskExecutionException e){
-        printf("> error: tts_call failed: %s\n", e.what());
-    }
-
-    printf("> failed... got no utterance\n");
-    boost::shared_ptr<Utterance> utterance(new Utterance());
-    return utterance;
+// call a tts system to convert a string to an utterance
+boost::shared_ptr<Utterance> MiddlewareRSB::tts_call(string text) {
+	double tts_timeout = 1.0; // seconds. DO NOT CHANGE THIS!
+
+	// build request
+	boost::shared_ptr<std::string> request(new string(text));
+
+	// try to fetch it asynchronously:
+	try {
+		RemoteServer::DataFuture<rst::audition::Utterance> future_ptr =
+		   tts_server->callAsync<rst::audition::Utterance>("create_utterance", request);
+
+		// try to fetch the result
+		boost::shared_ptr<rst::audition::Utterance> utterance_ptr = future_ptr.get(tts_timeout);
+
+		// done, return utterance ptr
+		boost::shared_ptr<Utterance> utterance(new UtteranceRSB(*(utterance_ptr.get())));
+		printf("> done. got utterance (text=%s)\n", utterance->get_text().c_str());
+		return utterance;
+	}
+	catch (rsc::threading::FutureTimeoutException e) {
+		printf("> error: tts_call timed out after %3.1f seconds.\n", tts_timeout);
+	}
+	catch (rsc::threading::FutureTaskExecutionException e) {
+		printf("> error: tts_call failed: %s\n", e.what());
+	}
+
+	printf("> failed... got no utterance\n");
+	boost::shared_ptr<Utterance> utterance(new Utterance());
+	return utterance;
 }
 
 #endif
