LRAUV  revA
HDF5LogWriter Class Reference

Defines a LogWriter that generates a NetCDF table of values. More...

#include <HDF5LogWriter.h>

Inheritance diagram for HDF5LogWriter:
Collaboration diagram for HDF5LogWriter:

Public Member Functions

 HDF5LogWriter (const Str &filename, bool version4, int varCount, char **varList, char **unitList, int attCount=0, char **attList=NULL)
 Constructor. More...
 
virtual ~HDF5LogWriter ()
 Destructor. More...
 
unsigned int writeHeader ()
 Start writing the NetCDF file. More...
 
unsigned int write (const LogEntry *entry, const Unit *unit=NULL)
 Write an entry to the buffer. More...
 
unsigned int writeFooter ()
 Finish writing the NetCDF file. More...
 
const StrgetFilename ()
 Return the filename. More...
 
- Public Member Functions inherited from FilterLogWriter
 FilterLogWriter (LogWriter *outputTo, int varCount, char **varList, char **unitList, bool passCycleStarts, int attCount=0, char **attList=NULL)
 Constructor. More...
 
virtual ~FilterLogWriter ()
 Destructor. More...
 
virtual void endCycle ()
 Do what needs to be done at the end of the cycle. More...
 
virtual void config (Logger &logger)
 Configure from a config file. More...
 
- Public Member Functions inherited from LogWriter
virtual ~LogWriter ()
 Destructor. More...
 
virtual void setOutStream (OutStream &outStream)
 Sets the OutStream. More...
 
virtual bool isValid ()
 Return true if logStream_ is available. More...
 
void addParent ()
 
void removeParent ()
 
int getParentCount ()
 
virtual void activate ()
 
virtual void deactivate ()
 
virtual bool isActive ()
 
virtual void lockWrites ()
 
virtual void unlockWrites ()
 
- Public Member Functions inherited from HasFilename
virtual ~HasFilename ()
 

Protected Member Functions

virtual unsigned int writeData (const DataEntry *dataEntry, int index, const Unit *unit)
 
virtual unsigned int writeAtt (const DataEntry *dataEntry, int index, const Unit *unit)
 
- Protected Member Functions inherited from FilterLogWriter
virtual void resetInputs ()
 Reset cached input settings. More...
 
void initializeFilterLogWriter ()
 
virtual unsigned int writeCycleStart (const EventEntry *eventEntry)
 
- Protected Member Functions inherited from LogWriter
 LogWriter ()
 Protected constructor for pure virtual class. More...
 
 LogWriter (OutStream &outStream)
 Protected constructor for pure virtual class. More...
 
- Protected Member Functions inherited from HasFilename
 HasFilename ()
 

Private Member Functions

 HDF5LogWriter (const HDF5LogWriter &old)
 
void initializeHDF5LogWriter ()
 Initialize variables, etc. More...
 
void addVar (const int index, const ElementURI *uri, BinaryDataType binaryType, const Unit &unit, short universalCode, bool useChunks)
 Add a new variable. More...
 
void setAttValue (const DataEntry *dataEntry, const int attIndex)
 Set an attribute value. More...
 

Private Attributes

const Str filename_
 
HDF5Filehdf5File_
 
bool hdf5LogWriterInitialized_
 
bool finalized_
 
HDF5Dataset ** vars_
 
HDF5Dataset ** timeVars_
 

Additional Inherited Members

- Public Types inherited from LogWriter
enum  ServiceType {
  NO_SERVICE = -1, SERVICE_COURIER, SERVICE_EXPRESS, SERVICE_PRIORITY,
  SERVICE_NORMAL, SERVICE_BULK, SERVICE_COUNT, SERVICE_MULTI
}
 
- Static Public Member Functions inherited from LogWriter
static ServiceType Str2ServiceType (const char *const serviceTypeStr, int len=-1)
 
static const char * ServiceType2Str (LogWriter::ServiceType serviceType)
 
