Gaudi Framework, version v23r2

Home   Generated: Thu Jun 28 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:
Collaboration graph
[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.
Linklink (long id)
 Retrieve symbolic link identified by ID.
Linklink (const DataObject *pObject)
 Retrieve symbolic link identified by object.
Linklink (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 LinkManagernewInstance ()
 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

Data type: iterator over leaf links (CONST)

Definition at line 92 of file LinkManager.h.

Data type: iterator over leaf links.

Definition at line 90 of file LinkManager.h.

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.

                          {
}
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.

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.

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

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 23:27:42 for Gaudi Framework, version v23r2 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004