CMS 3D CMS Logo

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

ora::QueryableVector< Tp > Class Template Reference

#include <QueryableVector.h>

Inheritance diagram for ora::QueryableVector< Tp >:
ora::LoaderClient

List of all members.

Public Types

typedef CIterator< Tp > const_iterator
typedef const Tp & const_reference
typedef CRIterator< Tp > const_reverse_iterator
typedef Iterator< Tp > iterator
typedef Query< Tp > pquery
typedef Range< Tp > prange
typedef Tp & reference
typedef RIterator< Tp > reverse_iterator
typedef QueryableVectorData
< Tp >::store_base_type 
store_base_type
typedef QueryableVectorData
< Tp >::store_item_type 
store_item_type
typedef QueryableVectorData
< Tp >::store_type 
store_type
typedef std::vector< Tp >
::value_type 
value_type

Public Member Functions

void assign (size_t n, const Tp &u)
reference at (size_t n)
const_reference at (size_t n) const
const_reference back () const
reference back ()
const_iterator begin () const
iterator begin ()
size_t capacity () const
void clear ()
bool empty () const
iterator end ()
const_iterator end () const
reference front ()
const_reference front () const
bool isLocked () const
void load () const
bool lock ()
size_t max_size () const
bool operator!= (const QueryableVector &vec) const
QueryableVector< Tp > & operator= (const QueryableVector< Tp > &rhs)
bool operator== (const QueryableVector &vec) const
reference operator[] (size_t n)
const_reference operator[] (size_t n) const
size_t persistentSize () const
void pop_back ()
void push_back (const Tp &x)
Query< Tp > query () const
 QueryableVector ()
 QueryableVector (size_t n, const Tp &value=Tp())
 QueryableVector (const QueryableVector< Tp > &rhs)
reverse_iterator rbegin ()
const_reverse_iterator rbegin () const
const_reverse_iterator rend () const
reverse_iterator rend ()
void reserve (size_t n)
void reset ()
void resize (size_t n, const Tp &value=Tp())
Range< Tp > select (int startIndex, int endIndex=Selection::endOfRange) const
Range< Tp > select (const Selection &sel) const
size_t size () const
const void * storageAddress () const
virtual ~QueryableVector ()

Private Member Functions

void initialize () const

Private Attributes

boost::shared_ptr
< QueryableVectorData< Tp > > 
m_data
bool m_isLoaded
bool m_isLocked

Detailed Description

template<typename Tp>
class ora::QueryableVector< Tp >

Definition at line 65 of file QueryableVector.h.


Member Typedef Documentation

template<typename Tp>
typedef CIterator<Tp> ora::QueryableVector< Tp >::const_iterator

Definition at line 73 of file QueryableVector.h.

template<typename Tp>
typedef const Tp& ora::QueryableVector< Tp >::const_reference

Definition at line 71 of file QueryableVector.h.

template<typename Tp>
typedef CRIterator<Tp> ora::QueryableVector< Tp >::const_reverse_iterator

Definition at line 75 of file QueryableVector.h.

template<typename Tp>
typedef Iterator<Tp> ora::QueryableVector< Tp >::iterator

Definition at line 72 of file QueryableVector.h.

template<typename Tp>
typedef Query<Tp> ora::QueryableVector< Tp >::pquery

Definition at line 78 of file QueryableVector.h.

template<typename Tp>
typedef Range<Tp> ora::QueryableVector< Tp >::prange

Definition at line 79 of file QueryableVector.h.

template<typename Tp>
typedef Tp& ora::QueryableVector< Tp >::reference

Definition at line 70 of file QueryableVector.h.

template<typename Tp>
typedef RIterator<Tp> ora::QueryableVector< Tp >::reverse_iterator

Definition at line 74 of file QueryableVector.h.

template<typename Tp>
typedef QueryableVectorData<Tp>::store_base_type ora::QueryableVector< Tp >::store_base_type

Definition at line 81 of file QueryableVector.h.

template<typename Tp>
typedef QueryableVectorData<Tp>::store_item_type ora::QueryableVector< Tp >::store_item_type

Definition at line 80 of file QueryableVector.h.

template<typename Tp>
typedef QueryableVectorData<Tp>::store_type ora::QueryableVector< Tp >::store_type

Definition at line 82 of file QueryableVector.h.

template<typename Tp>
typedef std::vector<Tp>::value_type ora::QueryableVector< Tp >::value_type

Definition at line 76 of file QueryableVector.h.


Constructor & Destructor Documentation

template<class Tp >
ora::QueryableVector< Tp >::QueryableVector ( )

Definition at line 71 of file QueryableVectorImpl.h.

                                                           :LoaderClient(),m_data(new QueryableVectorData<Tp>),m_isLocked(false),m_isLoaded(false){
}
template<class Tp >
ora::QueryableVector< Tp >::QueryableVector ( size_t  n,
const Tp &  value = Tp() 
) [explicit]

Definition at line 74 of file QueryableVectorImpl.h.

                                                                                    :LoaderClient(),m_data(new QueryableVectorData<Tp>(n,value)),m_isLocked(false),m_isLoaded(false){
}
template<class Tp >
ora::QueryableVector< Tp >::QueryableVector ( const QueryableVector< Tp > &  rhs)

Definition at line 77 of file QueryableVectorImpl.h.

                                                                                         :LoaderClient(rhs),m_data(rhs.m_data),m_isLocked(rhs.m_isLocked),m_isLoaded(rhs.m_isLoaded){
}
template<class Tp >
ora::QueryableVector< Tp >::~QueryableVector ( ) [virtual]

Definition at line 80 of file QueryableVectorImpl.h.

                                                            {
}

Member Function Documentation

template<class Tp >
void ora::QueryableVector< Tp >::assign ( size_t  n,
const Tp &  u 
)

Definition at line 233 of file QueryableVectorImpl.h.

                                                                                {
  m_data->assign(n,u);
}
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::at ( size_t  n)

Definition at line 212 of file QueryableVectorImpl.h.

References n.

                                                                                                  {
  initialize();
  return m_data->operator[](n);
}
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::at ( size_t  n) const

Definition at line 207 of file QueryableVectorImpl.h.

References n.

                                                                                                              {
  initialize();
  return m_data->operator[](n);
}
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::back ( )

Definition at line 225 of file QueryableVectorImpl.h.

                                                                                            {
  return m_data->back();
}
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::back ( ) const

Definition at line 229 of file QueryableVectorImpl.h.

                                                                                                        {
  return m_data->back();
}
template<class Tp >
ora::QueryableVector< Tp >::iterator ora::QueryableVector< Tp >::begin ( void  )

Definition at line 131 of file QueryableVectorImpl.h.

                                                                                         {
  initialize();
  return m_data->begin();
}
template<class Tp >
ora::QueryableVector< Tp >::const_iterator ora::QueryableVector< Tp >::begin ( void  ) const

Definition at line 141 of file QueryableVectorImpl.h.

                                                                                                      {
  initialize();
  return m_data->cbegin();
}
template<class Tp >
size_t ora::QueryableVector< Tp >::capacity ( ) const

Definition at line 184 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::capacity().

Referenced by ora::QueryableVector< Tp >::capacity().

                                                                  {
  return m_data->capacity();
}
template<class Tp >
void ora::QueryableVector< Tp >::clear ( void  )

Definition at line 249 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::clear().

Referenced by ora::QueryableVector< Tp >::clear().

                                                        {
  m_data->clear();
  m_isLoaded = false;
}
template<class Tp >
bool ora::QueryableVector< Tp >::empty ( ) const

Definition at line 188 of file QueryableVectorImpl.h.

                                                             {
  initialize();
  return m_data->empty();
}
template<class Tp >
ora::QueryableVector< Tp >::iterator ora::QueryableVector< Tp >::end ( void  )

Definition at line 136 of file QueryableVectorImpl.h.

                                                                                       {
  initialize();
  return m_data->end();
}
template<class Tp >
ora::QueryableVector< Tp >::const_iterator ora::QueryableVector< Tp >::end ( void  ) const

Definition at line 146 of file QueryableVectorImpl.h.

                                                                                                    {
  initialize();
  return m_data->cend();
}
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::front ( )

Definition at line 217 of file QueryableVectorImpl.h.

                                                                                             {
  return m_data->front();
}
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::front ( ) const

