| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes

# 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:
[legend]

List of all members.

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

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

enum LinkManager::DirLinkType

Directory link types.

Enumerator:

  INVALID |
  VALID |

Definition at line 24 of file LinkManager.h.

    {INVALID, VALID};

## Constructor & Destructor Documentation

LinkManager::LinkManager | ( | ) |

Standard Constructor.

Definition at line 32 of file LinkManager.cpp.

                              {
    }

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

Standard Destructor.

Standard Constructor.

Definition at line 36 of file LinkManager.cpp.

                                 {
      clearLinks();
    }

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

                                                                                        {
      long n = 0;
      for ( LinkVector::const_iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
        Link* lnk = *i;
        const DataObject* pO = lnk->object();
        if ( 0 != pO && pO == pObject )   {
          return n;
        }
        bool same_path = lnk->path() == path;
        if ( same_path ) {
          if ( 0 != pObject && pObject != pO )  {
            lnk->setObject(pObject);
          }
          return n;
        }
        n++;
      }
      // Link is completely unknown
      Link* link = new Link(m_linkVector.size(), path, pObject);
      m_linkVector.push_back( link );
      return link->ID();
    }

void LinkManager::clearLinks | ( | ) |

Remove all possibly existing symbolic links.

Definition at line 131 of file LinkManager.cpp.

                                  {
      for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
        delete (*i);
      }
      m_linkVector.erase(m_linkVector.begin(), m_linkVector.end());
    }

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.

                                                                 {
      if ( 0 != pObject )   {
        for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
          if ( (*i)->object() == pObject )    {
            return (*i);
          }
        }
      }
      return 0;
    }

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

Retrieve symbolic link identified by ID.

Definition at line 41 of file LinkManager.cpp.

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

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.

                                                             {
      if ( 0 != path.length() )   {
        for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
          if ( (*i)->path() == path )    {
            return (*i);
          }
        }
      }
      return 0;
    }

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

Static instantiation.

Definition at line 27 of file LinkManager.cpp.

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

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

Remove link by object reference.

Definition at line 94 of file LinkManager.cpp.

                                                                  {
      long n = 0;
      for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
        if ( (*i)->object() == pObject )    {
          delete (*i);
          m_linkVector.erase(i);
          return n;
        }
        n++;
      }
      return INVALID;
    }

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

Remove link by link ID.

Definition at line 122 of file LinkManager.cpp.

                                                {
      LinkVector::iterator i = m_linkVector.begin();
      i += id;
      delete (*i);
      m_linkVector.erase(i);
      return id;
    }

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

Remove link by object reference.

Definition at line 108 of file LinkManager.cpp.

                                                              {
      long n = 0;
      for ( LinkVector::iterator i = m_linkVector.begin(); i != m_linkVector.end(); i++ )   {
        if ( (*i)->path() == path )    {
          delete (*i);
          m_linkVector.erase(i);
          return n;
        }
        n++;
      }
      return INVALID;
    }

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

Assign new instantiator.

Definition at line 22 of file LinkManager.cpp.

                                                                     {
      s_newInstance = newInstance;
    }

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

Retrieve number of link present.

Definition at line 107 of file LinkManager.h.

                            {
        return m_linkVector.size();
      }

## 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_v23r0/GaudiKernel/GaudiKernel/LinkManager.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiKernel/src/Lib/LinkManager.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines