CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

edm::detail::ThreadSafeIndexedRegistry< T, E > Class Template Reference

#include <ThreadSafeIndexedRegistry.h>

List of all members.

Public Types

typedef std::vector< value_typecollection_type
typedef
collection_type::const_iterator 
const_iterator
typedef E extra_type
typedef collection_type::size_type size_type
typedef T value_type

Public Member Functions

const_iterator begin () const
collection_typedata ()
 Provide access to the contained collection.
collection_type const & data () const
bool empty () const
 Return true if there are no contained value_type objects.
const_iterator end () const
extra_type const & extra () const
extra_typeextra ()
void getMapped (size_type index, value_type &result) const
void insertCollection (collection_type const &c)
bool insertMapped (value_type const &v)
bool notEmpty () const
 Return true if there are any contained value_type objects.
void print (std::ostream &os) const
 Print the contents of this registry to the given ostream.
size_type size () const
 Return the number of contained value_type objects.

Static Public Member Functions

static ThreadSafeIndexedRegistryinstance ()

Private Member Functions

ThreadSafeIndexedRegistry< T, E > & operator= (ThreadSafeIndexedRegistry< T, E > const &)
 ThreadSafeIndexedRegistry ()
 ThreadSafeIndexedRegistry (ThreadSafeIndexedRegistry< T, E > const &)
 ~ThreadSafeIndexedRegistry ()

Private Attributes

collection_type data_
extra_type extra_

Static Private Attributes

static ThreadSafeIndexedRegistryinstance_ = 0
static boost::mutex registry_mutex

Detailed Description

template<typename T, typename E = Empty>
class edm::detail::ThreadSafeIndexedRegistry< T, E >

Definition at line 23 of file ThreadSafeIndexedRegistry.h.


Member Typedef Documentation

template<typename T, typename E = Empty>
typedef std::vector<value_type> edm::detail::ThreadSafeIndexedRegistry< T, E >::collection_type

Definition at line 27 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
typedef collection_type::const_iterator edm::detail::ThreadSafeIndexedRegistry< T, E >::const_iterator

Definition at line 30 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
typedef E edm::detail::ThreadSafeIndexedRegistry< T, E >::extra_type

Definition at line 26 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
typedef collection_type::size_type edm::detail::ThreadSafeIndexedRegistry< T, E >::size_type

Definition at line 28 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
typedef T edm::detail::ThreadSafeIndexedRegistry< T, E >::value_type

Definition at line 25 of file ThreadSafeIndexedRegistry.h.


Constructor & Destructor Documentation

template<typename T , typename E >
edm::detail::ThreadSafeIndexedRegistry< T, E >::ThreadSafeIndexedRegistry ( ) [private]

Definition at line 223 of file ThreadSafeIndexedRegistry.h.

                                                               : 
      data_()
    { }
template<typename T , typename E >
edm::detail::ThreadSafeIndexedRegistry< T, E >::~ThreadSafeIndexedRegistry ( ) [private]

Definition at line 229 of file ThreadSafeIndexedRegistry.h.

    { }
template<typename T, typename E = Empty>
edm::detail::ThreadSafeIndexedRegistry< T, E >::ThreadSafeIndexedRegistry ( ThreadSafeIndexedRegistry< T, E > const &  ) [private]

Member Function Documentation

template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::const_iterator edm::detail::ThreadSafeIndexedRegistry< T, E >::begin ( void  ) const [inline]

Allow iteration through the contents of the registry. Only const access is provided to the entries of the registry.

