2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////
18 /// \ingroup tag_SS_LoggerService
21 ///////////////////////////////////////////////////////////////////////////////
25 #include "readerWriter/writer/writer.h"
26 #include "readerWriter/writer/file_writer.h"
27 #include "readerWriter/writer/udp_writer.h"
28 #include "readerWriter/writer/udp_file_writer.h"
29 #include "readerWriter/writer/cached_file_writer.h"
31 namespace ReaderWriter {
34 : m_pLoggerCfg(NULL) {
40 CWriter* CWriter::OpenWriter(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
41 std::string f_Name1, UI_32 f_size1,
42 std::string f_Name2, UI_32 f_size2) {
43 CWriter* l_ret = NULL;
44 if ((f_Name1.length() != 0) && (f_pLoggerCfg != NULL)) { // LCOV_EXCL_BR_LINE 200:As it is always TRUE
45 switch (f_type) {// LCOV_EXCL_BR_LINE 200:As it must be eReaderWriterTypeQueue or eReaderWriterTypeMem
46 case eReaderWriterTypeFile:
47 l_ret = new (std::nothrow) CCachedFileWriter(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
50 case eReaderWriterTypeUdp:
51 l_ret = new (std::nothrow) CUdpWriter(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
53 case eReaderWriterTypeUdpAndFile: // LCOV_EXCL_START 8:dead code
54 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
55 if (f_Name2.length() != 0) {
56 l_ret = new (std::nothrow) CUdpFileWriter();
63 if (NULL != l_ret) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
64 if (eFrameworkunifiedStatusOK != l_ret->Initialize(f_pLoggerCfg, f_Name1, f_size1, f_Name2, f_size2)) {
65 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Open Writer Failed");
74 EFrameworkunifiedStatus CWriter::FlushCache(void) { // LCOV_EXCL_START 8:Base class virtual functions
75 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
76 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Default function called!");
77 return (eFrameworkunifiedStatusOK);
81 EFrameworkunifiedStatus CWriter::UpdateLoggingParameters(void) {
82 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "Default function called!");
83 return (eFrameworkunifiedStatusOK);
85 } // namespace ReaderWriter