NSCL DDAS  1.0
Support for XIA DDAS at the NSCL
 All Classes Namespaces Files Functions Variables Macros Pages
Classes | Public Member Functions | List of all members
DDAS::XMLCrateWriter Class Reference

#include <XMLCrateWriter.h>

Inheritance diagram for DDAS::XMLCrateWriter:
DDAS::CrateWriter

Classes

struct  ModuleInformation
 

Public Member Functions

 XMLCrateWriter (std::string crateFile, const Crate &settings, const std::vector< ModuleInformation > &metadata)
 
virtual ~XMLCrateWriter ()
 
virtual void startCrate (int id, const std::vector< unsigned short > &slots)
 
virtual void endCrate (int id, const std::vector< unsigned short > &slots)
 
virtual SettingsWritergetWriter (unsigned short slotNum)
 
- Public Member Functions inherited from DDAS::CrateWriter
 CrateWriter (const Crate &settings)
 
virtual void write ()
 

Additional Inherited Members

- Protected Attributes inherited from DDAS::CrateWriter
Crate m_settings
 

Detailed Description

Writes a crate worth of settings via XML This requires a few things:

Slot number for the module (comes from the base class)

See the ModuleInformation struct in the class for that.

Constructor & Destructor Documentation

DDAS::XMLCrateWriter::XMLCrateWriter ( std::string  crateFile,
const Crate settings,
const std::vector< ModuleInformation > &  metadata 
)

constructor We just save the data for now.

Parameters
crateFile- Where we're going to write the crate file.
settings- Settings info (passed to the base class).
metadata- Per slot metadata for the <slot> tag.
DDAS::XMLCrateWriter::~XMLCrateWriter ( )
virtual

destructor Kill off the XMLPrinter if it's still alive.

Member Function Documentation

void DDAS::XMLCrateWriter::endCrate ( int  id,
const std::vector< unsigned short > &  slots 
)
virtual

endCrate Called when the entire crate has been writeen out.

  • Close the top level element.
  • Open the crate file.
  • Write the XML string from the printer.
  • delete the printer and set m_pPrinter -> nullptr. (this allows multiple writes).
    Parameters
    id- crate id.
    slots- slot map.

Implements DDAS::CrateWriter.

SettingsWriter * DDAS::XMLCrateWriter::getWriter ( unsigned short  slot)
virtual

getWriter Our responsibility from the point of view of the base class is to produce an XMLSettingsWriter for it to write the settings file for a single module. Additionally, we need to add a <slot> tag to the crate file. To do this we need to:

  • open the tag,
  • Write the slot attribute.
  • Figure out the id of the slot and look up the corresponding ModuleInformation record.
  • Use the module info record to write the remaining attributes.
  • Close the <slot> tag. We can use the filename in the ModuleSettings to create the settings writer which we pass back to the caller.
Parameters
slotNum- number of the slot to write.

Implements DDAS::CrateWriter.

void DDAS::XMLCrateWriter::startCrate ( int  id,
const std::vector< unsigned short > &  slots 
)
virtual

startCrate

  • Create the printer to print to strings.
  • Open the crate tag giving it the crate id. Notes:
  • Each slot tag is issued in GetWriter.
  • The XMLPrinter is opened in string mode.
  • On end crate, the crate file is opened and the XML string written to it.
    Parameters
    id- Id of the crate.
    slots(unused) slot map of the crate.

Implements DDAS::CrateWriter.


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