1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
20 #include "DataReader.h"
22 CDataReader::CDataReader()
26 CDataReader::~CDataReader()
28 for (std::map<std::string, std::vector<CModelData *> >::iterator itorModel =
29 m_modelDataList.begin();
30 itorModel != m_modelDataList.end(); ++itorModel)
32 for (std::vector<CModelData *>::iterator itorData = itorModel->second.begin();
33 itorData != itorModel->second.end(); ++itorData)
35 SAFE_DELETE(*itorData);
40 SSMRESULT CDataReader::addModelData(std::string modelName,
41 std::vector<CModelData *> *pModelData)
43 m_modelDataList[modelName] = *pModelData;
48 SSMRESULT CDataReader::getAffectedModels(std::vector<std::string> *pAffectedModels)
50 for (std::map<std::string, std::vector<CModelData *> >::iterator itorModel =
51 m_modelDataList.begin();
52 itorModel != m_modelDataList.end(); ++itorModel)
54 pAffectedModels->push_back(itorModel->first);
60 SSMRESULT CDataReader::getModelDataCount(std::string modelName, int *pDataCount)
62 std::map<std::string, std::vector<CModelData *> >::iterator itor;
64 itor = m_modelDataList.find(modelName);
66 if (itor == m_modelDataList.end())
71 *pDataCount = itor->second.size();
76 SSMRESULT CDataReader::getModelData(std::string modelName, int dataIndex,
77 IModelData **ppModelData)
79 std::map<std::string, std::vector<CModelData *> >::iterator itor;
81 itor = m_modelDataList.find(modelName);
83 if (itor == m_modelDataList.end())
88 if (dataIndex > (int)itor->second.size() - 1)
93 *ppModelData = itor->second[dataIndex];