NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Public Member Functions | Protected Attributes | List of all members
Converter Class Referenceabstract

Base class for all converter objects. More...

#include <Converter.h>

Inheritance diagram for Converter:
RootConverter RootConverter2

Public Member Functions

 Converter ()
 Default constructor. More...
 
virtual ~Converter ()
 Default destructor. More...
 
virtual void Initialize (std::string in_fname, std::string fileout)
 Open output root file and creates the tree structure. More...
 
virtual void DumpData (const CRingItem &item)=0
 Dump the data from ring into a object in a root file. More...
 
virtual void Close ()
 Close ROOT file. More...
 
TFile * GetFile ()
 Access the output file.
 
TTree * GetTree ()
 Access the output tree.
 

Protected Attributes

TFile * m_fileout
 
TTree * m_treeout
 

Detailed Description

Base class for all converter objects.

This is an abstract class and cannot be instantiated. It provides the interface that must be implemented by all derived classes. At the moment these are the RootConverter and RootConverter2 classes. The BufdumpMain class only deals with the interface defined here such that the use of different conversion objects in the ddasdumper program is transparent to the remainder of the program.

There is one pure virtual member, DumpData(const CRingItem&), that exists because there is no sensible default implementation.

This base class does not merely define an interface though, instead it provides some basic functionality that will promote consistency between output data of all concretely defined classes. The basic functionality defined by this class is the generation of the TFile that will be used to store the outputted data and also the TTree that contains the converted data. The actual structure of the TTree is not defined here and its definition is left as a responsibility derived classes.

Constructor & Destructor Documentation

Converter::Converter ( )
inline

Default constructor.

This initializes the pointers to both member pointers as null.

virtual Converter::~Converter ( )
inlinevirtual

Default destructor.

Calls the Close() method if the object's file pointer is not null. Because this object's tree pointer is owned by the the file it lives in, it is not deleted. Closing the file is enough to free the memory block associated with it. Note that any time this class closes the file, the file pointer is set to null.

Member Function Documentation

void Converter::Close ( )
virtual

Close ROOT file.

Closes the root file if it exists. When the file is closed, the pointer is reset to null.

virtual void Converter::DumpData ( const CRingItem &  item)
pure virtual

Dump the data from ring into a object in a root file.

Conversion method. This is a purely virtual method. All derived classes must implement this to support the conversion of the data stored in the CRingItem. This method is also where data is added to the TTree by means of the TTree::Fill() method. The user is presented with the full CRingItem, including its header. The structure of these can be found in in the file /path/to/nscldaq/version/./include/DataFormat.h

Parameters
itemis a reference to the data

Implemented in RootConverter2, and RootConverter.

void Converter::Initialize ( std::string  in_fname,
std::string  fileout 
)
virtual

Open output root file and creates the tree structure.

Creates and opens the root file in which the tree will be stored and creates the tree. There are no branches added to the tree. Adding the branches is left as a responsibility to the derived classes.

*** Derived classes MUST CALL THIS METHOD BEFORE ADDING TO THE TREE! ***

Parameters
in_fnamedoes not serve any functional purpose
fileoutname of the root file to create for output

Reimplemented in RootConverter2, and RootConverter.

Member Data Documentation

TFile* Converter::m_fileout
protected

pointer to output root file

TTree* Converter::m_treeout
protected

pointer to output tree


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