NLMISC::CAsyncFileManager::CMultipleFileLoad Class Reference

Inheritance diagram for NLMISC::CAsyncFileManager::CMultipleFileLoad:

NLMISC::IRunnable

Public Member Functions

 CMultipleFileLoad (const std::vector< std::string > &vFileNames, const std::vector< uint8 ** > &vPtrs)
void getName (std::string &result) const
void run (void)

Private Attributes

std::vector< std::string > _FileNames
std::vector< uint8 ** > _Ptrs

Constructor & Destructor Documentation

NLMISC::CAsyncFileManager::CMultipleFileLoad::CMultipleFileLoad const std::vector< std::string > &  vFileNames,
const std::vector< uint8 ** > &  vPtrs
 

Definition at line 241 of file async_file_manager.cpp.

References _Ptrs.

00243 {
00244         _FileNames = vFileNames;
00245         _Ptrs = vPtrs;
00246 }


Member Function Documentation

void NLMISC::CAsyncFileManager::CMultipleFileLoad::getName std::string &  result  )  const [virtual]
 

Reimplemented from NLMISC::IRunnable.

Definition at line 278 of file async_file_manager.cpp.

References uint.

00279 {
00280         result = "MultipleFileLoad (";
00281         uint i;
00282         for (i=0; i<_FileNames.size (); i++)
00283         {
00284                 if (i)
00285                         result += ", ";
00286                 result += _FileNames[i];
00287         }
00288         result += ")";
00289 }

void NLMISC::CAsyncFileManager::CMultipleFileLoad::run void   )  [virtual]
 

Implements NLMISC::IRunnable.

Definition at line 249 of file async_file_manager.cpp.

References _Ptrs, nlwarning, uint32, and uint8.

00250 {
00251         for (uint32 i = 0; i < _FileNames.size(); ++i)
00252         {
00253                 FILE *f = fopen (_FileNames[i].c_str(), "rb");
00254                 if (f != NULL)
00255                 {
00256                         uint8 *ptr;
00257                         long filesize=CFile::getFileSize (f);
00258                         //fseek (f, 0, SEEK_END);
00259                         //long filesize = ftell (f);
00260                         //nlSleep(5);
00261                         //fseek (f, 0, SEEK_SET);
00262                         ptr = new uint8[filesize];
00263                         fread (ptr, filesize, 1, f);
00264                         fclose (f);
00265 
00266                         *_Ptrs[i] = ptr;
00267                 }
00268                 else
00269                 {
00270                         nlwarning ("AFM: Couldn't load '%s'", _FileNames[i].c_str());
00271                         *_Ptrs[i] = (uint8*)-1;
00272                 }
00273         }
00274 
00275 }


Field Documentation

std::vector<std::string> NLMISC::CAsyncFileManager::CMultipleFileLoad::_FileNames [private]
 

Definition at line 101 of file async_file_manager.h.

std::vector<uint8**> NLMISC::CAsyncFileManager::CMultipleFileLoad::_Ptrs [private]
 

Definition at line 102 of file async_file_manager.h.

Referenced by CMultipleFileLoad(), and run().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:01:52 2004 for NeL by doxygen 1.3.6