23.05.2014 Views

Athena Developer Guide

Athena Developer Guide

Athena Developer Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Athena</strong> Chapter 7 Accessing data Version/Issue: 2.0.0<br />

7.6 Data access checklist<br />

A little reminder:<br />

• Do not delete objects that you have registered.<br />

• Do not delete objects that are contained within an object that you have registered.<br />

• Do not register local objects, i.e. objects NOT created with the new operator.<br />

• Do not delete objects which you got from the store via findObject() or<br />

retrieveObject().<br />

• Do delete objects which you create on the heap, i.e. by a call to new, and which you do not<br />

register into a store.<br />

7.7 Defining new data types<br />

Most of the data types which will be used within <strong>Athena</strong> will be used by everybody and thus packaged<br />

and documented centrally. However, for your own private development work you may wish to create<br />

objects of your own types which of course you can always do with C++ (or Java) . However, if you<br />

wish to place these objects within a store, either so as to pass them between algorithms or to have them<br />

later saved into a database or file, then you must derive your type from either the DataObject or<br />

ContainedObject base class.<br />

Consider the example below:<br />

const static CLID CLID_UDO = 135; // Collaboration wide Unique number<br />

class UDO : public DataObject {<br />

public:<br />

UDO() : DataObject(), m_n(0) {<br />

}<br />

static const CLID& classID() { return CLID_UDO; }<br />

virtual const CLID& clID() const { return classID(); }<br />

int n(){ return m_n; }<br />

void setN(int n){ m_n = n; }<br />

private:<br />

int m_n;<br />

}<br />

page 50<br />

This defines a class UDO which since it derives from DataObject may be registered into, say, the<br />

event data store. (The class itself is not very useful as its sole attribute is a single integer and it has no<br />

behaviour).

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

Saved successfully!

Ooh no, something went wrong!