|
MASA-Core
|
00001 /******************************************************************************* 00002 * 00003 * Copyright (c) 2010-2015 Edans Sandes 00004 * 00005 * This file is part of MASA-Core. 00006 * 00007 * MASA-Core is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * MASA-Core is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with MASA-Core. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 ******************************************************************************/ 00021 00022 #include "DummyCellsReader.hpp" 00023 00024 #include <string.h> 00025 00026 DummyCellsReader::DummyCellsReader(int size) { 00027 if (size <= 0) { 00028 this->size = 0x7FFFFFFF; 00029 } else { 00030 this->size = size; 00031 } 00032 this->position = 0; 00033 } 00034 00035 DummyCellsReader::~DummyCellsReader() { 00036 // Does Nothing 00037 } 00038 00039 void DummyCellsReader::close() { 00040 // Does Nothing 00041 } 00042 00043 int DummyCellsReader::getType() { 00044 return INIT_WITH_CUSTOM_DATA; 00045 } 00046 00047 int DummyCellsReader::read(cell_t* buf, int len) { 00048 if (len > size-position) { 00049 len = size-position; 00050 } 00051 memset(buf, 0, sizeof(cell_t)*len); 00052 this->position += len; 00053 return len; 00054 } 00055 00056 void DummyCellsReader::seek(int position) { 00057 this->position = position; 00058 } 00059 00060 int DummyCellsReader::getOffset() { 00061 return position; 00062 }
1.7.6.1