Obtain an IOBuffer to read/write the given fileName.
The function checks whether the data server should be used. The user has some control over the type of buffer returned via the other parameters: useMemoryIfLocal determines whether the buffer should be memory or file based in case there is no data server. In case there is a data server, useLocalFileIfRemote determines whether the buffer should be file based or memory based. In the latter case, useLocalSizeIfRemote determines the (fixed) size of the buffer.
The SAFE way to use this function is. For a read mode buffer: GetIOBuffer(fileName, true, false, ""); For a write mode buffer: GetIOBuffer(fileName, false, false, "tmp");
The BEST way to use this function is. Read mode buffer: GetIOBuffer(fileName, true, false, "", 0, true); Write mode buffer: GetIOBuffer(fileName, false, false, "tmp", 0, true);
Definition at line 184 of file Database.h.
References Impala::FileNameTmp(), ILOG_DEBUG, mDataChannel, mDataServer, Impala::Util::ReadIOBufferFromChannel(), Impala::Util::IOBuffer::SetUseChannel(), and Impala::Util::IOBuffer::Valid().
Referenced by Impala::Application::CheckParameteres(), Impala::Core::Geometry::DatabaseReadIxRectangle(), Impala::Util::DatabaseReadString(), Impala::Core::Geometry::DatabaseReadVxRectangle(), Impala::Util::DatabaseWriteNative(), Impala::Util::DatabaseWriteString(), Impala::Application::Util::DoDumpParameter(), Impala::Core::ImageSet::ImageSet::GetImageData(), Impala::Core::Stream::RgbDataSrcInfo::GetInfoIOBuffer(), Impala::Core::ImageSet::InterestPointProc::HandleDoneDir(), Impala::Core::VideoSet::InterestPointProc::HandleDoneFile(), Impala::Core::ImageSet::Archive::HandleNewFile(), Impala::Core::ImageSet::ImageSetRepository::ImageSetRepository(), Impala::Core::Database::RawDataSet::Init(), Impala::Core::Array::ImageArchiveFile::Init(), Impala::Core::Feature::LabelSet::Load(), Impala::Application::LoadAverages(), Impala::Core::Training::ApplyConceptsHelperKernels::LoadFeatures(), Impala::Core::Training::ApplyConceptsHelperKernels::LoadInfoFile(), Impala::Core::Training::Svm::LoadModel(), Impala::Core::Training::Fisher::LoadModel(), main(), Impala::Core::DataFactory::MakeAllParametersFile(), Impala::Core::DataFactory::MakeBestFile(), Impala::Core::DataFactory::MakeBestFileWrite(), Impala::Core::Feature::ConceptSet::MakeFromFile(), Impala::Core::VideoSet::Mpeg7Doc::Mpeg7Doc(), Impala::Core::VideoSet::Mpeg7DocWrite(), Impala::Application::OpenFeatureTable(), Impala::Core::VideoJob::Manager::Prepare(), Impala::Core::Feature::InterestPointFeature::ProjectOntoCodebook(), Impala::Core::Table::Read(), Impala::Core::Column::Read(), Impala::Core::VideoSet::Mpeg7DocAudio::ReadData(), Impala::Core::Trec::Collection::ReadData(), Impala::Core::Matrix::DistributedAccess::ReadInfoFile(), Impala::Core::Array::ReadJpg(), Impala::Core::Array::ReadPgm(), Impala::Core::Feature::FeatureTable::ReadPlainAsciiFile(), Impala::Core::Array::ReadPng(), Impala::Core::Array::ReadRaw(), Impala::Core::Array::ReadRawArrayType(), Impala::Core::Array::ReadRawList(), Impala::Core::Array::ReadRawListVar(), Impala::Core::Array::ReadRawListVarIndex(), Impala::Core::Trec::TrecTopic::ReadTopics(), Impala::Core::Feature::LabelSet::Save(), Impala::Core::Database::RawDataSet::Save(), Impala::Core::Training::Fisher::SaveModel(), Impala::Core::Feature::InterestPointFeature::SetCodebook(), Impala::Samples::ActiveLearnEngineQuids::SubmitRequest(), Impala::Samples::ActiveLearnEngine::SubmitRequest(), Impala::Application::DataTransfer::TransferServerToLocal(), Impala::Core::VideoJob::Manager::UpdateMaskFile(), Impala::Core::VideoJob::Manager::UpdateVideoSet(), Impala::Core::VideoSet::VideoSetRepository::VideoSetRepository(), Impala::Core::Table::Write(), Impala::Core::Column::Write(), Impala::Application::WriteAverages(), Impala::Core::DataFactory::WriteCodebook(), Impala::Application::WriteInfoFile(), Impala::Core::Array::WriteJpg(), Impala::Core::Feature::FeatureTable::WritePlainAsciiFile(), Impala::Core::Array::WritePng(), Impala::Core::DataFactory::WriteRandomForest(), Impala::Core::Array::WriteRaw(), Impala::Core::Array::WriteRawList(), Impala::Core::Array::WriteRawListVar(), Impala::Core::DataFactory::WriteScoreOnSelf(), Impala::Core::Feature::FeatureTable::WriteSvmFile(), and Impala::Core::VideoJob::Manager::WriteVideoSet().
00187 {
00188 IOBuffer* res = 0;
00189 ILOG_DEBUG("GetIOBuffer [" << fileName << "]");
00190 if (mDataChannel)
00191 {
00192 if (readMode)
00193 {
00194 if (useIOBufferChannel)
00195 {
00196 ILOG_DEBUG("GetIOBuffer: Read using Channel to " <<
00197 mDataServer << ": " << fileName);
00198 res = new IOBufferChannel(fileName, true, mDataChannel);
00199 }
00200 else
00201 {
00202 ILOG_DEBUG("GetIOBuffer: Read using File: " << fileName);
00203
00204
00205
00206
00207 if (useLocalFileIfRemote == "tmp")
00208 useLocalFileIfRemote = FileNameTmp();
00209 res = ReadIOBufferFromChannel(mDataChannel, fileName,
00210 useLocalFileIfRemote);
00211 }
00212 }
00213 else
00214 {
00215 if (useIOBufferChannel)
00216 {
00217 ILOG_DEBUG("GetIOBuffer: Write using Channel " << fileName);
00218 res = new IOBufferChannel(fileName, false, mDataChannel);
00219 }
00220 else if (useLocalFileIfRemote.empty())
00221 {
00222 ILOG_DEBUG("GetIOBuffer: Write using mem " << fileName);
00223 res = new IOBuffer(useLocalSizeIfRemote);
00224 }
00225 else
00226 {
00227 ILOG_DEBUG("GetIOBuffer: Write using File " << fileName);
00228 if (useLocalFileIfRemote == "tmp")
00229 useLocalFileIfRemote = FileNameTmp();
00230 res = new IOBufferFile(useLocalFileIfRemote, false, false);
00231 }
00232 if (!useIOBufferChannel)
00233 res->SetUseChannel(mDataChannel, fileName,
00234 useLocalFileIfRemote);
00235 }
00236 }
00237 else
00238 {
00239 res = new IOBufferFile(fileName, readMode, useMemoryIfLocal);
00240 }
00241
00242 if (res)
00243 {
00244 if (!res->Valid())
00245 {
00246 delete res;
00247 res = 0;
00248 }
00249 }
00250 return res;
00251 }
Here is the call graph for this function: