| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# HbookCnv::PersSvc Class Reference

`#include <PersSvc.h>`

Inheritance diagram for HbookCnv::PersSvc:

[legend]
Collaboration diagram for HbookCnv::PersSvc:

[legend]
List of all members.

## Detailed Description

Definition at line 27 of file PersSvc.h.

## Public Member Functions
virtual StatusCode | initialize ()
| Initialise the service.
virtual StatusCode | finalize ()
| Finalise the service.
virtual StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddr)
| Convert a transient data object into its persistent representation.
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddr, DataObject *pObject)
| Update references of the persistent data representation.
| PersSvc (const std::string &name, ISvcLocator *svc)
| Standard constructor.
virtual | ~PersSvc ()
| Standard destructor.
## Private Attributes
std::string | m_persistencySvc
std::string | m_defFileName
std::string | m_rowWisePolicy
int | m_NPAWC
int | m_NREC
int | m_RECL
bool | m_histDo
| Flag to switch on printing of histograms to standard output.
## Friends
class | SvcFactory< PersSvc >

## Constructor & Destructor Documentation

HbookCnv::PersSvc::PersSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc |
| ) |  |  |

Standard constructor.

Definition at line 135 of file PersSvc.cpp.

References Service::declareProperty(), m_defFileName, m_histDo, m_NPAWC, m_NREC, m_persistencySvc, m_RECL, m_rowWisePolicy, and undefFileName.

    00136 : ConversionSvc(name, svc, HBOOK_StorageType)
    00137 {
    00138
    00139   declareProperty("OutputFile", m_defFileName = undefFileName);
    00140   declareProperty("PersistencySvc", m_persistencySvc = "HistogramPersistencySvc");
    00141   declareProperty("RowWiseNtuplePolicy", m_rowWisePolicy = "FLOAT_ONLY");
    00142   declareProperty("PrintHistos", m_histDo = false );
    00143   declareProperty("NPAWC",m_NPAWC = 250000);  // size of PAWC common block
    00144   declareProperty("IQUEST10",m_NREC = -1);    // IQUEST(10)
    00145   declareProperty("RecordLength",m_RECL = 1024);  // Record length in HROPEN
    00146 }

HbookCnv::PersSvc::~PersSvc | ( |  | ) | `[virtual]`

Standard destructor.

Definition at line 149 of file PersSvc.cpp.

    00149                                                                           {
    00150 }

## Member Function Documentation

StatusCode HbookCnv::PersSvc::initialize | ( |  | ) | `[virtual]`

Initialise the service.

Reimplemented from ConversionSvc.

Definition at line 41 of file PersSvc.cpp.

References endreq(), FLOAT_ONLY, FORTRAN_STYLE, HUNGARIAN_STYLE, MSG::INFO, INIT_HBOOK(), ConversionSvc::initialize(), StatusCode::isSuccess(), m_defFileName, m_NPAWC, m_NREC, m_RECL, m_rowWisePolicy, Service::messageService(), Service::name(), s_dataTypePolicy, std::basic_string< _CharT, _Traits, _Alloc >::size(), stat_dir, std::basic_string< _CharT, _Traits, _Alloc >::substr(), toupper(), undefFileName, USE_DATA_TYPES, and MSG::WARNING.

    00041                                            {
    00042   StatusCode status = ConversionSvc::initialize();
    00043   if ( status.isSuccess() ) {
    00044     MsgStream log( messageService(), name() );
    00045
    00046     // Report on size properties
    00047     log << MSG::INFO << "Setting /PAWC/ common block size to "
    00048         << m_NPAWC << endreq;
    00049     if (m_NREC > 0) {
    00050         log << MSG::INFO << "Setting IQUEST(10) to " << m_NREC << endreq;
    00051     }
    00052
    00053     if (m_RECL != 1024) {
    00054         log << MSG::INFO << "Setting Record Length to " << m_RECL << endreq;
    00055     }
    00056
    00057     // Return an error if output file has not been specified
    00058     if( undefFileName == m_defFileName ) {
    00059       log << MSG::WARNING << "HBOOK output file name missing!!" << endreq;
    00060       INIT_HBOOK( m_NPAWC );
    00061     }
    00062     else {
    00063       INIT_HBOOK( stat_dir.substr(1,stat_dir.size()), m_defFileName,
    00064                   m_NPAWC, m_NREC, m_RECL );
    00065     }
    00066
    00067     if ( ::toupper(m_rowWisePolicy[0]) == 'U' )   {
    00068       s_dataTypePolicy = USE_DATA_TYPES;
    00069     }
    00070     else if ( ::toupper(m_rowWisePolicy[0]) == 'F' )   {
    00071       if ( ::toupper(m_rowWisePolicy[1]) == 'O' )   {
    00072         s_dataTypePolicy = FORTRAN_STYLE;
    00073       }
    00074       else    {
    00075         s_dataTypePolicy = FLOAT_ONLY;
    00076       }
    00077     }
    00078     else if ( ::toupper(m_rowWisePolicy[0]) == 'H' )   {
    00079       s_dataTypePolicy = HUNGARIAN_STYLE;
    00080     }
    00081   }
    00082   return status;
    00083 }

