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 ///////////////////////////////////////////////////////////////////////////////
22 #include "readerWriter/reader/reader.h"
26 #include "readerWriter/reader/queue_reader.h"
27 #include "readerWriter/reader/mem_reader.h"
28 #include "ss_logger_cfg.h"
29 namespace ReaderWriter {
31 : m_pLoggerCfg(NULL) {
37 CReader* CReader::OpenReader(CLoggerCfg* f_pLoggerCfg, EReaderType f_type,
38 std::string f_name, UI_32 f_maxSize) {
39 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
40 CReader* l_ret = NULL;
41 if (f_pLoggerCfg != NULL) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
42 if (f_name.length() != 0) { // LCOV_EXCL_BR_LINE 200:Because it is not always an empty string
43 switch (f_type) { // LCOV_EXCL_BR_LINE 200:As it must be eReaderWriterTypeQueue or eReaderWriterTypeMem
44 case eReaderWriterTypeFile:
47 case eReaderWriterTypeQueue:
48 l_ret = new (std::nothrow) CQueueReader(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
51 case eReaderWriterTypeMem:
52 l_ret = new (std::nothrow) CMemReader(); // LCOV_EXCL_BR_LINE 5:Cannot pass because it cannot be new
59 if (NULL != l_ret) { // LCOV_EXCL_BR_LINE 200:As it is not always NULL
60 if (eFrameworkunifiedStatusOK != l_ret->Initialize(f_pLoggerCfg, f_name, f_maxSize)) {
66 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
71 EFrameworkunifiedStatus CReader::ReadToFile(std::string f_fileName, UI_32& f_Written) {
72 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
73 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNotImplemented;
75 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
79 EFrameworkunifiedStatus CReader::ResetPosition(void) {
80 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
81 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusNotImplemented;
83 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
86 } // namespace ReaderWriter