Source

mana-core-sgcomps / src / SGFolder.h

The default branch has multiple heads

Full commit
#ifndef SGTOOLS_FOLDER_H
#define SGTOOLS_FOLDER_H
  /** @file SGFolder.h
   * @brief a run-time configurable list of data objects
   *
   * @author pcalafiura@lbl.gov - ATLAS Collaboration
   * $Id: SGFolder.h,v 1.4 2007-08-23 22:48:15 calaf Exp $
   **/

#include <string>

#include "GaudiKernel/AlgTool.h"
#include "GaudiKernel/ServiceHandle.h"

#include "SGTools/SGIFolder.h"

#include "AthenaKernel/IClassIDSvc.h"

namespace SG {

  /** @class Folder
   * @brief a run-time configurable list of data objects
   * @details the ItemList property, used to initialize the folder, is a
   * list of class name (or clid)/key pairs.
   * One can use '*' as key value to add all objects of a given type 
   * to the Folder.
   * Examples:
   @code
    ItemList = [ "DataHeader#*", "AthenaAttributeList#SimpleTag", "8101/Foo" ]
   @endcode
   **/
  class Folder : public virtual IFolder, public virtual AlgTool
  {
  public:
    /// \name structors
    //@{
    Folder(const std::string& name, 
	   const std::string& type,
	   const IInterface* parent);
    virtual ~Folder() {};
    //@}

    /// the list we manage
    typedef IFolder::ItemList ItemList;

    /// \name access the ItemList
    //@{
    typedef IFolder::const_iterator const_iterator;
    virtual const_iterator begin() const { return m_list.begin(); }
    virtual const_iterator end() const { return m_list.end(); }
    //@}

    ///add a data object identifier to the list
    virtual StatusCode add(const std::string& typeName, const std::string& skey);
    ///add a data object identifier to the list
    virtual StatusCode add(const CLID& clid, const std::string& skey);

    /// \name AlgTool boilerplate 
    //@{
    virtual StatusCode initialize();
    /// Query for a given interface
    virtual StatusCode queryInterface(const InterfaceID& , void** ); 
    //@}

  private:
    ServiceHandle<IClassIDSvc> m_pCLIDSvc;
    /// property: the list of items (data objects identified by a class name/key pair)
    StringArrayProperty m_itemList;
    void decodeItemList(Property&);
    void decodeItem(std::string); //FIXME
    ItemList m_list; 
    /// property: check if item types are known to ClassIDSvc
    BooleanProperty m_checkItems;

  };
} //ns SG

#endif