ICP  1
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SplitFile Class Reference

#include <SplitFile.h>

Inheritance diagram for SplitFile:
Inheritance graph

Public Member Functions

 SplitFile ()
 
int open (const std::string &path, IFile::Mode mode, int shflag)
 
int open (const std::string &path, Mode mode, int shflag, bool toggle_readonly)
 
size_t write (const void *data, size_t element_size, size_t nelement)
 
size_t read (void *data, size_t element_size, size_t nelement)
 
int close ()
 
int seek (int64_t offset, int whence)
 
int tell (int64_t &offset)
 
int discardContents ()
 
bool isOpen () const
 
int flush ()
 
 ~SplitFile ()
 

Static Public Member Functions

static void removeFile (const std::string &path)
 

Private Member Functions

 SplitFile (const SplitFile &)
 
void operator= (const SplitFile &)
 
int open ()
 
std::string fileNamefromCount (size_t count) const
 
std::string getFileName () const
 
void nextFile ()
 
size_t countFromOffset (int64_t offset) const
 
void findFiles (std::set< std::string > &files) const
 
std::string openMode (const std::string &path) const
 determine flags to use for fopen/fsopen More...
 

Static Private Member Functions

static void findFiles (const Poco::Path &path, std::set< std::string > &files)
 

Private Attributes

FILE * m_file
 
size_t m_count
 
size_t m_current_bytes
 
int m_shflag
 
int m_mode
 
Poco::Path m_top_directory
 
bool m_toggle_readonly
 

Static Private Attributes

static const size_t m_bytes_per_file = 512*1024
 
static const size_t m_files_per_sub_dir = 1000
 

Additional Inherited Members

- Public Types inherited from IFile
enum  Mode { ReadOnly, ReadWriteCreate }
 
- Protected Member Functions inherited from ISIS::Base
 Base (const std::string &logger_name="UNKNOWN")
 
void setLoggerName (const std::string &logger_name)
 
virtual ~Base ()
 
virtual std::string loggingPrefix () const
 
void setThisLoggerLevel (int level)
 
- Static Protected Member Functions inherited from ISIS::Base
static void setAllLoggerLevel (int level)
 
- Protected Attributes inherited from ISIS::Base
Poco::Logger * m_logger
 
Poco::LogStream * m_logstr
 
Poco::Mutex m_logger_lock
 

Detailed Description

Definition at line 6 of file SplitFile.h.

Constructor & Destructor Documentation

SplitFile::SplitFile ( const SplitFile )
inlineprivate

Definition at line 19 of file SplitFile.h.

SplitFile::SplitFile ( )

Definition at line 8 of file SplitFile.cpp.

References ISIS::Base::setLoggerName().

SplitFile::~SplitFile ( )

Definition at line 13 of file SplitFile.cpp.

References close().

Member Function Documentation

int SplitFile::close ( )
virtual
size_t SplitFile::countFromOffset ( int64_t  offset) const
private

Definition at line 250 of file SplitFile.cpp.

References m_bytes_per_file.

Referenced by seek().

int SplitFile::discardContents ( )
virtual

Implements IFile.

Definition at line 188 of file SplitFile.cpp.

References findFiles(), getFileName(), m_file, and RetryWIN32APIBOOL().

Referenced by EventStoreCard::clearOutputFile().

std::string SplitFile::fileNamefromCount ( size_t  count) const
private

Definition at line 260 of file SplitFile.cpp.

References m_files_per_sub_dir, and m_top_directory.

Referenced by getFileName().

void SplitFile::findFiles ( std::set< std::string > &  files) const
private

Definition at line 267 of file SplitFile.cpp.

References m_top_directory.

Referenced by discardContents(), and removeFile().

void SplitFile::findFiles ( const Poco::Path &  path,
std::set< std::string > &  files 
)
staticprivate

Definition at line 272 of file SplitFile.cpp.

int SplitFile::flush ( )
virtual

Implements IFile.

Definition at line 238 of file SplitFile.cpp.

References m_file.

