23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Athena</strong> Chapter 8 StoreGate - the event data access model Version/Issue: 2.0.0<br />

8.5 Recording a DataObject<br />

A DataObject may be recorded to the TransientStore using the StoreGateSvc. Each Algorithm has<br />

access to the storeGateSvc() and can therefore invoke the record method. Once recorded, the TDS has<br />

ownership of the DataObject. Hence clients must not call the delete of the DataObject.<br />

All recorded DataObjects are organized according to their type. A key can be optionally associated to a<br />

DataObject when this is recorded. At present it is the client responsibility to explicitly lock (set<br />

constant) the DataObjects which should no longer be modified.<br />

8.5.1 Recording DataObjects without keys<br />

In the execute method of WriteData, create a DataObject of type MyDataObj, and set its member data:<br />

Listing 8.4 Fragment 1 of WriteData Algorithm<br />

MyDataObj* dobj = new MyDataObj();<br />

dobj -> val(10);<br />

Record it in the TDS as shown in Listing 8.5: (Note that the pointer to storeGateSvc() is available to<br />

you if you are an “Algorithm”<br />

Listing 8.5 Fragment 2 of WriteData Algorithm<br />

StatusCode sc = storeGateSvc()->record(dobj);<br />

if (sc.isFailure())<br />

{<br />

log

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!