Definition at line 174 of file ThreadSafeIndexedRegistry.h.

                                                 {
      return data_.begin();
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::collection_type & edm::detail::ThreadSafeIndexedRegistry< T, E >::data ( ) [inline]

Provide access to the contained collection.

Definition at line 197 of file ThreadSafeIndexedRegistry.h.

Referenced by edm::BranchIDListHelper::clearRegistries(), edm::BranchIDListHelper::updateFromInput(), and edm::BranchIDListHelper::updateRegistries().

                                          {
      return data_;
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::collection_type const & edm::detail::ThreadSafeIndexedRegistry< T, E >::data ( ) const [inline]

Definition at line 218 of file ThreadSafeIndexedRegistry.h.

                                                {
      return data_;
    }
template<typename T , typename E >
bool edm::detail::ThreadSafeIndexedRegistry< T, E >::empty ( void  ) const [inline]

Return true if there are no contained value_type objects.

Definition at line 153 of file ThreadSafeIndexedRegistry.h.

                                                 {
      return data_.empty();
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::const_iterator edm::detail::ThreadSafeIndexedRegistry< T, E >::end ( void  ) const [inline]

Definition at line 181 of file ThreadSafeIndexedRegistry.h.

                                               {
      return data_.end();
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::extra_type & edm::detail::ThreadSafeIndexedRegistry< T, E >::extra ( ) [inline]

Provide access to the appendage "extra". The ThreadSafeIndexedRegistry doesn't know what this is for, but instantiations of the template can use it.

Definition at line 204 of file ThreadSafeIndexedRegistry.h.

Referenced by edm::BranchIDListHelper::clearRegistries(), edm::BranchIDListHelper::fixBranchListIndexes(), edm::BranchIDListHelper::updateFromInput(), and edm::BranchIDListHelper::updateRegistries().

                                           {
      return extra_;
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::extra_type const & edm::detail::ThreadSafeIndexedRegistry< T, E >::extra ( ) const [inline]

Definition at line 211 of file ThreadSafeIndexedRegistry.h.

                                                 {
      return extra_;
    }
template<typename T , typename E >
void edm::detail::ThreadSafeIndexedRegistry< T, E >::getMapped ( size_type  index,
value_type result 
) const

Retrieve the value_type object with the given index. If we return 'true', then 'result' carries the value_type object. If we return 'false, no matching index was found, and the value of 'result' is undefined.

Definition at line 129 of file ThreadSafeIndexedRegistry.h.

References gen::k, and CommonMethods::lock().

                                                                                    {
      boost::mutex::scoped_lock lock(registry_mutex);
      result = data_[k];
    }
template<typename T , typename E >
void edm::detail::ThreadSafeIndexedRegistry< T, E >::insertCollection ( collection_type const &  c)

put the value_type objects in the given collection into the registry.

Definition at line 144 of file ThreadSafeIndexedRegistry.h.

                                                                              {
      for (typename collection_type::const_iterator it = c.begin(), itEnd = c.end(); it != itEnd; ++it) {
        insertMapped(*it);
      }
    }
template<typename T , typename E >
bool edm::detail::ThreadSafeIndexedRegistry< T, E >::insertMapped ( value_type const &  v)

put the given value_type object into the registry.

Definition at line 136 of file ThreadSafeIndexedRegistry.h.

References CommonMethods::lock().

Referenced by edm::BranchIDListHelper::updateFromInput(), and edm::BranchIDListHelper::updateRegistries().

                                                                     {
      boost::mutex::scoped_lock lock(registry_mutex);
      data_.push_back(v);
      return true;
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E > * edm::detail::ThreadSafeIndexedRegistry< T, E >::instance ( ) [static]
template<typename T , typename E >
bool edm::detail::ThreadSafeIndexedRegistry< T, E >::notEmpty ( ) const [inline]

Return true if there are any contained value_type objects.

Definition at line 160 of file ThreadSafeIndexedRegistry.h.

References relativeConstraints::empty.

                                                    {
      return !empty();
    }
template<typename T, typename E = Empty>
ThreadSafeIndexedRegistry<T, E>& edm::detail::ThreadSafeIndexedRegistry< T, E >::operator= ( ThreadSafeIndexedRegistry< T, E > const &  ) [private]
template<typename T , typename E >
void edm::detail::ThreadSafeIndexedRegistry< T, E >::print ( std::ostream &  os) const

Print the contents of this registry to the given ostream.

Definition at line 187 of file ThreadSafeIndexedRegistry.h.

References begin, end, i, and findQualityFiles::size.

                                                               {
      os << "Registry with " << size() << " entries\n";
      for (const_iterator i = begin(), e = end(); i != e; ++i) {
          os << i - begin() << " " << i << '\n';
      }
    }
template<typename T , typename E >
ThreadSafeIndexedRegistry< T, E >::size_type edm::detail::ThreadSafeIndexedRegistry< T, E >::size ( void  ) const [inline]

Return the number of contained value_type objects.

Definition at line 167 of file ThreadSafeIndexedRegistry.h.

                                                {
      return data_.size();
    }

Member Data Documentation

template<typename T, typename E = Empty>
collection_type edm::detail::ThreadSafeIndexedRegistry< T, E >::data_ [private]

Definition at line 86 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
extra_type edm::detail::ThreadSafeIndexedRegistry< T, E >::extra_ [private]

Definition at line 87 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
ThreadSafeIndexedRegistry< T, E > * edm::detail::ThreadSafeIndexedRegistry< T, E >::instance_ = 0 [static, private]

Definition at line 89 of file ThreadSafeIndexedRegistry.h.

template<typename T, typename E = Empty>
boost::mutex edm::detail::ThreadSafeIndexedRegistry< T, E >::registry_mutex [static, private]

Definition at line 91 of file ThreadSafeIndexedRegistry.h.