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 />

• By providing a key, in which case there will be a unique match. Note that a keyed access is<br />

possible only if you recorded theDataObject with a key. Since two DataObjects of the same<br />

type cannot have the same key, you are assured of a unique DataObject (provided of course it<br />

exists).<br />

• You can ask for a list of DataObjects of a given type. You will be returned a begin and end<br />

iterator over all the DataObjects of that type (whether or not it was recorded with a key).<br />

For each of these three modes you have the option to require const access to the retrieved objects or non<br />

constant access. In the latter case, if the DataObject has already been locked, as it will normally be the<br />

case, the retrieve operation will not return the locked object (and will fail if no unlocked matching<br />

objects are available).<br />

8.6.1 Retrieving DataObjects without a key<br />

In the execute method of ReadData, get the last MyDataObj recorded in the TDS (recall that we<br />

recorded three MyDataObj in TDS, one with a key). The example shown in Listing 8.9 will retrieve the<br />

last of the three MyDataObj from the TDS:<br />

Listing 8.9 Retrieve a DataObject without a key<br />

const DataHandle dhandle;<br />

StatusCode sc = storeGateSvc()->retrieve(dhandle); [1]<br />

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

{<br />

log

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

Saved successfully!

Ooh no, something went wrong!