| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends

# AIDATupleSvc Class Reference

AIDATupleSvc class definition. More...

`#include <AIDATupleSvc/AIDATupleSvc.h>`

Inheritance diagram for AIDATupleSvc:
[legend]
Collaboration diagram for AIDATupleSvc:
[legend]

List of all members.

## Public Member Functions
virtual StatusCode | initialize ()
| DataSvc overrides: Initialize the service.
virtual StatusCode | reinitialize ()
| DataSvc overrides: reinitialize service.
virtual StatusCode | finalize ()
| DataSvc overrides: stop the service.
virtual AIDA::ITuple * | book (const std::string &fullPath, const std::string &title, const std::string &columns)
| Create AIDATuple in the data store.
virtual AIDA::ITuple * | book (const std::string &parentPath, const std::string &objPath, const std::string &title, const std::string &columns)
| Create AIDATuple in the data store.
virtual AIDA::ITuple * | book (const std::string &parentPath, int tupleID, const std::string &title, const std::string &columns)
| Create AIDATuple in the data store.
virtual AIDA::ITuple * | book (DataObject *pParent, const std::string &objPath, const std::string &title, const std::string &columns)
| Create AIDATuple in the data store.
virtual AIDA::ITuple * | book (DataObject *pParent, int tupleID, const std::string &title, const std::string &columns)
| Create AIDATuple in the data store.
virtual StatusCode | registerObject (const std::string &dirPath, const std::string &objPath, AIDA::ITuple *tObj)
| Register a tuple in the data store.
virtual StatusCode | registerObject (DataObject *pParent, const std::string &objPath, AIDA::ITuple *tObj)
| Register a tuple in the data store.
virtual StatusCode | unregisterObject (AIDA::ITuple *tObj)
| Unregister a tuple in the data store.
virtual StatusCode | unregisterObject (AIDA::ITuple *tObj, const std::string &objPath)
| Unregister a tuple in the data store.
virtual StatusCode | retrieveObject (const std::string &fullPath, AIDA::ITuple *&tObj)
| Retrieve a tuple from the data store.
virtual StatusCode | retrieveObject (const std::string &parentPath, const std::string &objPath, AIDA::ITuple *&tObj)
| Retrieve a tuple from the data store.
virtual StatusCode | retrieveObject (DataObject *pParent, const std::string &objPath, AIDA::ITuple *&tObj)
| Retrieve a tuple from the data store.
virtual StatusCode | findObject (const std::string &fullPath, AIDA::ITuple *&tObj)
| Locate a tuple in the data store.
virtual StatusCode | findObject (IRegistry *pDirectory, const std::string &path, AIDA::ITuple *&tObj)
| Locate a tuple in the data store.
virtual StatusCode | findObject (const std::string &parentPath, const std::string &objPath, AIDA::ITuple *&tObj)
| Locate a tuple in the data store.
virtual StatusCode | findObject (DataObject *parentObj, const std::string &objPath, AIDA::ITuple *&tObj)
| Locate a tuple in the data store.
virtual void | setCriteria (AIDA::ITuple *&tObj, const std::string &criteria)
| Set a selection criteria for reading, as a filter.
virtual StatusCode | myTest ()
| Dummy method to test the service.
## Protected Types
typedef std::vector< std::string > | DBaseEntries
| Typedefs for connections.
typedef std::map< std::string, pi_aida::Proxy_Store * > | Connections
## Protected Member Functions
| AIDATupleSvc (const std::string &name, ISvcLocator *svc)
| Standard constructor.
virtual | ~AIDATupleSvc ()
| Standard destructor.
void | parsePath (const std::string &fullPath, std::string &dirPath, std::string &objPath, std::string &storePath, std::string &storeObj)
| Split full path into its components.
virtual DataObject * | createPath (const std::string &newPath)
| Create all directories recursively in a given full path.
virtual DataObject * | createDirectory (const std::string &parentDir, const std::string &subDir)
| Create a sub-directory in a given directory.
StatusCode | connect (const std::string &ident, int mode)
| Add file to I/O list.
StatusCode | closeAIDAStores ()
| Disconnect all the stores in the I/O list.
## Protected Attributes
DBaseEntries | m_output
| Output streams.
DBaseEntries | m_input
| Input streams.
Connections | m_connections
| Container of connection points.
## Friends
class | SvcFactory< AIDATupleSvc >
| Allow SvcFactory to instantiate the service.

