From 17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Fri, 20 Nov 2020 23:36:23 +0900 Subject: Re-organized sub-directory by category Since all the sub-directories were placed in the first level, created sub-directories, "hal", "module", and "service" for classification and relocated each component. Signed-off-by: Tadao Tanikawa Change-Id: Ifdf743ac0d1893bd8e445455cf0d2c199a011d5c --- .../include/native_service/ns__CWORD77__common.h | 129 +++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100755 service/native/framework_unified/client/include/native_service/ns__CWORD77__common.h (limited to 'service/native/framework_unified/client/include/native_service/ns__CWORD77__common.h') diff --git a/service/native/framework_unified/client/include/native_service/ns__CWORD77__common.h b/service/native/framework_unified/client/include/native_service/ns__CWORD77__common.h new file mode 100755 index 0000000..e472b30 --- /dev/null +++ b/service/native/framework_unified/client/include/native_service/ns__CWORD77__common.h @@ -0,0 +1,129 @@ +/* + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file ns__CWORD77__common.h + * @brief \~english This file has templet class declaration of CCallback and CResCallback + * + */ +/** @addtogroup BaseSystem + * @{ + */ +/** @addtogroup native_service + * @ingroup BaseSystem + * @{ + */ +/** @addtogroup framework_unified + * @ingroup native_service + * @{ + */ +/** @addtogroup _CWORD77_ + * @ingroup framework_unified + * @{ + */ +#ifndef _NS__CWORD77_COMMON_H_ // NOLINT (build/header_guard) +#define _NS__CWORD77_COMMON_H_ + +#include +#include +#include +#include + +#include +#include +#include + +#define MAX_DATA_SIZE 512; +// using namespace std; + + +// typedef string ServiceName; + + +#define DELETEPTR(p) {if (p != NULL) {delete p; p = NULL;}} + +typedef EFrameworkunifiedStatus(*_CWORD77_FuncPtr)(HANDLE hApp, BOOL bTImerExpiry); +typedef EFrameworkunifiedStatus(*ResponseServiceTo_CWORD77_)(HANDLE hApp, E_CWORD77_ResponseType ResponseType, std::string ServiceName); +typedef boost::function< EFrameworkunifiedStatus(HANDLE, std::string, std::string, UI_32, EFrameworkunifiedStatus) > SessionAckTo_CWORD77_; + +// typedef EFrameworkunifiedStatus (*_CWORD77_TimeoutFuncPtr)(HANDLE hApp,UI_32 uiCmdId, E_CWORD77_MessageType MessageType); + +template +class CCallback { + public: + static CallbackFunctionPtr set(void *pInst) { + if (pInst == NULL) { + throw; + } + if (ms_pInst != NULL) { + // TODO(framework_unified): FRAMEWORKUNIFIEDLOG some warning, preferably outside the template (i.e. use a global), + // to limit executable size, as this code will be replicated many times over + } + ms_pInst = pInst; + return &CCallback::call; + } + static EFrameworkunifiedStatus call(HANDLE y) { + if (ms_pInst == NULL) { + return eFrameworkunifiedStatusFault; // can't throw here + } + C *c = static_cast(ms_pInst); + return (c->*M)(y); + } + private: + static void *ms_pInst; +}; + + + +template +void *CCallback::ms_pInst = NULL; + + + +template +class CResCallback { + public: + static ResponseServiceTo_CWORD77_ set(void *pInst) { + if (pInst == NULL) { + throw; + } + if (ms_pInst != NULL) { + // TODO(framework_unified): FRAMEWORKUNIFIEDLOG some warning, preferably outside the template (i.e. use a global), + // to limit executable size, as this code will be replicated many times over + } + ms_pInst = pInst; + return &CResCallback::call; + } + static EFrameworkunifiedStatus call(HANDLE y, E_CWORD77_ResponseType ResponseType, std::string ServiceName) { + if (ms_pInst == NULL) { + return eFrameworkunifiedStatusFault; // can't throw here + } + C *c = static_cast(ms_pInst); + return (c->*M)(y, ResponseType, ServiceName); + } + private: + static void *ms_pInst; +}; + +template +void *CResCallback::ms_pInst = NULL; + + +#endif // _NS__CWORD77_COMMON_H_ NOLINT (build/header_guard) +/** @}*/ +/** @}*/ +/** @}*/ +/** @}*/ -- cgit 1.2.3-korg