Definition at line 221 of file QueryableVectorImpl.h.

                                                                                                         {
  return m_data->front();
}
template<class Tp >
void ora::QueryableVector< Tp >::initialize ( ) const [private]

Definition at line 286 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::load().

Referenced by ora::QueryableVector< Tp >::operator!=(), and ora::QueryableVector< Tp >::operator==().

                                                                  {
  if(hasLoader() && !m_isLocked && !m_isLoaded){
    loader()->load(const_cast<void*>(m_data->storageAddress()));
    m_isLoaded = true;
  }
}
template<class Tp >
bool ora::QueryableVector< Tp >::isLocked ( ) const

Definition at line 127 of file QueryableVectorImpl.h.

                                                                {
  return m_isLocked;
}
template<class Tp >
void ora::QueryableVector< Tp >::load ( ) const

Definition at line 282 of file QueryableVectorImpl.h.

Referenced by ora::QueryableVector< Tp >::initialize().

                                                            {
  initialize();
}
template<class Tp >
bool ora::QueryableVector< Tp >::lock ( )

Definition at line 121 of file QueryableVectorImpl.h.

                                                      {
  bool wasLocked = m_isLocked;
  m_isLocked = true;
  return wasLocked;
}
template<class Tp >
size_t ora::QueryableVector< Tp >::max_size ( ) const

Definition at line 175 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::max_size().

Referenced by ora::QueryableVector< Tp >::max_size().

                                                                  {
  return m_data->max_size();
}
template<class Tp >
bool ora::QueryableVector< Tp >::operator!= ( const QueryableVector< Tp > &  vec) const

Definition at line 266 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::initialize(), and ora::QueryableVector< Tp >::m_data.

                                                                                                   {
  initialize();
  vec.initialize();
  return m_data->operator!=(*vec.m_data);
}
template<class Tp >
ora::QueryableVector< Tp > & ora::QueryableVector< Tp >::operator= ( const QueryableVector< Tp > &  rhs)

Definition at line 83 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::m_data, ora::QueryableVector< Tp >::m_isLoaded, and ora::QueryableVector< Tp >::m_isLocked.

                                                                                                              {
  if(&rhs != this){
    m_data = rhs.m_data;
    m_isLocked = rhs.m_isLocked;
    m_isLoaded = rhs.m_isLoaded;
  }
  return *this;
}
template<class Tp >
bool ora::QueryableVector< Tp >::operator== ( const QueryableVector< Tp > &  vec) const

Definition at line 260 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::initialize(), and ora::QueryableVector< Tp >::m_data.

                                                                                                   {
  initialize();
  vec.initialize();
  return m_data->operator==(*vec.m_data);
}
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::operator[] ( size_t  n)

Definition at line 197 of file QueryableVectorImpl.h.

References n.

                                                                                                          {
  initialize();
  return m_data->operator[](n);
}
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::operator[] ( size_t  n) const

Definition at line 202 of file QueryableVectorImpl.h.

References n.

                                                                                                                       {
  initialize();
  return m_data->operator[](n);
}
template<class Tp >
size_t ora::QueryableVector< Tp >::persistentSize ( ) const

Definition at line 272 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::persistentSize().

Referenced by ora::QueryableVector< Tp >::persistentSize().

                                                                        {
  // not sure needs init...
  //initialize();
  return m_data->persistentSize();
}
template<class Tp >
void ora::QueryableVector< Tp >::pop_back ( )

Definition at line 243 of file QueryableVectorImpl.h.

                                                          {
  initialize();
  m_isLocked = true;
  m_data->pop_back();
}
template<class Tp >
void ora::QueryableVector< Tp >::push_back ( const Tp &  x)

Definition at line 237 of file QueryableVectorImpl.h.

                                                                        {
  initialize();
  m_isLocked = true;
  m_data->push_back(x);
}
template<class Tp >
ora::Query< Tp > ora::QueryableVector< Tp >::query ( ) const

Definition at line 110 of file QueryableVectorImpl.h.

References ora::throwException().

                                                                    {
  if(m_isLocked ){
    throwException("The Vector is locked in writing mode, cannot make queries.","ora::QueryableVector<Tp>::query");
  }
  if(!hasLoader()){
    throwException("The Loader is not installed.","ora::QueryableVector<Tp>::query");
  }
  boost::shared_ptr<IVectorLoader> loaderH = loader();
  return Query<Tp>(loaderH);
}
template<class Tp >
ora::QueryableVector< Tp >::reverse_iterator ora::QueryableVector< Tp >::rbegin ( )