## Detailed Description

AIDATupleSvc class definition.

Author:
  Manuel Domenech Saavedra

Date:
  2005-05-23

Definition at line 28 of file AIDATupleSvc.h.

## Member Typedef Documentation

typedef std::map<std::string, pi_aida::Proxy_Store*> AIDATupleSvc::Connections`[protected]`

Definition at line 37 of file AIDATupleSvc.h.

typedef std::vector<std::string> AIDATupleSvc::DBaseEntries`[protected]`

Typedefs for connections.

Definition at line 36 of file AIDATupleSvc.h.

## Constructor & Destructor Documentation

AIDATupleSvc::AIDATupleSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  | `[protected]`

Standard constructor.

Definition at line 551 of file AIDATupleSvc.cpp.

      : DataSvc( name, svc )
    {
      // Properties can be declared here
      m_rootName = "/NTUPLES";
      m_rootCLID = CLID_DataObject;
      declareProperty("Input",  m_input);
      declareProperty("Output", m_output);
    }

AIDATupleSvc::~AIDATupleSvc | ( | ) | `[protected, virtual]`

Standard destructor.

Definition at line 562 of file AIDATupleSvc.cpp.

    {
      clearStore().ignore();
    }

## Member Function Documentation

AIDA::ITuple * AIDATupleSvc::book | ( | const std::string & | fullPath,
|  | const std::string & | title,
|  | const std::string & | columns
| ) |  | `[virtual]`

Create AIDATuple in the data store.

Parameters:

  fullPath | [IN]: Full path of the tuple
  title | [IN]: Title of the tuple
  columns | [IN]: Description of the column names and types returns a new tuple registered in the transient store

Implements IAIDATupleSvc.

Definition at line 98 of file AIDATupleSvc.cpp.

    {
      std::string dirPath, objPath, storePath, storeObj;
      parsePath( fullPath, dirPath, objPath, storePath, storeObj);

      Connections::iterator i = m_connections.find(storePath);
      if( i != m_connections.end() ) {
        pi_aida::Tuple* tmp = new pi_aida::Tuple( *(*i).second, storeObj, title, columns );
        AIDA::ITuple* tuple = tmp;

        if( registerObject(dirPath, objPath, tuple).isSuccess() )
          return tuple;
        else {
          delete tuple;
          throw GaudiException("Cannot book tuple " + title,"AIDATupleSvc", StatusCode::FAILURE);
        }
      }
      else
        throw GaudiException("Cannot find store " + storePath, "AIDATupleSvc", StatusCode::FAILURE);
    }

AIDA::ITuple * AIDATupleSvc::book | ( | const std::string & | parentPath,
|  | const std::string & | objPath,
|  | const std::string & | title,
|  | const std::string & | columns
| ) |  | `[virtual]`

Create AIDATuple in the data store.

Parameters:

  parentPath | [IN]: Full path to the parent dir of the tuple
  objPath | [IN]: Name of the tuple
  title | [IN]: Title of the tuple
  columns | [IN]: Description of the column names and types returns a new tuple registered in the transient store

Definition at line 122 of file AIDATupleSvc.cpp.

    {
      std::string fullPath = parentPath+"/"+objPath;
      return book( fullPath, title, columns );
    }

AIDA::ITuple * AIDATupleSvc::book | ( | const std::string & | parentPath,
|  | int | tupleID,
|  | const std::string & | title,
|  | const std::string & | columns
| ) |  | `[virtual]`

Create AIDATuple in the data store.

Parameters:

  parentPath | [IN]: Full path to the parent dir of the tuple
  tupleID | [IN]: ID of the tuple
  title | [IN]: Title of the tuple
  columns | [IN]: Description of the column names and types returns a new tuple registered in the transient store