static size_t ServiceType2Strlen (LogWriter::ServiceType serviceType)
 
- Static Public Attributes inherited from LogWriter
static const char *const SERVICE_TYPE_STRS [SERVICE_COUNT]
 
static size_t const SERVICE_TYPE_STRLEN [SERVICE_COUNT]
 
- Protected Attributes inherited from FilterLogWriter
LogWriteroutputTo_
 
int varCount_
 
char ** varList_
 
char ** unitList_
 
const Unit ** units_
 
bool passCycleStarts_
 
int attCount_
 
char ** attList_
 
unsigned short * uriCodes_
 
int * codeLookup_
 
unsigned short * attUriCodes_
 
int * attCodeLookup_
 
bool * isUniversal_
 
Timestamp lastTime_
 
bool initializedFilterLogWriter_
 
unsigned int slateElementURICount_
 
- Protected Attributes inherited from LogWriter
OutStreamlogStream_
 Stores an OutStream. More...
 
bool wroteHeader_
 
bool wroteFooter_
 
Mutex writeMutex_
 
int parentCount_
 
bool active_
 

Detailed Description

Defines a LogWriter that generates a NetCDF table of values.

A list of variable names is supplied to the constructor. If any of these variables change their value in a computation cycle, then a record is added to the NetCDF file with the current value of every variable. The Timestamp for each record corresponds to the time of the start of the computation cycle in which any value changed.

Constructor & Destructor Documentation

HDF5LogWriter::HDF5LogWriter ( const Str filename,
bool  version4,
int  varCount,
char **  varList,
char **  unitList,
int  attCount = 0,
char **  attList = NULL 
)

Constructor.

Streamless Constructor.

References FilterLogWriter::attCount_, timeVars_, FilterLogWriter::varCount_, and vars_.

HDF5LogWriter::~HDF5LogWriter ( )
virtual

Destructor.

References finalized_, hdf5File_, timeVars_, vars_, and writeFooter().

HDF5LogWriter::HDF5LogWriter ( const HDF5LogWriter old)
private

Member Function Documentation

const Str& HDF5LogWriter::getFilename ( )
inlinevirtual

Return the filename.

Implements HasFilename.

References filename_.

void HDF5LogWriter::setAttValue ( const DataEntry dataEntry,
const int  attIndex 
)
private

Set an attribute value.

unsigned int HDF5LogWriter::write ( const LogEntry entry,
const Unit unit = NULL 
)
virtual

Write an entry to the buffer.

If a start of cycle is encountered, write the whole record to the NetCDF file.

Reimplemented from FilterLogWriter.

References Slate::GetElementURICount(), hdf5LogWriterInitialized_, FilterLogWriter::initializedFilterLogWriter_, FilterLogWriter::initializeFilterLogWriter(), FilterLogWriter::slateElementURICount_, FilterLogWriter::write(), and writeHeader().

unsigned int HDF5LogWriter::writeAtt ( const DataEntry dataEntry,
int  index,
const Unit unit 
)
protectedvirtual

Reimplemented from FilterLogWriter.

References FilterLogWriter::varCount_, and writeData().

unsigned int HDF5LogWriter::writeData ( const DataEntry dataEntry,
int  index,
const Unit unit 
)
protectedvirtual
unsigned int HDF5LogWriter::writeHeader ( )
virtual

Start writing the NetCDF file.

Reimplemented from FilterLogWriter.

References hdf5File_, hdf5LogWriterInitialized_, initializeHDF5LogWriter(), and HDF5Group::writeHeader().

Referenced by write().

Member Data Documentation

const Str HDF5LogWriter::filename_
private

Referenced by getFilename().

bool HDF5LogWriter::finalized_
private

Referenced by writeFooter(), and ~HDF5LogWriter().

HDF5File* HDF5LogWriter::hdf5File_
private
bool HDF5LogWriter::hdf5LogWriterInitialized_
private
HDF5Dataset** HDF5LogWriter::timeVars_
private

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