Definition at line 151 of file QueryableVectorImpl.h.

                                                                                                  {
  initialize();
  return m_data->rbegin();
}
template<class Tp >
ora::QueryableVector< Tp >::const_reverse_iterator ora::QueryableVector< Tp >::rbegin ( ) const

Definition at line 161 of file QueryableVectorImpl.h.

                                                                                                               {
  initialize();
  return m_data->crbegin();
}
template<class Tp >
ora::QueryableVector< Tp >::reverse_iterator ora::QueryableVector< Tp >::rend ( )

Definition at line 156 of file QueryableVectorImpl.h.

                                                                                                {
  initialize();
  return m_data->rend();
}
template<class Tp >
ora::QueryableVector< Tp >::const_reverse_iterator ora::QueryableVector< Tp >::rend ( ) const

Definition at line 166 of file QueryableVectorImpl.h.

                                                                                                             {
  return m_data->crend();
}
template<class Tp >
void ora::QueryableVector< Tp >::reserve ( size_t  n)

Definition at line 193 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::reserve().

Referenced by ora::QueryableVector< Tp >::reserve().

                                                                 {
  m_data->reserve(n);
}
template<class Tp >
void ora::QueryableVector< Tp >::reset ( void  )

Reimplemented from ora::LoaderClient.

Definition at line 254 of file QueryableVectorImpl.h.

                                                        {
  m_data->clear();
  m_isLoaded = false;
  m_isLocked = false;
}
template<class Tp >
void ora::QueryableVector< Tp >::resize ( size_t  n,
const Tp &  value = Tp() 
)

Definition at line 179 of file QueryableVectorImpl.h.

                                                                                {
  initialize();
  m_data->resize(n,value);
}
template<class Tp >
ora::Range< Tp > ora::QueryableVector< Tp >::select ( int  startIndex,
int  endIndex = Selection::endOfRange 
) const

Definition at line 92 of file QueryableVectorImpl.h.

References ora::Selection::addIndexItem(), runTheMatrix::sel, and benchmark_cfg::select.

                                                                                                  {
  Selection sel;
  sel.addIndexItem( startIndex, endIndex );
  return select( sel );
}
template<class Tp >
ora::Range< Tp > ora::QueryableVector< Tp >::select ( const Selection sel) const

Definition at line 98 of file QueryableVectorImpl.h.

References ora::throwException().

                                                                                             {
  if(m_isLocked ){
    throwException("The Vector is locked in writing mode, cannot make queries.","ora::QueryableVector<Tp>::select");
  }
  if(!hasLoader()){
    throwException("The Loader is not installed.","ora::QueryableVector<Tp>::select");
  }
  boost::shared_ptr<QueryableVectorData<Tp> > newData ( new QueryableVectorData<Tp> );
  loader()->loadSelection( sel, const_cast<void*>(newData->storageAddress()) );
  return Range<Tp>(newData);
}
template<class Tp >
size_t ora::QueryableVector< Tp >::size ( void  ) const

Definition at line 170 of file QueryableVectorImpl.h.

                                                              {
  initialize();
  return m_data->size();
}
template<class Tp >
const void * ora::QueryableVector< Tp >::storageAddress ( ) const

Definition at line 278 of file QueryableVectorImpl.h.

References ora::QueryableVector< Tp >::storageAddress().

Referenced by ora::QueryableVector< Tp >::storageAddress().

                                                                             {
  return m_data->storageAddress();
}

Member Data Documentation

template<typename Tp>
boost::shared_ptr<QueryableVectorData<Tp> > ora::QueryableVector< Tp >::m_data [private]
template<typename Tp>
bool ora::QueryableVector< Tp >::m_isLoaded [mutable, private]

Definition at line 190 of file QueryableVector.h.

Referenced by ora::QueryableVector< Tp >::operator=().

template<typename Tp>
bool ora::QueryableVector< Tp >::m_isLocked [private]

Definition at line 189 of file QueryableVector.h.

Referenced by ora::QueryableVector< Tp >::operator=().