Definition at line 132 of file AIDATupleSvc.cpp.

    {
      char objPath[32];
      ::_itoa(tupleID, objPath, 10);
      std::string fullPath = parentPath+"/"+objPath;
      return book( fullPath, title, columns );
    }

AIDA::ITuple * AIDATupleSvc::book | ( | DataObject * | pParent,
|  | const std::string & | objPath,
|  | const std::string & | title,
|  | const std::string & | columns
| ) |  | `[virtual]`

Create AIDATuple in the data store.

Parameters:

  pParent | [IN]: Pointer to the parent directory of the tuple
  objPath | [IN]: Name of the tuple
  title | [IN]: Title of the tuple
  columns | [IN]: Description of the column names and types returns a new tuple registered in the transient store

Definition at line 144 of file AIDATupleSvc.cpp.

    {
      IRegistry* tmp = pParent->registry();
      std::string fullPath, parentPath;
      parentPath = tmp->identifier();
      fullPath = fullPath = parentPath+"/"+objPath;
      return book( fullPath, title, columns );
    }

AIDA::ITuple * AIDATupleSvc::book | ( | DataObject * | pParent,
|  | int | tupleID,
|  | const std::string & | title,
|  | const std::string & | columns
| ) |  | `[virtual]`

Create AIDATuple in the data store.

Parameters:

  pParent | [IN]: Pointer to the parent directory of the tuple
  tupleID | [IN]: ID of the tuple
  title | [IN]: Title of the tuple
  columns | [IN]: Description of the column names and types returns a new tuple registered in the transient store

Definition at line 157 of file AIDATupleSvc.cpp.

    {
      char txt[32];
      return book( pParent, ::_itoa(tupleID, txt, 10), title, columns );
    }

StatusCode AIDATupleSvc::closeAIDAStores | ( | ) | `[protected]`

Disconnect all the stores in the I/O list.

Definition at line 443 of file AIDATupleSvc.cpp.

    {
       for( Connections::iterator k = m_connections.begin(); k != m_connections.end(); k++ ) {
         if ( (*k).second->isOpen()) {
           (*k).second->close();
           (*k).second = 0;
         }
       }

       m_connections.erase(m_connections.begin(), m_connections.end());
      return StatusCode::SUCCESS;
    }

StatusCode AIDATupleSvc::connect | ( | const std::string & | ident,
|  | int | mode
| ) |  | `[protected]`

Add file to I/O list.

Parameters:

  ident | [IN]: String with all the options from the job options file
  mode | [IN]: Flag indicating INPUT or OUTPUT stream returns StatusCode indicating the success of the operation

