code::DataStreamManager Class Reference

Inheritance diagram for code::DataStreamManager:

code::DataDirectoryManager code::DataProvider List of all members.

Detailed Description

The DataStreamManager extends the DataDirectoryManager and allows it to manage data that arrives via a PIPE (such as standard input).

The DataStreamManager will process data stream form PIPE and then farm the data to any attached DataHandler objects that have been added via the addDataHandler method.

Author:
Lulin Song
Version:
Id
code_DataStreamManager.h,v 1.5 2009/06/02 20:17:39 lakshman Exp


Public Types

 FlatFile
 Gzipped
 Bzipped
enum  compressTypes { FlatFile, Gzipped, Bzipped }

Public Member Functions

 DataStreamManager (compressTypes t=FlatFile)
 Constructs an object that will provide access to streaming data via the readData() method.
virtual ~DataStreamManager ()
virtual int readData ()
 Reads data from the LDM and returns number of bytes read as a result of this call.
void setAcceptablePattern (const std::string &pattern_in)
 By setting a pattern, you can ask the accessor to avoid using the strict LDM raw file format ( e.g: 20020131220951.raw) and accept all files that start with this pattern.
void setMaxPendingFiles (int new_value)
 How many files can be pending a read? By default, this is INT_MAX in archive mode and 3 in real-time mode.
virtual void addDataHandler (SmartPtr< DataHandler > h)
virtual void addDataHandler (SmartPtr< DataHandler > h)
 Attach a handler for the data that is read.

Protected Types

typedef std::map< std::string,
SmartPtr< DataDirectoryManager > > 
SubDirs

Protected Member Functions

virtual int findFilesToRead (bool)
 Adds any subdirectories found to subdir; these will be processed on next readData().
virtual int readMoreDataFromFile (const std::string &fileName)
 returns number of bytes read from the file in this pass.
virtual int readAndRemoveFile (const std::string &fileName)
 returns number of bytes read from the file.
bool shouldReadFile (const std::string &fileName) const
virtual bool isFileComplete (const std::string &filename)
bool matchesPattern (const std::string &pattern, const std::string &fileName) const
 Does the file name match the pattern?
void addSubDir (const std::string &dirname, bool readall)
 Start to parse this subdirectory also.

Protected Attributes

compressTypes _ctype
std::string inputDir
bool shouldDeleteAfterRead
std::string pattern
int maxPendingFiles
bool searchSubdirsFlag
bool notStreamingData
std::set< std::string > filesToRead
std::string lastFinishedFile
SubDirs subdirs
std::map< std::string, size_t > file_size
std::string lastStartedFile
SmartPtr< ProgressiveReaderreader
SmartPtr< ConventionTest > conventionTest
Buffer dataBuf
std::vector< SmartPtr< DataHandler > > dataHandlers


Member Typedef Documentation

typedef std::map< std::string, SmartPtr<DataDirectoryManager> > code::DataDirectoryManager::SubDirs [protected, inherited]


Member Enumeration Documentation

enum code::DataStreamManager::compressTypes

Enumerator:
FlatFile 
Gzipped 
Bzipped 


Constructor & Destructor Documentation

code::DataStreamManager::DataStreamManager ( compressTypes  t = FlatFile  ) 

Constructs an object that will provide access to streaming data via the readData() method.

virtual code::DataStreamManager::~DataStreamManager (  )  [inline, virtual]


Member Function Documentation

virtual void code::DataProvider::addDataHandler ( SmartPtr< DataHandler h  )  [inline, virtual, inherited]

Attach a handler for the data that is read.

virtual void code::DataDirectoryManager::addDataHandler ( SmartPtr< DataHandler >  h  )  [virtual, inherited]

void code::DataDirectoryManager::addSubDir ( const std::string &  dirname,
bool  readall 
) [protected, inherited]

Start to parse this subdirectory also.

dirname is relative to this directory.

virtual int code::DataStreamManager::findFilesToRead ( bool   )  [protected, virtual]

Adds any subdirectories found to subdir; these will be processed on next readData().

Reimplemented from code::DataDirectoryManager.

virtual bool code::DataDirectoryManager::isFileComplete ( const std::string &  filename  )  [protected, virtual, inherited]

bool code::DataDirectoryManager::matchesPattern ( const std::string &  pattern,
const std::string &  fileName 
) const [protected, inherited]

Does the file name match the pattern?

virtual int code::DataDirectoryManager::readAndRemoveFile ( const std::string &  fileName  )  [protected, virtual, inherited]

returns number of bytes read from the file.

virtual int code::DataStreamManager::readData (  )  [virtual]

Reads data from the LDM and returns number of bytes read as a result of this call.

Typically, you will keep calling readData() indefinitely in real-time, and until it returns zero for archive.

Reimplemented from code::DataDirectoryManager.

virtual int code::DataDirectoryManager::readMoreDataFromFile ( const std::string &  fileName  )  [protected, virtual, inherited]

returns number of bytes read from the file in this pass.

void code::DataDirectoryManager::setAcceptablePattern ( const std::string &  pattern_in  )  [inherited]

By setting a pattern, you can ask the accessor to avoid using the strict LDM raw file format ( e.g: 20020131220951.raw) and accept all files that start with this pattern.

void code::DataDirectoryManager::setMaxPendingFiles ( int  new_value  )  [inherited]

How many files can be pending a read? By default, this is INT_MAX in archive mode and 3 in real-time mode.

It has to be a number greater than 1 i.e. at least one file should be allowed to be pending.

bool code::DataDirectoryManager::shouldReadFile ( const std::string &  fileName  )  const [protected, inherited]


Member Data Documentation

compressTypes code::DataStreamManager::_ctype [protected]

SmartPtr<ConventionTest> code::DataDirectoryManager::conventionTest [protected, inherited]

Buffer code::DataDirectoryManager::dataBuf [protected, inherited]

std::vector< SmartPtr<DataHandler> > code::DataProvider::dataHandlers [protected, inherited]

std::map<std::string, size_t> code::DataDirectoryManager::file_size [protected, inherited]

std::set< std::string > code::DataDirectoryManager::filesToRead [protected, inherited]

std::string code::DataDirectoryManager::inputDir [protected, inherited]

std::string code::DataDirectoryManager::lastFinishedFile [protected, inherited]

std::string code::DataDirectoryManager::lastStartedFile [protected, inherited]

int code::DataDirectoryManager::maxPendingFiles [protected, inherited]

bool code::DataDirectoryManager::notStreamingData [protected, inherited]

std::string code::DataDirectoryManager::pattern [protected, inherited]

SmartPtr<ProgressiveReader> code::DataDirectoryManager::reader [protected, inherited]

bool code::DataDirectoryManager::searchSubdirsFlag [protected, inherited]

bool code::DataDirectoryManager::shouldDeleteAfterRead [protected, inherited]

SubDirs code::DataDirectoryManager::subdirs [protected, inherited]


Generated on Fri May 4 13:40:12 2012 for WDSS-IIw2 by  doxygen 1.4.7