StatusCode HbookCnv::PersSvc::finalize | ( |  | ) | `[virtual]`

Finalise the service.

Reimplemented from ConversionSvc.

Definition at line 86 of file PersSvc.cpp.

References CLOSE_HBOOK(), ConversionSvc::finalize(), m_defFileName, std::basic_string< _CharT, _Traits, _Alloc >::size(), stat_dir, std::basic_string< _CharT, _Traits, _Alloc >::substr(), and undefFileName.

    00086                                        {
    00087   // Close HBOOK only if the HBOOK output file name is defined
    00088   if( undefFileName != m_defFileName ) {
    00089     CLOSE_HBOOK( stat_dir.substr(1,stat_dir.size()), m_defFileName );
    00090   }
    00091   return ConversionSvc::finalize();
    00092 }

StatusCode HbookCnv::PersSvc::createRep | ( | DataObject * | pObject,
|  | IOpaqueAddress *& | refpAddr |
| ) |  |  | `[virtual]`

Convert a transient data object into its persistent representation.

Reimplemented from ConversionSvc.

Definition at line 95 of file PersSvc.cpp.

References ConversionSvc::createRep(), IID_IProperty, StatusCode::isSuccess(), m_defFileName, m_histDo, Service::msgSvc(), IInterface::queryInterface(), StatusCode::SUCCESS, and undefFileName.

    00096                                                                      {
    00097
    00098   StatusCode sc = StatusCode::SUCCESS;
    00099
    00100   // Convert histograms only if HBOOK output file name is defined
    00101   if( undefFileName != m_defFileName ) { // Valid HBOOK output file name
    00102
    00103     // Manipulate global output level to switch on/off histogram printing
    00104     IProperty* msgProp;
    00105     msgSvc()->queryInterface( IID_IProperty, (void**)&msgProp );
    00106     std::string dfltLevel;
    00107     StatusCode scl = msgProp->getProperty( "OutputLevel", dfltLevel );
    00108     if ( m_histDo && scl.isSuccess() ) {
    00109       msgProp->setProperty( "OutputLevel", "3" );
    00110     }
    00111     else {
    00112       msgProp->setProperty( "OutputLevel", "4" );
    00113     }
    00114
    00115     //Save the histograms
    00116     sc = ConversionSvc::createRep(pObject, refpAddr);
    00117
    00118     // Reset the global output level to its previous value
    00119     if( scl.isSuccess() ) msgProp->setProperty( "OutputLevel", dfltLevel );
    00120
    00121   }
    00122   return sc;
    00123 }

StatusCode HbookCnv::PersSvc::fillRepRefs | ( | IOpaqueAddress * | pAddr,
|  | DataObject * | pObject |
| ) |  |  | `[virtual]`

Update references of the persistent data representation.

Reimplemented from ConversionSvc.

Definition at line 126 of file PersSvc.cpp.

References ConversionSvc::fillRepRefs(), m_defFileName, StatusCode::SUCCESS, and undefFileName.

    00126                                                                                     {
    00127   // Convert histograms only if HBOOK output file name is defined
    00128   if( undefFileName != m_defFileName ) { // Valid HBOOK output file name
    00129     return ConversionSvc::fillRepRefs(pAddr, pObject);
    00130   }
    00131   return StatusCode::SUCCESS;
    00132 }

## Friends And Related Function Documentation

friend class SvcFactory< PersSvc >`[friend]`

Definition at line 29 of file PersSvc.h.

## Member Data Documentation

std::string HbookCnv::PersSvc::m_persistencySvc`[private]`

Definition at line 52 of file PersSvc.h.

Referenced by PersSvc().

std::string HbookCnv::PersSvc::m_defFileName`[private]`

Definition at line 53 of file PersSvc.h.

Referenced by createRep(), fillRepRefs(), finalize(), initialize(), and PersSvc().

std::string HbookCnv::PersSvc::m_rowWisePolicy`[private]`

Definition at line 54 of file PersSvc.h.

Referenced by initialize(), and PersSvc().

int HbookCnv::PersSvc::m_NPAWC`[private]`

Definition at line 55 of file PersSvc.h.

Referenced by initialize(), and PersSvc().

int HbookCnv::PersSvc::m_NREC`[private]`

Definition at line 56 of file PersSvc.h.

Referenced by initialize(), and PersSvc().

int HbookCnv::PersSvc::m_RECL`[private]`

Definition at line 57 of file PersSvc.h.

Referenced by initialize(), and PersSvc().

bool HbookCnv::PersSvc::m_histDo`[private]`

Flag to switch on printing of histograms to standard output.

Definition at line 60 of file PersSvc.h.

Referenced by createRep(), and PersSvc().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/HbookCnv/v14r13/src/PersSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/HbookCnv/v14r13/src/PersSvc.cpp