Referenced by close(), and EventStoreCard::flushEvents().

std::string SplitFile::getFileName ( ) const
private

Definition at line 255 of file SplitFile.cpp.

References fileNamefromCount(), and m_count.

Referenced by close(), discardContents(), and open().

bool SplitFile::isOpen ( ) const
virtual
void SplitFile::nextFile ( )
private

Definition at line 122 of file SplitFile.cpp.

References close(), m_count, and open().

Referenced by read(), and write().

int SplitFile::open ( const std::string &  path,
IFile::Mode  mode,
int  shflag 
)
inlinevirtual

Implements IFile.

Definition at line 24 of file SplitFile.h.

References open().

Referenced by FileEventSource::FileEventSource(), and EventStoreCard::setOutputFileName().

int SplitFile::open ( const std::string &  path,
Mode  mode,
int  shflag,
bool  toggle_readonly 
)

Definition at line 18 of file SplitFile.cpp.

References m_count, m_mode, m_shflag, m_toggle_readonly, m_top_directory, and open().

int SplitFile::open ( )
private
std::string SplitFile::openMode ( const std::string &  path) const
private

determine flags to use for fopen/fsopen

Definition at line 282 of file SplitFile.cpp.

References m_mode, IFile::ReadOnly, and IFile::ReadWriteCreate.

Referenced by open().

void SplitFile::operator= ( const SplitFile )
inlineprivate

Definition at line 20 of file SplitFile.h.

References m_file.

size_t SplitFile::read ( void *  data,
size_t  element_size,
size_t  nelement 
)
virtual

Implements IFile.

Definition at line 85 of file SplitFile.cpp.

References m_bytes_per_file, m_current_bytes, m_file, and nextFile().

Referenced by FileEventSource::getNewEvents().

void SplitFile::removeFile ( const std::string &  path)
static

Definition at line 212 of file SplitFile.cpp.

References findFiles(), and RetryWIN32APIBOOL().

Referenced by EventStore::deleteOutputFile(), and EventStore::setOutputFileName().

int SplitFile::seek ( int64_t  offset,
int  whence 
)
virtual
int SplitFile::tell ( int64_t &  offset)

Definition at line 178 of file SplitFile.cpp.

References m_bytes_per_file, m_count, m_current_bytes, and m_file.

size_t SplitFile::write ( const void *  data,
size_t  element_size,
size_t  nelement 
)
virtual

Implements IFile.

Definition at line 56 of file SplitFile.cpp.

References m_bytes_per_file, m_current_bytes, m_file, and nextFile().

Referenced by EventStoreCard::flushEvents().

Member Data Documentation

const size_t SplitFile::m_bytes_per_file = 512*1024
staticprivate

Definition at line 12 of file SplitFile.h.

Referenced by countFromOffset(), read(), seek(), tell(), and write().

size_t SplitFile::m_count
private

Definition at line 10 of file SplitFile.h.

Referenced by getFileName(), nextFile(), open(), seek(), and tell().

size_t SplitFile::m_current_bytes
private

Definition at line 11 of file SplitFile.h.

Referenced by open(), read(), seek(), tell(), and write().

FILE* SplitFile::m_file
private

Definition at line 9 of file SplitFile.h.

Referenced by close(), discardContents(), flush(), isOpen(), open(), operator=(), read(), seek(), tell(), and write().

const size_t SplitFile::m_files_per_sub_dir = 1000
staticprivate

Definition at line 13 of file SplitFile.h.

Referenced by fileNamefromCount().

int SplitFile::m_mode
private

Definition at line 16 of file SplitFile.h.

Referenced by open(), and openMode().

int SplitFile::m_shflag
private

Definition at line 15 of file SplitFile.h.

Referenced by open().

bool SplitFile::m_toggle_readonly
private

Definition at line 18 of file SplitFile.h.

Referenced by close(), and open().

Poco::Path SplitFile::m_top_directory
private

Definition at line 17 of file SplitFile.h.

Referenced by fileNamefromCount(), findFiles(), and open().


The documentation for this class was generated from the following files: