LRAUV  revA
NetCdfLogWriter Class Reference

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

#include <NetCdfLogWriter.h>

Inheritance diagram for NetCdfLogWriter:
Collaboration diagram for NetCdfLogWriter:

Public Member Functions

 NetCdfLogWriter (const Str &filename, bool version4, int varCount, char **varList, char **unitList, int attCount=0, char **attList=NULL)
 Constructor. More...
 
virtual ~NetCdfLogWriter ()
 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...
 
virtual const StrgetFilename ()
 
- 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

 NetCdfLogWriter (const NetCdfLogWriter &old)
 
void initializeNetCdfLogWriter ()
 Initialize variables, etc. More...
 
void addVar (const int index, const ElementURI *uri, BinaryDataType binaryType, const Unit &unit, short universalCode)
 Add a new variable. More...
 
void setAttValue (const DataEntry *dataEntry, const int attIndex)
 Set an attribute value. More...
 
void netCdfInitialize ()
 Initialize the NetCDF file. More...
 

Private Attributes

const Str filename_
 
NetCdfWriternetCdfWriter_
 
bool netCdfInitialized_
 
bool finalized_
 
NetCdf::NetCdfVar ** vars_
 
const ElementURI ** varUris_
 
NetCdf::NetCdfVar ** 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

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

Constructor.

Streamless Constructor.

References initializeNetCdfLogWriter(), timeVars_, FilterLogWriter::varCount_, vars_, and varUris_.

NetCdfLogWriter::~NetCdfLogWriter ( )
virtual

Destructor.

References finalized_, netCdfWriter_, timeVars_, vars_, varUris_, and writeFooter().

NetCdfLogWriter::NetCdfLogWriter ( const NetCdfLogWriter old)
private

Member Function Documentation

virtual const Str& NetCdfLogWriter::getFilename ( )
inlinevirtual

Implements HasFilename.

References filename_.

void NetCdfLogWriter::initializeNetCdfLogWriter ( )
private

Initialize variables, etc.

Referenced by NetCdfLogWriter().

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

Set an attribute value.

unsigned int NetCdfLogWriter::write ( const LogEntry entry,
const Unit unit = NULL 
)
virtual
unsigned int NetCdfLogWriter::writeAtt ( const DataEntry dataEntry,
int  index,
const Unit unit 
)
protectedvirtual

Reimplemented from FilterLogWriter.

References FilterLogWriter::varCount_, and writeData().

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

Start writing the NetCDF file.

Reimplemented from FilterLogWriter.

Member Data Documentation

const Str NetCdfLogWriter::filename_
private

Referenced by getFilename().

bool NetCdfLogWriter::finalized_
private

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

bool NetCdfLogWriter::netCdfInitialized_
private
NetCdfWriter* NetCdfLogWriter::netCdfWriter_
private
NetCdf::NetCdfVar** NetCdfLogWriter::timeVars_
private
const ElementURI** NetCdfLogWriter::varUris_
private

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