Definition at line 338 of file AIDATupleSvc.cpp.

    {
      MsgStream log ( msgSvc(), name() );
      DataObject* p0 = 0;
      StatusCode status = DataSvc::findObject(m_rootName, p0);
      if (status.isSuccess() ) {
        Tokenizer tok(true);
        long loc = ident.find(" ");
        int open_mode = 0; // Default is AUTO mode
        std::string file, typ = "", tmp_typ = "", opt = "";
        std::string logname = ident.substr(0,loc);
        tok.analyse(ident.substr(loc+1,ident.length()), " ", "", "", "=", "'", "'");
        for ( Tokenizer::Items::iterator i = tok.items().begin(); i != tok.items().end(); i++) {
          const std::string& tag = (*i).tag();
          switch( ::toupper(tag[0]) ) {
          case 'F':   // FILE='<file name>'
          case 'D':   // DATAFILE='<file name>'
            file = (*i).value();
            break;
          case 'O':   // OPT='<AUTO, OVERWRITE, CREATE, READONLY, UPDATE>'
            switch( ::toupper((*i).value()[0]) ) {
            case 'A': // AUTO
              if( mode == 0 )
                open_mode = 3; // READONLY
              else
                open_mode = 1; // CREATE
              break;
            case 'O': // OVERWRITE
              if( mode == 0 )
                throw GaudiException("Input file " + file + " with improper option (OVERWRITE)", "AIDATupleSvc", StatusCode::FAILURE);
              else
                open_mode = 1;
              break;
            case 'C': // CREATE
              if( mode == 0 )
                throw GaudiException("Input file " + file + " with improper option (CREATE)", "AIDATupleSvc", StatusCode::FAILURE);
              else
                open_mode = 2;
              break;
            case 'R': // READONLY
              if( mode == 1 )
                throw GaudiException("Output file " + file + " with improper option (READONLY)", "AIDATupleSvc", StatusCode::FAILURE);
              else
                open_mode = 3;
              break;
            case 'U': // UPDATE
              if( mode == 0 )
                throw GaudiException("Input file " + file + " with improper option (UPDATE)", "AIDATupleSvc", StatusCode::FAILURE);
              else
                open_mode = 4;
              break;
            }
            break;
          case 'T':   // TYP='<HBOOK,ROOT,XML,POOL>'
            typ = (*i).value();
            break;
          default:
            opt += (*i).tag() + "=" + (*i).value() + ",";
            break;
          }
        }

        // Check if persistency type has been specified at job options
        if (typ == "") {
          log << MSG::WARNING << "File type not specified at job options."
              << " Setting 'HistogramPersistency' type as default"
              << endmsg;
          // Get the value of the Stat persistancy mechanism from the AppMgr
          IProperty*   appPropMgr = 0;
          status = serviceLocator()->queryInterface(IProperty::interfaceID(),(void **)&appPropMgr );
          if( !status.isSuccess() ) {
            // Report an error and return the FAILURE status code
            log << MSG::ERROR << "Could not get PropMgr" << endmsg;
            return status;
          }
          StringProperty sp("HistogramPersistency","");
          status = appPropMgr->getProperty( &sp );
          if ( !status.isSuccess() ) {
            log << MSG::ERROR << "Could not get NTuple Persistency format"
                << " from ApplicationMgr properties" << endmsg;
            return status;
          }
          tmp_typ = sp.value();
          if (tmp_typ == "ROOT" || tmp_typ == "XML" || tmp_typ == "HBOOK" || tmp_typ == "POOL")
            typ = tmp_typ;
          else {
            log << MSG::ERROR << "Unknown persistency format at 'HistogramPersistency' option"
                << endmsg;
            return StatusCode::FAILURE;
          }
        }

        // Create a new pi_aida::Proxy_Store
        pi_aida::Proxy_Store* storePtr = new pi_aida::Proxy_Store( file, typ, open_mode, opt );
        m_connections.insert(Connections::value_type(m_rootName+'/'+logname, storePtr));

        return StatusCode::SUCCESS;
      }
      log << MSG::ERROR << "Cannot add " << ident << " invalid filename!" << endmsg;
      return StatusCode::FAILURE;

    }

DataObject * AIDATupleSvc::createDirectory | ( | const std::string & | parentDir,
|  | const std::string & | subDir
| ) |  | `[protected, virtual]`

Create a sub-directory in a given directory.

Parameters:

  parentDir | [IN]: Path to the parent directory, already existing
  subDir | [IN]: Name of the subdirectory returns pointer to DataObject corresponding to the new subdirectory

Implements IAIDATupleSvc.

Definition at line 517 of file AIDATupleSvc.cpp.

    {

      StatusCode   status    = StatusCode::FAILURE;
      DataObject*  directory = new DataObject();

      if ( 0 != directory )  {
        DataObject* pnode;
        status = DataSvc::findObject( parentDir, pnode );
        if( status.isSuccess() ) {
          status = DataSvc::registerObject( pnode, subDir, directory );
          if ( !status.isSuccess() )   {
            MsgStream log( msgSvc(), name() );
            log << MSG::ERROR << "Unable to create the directory: "
                              << parentDir << "/" << subDir << endmsg;
            delete directory;
            return 0;
          }
        }
        else {
          MsgStream log( msgSvc(), name() );
          log << MSG::ERROR << "Unable to create the directory: "
                            << parentDir << "/" << subDir << endmsg;
          delete directory;
          return 0;
        }
      }
      return directory;
    }

DataObject * AIDATupleSvc::createPath | ( | const std::string & | newPath ) | `[protected, virtual]`

Create all directories recursively in a given full path.

Parameters:

  newPath | [IN]: Path until the tuple in the transient store returns pointer to DataObject corresponding to the top level directory of the path

