All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LinkManager Class Reference

A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of non-tree like links. More...

#include <GaudiKernel/LinkManager.h>

Collaboration diagram for LinkManager:

Classes

class  Link
 Embedded class defining a symbolic link Note: No copy constructor; bitwise copy (done by the compiler) is just fine. More...
 

Public Types

enum  DirLinkType { INVALID, VALID }
 Directory link types. More...
 
typedef std::vector< Link * > LinkVector
 
typedef LinkVector::iterator LinkIterator
 Data type: iterator over leaf links. More...
 
typedef LinkVector::const_iterator ConstLinkIterator
 Data type: iterator over leaf links (CONST) More...
 

Public Member Functions

 LinkManager ()
 Standard Constructor. More...
 
virtual ~LinkManager ()
 Standard Destructor. More...
 
long size () const
 Retrieve number of link present. More...
 
Linklink (long id)
 Retrieve symbolic link identified by ID. More...
 
Linklink (const DataObject *pObject)
 Retrieve symbolic link identified by object. More...
 
Linklink (const std::string &path)
 Retrieve symbolic link identified by path. More...
 
long addLink (const std::string &path, const DataObject *pObject) const
 Add link by object reference and path. More...
 
long removeLink (const DataObject *pObject) const
 Remove link by object reference. More...
 
long removeLink (const std::string &fullPath) const
 Remove link by object reference. More...
 
long removeLink (long id) const
 Remove link by link ID. More...
 
void clearLinks ()
 Remove all possibly existing symbolic links. More...
 

Static Public Member Functions

static LinkManagernewInstance ()
 Static instantiation. More...
 
static void setInstantiator (LinkManager *(*newInstance)())
 Assign new instantiator. More...
 

Public Attributes

LinkVector m_linkVector
 The vector containing all links which are non-tree like. More...
 

Detailed Description

A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of non-tree like links.

Author
M.Frank

Definition at line 20 of file LinkManager.h.

Member Typedef Documentation

typedef LinkVector::const_iterator LinkManager::ConstLinkIterator

Data type: iterator over leaf links (CONST)

Definition at line 92 of file LinkManager.h.

typedef LinkVector::iterator LinkManager::LinkIterator

Data type: iterator over leaf links.

Definition at line 90 of file LinkManager.h.

typedef std::vector<Link*> LinkManager::LinkVector

Definition at line 88 of file LinkManager.h.

Member Enumeration Documentation

Directory link types.

Enumerator
INVALID 
VALID 

Definition at line 24 of file LinkManager.h.

Constructor & Destructor Documentation

LinkManager::LinkManager ( )

Standard Constructor.

Definition at line 32 of file LinkManager.cpp.

32  {
33 }
LinkManager::~LinkManager ( )
virtual

Standard Destructor.

Standard Constructor.

Definition at line 36 of file LinkManager.cpp.

36  {
37  clearLinks();
38 }

Member Function Documentation

long LinkManager::addLink ( const std::string &  path,
const DataObject pObject 
) const

Add link by object reference and path.

Add link by object reference and path string.

Definition at line 70 of file LinkManager.cpp.

70  {
71  long n = 0;
72  for ( LinkVector::const_iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
73  Link* lnk = *i;
74  const DataObject* pO = lnk->object();
75  if ( 0 != pO && pO == pObject ) {
76  return n;
77  }
78  bool same_path = lnk->path() == path;
79  if ( same_path ) {
80  if ( 0 != pObject && pObject != pO ) {
81  lnk->setObject(pObject);
82  }
83  return n;
84  }
85  n++;
86  }
87  // Link is completely unknown
88  Link* link = new Link(m_linkVector.size(), path, pObject);
89  m_linkVector.push_back( link );
90  return link->ID();
91 }
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
list i
Definition: ana.py:128
void LinkManager::clearLinks ( )

Remove all possibly existing symbolic links.

Definition at line 131 of file LinkManager.cpp.

131  {
132  for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
133  delete (*i);
134  }
135  m_linkVector.erase(m_linkVector.begin(), m_linkVector.end());
136 }
list i
Definition: ana.py:128
LinkManager::Link * LinkManager::link ( long  id)

Retrieve symbolic link identified by ID.

Definition at line 41 of file LinkManager.cpp.

41  {
42  return (0<=id && (unsigned)id < m_linkVector.size()) ? m_linkVector[id] : 0;
43 }
LinkManager::Link * LinkManager::link ( const DataObject pObject)

Retrieve symbolic link identified by object.

Retrieve symbolic link identified by Object pointer.

Definition at line 46 of file LinkManager.cpp.

46  {
47  if ( 0 != pObject ) {
48  for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
49  if ( (*i)->object() == pObject ) {
50  return (*i);
51  }
52  }
53  }
54  return 0;
55 }
list i
Definition: ana.py:128
LinkManager::Link * LinkManager::link ( const std::string &  path)

Retrieve symbolic link identified by path.

Retrieve symbolic link identified by Object path.

Definition at line 58 of file LinkManager.cpp.

58  {
59  if ( 0 != path.length() ) {
60  for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
61  if ( (*i)->path() == path ) {
62  return (*i);
63  }
64  }
65  }
66  return 0;
67 }
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
list i
Definition: ana.py:128
LinkManager * LinkManager::newInstance ( )
static

Static instantiation.

Definition at line 27 of file LinkManager.cpp.

27  {
28  return s_newInstance ? (*s_newInstance)() : new LinkManager();
29 }
long LinkManager::removeLink ( const DataObject pObject) const

Remove link by object reference.

Definition at line 94 of file LinkManager.cpp.

94  {
95  long n = 0;
96  for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
97  if ( (*i)->object() == pObject ) {
98  delete (*i);
99  m_linkVector.erase(i);
100  return n;
101  }
102  n++;
103  }
104  return INVALID;
105 }
list i
Definition: ana.py:128
long LinkManager::removeLink ( const std::string &  fullPath) const

Remove link by object reference.

Definition at line 108 of file LinkManager.cpp.

108  {
109  long n = 0;
110  for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
111  if ( (*i)->path() == path ) {
112  delete (*i);
113  m_linkVector.erase(i);
114  return n;
115  }
116  n++;
117  }
118  return INVALID;
119 }
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
list i
Definition: ana.py:128
long LinkManager::removeLink ( long  id) const

Remove link by link ID.

Definition at line 122 of file LinkManager.cpp.

122  {
123  LinkVector::iterator i = m_linkVector.begin();
124  i += id;
125  delete (*i);
126  m_linkVector.erase(i);
127  return id;
128 }
list i
Definition: ana.py:128
void LinkManager::setInstantiator ( LinkManager *(*)()  newInstance)
static

Assign new instantiator.

Definition at line 22 of file LinkManager.cpp.

22  {
23  s_newInstance = newInstance;
24 }
long LinkManager::size ( ) const
inline

Retrieve number of link present.

Definition at line 107 of file LinkManager.h.

107  {
108  return m_linkVector.size();
109  }

Member Data Documentation

LinkVector LinkManager::m_linkVector
mutable

The vector containing all links which are non-tree like.

Definition at line 95 of file LinkManager.h.


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