diff --git a/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp b/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp index 7310407..9f5898d 100644 --- a/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp +++ b/source/w3cipa/w3cipachatgptipaprovider/src/w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.cpp @@ -17,8 +17,7 @@ #include -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h" -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h" +#include "w3c/voiceinteraction/ipa/reference/TextMultiModalData.h" #include "w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTIPAProvider.h" #include "w3c/voiceinteraction/ipa/reference/external/ipa/chatgpt/ChatGPTMessage.h" @@ -107,13 +106,13 @@ const std::shared_ptr ChatGPTIPAProvider::processInput( req.model = std::string("gpt-3.5-turbo"); ChatGPTMessage systemMessage {"system", "You are a standards maniac."}; - std::shared_ptr multiModalInputs = + std::shared_ptr multiModalInputs = request->getMultiModalInputs(); - std::shared_ptr input = - multiModalInputs->getMultiModalInput(TextMultiModalInput::MODALITY); + std::shared_ptr input = + multiModalInputs->getMultiModalData(TextMultiModalInput::MODALITY); std::shared_ptr textInput = std::dynamic_pointer_cast(input); - const std::string& text = textInput->getTextInput(); + const std::string& text = textInput->getText(); ChatGPTMessage userMessage { "user", text }; req.messages = std::vector({ systemMessage, userMessage }); req.temperature = 1; @@ -196,11 +195,11 @@ const std::shared_ptr ChatGPTIPAProvider::processInput( nlohmann::json responseData = nlohmann::json::parse(response); ChatGPTJSONResponse parsedResponse = responseData; std::string textOutput = parsedResponse.choices[0].message.content; - std::shared_ptr output = - std::make_shared(textOutput); - std::shared_ptr outputs = - std::make_shared(); - outputs->addMultiModalOutput(output); + std::shared_ptr output = + std::make_shared(textOutput); + std::shared_ptr outputs = + std::make_shared(); + outputs->addMultiModalData(output); std::shared_ptr out = std::make_shared(request->getSessionId(), request->getRequestId(), outputs, nullptr); diff --git a/source/w3cipa/w3cipademo/CMakeLists.txt b/source/w3cipa/w3cipademo/CMakeLists.txt index 5863f2b..76f79d3 100644 --- a/source/w3cipa/w3cipademo/CMakeLists.txt +++ b/source/w3cipa/w3cipademo/CMakeLists.txt @@ -32,13 +32,14 @@ target_link_libraries(${PROJECT_NAME} w3cipachatgptipaprovider) target_link_libraries(${PROJECT_NAME} w3cipareferenceimplementation) target_link_libraries(${PROJECT_NAME} w3cipaframework) -install( - TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin +install(TARGETS ${PROJECT_NAME} + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/log4cplus.properties DESTINATION config) -install(DIRECTORY ${W3CIPA_OPEN_SOURCE_SRC}/bin/ DESTINATION bin) +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/log4cplus.properties + DESTINATION config) +install(DIRECTORY ${W3CIPA_OPEN_SOURCE_SRC}/bin/ + DESTINATION bin) # # Add configuration files @@ -47,6 +48,3 @@ set(PROJECT_CONFIG_DIR ${CMAKE_CURRENT_BINARY_DIR}/config) file(MAKE_DIRECTORY ${PROJECT_CONFIG_DIR}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/log4cplus.properties ${PROJECT_CONFIG_DIR}/log4cplus.properties COPYONLY) - - - diff --git a/source/w3cipa/w3cipaframework/CMakeLists.txt b/source/w3cipa/w3cipaframework/CMakeLists.txt index b425504..82647cc 100644 --- a/source/w3cipa/w3cipaframework/CMakeLists.txt +++ b/source/w3cipa/w3cipaframework/CMakeLists.txt @@ -37,10 +37,8 @@ set(HEADERS include/w3c/voiceinteraction/ipa/LanguageDependent.h include/w3c/voiceinteraction/ipa/MetaData.h include/w3c/voiceinteraction/ipa/ModalityType.h - include/w3c/voiceinteraction/ipa/MultiModalInput.h - include/w3c/voiceinteraction/ipa/MultiModalInputs.h - include/w3c/voiceinteraction/ipa/MultiModalOutput.h - include/w3c/voiceinteraction/ipa/MultiModalOutputs.h + include/w3c/voiceinteraction/ipa/MultiModalData.h + include/w3c/voiceinteraction/ipa/MultiModalDataCollection.h include/w3c/voiceinteraction/ipa/RequestId.h include/w3c/voiceinteraction/ipa/SemanticInterpretation.h include/w3c/voiceinteraction/ipa/SessionId.h @@ -75,10 +73,8 @@ set(SOURCES src/w3c/voiceinteraction/ipa/IPAResponse.cpp src/w3c/voiceinteraction/ipa/Language.cpp src/w3c/voiceinteraction/ipa/Metadata.cpp - src/w3c/voiceinteraction/ipa/MultiModalInput.cpp - src/w3c/voiceinteraction/ipa/MultiModalInputs.cpp - src/w3c/voiceinteraction/ipa/MultiModalOutput.cpp - src/w3c/voiceinteraction/ipa/MultiModalOutputs.cpp + src/w3c/voiceinteraction/ipa/MultiModalData.cpp + src/w3c/voiceinteraction/ipa/MultiModalDataCollection.cpp src/w3c/voiceinteraction/ipa/RequestId.cpp src/w3c/voiceinteraction/ipa/SessionId.cpp src/w3c/voiceinteraction/ipa/TextModalityType.cpp diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/ExternalIPAResponse.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/ExternalIPAResponse.h index 8f38b8b..15a622e 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/ExternalIPAResponse.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/ExternalIPAResponse.h @@ -17,7 +17,7 @@ #include "CallResult.h" #include "ErrorMessage.h" -#include "MultiModalOutputs.h" +#include "MultiModalDataCollection.h" #include "IPAData.h" #include "SemanticInterpretation.h" @@ -41,7 +41,7 @@ class ExternalIPAResponse : public IPAData { */ ExternalIPAResponse(const std::shared_ptr& sessionIdentifier, const std::shared_ptr& requestIdentifier, - const std::shared_ptr& multiModalOutputs, + const std::shared_ptr& multiModalOutputs, const std::shared_ptr semanticInterpretation); /** @@ -63,7 +63,7 @@ class ExternalIPAResponse : public IPAData { * Returns the multimodal outputs to be returned to the client. * @return The multimodal outputs to be returned to the client. */ - const std::shared_ptr getMultiModalOutputs() const; + const std::shared_ptr getMultiModalOutputs() const; /** * Returns the multimodal outputs to be returned to the client. @@ -90,7 +90,7 @@ class ExternalIPAResponse : public IPAData { const std::shared_ptr getErrorMessage() const; private: /** The multimodal outputs to be returned to the client. */ - std::shared_ptr outputs; + std::shared_ptr outputs; /** Semantic interpretation of an utterance. */ std::shared_ptr interpretation; /** Optionalla a caught error. */ diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPARequest.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPARequest.h index 373b767..08694ab 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPARequest.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPARequest.h @@ -16,7 +16,7 @@ #include #include "AudioData.h" -#include "MultiModalInputs.h" +#include "MultiModalDataCollection.h" #include "MetaData.h" #include "IPAData.h" @@ -41,7 +41,7 @@ class IPARequest : public IPAData { */ IPARequest(const std::shared_ptr& sessionIdentifier, const std::shared_ptr& requestIdentifier, - const std::shared_ptr& multiModalInputs, + const std::shared_ptr& multiModalInputs, const std::shared_ptr& audioDataToSend, const std::shared_ptr metaDataToSend); @@ -60,7 +60,7 @@ class IPARequest : public IPAData { * Returns the multimodal inputs to be sent to the client. * qreturn The multimodal inputs to be sent to the client. */ - const std::shared_ptr& getMultiModalInputs(); + const std::shared_ptr& getMultiModalInputs(); /** * Returns the metadata of the request. @@ -72,7 +72,7 @@ class IPARequest : public IPAData { /** The audio data. */ std::shared_ptr audioData; /** The multimodal outputs to be returned to the client. */ - std::shared_ptr inputs; + std::shared_ptr inputs; /** The metadata. */ std::shared_ptr metaData; }; diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPAResponse.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPAResponse.h index 1b43b17..c13b01d 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPAResponse.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/IPAResponse.h @@ -16,7 +16,7 @@ #include #include "AudioData.h" -#include "MultiModalOutputs.h" +#include "MultiModalDataCollection.h" #include "MetaData.h" #include "IPAData.h" @@ -35,14 +35,14 @@ class IPAResponse : public IPAData { * Constructs a new object. * @param sessionIdentifier the session identifier * @param requestIdentifier the request identifier - * @param multiModalOutputs The multimodal outputs to be returned to the + * @param multiModalData The multimodal data elements to be returned to the * client. * @param audioDataToSend audio data to send * @param metaDataToSend meta data to send */ IPAResponse(const std::shared_ptr& sessionIdentifier, const std::shared_ptr& requestIdentifier, - const std::shared_ptr& multiModalOutputs, + const std::shared_ptr& multiModalData, const std::shared_ptr& audioDataToSend, const std::shared_ptr metaDataToSend); @@ -61,7 +61,7 @@ class IPAResponse : public IPAData { * Returns the multimodal outputs to be returned to the client. * qreturn The multimodal outputs to be returned to the client. */ - virtual const std::shared_ptr getMultiModalOutputs(); + virtual const std::shared_ptr getMultiModalOutputs(); /** * Returns the metadata of the request. @@ -73,7 +73,7 @@ class IPAResponse : public IPAData { /** The audio data. */ std::shared_ptr audioData; /** The multimodal outputs to be returned to the client. */ - std::shared_ptr outputs; + std::shared_ptr outputs; /** The metadata. */ std::shared_ptr metaData; }; diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalInput.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalData.h similarity index 78% rename from source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalInput.h rename to source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalData.h index aaa742b..6cc97f4 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalInput.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalData.h @@ -10,8 +10,8 @@ * [1] https://www.w3.org/Consortium/Legal/copyright-software */ -#if !defined(MULTI_MODAL_INPUT_H) -#define MULTI_MODAL_INPUT_H +#if !defined(MULTI_MODAL_DATA_H) +#define MULTI_MODAL_DATA_H #include "ModalityType.h" @@ -20,23 +20,22 @@ namespace voiceinteraction { namespace ipa { /** - * This interface is used to represent input from a modality. + * This interface is used to represent input or output from a modality. * @author Dirk Schnelle-Walka */ -class MultiModalInput -{ +class MultiModalData { public: /** * Constructs a new object. * @param modality The modality of this input. */ - MultiModalInput(const ModalityType modality); + MultiModalData(const ModalityType modality); /** * Destroys the object. */ - virtual ~MultiModalInput(); + virtual ~MultiModalData(); /** * Retrieves a string identifying the modality of this input. @@ -54,4 +53,4 @@ class MultiModalInput } // namespace voiceinteraction } // namespace w3c -#endif // !defined(MULTI_MODAL_INPUT_H) +#endif // !defined(MULTI_MODAL_DATA_H) diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalInputs.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalDataCollection.h similarity index 57% rename from source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalInputs.h rename to source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalDataCollection.h index 5dae979..395dc4b 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalInputs.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalDataCollection.h @@ -10,15 +10,15 @@ * [1] https://www.w3.org/Consortium/Legal/copyright-software */ -#if !defined(MULTIMODALINPUTS_H) -#define MULTIMODALINPUTS_H +#if !defined(MULTIMODALDATACOLLECTION_H) +#define MULTIMODALDATACOLLECTION_H #include #include #include #include "ModalityType.h" -#include "MultiModalInput.h" +#include "MultiModalData.h" #include "Language.h" namespace w3c { @@ -30,56 +30,61 @@ namespace ipa { * allows for only on input per modality. * @author Dirk Schnelle-Walka */ -class MultiModalInputs -{ +class MultiModalDataCollection { public: /** * Constructs an empty set of multimodal inputs. */ - MultiModalInputs(); + MultiModalDataCollection(); /** * Destroys the set of multimodal inputs. */ - virtual ~MultiModalInputs(); + virtual ~MultiModalDataCollection(); /** * Adds a multimodal input to the set. An existing entry for the * provided modality will be overwritten. * @param input The multimodal input to add. */ - void addMultiModalInput(const std::shared_ptr& input); + void addMultiModalData(const std::shared_ptr& input); /** - * Returns the multimodal input for the given modality. + * Returns the multimodal data elements for the given modality. * @param modality The modality to return. - * @return The multimodal input for the given modality, {@code nullptr} if + * @return The multimodal data for the given modality, {@code nullptr} if * the modality could not be found. */ - std::shared_ptr getMultiModalInput(const ModalityType& modality) const; + std::shared_ptr getMultiModalData(const ModalityType& modality) const; /** - * Retrieves all modality types provided in this input. + * Retrieves all modality types provided in this multimodal data collection. * @return list of all modality types */ - std::list getInputModalities() const; + std::list getMultiModalData() const; /** - * Retrieves all languages supported by the input. + * Retrieves all languages supported by this multimodal data collection. * @return list of all supported languages */ std::list getInputLanguages() const; -private: /** - * The map of known multimodal inputs. + * Retrieves all modality types provided. + * @return list of all modality types + */ + std::list getModalityTypes() const; + + private: + /** + * The map of known multimodal data elements. */ - std::map> inputs; + std::map> multiModalData; }; } // namespace ipa } // namespace voiceinteraction } // namespace w3c -#endif // !defined(MULTIMODALINPUTS_H) +#endif // !defined(MULTIMODALDATACOLLECTION_H) diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalOutput.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalOutput.h deleted file mode 100644 index a7144d5..0000000 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalOutput.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * IPA Reference Implementation: https://github.com/w3c/voiceinteraction - * - * Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. - * - * This work is distributed under the W3C Software and Document License [1] - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] https://www.w3.org/Consortium/Legal/copyright-software - */ - -#if !defined(MULTI_MODAL_OUTPUT_H) -#define MULTI_MODAL_OUTPUT_H - -#include "ModalityType.h" - -namespace w3c { -namespace voiceinteraction { -namespace ipa { - -/** - * This interface is used to represent the output of a modality. - * @author Dirk Schnelle-Walka - */ -class MultiModalOutput -{ - -public: - /** - * Constructs a new object. - * @param modality The modality of this input. - */ - MultiModalOutput(const ModalityType& modality); - - /** - * Destroys the object. - */ - virtual ~MultiModalOutput(); - - /** - * Retrieves a string identifying the modality of this input. - */ - const ModalityType& getModality() const; - -private: - /** - * The modality of this input. - */ - ModalityType modality; -}; - -} // namespace ipa -} // namespace voiceinteraction -} // namespace w3c - -#endif // !defined(MULTI_MODAL_OUTPUT_H) diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalOutputs.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalOutputs.h deleted file mode 100644 index 4b3d2ee..0000000 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/MultiModalOutputs.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * IPA Reference Implementation: https://github.com/w3c/voiceinteraction - * - * Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. - * - * This work is distributed under the W3C Software and Document License [1] - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] https://www.w3.org/Consortium/Legal/copyright-software - */ - -#if !defined(MULTIMODALOUTPUTS_H) -#define MULTIMODALOUTPUTS_H - -#include -#include -#include - -#include "ModalityType.h" -#include "MultiModalOutput.h" - -namespace w3c { -namespace voiceinteraction { -namespace ipa { - -/** - * This class represents a set of multi modal outputs. This implementation - * allows for only on output per modality. - * @author Dirk Schnelle-Walka - */ -class MultiModalOutputs -{ - -public: - /** - * Constructs an empty set of multi modal outputs. - */ - MultiModalOutputs(); - - /** - * Destroys the set of multi modal outputs. - */ - virtual ~MultiModalOutputs(); - - /** - * Adds a multi modal output to the set. An existing entry for the - * provided modality will be overwritten. - * @param output The multi modal output to add. - */ - void addMultiModalOutput(const std::shared_ptr& output); - - /** - * Returns the multi modal output for the given modality. - * @param modality The modality to get the multi modal output for. - * @return The multi modal output for the given modality. - */ - std::shared_ptr getMultiModalOutput( - const ModalityType& modality); - - /** - * Retrieves all known modality types. - * @return known modality types - */ - std::list getModalityTypes() const; - -private: - /** - * The map of known multi modal outputs. - */ - std::map> outputs; -}; - -} // namespace ipa -} // namespace voiceinteraction -} // namespace w3c - -#endif // !defined(MULTIMODALOUTPUTS_H) diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputModalityComponentListener.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputModalityComponentListener.h index a3a08ed..5f79c0e 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputModalityComponentListener.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputModalityComponentListener.h @@ -15,7 +15,7 @@ #include -#include "w3c/voiceinteraction/ipa/MultiModalInputs.h" +#include "w3c/voiceinteraction/ipa/MultiModalDataCollection.h" namespace w3c { namespace voiceinteraction { @@ -42,7 +42,7 @@ class InputModalityComponentListener { * The input modality component received the provided multimodal input. * @param input the multimodal input. */ - virtual void onMultiModalInput(std::shared_ptr input) = 0; + virtual void onMultiModalInput(std::shared_ptr input) = 0; /** * Obtains the next input for the IPA. This call is blocking until input @@ -50,7 +50,7 @@ class InputModalityComponentListener { * conditions when this method returns. * @return next input for the IPA */ - virtual std::shared_ptr getMultiModalInputs() = 0; + virtual std::shared_ptr getMultiModalInputs() = 0; }; } // namespace client diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputNotificationMediator.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputNotificationMediator.h index 4e799f2..0e63a38 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputNotificationMediator.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/InputNotificationMediator.h @@ -52,7 +52,7 @@ class InputNotificationMediator { * Notifies all listeners about the received multiomodal input. * @param input the input */ - void notifyListeners(std::shared_ptr input); + void notifyListeners(std::shared_ptr input); private: /** Known listeners for multimnodal input. */ diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/ModalityManager.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/ModalityManager.h index 6a8aff4..f369f19 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/ModalityManager.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/ModalityManager.h @@ -19,7 +19,7 @@ #include #include -#include "w3c/voiceinteraction/ipa/MultiModalOutputs.h" +#include "w3c/voiceinteraction/ipa/MultiModalDataCollection.h" #include "w3c/voiceinteraction/ipa/IPADataProcessor.h" #include "ModalityComponent.h" #include "InputModalityComponent.h" @@ -80,7 +80,7 @@ class ModalityManager : public IPADataProcessor { * Handles the provided multimodal output with all known modality handlers. * @param outputs the outputs to process */ - void handleOutput(const std::shared_ptr& outputs) const; + void handleOutput(const std::shared_ptr& outputs) const; /** * Adds the provided listener for multimodal inputs to the list of known diff --git a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/OutputModalityComponent.h b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/OutputModalityComponent.h index 701eebd..f38b6d2 100644 --- a/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/OutputModalityComponent.h +++ b/source/w3cipa/w3cipaframework/include/w3c/voiceinteraction/ipa/client/OutputModalityComponent.h @@ -15,7 +15,7 @@ #include -#include "w3c/voiceinteraction/ipa/MultiModalOutput.h" +#include "w3c/voiceinteraction/ipa/MultiModalData.h" namespace w3c { namespace voiceinteraction { @@ -47,7 +47,7 @@ class OutputModalityComponent { * @param output the obtained output. */ virtual void handleOutput( - const std::shared_ptr& output) = 0; + const std::shared_ptr& output) = 0; }; } // namespace client diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/ExternalIPAResponse.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/ExternalIPAResponse.cpp index 3a8a60d..3396b84 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/ExternalIPAResponse.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/ExternalIPAResponse.cpp @@ -18,7 +18,7 @@ namespace ipa { ExternalIPAResponse::ExternalIPAResponse(const std::shared_ptr& sessionIdentifier, const std::shared_ptr& requestIdentifier, - const std::shared_ptr& multiModalOutputs, + const std::shared_ptr& multiModalOutputs, const std::shared_ptr semanticInterpretation) : IPAData(sessionIdentifier, requestIdentifier), outputs(multiModalOutputs), interpretation(semanticInterpretation), @@ -37,7 +37,7 @@ ExternalIPAResponse::ExternalIPAResponse( ExternalIPAResponse::~ExternalIPAResponse() { } -const std::shared_ptr ExternalIPAResponse::getMultiModalOutputs() const { +const std::shared_ptr ExternalIPAResponse::getMultiModalOutputs() const { return outputs; } diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPARequest.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPARequest.cpp index 2456a40..c0c74bd 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPARequest.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPARequest.cpp @@ -18,7 +18,7 @@ namespace ipa { IPARequest::IPARequest(const std::shared_ptr& sessionIdentifier, const std::shared_ptr& requestIdentifier, - const std::shared_ptr& multiModalInputs, + const std::shared_ptr& multiModalInputs, const std::shared_ptr& audioDataToSend, const std::shared_ptr metaDataToSend) : IPAData(sessionIdentifier, requestIdentifier), @@ -34,7 +34,7 @@ const std::shared_ptr& IPARequest::getAudioData() { return audioData; } -const std::shared_ptr& IPARequest::getMultiModalInputs() { +const std::shared_ptr& IPARequest::getMultiModalInputs() { return inputs; } diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPAResponse.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPAResponse.cpp index 0c93254..5a1b9df 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPAResponse.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/IPAResponse.cpp @@ -19,11 +19,11 @@ namespace ipa { IPAResponse::IPAResponse(const std::shared_ptr& sessionIdentifier, const std::shared_ptr& requestIdentifier, - const std::shared_ptr& multiModalOutputs, + const std::shared_ptr& multiModalData, const std::shared_ptr& audioDataToSend, const std::shared_ptr metaDataToSend) : IPAData(sessionIdentifier, requestIdentifier), - outputs(multiModalOutputs), audioData(audioDataToSend), + outputs(multiModalData), audioData(audioDataToSend), metaData(metaDataToSend) { } @@ -35,7 +35,7 @@ const std::shared_ptr& IPAResponse::getAudioData() { return audioData; } -const std::shared_ptr IPAResponse::getMultiModalOutputs() { +const std::shared_ptr IPAResponse::getMultiModalOutputs() { return outputs; } diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalInput.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalData.cpp similarity index 75% rename from source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalInput.cpp rename to source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalData.cpp index 45b980f..5b9a111 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalInput.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalData.cpp @@ -10,20 +10,20 @@ * [1] https://www.w3.org/Consortium/Legal/copyright-software */ -#include "w3c/voiceinteraction/ipa/MultiModalInput.h" +#include "w3c/voiceinteraction/ipa/MultiModalData.h" namespace w3c { namespace voiceinteraction { namespace ipa { -MultiModalInput::MultiModalInput(const ModalityType modality) +MultiModalData::MultiModalData(const ModalityType modality) : modality(modality) { } -MultiModalInput::~MultiModalInput() { +MultiModalData::~MultiModalData() { } -const ModalityType& MultiModalInput::getModality() const { +const ModalityType& MultiModalData::getModality() const { return modality; } diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalInputs.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalDataCollection.cpp similarity index 51% rename from source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalInputs.cpp rename to source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalDataCollection.cpp index 81b7f86..c999ac6 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalInputs.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalDataCollection.cpp @@ -11,29 +11,27 @@ */ #include "w3c/voiceinteraction/ipa/LanguageDependent.h" -#include "w3c/voiceinteraction/ipa/MultiModalInputs.h" +#include "w3c/voiceinteraction/ipa/MultiModalDataCollection.h" namespace w3c { namespace voiceinteraction { namespace ipa { -MultiModalInputs::MultiModalInputs() { -} +MultiModalDataCollection::MultiModalDataCollection() {} -MultiModalInputs::~MultiModalInputs() { -} +MultiModalDataCollection::~MultiModalDataCollection() {} -void MultiModalInputs::addMultiModalInput( - const std::shared_ptr& input) { +void MultiModalDataCollection::addMultiModalData( + const std::shared_ptr& input) { const ModalityType& modality = input->getModality(); - inputs[modality] = input; + multiModalData[modality] = input; } -std::shared_ptr MultiModalInputs::getMultiModalInput( +std::shared_ptr MultiModalDataCollection::getMultiModalData( const ModalityType& modality) const { - std::map>::const_iterator iterator = - inputs.find(modality); - if (iterator == inputs.end()) { + std::map>::const_iterator iterator = + multiModalData.find(modality); + if (iterator == multiModalData.end()) { return nullptr; } return iterator->second; @@ -43,11 +41,11 @@ std::shared_ptr MultiModalInputs::getMultiModalInput( * Retrieves all modality types provided in this input. * @return list of all modality types */ -std::list MultiModalInputs::getInputModalities() const { +std::list MultiModalDataCollection::getMultiModalData() const { std::list types; for (std::map>::const_iterator iterator = inputs.begin(); - iterator != inputs.end(); ++iterator) { + std::shared_ptr>::const_iterator iterator = multiModalData.begin(); + iterator != multiModalData.end(); ++iterator) { types.push_back(iterator->first); } return types; @@ -57,11 +55,11 @@ std::list MultiModalInputs::getInputModalities() const { * Retrieves all modality types provided in this input. * @return list of all modality types */ -std::list MultiModalInputs::getInputLanguages() const { +std::list MultiModalDataCollection::getInputLanguages() const { std::list languages; - for (std::map>::const_iterator - iterator = inputs.begin(); - iterator != inputs.end(); ++iterator) { + for (std::map>::const_iterator + iterator = multiModalData.begin(); + iterator != multiModalData.end(); ++iterator) { std::shared_ptr languageDependentInput = std::dynamic_pointer_cast(iterator->second); if (languageDependentInput != nullptr) { @@ -72,6 +70,16 @@ std::list MultiModalInputs::getInputLanguages() const { return languages; } +std::list MultiModalDataCollection::getModalityTypes() const { + std::list types; + for (std::map>::const_iterator + iterator = multiModalData.begin(); + iterator != multiModalData.end(); ++iterator) { + const ModalityType type = iterator->first; + types.push_back(type); + } + return types; +} } // namespace ipa } // namespace voiceinteraction } // namespace w3c diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalOutput.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalOutput.cpp deleted file mode 100644 index 930a3f4..0000000 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalOutput.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * IPA Reference Implementation: https://github.com/w3c/voiceinteraction - * - * Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. - * - * This work is distributed under the W3C Software and Document License [1] - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] https://www.w3.org/Consortium/Legal/copyright-software - */ - -#include "w3c/voiceinteraction/ipa/MultiModalOutput.h" - -namespace w3c { -namespace voiceinteraction { -namespace ipa { - -MultiModalOutput::MultiModalOutput(const ModalityType& modality) - : modality(modality) { -} - -MultiModalOutput::~MultiModalOutput() { -} - -const ModalityType& MultiModalOutput::getModality() const { - return modality; -} - - -} // namespace ipa -} // namespace voiceinteraction -} // namespace w3c diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalOutputs.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalOutputs.cpp deleted file mode 100644 index 2250795..0000000 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/MultiModalOutputs.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * IPA Reference Implementation: https://github.com/w3c/voiceinteraction - * - * Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. - * - * This work is distributed under the W3C Software and Document License [1] - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] https://www.w3.org/Consortium/Legal/copyright-software - */ - -#include "w3c/voiceinteraction/ipa/MultiModalOutputs.h" - -namespace w3c { -namespace voiceinteraction { -namespace ipa { - -MultiModalOutputs::MultiModalOutputs() { -} - -MultiModalOutputs::~MultiModalOutputs() { -} - -void MultiModalOutputs::addMultiModalOutput( - const std::shared_ptr& output) { - const ModalityType& modality = output->getModality(); - outputs[modality] = output; -} - -std::shared_ptr MultiModalOutputs::getMultiModalOutput( - const ModalityType& modality) { - return outputs[modality]; -} - -std::list MultiModalOutputs::getModalityTypes() const { - std::list types; - for (std::map>::const_iterator iterator = outputs.begin(); - iterator != outputs.end(); ++iterator) { - const ModalityType type = iterator->first; - types.push_back(type); - } - return types; -} - -} // namespace ipa -} // namespace voiceinteraction -} // namespace w3c diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/InputNotificationMediator.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/InputNotificationMediator.cpp index 496036b..86041b6 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/InputNotificationMediator.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/InputNotificationMediator.cpp @@ -28,7 +28,7 @@ void InputNotificationMediator::addInputModalityComponentListener( } void InputNotificationMediator::notifyListeners( - std::shared_ptr input) { + std::shared_ptr input) { for (const std::shared_ptr& listener : inputListeners) { // std::thread thread([&data, &listener]{ listener->onMultiModalInput(input); diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/ModalityManager.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/ModalityManager.cpp index bc12426..063588d 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/ModalityManager.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/client/ModalityManager.cpp @@ -87,18 +87,18 @@ void ModalityManager::startInput() const { void ModalityManager::processIPAData(std::shared_ptr data) { if (std::shared_ptr response = std::dynamic_pointer_cast(data)) { - std::shared_ptr outputs = + std::shared_ptr outputs = response->getMultiModalOutputs(); handleOutput(outputs); } } void ModalityManager::handleOutput( - const std::shared_ptr& outputs) const { + const std::shared_ptr& outputs) const { std::list outputModalities = outputs->getModalityTypes(); for (ModalityType& outputModality : outputModalities) { - std::shared_ptr output = - outputs->getMultiModalOutput(outputModality); + std::shared_ptr output = + outputs->getMultiModalData(outputModality); std::list> outputComponents = getModalityComponents(outputModality, client::IOType::OUTPUT); for (std::shared_ptr& outputComponent : outputComponents) { diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/LanguageMatchingProviderSelectionStrategy.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/LanguageMatchingProviderSelectionStrategy.cpp index a18043c..1730eb1 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/LanguageMatchingProviderSelectionStrategy.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/LanguageMatchingProviderSelectionStrategy.cpp @@ -28,7 +28,7 @@ const std::list> std::list> filteredProviders; // Check which known provider supports the provided modalities - const std::shared_ptr inputs = + const std::shared_ptr inputs = request->getMultiModalInputs(); std::list requestedLangauges = inputs->getInputLanguages(); for (const std::shared_ptr<::external::ipa::IPAProvider>& provider : providers) { diff --git a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/ModalityMatchingProviderSelectionStrategy.cpp b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/ModalityMatchingProviderSelectionStrategy.cpp index fa898e9..c88fb05 100644 --- a/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/ModalityMatchingProviderSelectionStrategy.cpp +++ b/source/w3cipa/w3cipaframework/src/w3c/voiceinteraction/ipa/external/ipa/ModalityMatchingProviderSelectionStrategy.cpp @@ -27,9 +27,9 @@ const std::list> ModalityMatchingP std::list> filteredProviders; // Check which known provider supports the provided modalities - const std::shared_ptr inputs = + const std::shared_ptr inputs = request->getMultiModalInputs(); - std::list requestedTypes = inputs->getInputModalities(); + std::list requestedTypes = inputs->getMultiModalData(); for (const std::shared_ptr<::external::ipa::IPAProvider>& provider : providers) { // Check if the current provider supports the requested modalities std::list supportedTypes = diff --git a/source/w3cipa/w3cipareferenceimplementation/CMakeLists.txt b/source/w3cipa/w3cipareferenceimplementation/CMakeLists.txt index 25bdbf7..f8cfe18 100644 --- a/source/w3cipa/w3cipareferenceimplementation/CMakeLists.txt +++ b/source/w3cipa/w3cipareferenceimplementation/CMakeLists.txt @@ -24,8 +24,7 @@ set(HEADERS include/w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.h include/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.h include/w3c/voiceinteraction/ipa/reference/IntegerRequestId.h - include/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h - include/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h + include/w3c/voiceinteraction/ipa/reference/TextMultiModalData.h include/w3c/voiceinteraction/ipa/reference/UUIDSessionId.h ) @@ -35,8 +34,7 @@ set(SOURCES src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.cpp src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.cpp src/w3c/voiceinteraction/ipa/reference/IntegerRequestId.cpp - src/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.cpp - src/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.cpp + src/w3c/voiceinteraction/ipa/reference/TextMultiModalData.cpp src/w3c/voiceinteraction/ipa/reference/UUIDSessionId.cpp ) diff --git a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalData.h similarity index 85% rename from source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h rename to source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalData.h index 7692054..9c31304 100644 --- a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h +++ b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalData.h @@ -16,7 +16,7 @@ #include #include -#include +#include namespace w3c { namespace voiceinteraction { @@ -28,20 +28,20 @@ namespace reference { * @author Dirk Schnelle-Walka */ class TextMultiModalInput - : public MultiModalInput, public LanguageDependent { + : public MultiModalData, public LanguageDependent { public: /** * Constructs a new object. * @param input the text - * @param lang the language of the text + * @param lang the language of the text, defaults to EN */ - TextMultiModalInput(const std::string& input, const Language& lang); + TextMultiModalInput(const std::string& input, const Language& lang = Language::EN); /** * Returns the text. * @return the text */ - const std::string& getTextInput() const { + const std::string& getText() const { return text; } diff --git a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h deleted file mode 100644 index 6a11e81..0000000 --- a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * IPA Reference Implementation: https://github.com/w3c/voiceinteraction - * - * Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. - * - * This work is distributed under the W3C Software and Document License [1] - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] https://www.w3.org/Consortium/Legal/copyright-software - */ - -#ifndef TEXTMULTMODALOUTPUT_H -#define TEXTMULTMODALOUTPUT_H - -#include - -#include - -namespace w3c { -namespace voiceinteraction { -namespace ipa { -namespace reference { - -/** - * @brief Multimodal output for text. - * @author Dirk Schnelle-Walka - */ -class TextMultiModalOutput : public MultiModalOutput { -public: - TextMultiModalOutput(const std::string& output); - - const std::string& getTextOutput() const { - return text; - } - - const static ModalityType MODALITY; -private: - std::string text; -}; - -} // namespace reference -} // namespace ipa -} // namespace voiceinteraction -} // namespace w3c - -#endif // TEXTMULTMODALOUTPUT_H diff --git a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.h b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.h index a7d4c0c..4f9d022 100644 --- a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.h +++ b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.h @@ -39,7 +39,7 @@ class ConsoleTextModalityComponent : public ModalityComponent, void stopInput() override; - void handleOutput(const std::shared_ptr& output) override; + void handleOutput(const std::shared_ptr& output) override; const static ModalityType MODALITY; diff --git a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.h b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.h index f73d03d..4f415c4 100644 --- a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.h +++ b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.h @@ -46,14 +46,14 @@ class TakeFirstInputModalityComponentListener void processIPAData(std::shared_ptr data) override; - void onMultiModalInput(std::shared_ptr input) override; + void onMultiModalInput(std::shared_ptr input) override; - std::shared_ptr getMultiModalInputs() override; + std::shared_ptr getMultiModalInputs() override; private: std::mutex mtx; std::condition_variable cv; - std::shared_ptr multiModalInput; + std::shared_ptr multiModalInput; /** Logger instance. */ const static log4cplus::Logger LOGGER; }; diff --git a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.h b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.h index c10168d..8adaabf 100644 --- a/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.h +++ b/source/w3cipa/w3cipareferenceimplementation/include/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.h @@ -45,7 +45,7 @@ class ReferenceIPADialogManager : public IPADataProcessor { * @param error the error message * @return the multimodal output */ - std::shared_ptr createOutputFromError( + std::shared_ptr createOutputFromError( const std::shared_ptr& error); void processIPAData(const std::shared_ptr& request); diff --git a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.cpp b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalData.cpp similarity index 89% rename from source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.cpp rename to source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalData.cpp index fc7569c..802bd6a 100644 --- a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalInput.cpp +++ b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalData.cpp @@ -12,7 +12,7 @@ #include -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h" +#include "w3c/voiceinteraction/ipa/reference/TextMultiModalData.h" namespace w3c { namespace voiceinteraction { @@ -22,7 +22,7 @@ namespace reference { const ModalityType TextMultiModalInput::MODALITY = TextModalityType(); TextMultiModalInput::TextMultiModalInput(const std::string& input, const Language& lang) - : MultiModalInput(MODALITY), + : MultiModalData(MODALITY), text(input), language(lang) { } diff --git a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.cpp b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.cpp deleted file mode 100644 index b313bcb..0000000 --- a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - * IPA Reference Implementation: https://github.com/w3c/voiceinteraction - * - * Copyright (C) 2024 World Wide Web Consortium. All Rights Reserved. - * - * This work is distributed under the W3C Software and Document License [1] - * in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even - * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * [1] https://www.w3.org/Consortium/Legal/copyright-software - */ - -#include - -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h" - -namespace w3c { -namespace voiceinteraction { -namespace ipa { -namespace reference { - -const ModalityType TextMultiModalOutput::MODALITY = TextModalityType(); - -TextMultiModalOutput::TextMultiModalOutput(const std::string& output) - : MultiModalOutput(MODALITY), - text(output) { -} - -} // namespace reference -} // namespace ipa -} // namespace voiceinteraction -} // namespace w3c diff --git a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.cpp b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.cpp index 94075b5..ed01734 100644 --- a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.cpp +++ b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.cpp @@ -17,8 +17,7 @@ #include -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalInput.h" -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h" +#include "w3c/voiceinteraction/ipa/reference/TextMultiModalData.h" #include "w3c/voiceinteraction/ipa/reference/client/ConsoleTextModalityComponent.h" namespace w3c { @@ -60,7 +59,7 @@ void ConsoleTextModalityComponent::captureInputAsynchronously( input.c_str()); // TODO: get language from user or configuration Language language("en"); - std::shared_ptr multiModalInput = + std::shared_ptr multiModalInput = std::make_shared(input, language); mediator->notifyListeners(multiModalInput); } @@ -70,10 +69,10 @@ void ConsoleTextModalityComponent::stopInput() { } void ConsoleTextModalityComponent::handleOutput( - const std::shared_ptr& output) { - std::shared_ptr textOutput = - std::dynamic_pointer_cast(output); - const std::string& text = textOutput->getTextOutput(); + const std::shared_ptr& output) { + std::shared_ptr textOutput = + std::dynamic_pointer_cast(output); + const std::string& text = textOutput->getText(); std::cout << "System: " << text.c_str() << std::endl; LOG4CPLUS_INFO_FMT(LOGGER, LOG4CPLUS_TEXT("Received response from ChatGPT: %s"), diff --git a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.cpp b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.cpp index fc57469..d9fd021 100644 --- a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.cpp +++ b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/client/TakeFirstInputModalityComponentListener.cpp @@ -35,7 +35,7 @@ void TakeFirstInputModalityComponentListener::processIPAData( std::shared_ptr data) { LOG4CPLUS_INFO(LOGGER, LOG4CPLUS_TEXT("waiting for input")); - std::shared_ptr multiModalInputs = getMultiModalInputs(); + std::shared_ptr multiModalInputs = getMultiModalInputs(); std::shared_ptr requestId = std::make_shared(); std::shared_ptr metaData = std::make_shared(); @@ -48,21 +48,21 @@ void TakeFirstInputModalityComponentListener::processIPAData( } void TakeFirstInputModalityComponentListener::onMultiModalInput( - std::shared_ptr input) { + std::shared_ptr input) { std::unique_lock lck(mtx); multiModalInput = input; cv.notify_one(); } -std::shared_ptr TakeFirstInputModalityComponentListener::getMultiModalInputs() { +std::shared_ptr TakeFirstInputModalityComponentListener::getMultiModalInputs() { std::unique_lock lck(mtx); cv.wait(lck, [this] { return multiModalInput != nullptr; }); - std::shared_ptr multiModalInputs = - std::make_shared(); - multiModalInputs->addMultiModalInput(multiModalInput); + std::shared_ptr multiModalInputs = + std::make_shared(); + multiModalInputs->addMultiModalData(multiModalInput); return multiModalInputs; } diff --git a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.cpp b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.cpp index 234a944..da9cb5b 100644 --- a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.cpp +++ b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.cpp @@ -15,7 +15,7 @@ #include #include "w3c/voiceinteraction/ipa/reference/dialog/ReferenceDialogManager.h" -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h" +#include "w3c/voiceinteraction/ipa/reference/TextMultiModalData.h" namespace w3c { namespace voiceinteraction { @@ -42,15 +42,15 @@ void ReferenceIPADialogManager::processIPAData(std::shared_ptr data) { } -std::shared_ptr ReferenceIPADialogManager::createOutputFromError( - // TODO temporarily take the error message as the output +std::shared_ptr ReferenceIPADialogManager::createOutputFromError( const std::shared_ptr& error) { + // TODO temporarily take the error message as the output const std::string& message = error->getErrorMessage(); - std::shared_ptr errorOutput = - std::make_shared(message); - std::shared_ptr outputs = - std::make_shared(); - outputs->addMultiModalOutput(errorOutput); + std::shared_ptr errorOutput = + std::make_shared(message); + std::shared_ptr outputs = + std::make_shared(); + outputs->addMultiModalData(errorOutput); return outputs; } @@ -60,7 +60,7 @@ void ReferenceIPADialogManager::processIPAData( if (response->hasError()) { const std::shared_ptr& error = response->getErrorMessage(); - std::shared_ptr outputs = + std::shared_ptr outputs = createOutputFromError(error); forwardedResponse = std::make_shared(response->getSessionId(), diff --git a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.cpp b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.cpp index ce9abd0..eeba07d 100644 --- a/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.cpp +++ b/source/w3cipa/w3cipareferenceimplementation/src/w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.cpp @@ -17,7 +17,7 @@ #include #include "w3c/voiceinteraction/ipa/reference/UUIDSessionId.h" -#include "w3c/voiceinteraction/ipa/reference/TextMultiModalOutput.h" +#include "w3c/voiceinteraction/ipa/reference/TextMultiModalData.h" #include "w3c/voiceinteraction/ipa/reference/dialog/ReferenceIPAService.h"