Implements IAIDATupleSvc.

Definition at line 482 of file AIDATupleSvc.cpp.

    {
      std::string tmpPath = newPath;
      if ( tmpPath[0] != SEPARATOR )    {
        tmpPath.insert(tmpPath.begin(), SEPARATOR);
        tmpPath.insert(tmpPath.begin(), m_rootName.begin(), m_rootName.end());
      }
      // Remove trailing "/" from newPath if it exists
      if (tmpPath.rfind(SEPARATOR) == tmpPath.length()-1) {
        tmpPath.erase(tmpPath.rfind(SEPARATOR),1);
      }

      DataObject* pObject = 0;
      StatusCode sc = DataSvc::findObject( tmpPath, pObject );
      if( sc.isSuccess() ) {
        return pObject;
      }

      int sep = tmpPath.rfind(SEPARATOR);
      std::string rest( tmpPath, sep+1, tmpPath.length()-sep );
      std::string subPath( tmpPath, 0, sep );
      if( 0 != sep ) {
        createPath( subPath );
      }
      else {
        MsgStream log( msgSvc(), name() );
        log << MSG::ERROR << "Unable to create the tuple path" << endmsg;
        return 0;
      }

      pObject = createDirectory( subPath, rest );
      return pObject;
    }

StatusCode AIDATupleSvc::finalize | ( | void | ) | `[virtual]`

DataSvc overrides: stop the service.

Reimplemented from DataSvc.

Definition at line 605 of file AIDATupleSvc.cpp.

    {
      MsgStream log( msgSvc(), name() );
      StatusCode status = DataSvc::finalize();
      if( status.isSuccess() ) {
        status = closeAIDAStores();
        if( status.isSuccess() )
          return status;
      }
      log << MSG::ERROR << "Error finalizing AIDATupleSvc." << endmsg;
      return status;
    }

