| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# 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>`

List of all members.

## 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.
typedef LinkVector::const_iterator | ConstLinkIterator
| Data type: iterator over leaf links (CONST).
## Public Member Functions
| LinkManager ()
| Standard Constructor.
virtual | ~LinkManager ()
| Standard Destructor.
long | size () const
| Retrieve number of link present.
Link * | link (long id)
| Retrieve symbolic link identified by ID.
Link * | link (const DataObject *pObject)
| Retrieve symbolic link identified by object.
Link * | link (const std::string &path)
| Retrieve symbolic link identified by path.
long | addLink (const std::string &path, const DataObject *pObject) const
| Add link by object reference and path.
long | removeLink (const DataObject *pObject) const
| Remove link by object reference.
long | removeLink (const std::string &fullPath) const
| Remove link by object reference.
long | removeLink (long id) const
| Remove link by link ID.
void | clearLinks ()
| Remove all possibly existing symbolic links.
## Static Public Member Functions
static LinkManager * | newInstance ()
| Static instantiation.
static void | setInstantiator (LinkManager *(*newInstance)())
| Assign new instantiator.
## Public Attributes
LinkVector | m_linkVector
| The vector containing all links which are non-tree like.
## Classes
class | Link
| Embedded class defining a symbolic link Note: No copy constructor; bitwise copy (done by the compiler) is just fine. 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 std::vector<Link*> LinkManager::LinkVector

Definition at line 88 of file LinkManager.h.

typedef LinkVector::iterator LinkManager::LinkIterator

Data type: iterator over leaf links.

Definition at line 90 of file LinkManager.h.

typedef LinkVector::const_iterator LinkManager::ConstLinkIterator

Data type: iterator over leaf links (CONST).

Definition at line 92 of file LinkManager.h.

## Member Enumeration Documentation

enum LinkManager::DirLinkType

Directory link types.

Enumerator:

  INVALID |
  VALID |

Definition at line 24 of file LinkManager.h.

    00024 {INVALID, VALID};

## Constructor & Destructor Documentation

LinkManager::LinkManager | ( |  | ) |

Standard Constructor.

Definition at line 32 of file LinkManager.cpp.

    00032                           {
    00033 }

LinkManager::~LinkManager | ( |  | ) | `[virtual]`

Standard Destructor.

Standard Constructor.

Definition at line 36 of file LinkManager.cpp.

    00036                              {
    00037   clearLinks();
    00038 }

## Member Function Documentation

LinkManager * LinkManager::newInstance | ( |  | ) | `[static]`

Static instantiation.

Definition at line 27 of file LinkManager.cpp.

    00027                                        {
    00028   return s_newInstance ? (*s_newInstance)() : new LinkManager();
    00029 }

void LinkManager::setInstantiator | ( | LinkManager *(*)() | newInstance | ) | `[static]`

Assign new instantiator.

Definition at line 22 of file LinkManager.cpp.

    00022                                                                  {
    00023   s_newInstance = newInstance;
    00024 }

long LinkManager::size | ( |  | ) | const`[inline]`

Retrieve number of link present.

Definition at line 107 of file LinkManager.h.

    00107                         {
    00108     return m_linkVector.size();
    00109   }

LinkManager::Link * LinkManager::link | ( | long | id | ) |

Retrieve symbolic link identified by ID.

Definition at line 41 of file LinkManager.cpp.

    00041                                              {
    00042   return (0<=id && (unsigned)id < m_linkVector.size()) ? m_linkVector[id] : 0;
    00043 }

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.

    00046                                                              {
    00047   if ( 0 != pObject )   {
    00048     for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
    00049       if ( (*i)->object() == pObject )    {
    00050         return (*i);
    00051       }
    00052     }
    00053   }
    00054   return 0;
    00055 }

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.

    00058                                                          {
    00059   if ( 0 != path.length() )   {
    00060     for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
    00061       if ( (*i)->path() == path )    {
    00062         return (*i);
    00063       }
    00064     }
    00065   }
    00066   return 0;
    00067 }

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.

    00070                                                                                     {
    00071   long n = 0;
    00072   for ( LinkVector::const_iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
    00073     Link* lnk = *i;
    00074     const DataObject* pO = lnk->object();
    00075     if ( 0 != pO && pO == pObject )   {
    00076       return n;
    00077     }
    00078     bool same_path = lnk->path() == path;
    00079     if ( same_path ) {
    00080       if ( 0 != pObject && pObject != pO )  {
    00081         lnk->setObject(pObject);
    00082       }
    00083       return n;
    00084     }
    00085     n++;
    00086   }
    00087   // Link is completely unknown
    00088   Link* link = new Link(m_linkVector.size(), path, pObject);
    00089   m_linkVector.push_back( link );
    00090   return link->ID();
    00091 }

long LinkManager::removeLink | ( | const DataObject * | pObject | ) | const

Remove link by object reference.

Definition at line 94 of file LinkManager.cpp.

    00094                                                               {
    00095   long n = 0;
    00096   for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
    00097     if ( (*i)->object() == pObject )    {
    00098       delete (*i);
    00099       m_linkVector.erase(i);
    00100       return n;
    00101     }
    00102     n++;
    00103   }
    00104   return INVALID;
    00105 }

long LinkManager::removeLink | ( | const std::string & | fullPath | ) | const

Remove link by object reference.

Definition at line 108 of file LinkManager.cpp.

    00108                                                           {
    00109   long n = 0;
    00110   for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
    00111     if ( (*i)->path() == path )    {
    00112       delete (*i);
    00113       m_linkVector.erase(i);
    00114       return n;
    00115     }
    00116     n++;
    00117   }
    00118   return INVALID;
    00119 }

long LinkManager::removeLink | ( | long | id | ) | const

Remove link by link ID.

Definition at line 122 of file LinkManager.cpp.

    00122                                             {
    00123   LinkVector::iterator i = m_linkVector.begin();
    00124   i += id;
    00125   delete (*i);
    00126   m_linkVector.erase(i);
    00127   return id;
    00128 }

void LinkManager::clearLinks | ( |  | ) |

Remove all possibly existing symbolic links.

Definition at line 131 of file LinkManager.cpp.

    00131                               {
    00132   for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
    00133     delete (*i);
    00134   }
    00135   m_linkVector.erase(m_linkVector.begin(), m_linkVector.end());
    00136 }

## 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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiKernel/GaudiKernel/LinkManager.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiKernel/src/Lib/LinkManager.cpp