GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ADF::GObject Class Reference

Base class for a Global Object. More...

#include <GObject.h>

Public Types

typedef std::pair< ANamedItem
*, std::pair< ANamedItem
*, DataLink * > > 
FullItem
 a full item is composed of a pointer to an item, an pointer to a proxy and a pointer to a datalink More...
 

Public Member Functions

virtual Bool_t AddItem (ANamedItem *item)
 Add a named item to this. The item belongs to GObject and will be thus deleted. More...
 
template<typename Data_t >
const NamedItem< Data_t > * Get (const char *name)
 to get a given item (reading mode only !!) More...
 
virtual void GetItems (const BufferIO &)
 read the value of all item from the buffer More...
 
virtual void GetItems () const
 Copy local variables into externals. More...
 
 GObject ()
 Constructor. More...
 
virtual Bool_t IsFullyLinked () const
 to check if all the items are linked with external variables More...
 
template<typename Data_t >
Bool_t Link (const char *name, Data_t *external_address)
 General method to Link one item with an external address. More...
 
Bool_t LinkItem (const Char_t *, const Char_t *, void *)
 Only for basic type ... otherwise better to use the most general Link method. More...
 
Bool_t LinkItem (const Char_t *name, Short_t *address)
 
Bool_t LinkItem (const Char_t *name, UShort_t *address)
 
Bool_t LinkItem (const Char_t *name, Int_t *address)
 
Bool_t LinkItem (const Char_t *name, UInt_t *address)
 
Bool_t LinkItem (const Char_t *name, Float_t *address)
 
Bool_t LinkItem (const Char_t *name, Double_t *address)
 
Bool_t LinkItem (const Char_t *name, Long64_t *address)
 
Bool_t LinkItem (const Char_t *name, ULong64_t *address)
 
virtual void Print (std::ostream &out=std::cout) const
 print some informations about this object More...
 
virtual void Reset ()
 Set local to default. More...
 
virtual void SetItems (BufferIO &) const
 write the value of all items into the buffer More...
 
virtual void SetItems ()
 Copy external variables into locals. More...
 
void TransferLinkAndProxy (GObject &to)
 transfert proxy and link for one GObject to another one More...
 
virtual ~GObject ()
 Destructor. More...
 

Detailed Description

Base class for a Global Object.

Data Frame are composed of structures that are related to the algorithm which produces them. For intance a PSAFrame is composed of a list of Hits, whatever is the real data members stored in the Frame (ex: with or without errors).

Data cannot be always organized into specific structures, but could be just a list of data identified by a unique name and a given basic type. This object is used to help the user to read/modify such data item.

- S  : a 16 bit signed integer (Short_t)
- US : a 16 bit unsigned integer (UShort_t)
- I  : a 32 bit signed integer (Int_t)
- UI : a 32 bit unsigned integer (UInt_t)
- F  : a 32 bit floating point (Float_t)
- D  : a 64 bit floating point (Double_t)
- L  : a 64 bit signed integer (Long64_t)
- UL : a 64 bit unsigned integer (ULong64_t)
- B  : a boolean (Bool_t)

A GObject is then a list of NamedItem that represents the current definition of that Object. To add a item to the list:

GObject ob1;
// add items to ob1
ob1.AddItem( new NamedItem<UShort_t>("Crys",0u) );
ob1.AddItem( new NamedItem<Float_t>("E",0.0) );
ob1.AddItem( new NamedItem<Int_t>("T0",0) );

Items are owned by ob1 and are thus deleted by it ... so the user should not care about that. As a consequence, the following is forbidden:

GObject ob1; NamedItem<UShort_t> cry("Crys",0u);
// add items to ob1
ob1.AddItem( &crys );

NamedItem are known by their name and type ... as a consequence, you cannot add twice an item with the same name and type.

In your program, you can establish a link between a NamedItem and a local variable (of the same type !) so that changing the value of your local variable will changed the item's one. As well you can get back the value of the itemin you program To do that:

GObject ob1;
// add items to ob1
ob1.AddItem( new NamedItem<UShort_t>("Crys",0u) );
// link it with a variable in youy code:
UShort_t Crys_link;
ob1.LinkItem("Crys",&Crys_link);
Crys_link = 1u;
ob1.SetItems(); // now the value Crys in ob1 is equal to 1u
// ... another code changes the Crys value in ob1 to 2u
ob1.GetItems(); // now your local variable Crys_link is equal to 2u

You can only link once a NamedItem ... otherwise it would be a mess !

You can however consult (reading mode) a NamedItem using proxy This is done like this :

GObject ob1;
// add items to ob1
ob1.AddItem( new NamedItem<UShort_t>("Crys",0u) );
const NamedItem<UShort_t> *Crys_prox = ob1.Get<UShort_t>("Crys");
// warning, it returns 0x0 is not a good name with the right type
cout << Crys_prox->Get() << endl;

see ADFObject.C for concrete exemples

Author
O.Stezowski

Definition at line 115 of file GObject.h.


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