StatusCode AIDATupleSvc::findObject | ( | const std::string & | fullPath,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Locate a tuple in the data store.

Parameters:

  fullPath | [IN]: Full path of the tuple
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 275 of file AIDATupleSvc.cpp.

    {
      DataObject*  pObject  = 0;
      StatusCode sc = DataSvc::findObject( fullPath, pObject );
      tObj = dynamic_cast<AIDA::ITuple*>(pObject);
      return sc;
    }

StatusCode AIDATupleSvc::findObject | ( | IRegistry * | pDirectory,
|  | const std::string & | path,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Locate a tuple in the data store.

Parameters:

  pDirectory | [IN]: Pointer to a directory
  path | [IN]: Relative path to the tuple from the pDirectory
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 285 of file AIDATupleSvc.cpp.

    {
      DataObject*  pObject  = 0;
      StatusCode sc = DataSvc::findObject( pRegistry, path, pObject );
      tObj = dynamic_cast<AIDA::ITuple*>(pObject);
      return sc;
    }

StatusCode AIDATupleSvc::findObject | ( | const std::string & | parentPath,
|  | const std::string & | objPath,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Locate a tuple in the data store.

Parameters:

  parentPath | [IN]: Full path of the tuple
  objPath | [IN]: Name of the tuple
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 296 of file AIDATupleSvc.cpp.

    {
      DataObject*  pObject  = 0;
      StatusCode sc = DataSvc::findObject( parentPath, objPath, pObject );
      tObj = dynamic_cast<AIDA::ITuple*>(pObject);
      return sc;
    }

StatusCode AIDATupleSvc::findObject | ( | DataObject * | parentObj,
|  | const std::string & | objPath,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Locate a tuple in the data store.

Parameters:

  parentObj | [IN]: Pointer to the parent directory
  objPath | [IN]: Name of the tuple
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 307 of file AIDATupleSvc.cpp.

    {
      DataObject*  pObject  = 0;
      StatusCode sc = DataSvc::findObject( parentObj, objPath, pObject );
      tObj = dynamic_cast<AIDA::ITuple*>(pObject);
      return sc;
    }

StatusCode AIDATupleSvc::initialize | ( | void | ) | `[virtual]`

DataSvc overrides: Initialize the service.

Reimplemented from DataSvc.

Definition at line 568 of file AIDATupleSvc.cpp.

    {
      MsgStream log( msgSvc(), name() );
      StatusCode status = DataSvc::initialize();

      if( status.isSuccess() ){
        DataObject* rootObj = new DataObject();
        status = setRoot( m_rootName, rootObj );
        if( !status.isSuccess() ) {
          log << MSG::ERROR << "Unable to set NTuple data store root." << endmsg;
          delete rootObj;
          return status;
        }

        //Connect inputs (MODE = 0)
        for( DBaseEntries::iterator i = m_input.begin(); i != m_input.end(); i++ ) {
          status = connect(*i, 0);
          if( !status.isSuccess() )
            return status;
        }
        //Connect outputs (MODE = 1)
        for( DBaseEntries::iterator j = m_output.begin(); j != m_output.end(); j++ ) {
          status = connect(*j, 1);
          if( !status.isSuccess() )
            return status;
        }
      }
      return status;
    }

StatusCode AIDATupleSvc::myTest | ( | ) | `[virtual]`

Dummy method to test the service.

AIDATupleSvc class implementation.

Author:
  Manuel Domenech Saavedra

Date:
  2005-05-23

Implements IAIDATupleSvc.

Definition at line 34 of file AIDATupleSvc.cpp.

    {
      MsgStream log ( msgSvc(), name() );
      log << MSG::INFO << "Welcome to myTest!" << endmsg;

      // Defining the description of the tuple columns
      std::string description =  "float px; float py; float pz; float mass";

      pi_aida::Proxy_Store* store = new pi_aida::Proxy_Store("ntuple.root","POOL",0,"CAT=xmlcatalog_file:anotherCatalog.xml,SUB=POOL_ROOTTREE");
      pi_aida::Tuple tuple(*store, "1", "tuple1", description);
      //AIDATuple tuple( store, "1", "example tuple", description );

      DRand48Engine randomEngine;
      RandGauss rBeamEnergy( randomEngine, 90, 5 );
      RandGauss rTracksSpread( randomEngine, 0, 2 );
      RandGauss rMomentum( randomEngine, 0, 3 );
      RandGauss rMass( randomEngine, 1, 0.1 );

      std::cout << "Tuple created ... starting to fill " << std::endl;

      int i_px = tuple.findColumn( "px" );
      int i_py = tuple.findColumn( "py" );
      int i_pz = tuple.findColumn( "pz" );
      int i_mass = tuple.findColumn( "mass" );

      for ( unsigned int i = 0; i < 1000; i++ ) {

          tuple.fill( i_px,  rMomentum.fire() );
          tuple.fill( i_py,  rMomentum.fire() );
          tuple.fill( i_pz,  rMomentum.fire() );
          tuple.fill( i_mass, rMass.fire() );
          tuple.addRow();
      }
      std::cout << "Filled the tuple with " << tuple.rows() << " rows" << std::endl;
      store->close();
      delete store;

      pi_aida::Proxy_Store* store1 = new pi_aida::Proxy_Store("ntuple.root","POOL",3,"CAT=xmlcatalog_file:anotherCatalog.xml,SUB=POOL_ROOTTREE");
      pi_aida::Tuple tuple1 = store1->retrieveTuple("1");

      //AIDATuple tuple1 = store1->retrieveTuple("1");
      //AIDATuple tuple = static_cast<AIDATuple>(tmp);

      std::cout << "FOUND TUPLE WITH  " << tuple1.rows() << " ROWS" << std::endl;

      tuple1.start();
      int i = 0;
      while( tuple1.next() ) {
        i++;
        std::cout << "ROW " << i << std::endl;
        std::cout << "px: " << tuple1.getFloat(i_px) << std::endl;
        std::cout << "py: " << tuple1.getFloat(i_py) << std::endl;
        std::cout << "pz: " << tuple1.getFloat(i_pz) << std::endl;
        std::cout << "mass: " << tuple1.getFloat(i_mass) << std::endl;
      }
      store1->close();
      delete store1;
      return StatusCode::SUCCESS;
    }

void AIDATupleSvc::parsePath | ( | const std::string & | fullPath,
|  | std::string & | dirPath,
|  | std::string & | objPath,
|  | std::string & | storePath,
|  | std::string & | storeObj
| ) |  | `[protected]`

Split full path into its components.

Parameters:

  fullPath | [IN]: Full path of the store
  dirPath | [OUT]: Path in the transient store to the tuple's parent dir
  objPath | [OUT]: Name of the tuple in the transient store starting with '/'
  storePath | [OUT]: Path in the transient store of the tuple store
  storeObj | [OUT]: Full name of the tuple inside the tuple store, including parent dirs.File is a flat structure.

Definition at line 457 of file AIDATupleSvc.cpp.

    {
      std::string tmpPath = fullPath;
      if ( tmpPath[0] != SEPARATOR ) {
        // Insert the top level name of the store (/NTUPLES)
        tmpPath.insert(tmpPath.begin(), SEPARATOR);
        tmpPath.insert(tmpPath.begin(), m_rootName.begin(), m_rootName.end());
      }
      // Remove trailing "/" from tmpPath if it exists
      if (tmpPath.rfind(SEPARATOR) == tmpPath.length()-1) {
        tmpPath.erase(tmpPath.rfind(SEPARATOR),1);
      }
      int sep   = tmpPath.rfind(SEPARATOR);
      dirPath   = tmpPath.substr(0, sep);
      objPath   = tmpPath.substr(sep, tmpPath.length()-sep );
      sep       = tmpPath.find(SEPARATOR, m_rootName.length()+1);
      storePath = tmpPath.substr(0, sep);
      storeObj  = tmpPath.substr(sep+1, tmpPath.length()-sep );
    }

StatusCode AIDATupleSvc::registerObject | ( | DataObject * | pParent,
|  | const std::string & | objPath,
|  | AIDA::ITuple * | tObj
| ) |  | `[virtual]`

Register a tuple in the data store.

Parameters:

  pParent | [IN]: Pointer to the parent directory of the tuple
  objPath | [IN]: Name of the tuple
  tObj | [IN]: Pointer to the tuple to be registered returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 180 of file AIDATupleSvc.cpp.

    {
      // Set the tuple id
      if ( objPath[0] == SEPARATOR ) {
        if ( !tObj->annotation().addItem( "id", objPath.substr(1) ) )
          tObj->annotation().setValue( "id", objPath.substr(1) );
      }
      else {
        if ( !tObj->annotation().addItem( "id", objPath ) )
          tObj->annotation().setValue( "id", objPath );
      }

      // Register the tuple in the tuple data store
      StatusCode status = DataSvc::registerObject( pParent,
                                                   objPath,
                                                   dynamic_cast<DataObject*>(tObj) );
      return status;
    }

StatusCode AIDATupleSvc::registerObject | ( | const std::string & | dirPath,
|  | const std::string & | objPath,
|  | AIDA::ITuple * | tObj
| ) |  | `[virtual]`

Register a tuple in the data store.

Parameters:

  dirPath | [IN]: Path to the directory where the tuple must be registered
  objPath | [IN]: Name of the tuple
  tObj | [IN]: Pointer to the tuple to be registered returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 170 of file AIDATupleSvc.cpp.

    {
      DataObject* pParent = 0;
      pParent = createPath( dirPath );
      return registerObject( pParent, objPath, tObj );

    }

StatusCode AIDATupleSvc::reinitialize | ( | ) | `[virtual]`

DataSvc overrides: reinitialize service.

Reimplemented from DataSvc.

Definition at line 599 of file AIDATupleSvc.cpp.

    {
      return StatusCode::SUCCESS;
    }

StatusCode AIDATupleSvc::retrieveObject | ( | const std::string & | parentPath,
|  | const std::string & | objPath,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Retrieve a tuple from the data store.

Parameters:

  parentPath | [IN]: Full path to the parent dir of the tuple
  objPath | [IN]: Name of the tuple
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 251 of file AIDATupleSvc.cpp.

    {
      std::string fullPath = parentPath+'/'+objPath;
      return retrieveObject( fullPath, tObj );
    }

StatusCode AIDATupleSvc::retrieveObject | ( | const std::string & | fullPath,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Retrieve a tuple from the data store.

Parameters:

  fullPath | [IN]: Full path of the tuple
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 224 of file AIDATupleSvc.cpp.

    {
      MsgStream log ( msgSvc(), name() );
      StatusCode status;
      status = findObject(fullPath, tObj);

      // Tuple already in the transient store
      if( status.isSuccess() )
        return status;

      std::string dirPath, objPath, storePath, storeObj;
      parsePath( fullPath, dirPath, objPath, storePath, storeObj);

      // Load tuple from persistency
      Connections::iterator i = m_connections.find(storePath);
      if( i != m_connections.end() ) {
        pi_aida::Tuple* tmp = new pi_aida::Tuple(((*i).second)->retrieveTuple(storeObj));

        tObj = dynamic_cast<AIDA::ITuple*>(tmp);
        return StatusCode::SUCCESS;
      }
      log << MSG::ERROR << "Could not retrieve tuple " << fullPath << endmsg;
      return StatusCode::FAILURE;
    }

StatusCode AIDATupleSvc::retrieveObject | ( | DataObject * | pParent,
|  | const std::string & | objPath,
|  | AIDA::ITuple *& | tObj
| ) |  | `[virtual]`

Retrieve a tuple from the data store.

Parameters:

  pParent | [IN]: Pointer to the parent directory of the tuple
  objPath | [IN]: Name of the tuple
  tObj | [OUT]: Pointer to the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 260 of file AIDATupleSvc.cpp.

    {
      IRegistry* tmpReg = pParent->registry();
      std::string parentPath = tmpReg->identifier();
      std::string fullPath = parentPath+'/'+objPath;

      return retrieveObject( fullPath, tObj );
    }

void AIDATupleSvc::setCriteria | ( | AIDA::ITuple *& | tObj,
|  | const std::string & | criteria
| ) |  | `[virtual]`

Set a selection criteria for reading, as a filter.

Parameters:

  tObj | [IN]: Pointer to the tuple
  criteria | [IN]: Selection criteria

Implements IAIDATupleSvc.

Definition at line 318 of file AIDATupleSvc.cpp.

    {
      pi_aida::Tuple* t = dynamic_cast<pi_aida::Tuple*>(tObj);
      t->setCriteria(criteria);
    }

StatusCode AIDATupleSvc::unregisterObject | ( | AIDA::ITuple * | tObj,
|  | const std::string & | objPath
| ) |  | `[virtual]`

Unregister a tuple in the data store.

Parameters:

  tObj | [IN]: Pointer to tuple
  objPath | [IN]: Name of the tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 212 of file AIDATupleSvc.cpp.

    {
      StatusCode status = DataSvc::unregisterObject( dynamic_cast<DataObject*>(tObj),
                                                     objPath );
      return status;
    }

StatusCode AIDATupleSvc::unregisterObject | ( | AIDA::ITuple * | tObj ) | `[virtual]`

Unregister a tuple in the data store.

Parameters:

  tObj | [IN]: Pointer to tuple returns StatusCode indicating the success of the operation

Implements IAIDATupleSvc.

Definition at line 205 of file AIDATupleSvc.cpp.

    {
      StatusCode status = DataSvc::unregisterObject( dynamic_cast<DataObject*>(tObj) );
      return status;
    }

## Friends And Related Function Documentation

friend class SvcFactory< AIDATupleSvc >`[friend]`

Allow SvcFactory to instantiate the service.

Definition at line 32 of file AIDATupleSvc.h.

## Member Data Documentation

Connections AIDATupleSvc::m_connections`[protected]`

Container of connection points.

Definition at line 46 of file AIDATupleSvc.h.

DBaseEntries AIDATupleSvc::m_input`[protected]`

Input streams.

Definition at line 43 of file AIDATupleSvc.h.

DBaseEntries AIDATupleSvc::m_output`[protected]`

Output streams.

Definition at line 40 of file AIDATupleSvc.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiSvc/src/AIDATupleSvc/AIDATupleSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiSvc/src/AIDATupleSvc/AIDATupleSvc.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines