GCpp general purpose C++ library  version 1.0
GItem Class Reference

#include <GItem.hh>

Inheritance diagram for GItem:
GNamed GSubItem

Public Member Functions

template<class Q >
bool IsInstanceOf () const
 
template<class Q >
bool IsInstanceOf ()
 
virtual GItemClone () const
 
virtual const char * ClassName () const
 
 GItem (const string &s, void *ptr=NULL, const int n=0)
 
 GItem (const GItem &original)
 
virtual ~GItem ()
 
GItemoperator= (const GItem &original)
 
bool operator== (const GItem &item)
 
int GetId () const
 
void SetId (const int n)
 
void * GetUserData () const
 
void SetUserData (void *ptr)
 
virtual string GetInfo () const
 
virtual void SetInfo (const string &info)
 
void Select (const bool b=true)
 
bool IsSelected () const
 
- Public Member Functions inherited from GNamed
template<class Q >
bool IsInstanceOf () const
 
template<class Q >
bool IsInstanceOf ()
 
 GNamed (const string &object_name="")
 
 GNamed (const GNamed &object)
 
virtual ~GNamed ()
 
GNamedoperator= (const GNamed &object)
 
virtual const string & Name () const
 
virtual string & Name ()
 
virtual string GetName () const
 
virtual void SetName (const string &object_name)
 
int Compare (const GNamed &object) const
 
int CompareDict (const GNamed &object) const
 
bool operator== (const GNamed &object) const
 
bool operator!= (const GNamed &object) const
 
bool operator< (const GNamed &object) const
 
bool operator> (const GNamed &object) const
 
bool operator<= (const GNamed &object) const
 
bool operator>= (const GNamed &object) const
 

Static Public Member Functions

static const char * StaticClassName ()
 
- Static Public Member Functions inherited from GNamed
static const char * StaticClassName ()
 

Protected Attributes

bool selected
 Indicates if the element is selected.
 
int id
 Identification number (for ROOT widgets)
 
void * user_data
 Pointer on user data.
 
string data_info
 More detailed information (if required)
 
- Protected Attributes inherited from GNamed
string name
 Object name.
 

Detailed Description

This class defines base elements for collections of pointer on objects of any type.

This class is used to generate objects lists for graphical interfaces.

A name is associated to each element (pointer), and an identification number.

Constructor & Destructor Documentation

GItem::GItem ( const string &  s,
void *  ptr = NULL,
const int  n = 0 
)

Constructor.

Parameters
sdisplay string (name)
ptruser data pointer
nidentification number for ROOT widgets

References data_info, selected, and user_data.

GItem::GItem ( const GItem original)

Copy constructor.

Parameters
originalitem to copy

References data_info, id, selected, and user_data.

GItem::~GItem ( )
inlinevirtual

Destructor.

Member Function Documentation

int GItem::GetId ( ) const
inline

Return the data identification number.

string GItem::GetInfo ( ) const
inlinevirtual

Return the detailed information to the object reference if it is set, else return the item name.

Reimplemented from GNamed.

References data_info, and GNamed::GetName().

void * GItem::GetUserData ( ) const
inline

Return the pointer on associated object.

References user_data.

Referenced by operator==().

template<class Q >
bool GItem::IsInstanceOf ( ) const
inline

Macro from GCpp library that defines the following functions:

  • ClassName(): return the real class name of the object
  • StaticClassName(): return the used class name of the object (that may be a base class of the real object).
  • IsInstanceOf<T>(): return true if the current object is an instance of the template class name argument
  • Clone(): return an allocated copy of the object.
bool GItem::IsSelected ( ) const
inline

Return the selection flag.

References selected.

GItem & GItem::operator= ( const GItem original)

Affectation operator.

Parameters
originalitem to copy

References data_info, G_AFFECT_MOTHER, id, selected, and user_data.

bool GItem::operator== ( const GItem item)
inline

Comparison operator: it compares the name and the data pointer.

Parameters
itemelement to compare

References GNamed::GetName(), GetUserData(), GNamed::name, and user_data.

void GItem::Select ( const bool  b = true)
inline

Set selection flag.

Parameters
bvalue (on/off)

References selected.

void GItem::SetId ( const int  n)
inline

Set the identification number.

Parameters
nnew number
void GItem::SetInfo ( const string &  info)
inlinevirtual

Associate an detailed information to the object reference.

Parameters
infoinformation text

References data_info.

Referenced by GTreeNodeT< T >::CreateItemList(), and GTreeLeafT< T >::CreateItemTree().

void GItem::SetUserData ( void *  ptr)
inline

Set the pointer on associated object.

Parameters
ptrnew pointer

References user_data.


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