/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Static Public Member Functions
SaveB4TrimAesSvc Class Reference

#include <SaveB4TrimAesSvc.h>

Inheritance diagram for SaveB4TrimAesSvc:
Inheritance graph
[legend]
Collaboration diagram for SaveB4TrimAesSvc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SaveB4TrimAesSvc (const std::string &name, ISvcLocator *svc)
 Standard Service Constructor.
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode store (const std::string &regSeqLocation, IDybStorageSvc *dybStorageSvc, IDataManagerSvc *aes, IArchiveTrimSvc *archiveTrimSvc, const TimeStamp &now)
 ISaveB4TrimAesSvc methods.
virtual StatusCode queryInterface (const InterfaceID &id, void **interface)
 Methods required by ServiceManager.

Static Public Member Functions

static const InterfaceID & interfaceID ()

Detailed Description

Definition at line 18 of file SaveB4TrimAesSvc.h.


Constructor & Destructor Documentation

SaveB4TrimAesSvc::SaveB4TrimAesSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Standard Service Constructor.

Definition at line 9 of file SaveB4TrimAesSvc.cpp.

                                                   : 
  Service(name,svc)
{
}

Member Function Documentation

StatusCode SaveB4TrimAesSvc::initialize ( ) [virtual]

Definition at line 34 of file SaveB4TrimAesSvc.cpp.

{
  return Service::initialize();
}
StatusCode SaveB4TrimAesSvc::finalize ( ) [virtual]

Definition at line 39 of file SaveB4TrimAesSvc.cpp.

{
  return Service::finalize();
}
StatusCode SaveB4TrimAesSvc::store ( const std::string &  regSeqLocation,
IDybStorageSvc dybStorageSvc,
IDataManagerSvc *  aes,
IArchiveTrimSvc archiveTrimSvc,
const TimeStamp now 
) [virtual]

ISaveB4TrimAesSvc methods.

Implements ISaveB4TrimAesSvc.

Definition at line 44 of file SaveB4TrimAesSvc.cpp.

{
  MsgStream log(msgSvc(), name());

  // get window for RegistrationSequence
  double window = archiveTrimSvc->window(regSeqLocation);

  // Threshold
  TimeStamp thres = now;
  thres.Add(-1.0 * window);

  // Get DataObject
  DataObject* pObj=0;
  //log<<MSG::DEBUG<<regSeqLocation<<endreq;
  //log<<MSG::DEBUG<<aes<<endreq;

  // Cast to pAes
  DataSvc* pAes=0;
  try{
    pAes=dynamic_cast<DataSvc*>(aes);
  }
  catch(...) {
    log<<MSG::ERROR<<"Failed to AES"<<endreq;
    return StatusCode::FAILURE;
  }

  StatusCode sc = pAes->retrieveObject(regSeqLocation,pObj);
  if(sc.isFailure()) {
    log<<MSG::ERROR<<"Failed to get data object"<<endreq;
    return StatusCode::FAILURE;
  }
  // Get RegSeqList
  DybArchiveList* pRegSeqList=0;
  try{
    pRegSeqList=dynamic_cast<DybArchiveList*>(pObj);
  }
  catch (...) {
    log<<MSG::ERROR<<"Failed to get DybArchiveList"<<endreq;
    return StatusCode::FAILURE;
  }


  // Traverse AES /Event/RegistrationSequence
  DybArchiveList::reverse_iterator iter;
  DayaBay::RegistrationSequence* pRS=0;
  
  for(iter=pRegSeqList->rbegin();iter!=pRegSeqList->rend();++iter) {
    
    pObj=*iter;
    try{
      pRS=dynamic_cast<DayaBay::RegistrationSequence*>(pObj);
    }
    catch (...) {
      log<<MSG::ERROR<<"Failed to get RegistrationSequence"<<endreq;
      return StatusCode::FAILURE;
    }

    // This must be consistent with TrimmingAgent
    if(pRS->earliest()<=thres) {
      // time to save
      sc = dybStorageSvc->store(*pRS);
    }
    else {
    }
  }

  return StatusCode::SUCCESS;
}
StatusCode SaveB4TrimAesSvc::queryInterface ( const InterfaceID &  id,
void **  interface 
) [virtual]

Methods required by ServiceManager.

Definition at line 15 of file SaveB4TrimAesSvc.cpp.

{
  MsgStream log(msgSvc(), name());

  if (ISaveB4TrimAesSvc::interfaceID().versionMatch(id)) {
    // If good enough match return this object.
    *interface = (ISaveB4TrimAesSvc*)this;
    addRef();
    // log<<MSG::DEBUG<<"match"<<endreq;
  } else {
    // Interface is not directly available: try out a base class.
    // log<<MSG::DEBUG<<"no match"<<endreq;
    return Service::queryInterface(id,interface);
  }

  return StatusCode::SUCCESS;
}

The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:09:08 for DybEventMgr by doxygen 1.7.4