CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
ora::QueryableVector< Tp > Class Template Reference

#include <QueryableVector.h>

Public Types

typedef PVector< Tp >
::const_iterator 
const_iterator
 
typedef PVector< Tp >
::const_reference 
const_reference
 
typedef PVector< Tp >
::const_reverse_iterator 
const_reverse_iterator
 
typedef PVector< Tp >::iterator iterator
 
typedef std::vector< std::pair
< size_t, Tp > > 
range_store_base_type
 
typedef PVector< Tp >::reference reference
 
typedef PVector< Tp >
::reverse_iterator 
reverse_iterator
 
typedef PVector< Tp >::size_type size_type
 
typedef PVector< Tp > store_base_type
 
typedef PVector< 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
 
reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
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
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
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
< store_base_type
m_data
 
bool m_isLoaded
 
bool m_isLocked
 
boost::shared_ptr< IVectorLoaderm_loader
 

Detailed Description

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

Definition at line 162 of file QueryableVector.h.

Member Typedef Documentation

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

Definition at line 170 of file QueryableVector.h.

template<typename Tp>
typedef PVector<Tp>::const_reference ora::QueryableVector< Tp >::const_reference

Definition at line 168 of file QueryableVector.h.

Definition at line 172 of file QueryableVector.h.

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

Definition at line 171 of file QueryableVector.h.

template<typename Tp>
typedef std::vector<std::pair<size_t,Tp> > ora::QueryableVector< Tp >::range_store_base_type

Definition at line 179 of file QueryableVector.h.

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

Definition at line 169 of file QueryableVector.h.

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

Definition at line 173 of file QueryableVector.h.

template<typename Tp>
typedef PVector<Tp>::size_type ora::QueryableVector< Tp >::size_type

Definition at line 167 of file QueryableVector.h.

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

Definition at line 177 of file QueryableVector.h.

template<typename Tp>
typedef PVector<Tp>::value_type ora::QueryableVector< Tp >::value_type

Definition at line 174 of file QueryableVector.h.

Constructor & Destructor Documentation

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

Definition at line 191 of file QueryableVectorImpl.h.

191  :
192  m_data(new PVector<Tp>),
193  m_isLocked(false),
194  m_isLoaded(false),
195  m_loader(){
196 }
boost::shared_ptr< IVectorLoader > m_loader
boost::shared_ptr< store_base_type > m_data
template<class Tp>
ora::QueryableVector< Tp >::QueryableVector ( size_t  n,
const Tp &  value = Tp() 
)
explicit

Definition at line 198 of file QueryableVectorImpl.h.

198  :
199  m_data(new PVector<Tp>(n,value)),
200  m_isLocked(false),
201  m_isLoaded(false),
202  m_loader(){
203 }
boost::shared_ptr< IVectorLoader > m_loader
boost::shared_ptr< store_base_type > m_data
template<class Tp>
ora::QueryableVector< Tp >::QueryableVector ( const QueryableVector< Tp > &  rhs)

Definition at line 205 of file QueryableVectorImpl.h.

205  :
206  m_data(rhs.m_data),
207  m_isLocked(rhs.m_isLocked),
208  m_isLoaded(rhs.m_isLoaded),
209  m_loader( rhs.m_loader ){
210 }
boost::shared_ptr< IVectorLoader > m_loader
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::~QueryableVector ( )
virtual

Definition at line 212 of file QueryableVectorImpl.h.

212  {
213 }

Member Function Documentation

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

Definition at line 373 of file QueryableVectorImpl.h.

References initialize().

373  {
374  initialize();
375  m_data->assign(n,u);
376 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::at ( size_t  n)

Definition at line 349 of file QueryableVectorImpl.h.

References initialize(), and gen::n.

349  {
350  initialize();
351  return m_data->operator[](n);
352 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::at ( size_t  n) const

Definition at line 344 of file QueryableVectorImpl.h.

References initialize(), and gen::n.

344  {
345  initialize();
346  return m_data->operator[](n);
347 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::back ( )

Definition at line 364 of file QueryableVectorImpl.h.

Referenced by cond::ExportIOVUtilities::execute(), and cond::IOVImportIterator::setUp().

364  {
365  return m_data->back();
366 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::back ( ) const

Definition at line 368 of file QueryableVectorImpl.h.

References initialize().

368  {
369  initialize();
370  return m_data->back();
371 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::iterator ora::QueryableVector< Tp >::begin ( void  )

Definition at line 264 of file QueryableVectorImpl.h.

References initialize().

Referenced by cond::IOVImportIterator::setUp(), cond::IOVSequence::sortMe(), cond::IOVSequence::swapOIds(), and cond::IOVSequence::swapTokens().

264  {
265  initialize();
266  return m_data->begin();
267 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_iterator ora::QueryableVector< Tp >::begin ( void  ) const

Definition at line 274 of file QueryableVectorImpl.h.

References initialize().

274  {
275  initialize();
276  return m_data->begin();
277 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
size_t ora::QueryableVector< Tp >::capacity ( ) const

Definition at line 319 of file QueryableVectorImpl.h.

References initialize().

319  {
320  initialize();
321  return m_data->capacity();
322 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
void ora::QueryableVector< Tp >::clear ( void  )
template<class Tp >
bool ora::QueryableVector< Tp >::empty ( ) const

Definition at line 324 of file QueryableVectorImpl.h.

References initialize().

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), Vispa.Gui.VispaWidget.TextField::setAutotruncate(), and cond::IOVImportIterator::setUp().

324  {
325  initialize();
326  return m_data->empty();
327 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::iterator ora::QueryableVector< Tp >::end ( void  )
template<class Tp >
ora::QueryableVector< Tp >::const_iterator ora::QueryableVector< Tp >::end ( void  ) const

Definition at line 279 of file QueryableVectorImpl.h.

References initialize().

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

279  {
280  initialize();
281  return m_data->end();
282 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::front ( )

Definition at line 354 of file QueryableVectorImpl.h.

References initialize().

Referenced by cond::IOVSequence::firstSince().

354  {
355  initialize();
356  return m_data->front();
357 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::front ( ) const

Definition at line 359 of file QueryableVectorImpl.h.

References initialize().

359  {
360  initialize();
361  return m_data->front();
362 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
void ora::QueryableVector< Tp >::initialize ( ) const
private

Definition at line 429 of file QueryableVectorImpl.h.

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

429  {
430  if(m_loader.get() && !m_isLocked && !m_isLoaded){
431  m_loader->load(m_data.get());
432  m_isLoaded = true;
433  }
434 }
boost::shared_ptr< IVectorLoader > m_loader
boost::shared_ptr< store_base_type > m_data
template<class Tp >
bool ora::QueryableVector< Tp >::isLocked ( ) const

Definition at line 260 of file QueryableVectorImpl.h.

260  {
261  return m_isLocked;
262 }
template<class Tp >
void ora::QueryableVector< Tp >::load ( ) const
template<class Tp >
bool ora::QueryableVector< Tp >::lock ( )

Definition at line 254 of file QueryableVectorImpl.h.

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

Definition at line 309 of file QueryableVectorImpl.h.

References initialize().

309  {
310  initialize();
311  return m_data->max_size();
312 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
bool ora::QueryableVector< Tp >::operator!= ( const QueryableVector< Tp > &  vec) const

Definition at line 409 of file QueryableVectorImpl.h.

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

409  {
410  initialize();
411  vec.initialize();
412  return m_data->operator!=(*vec.m_data);
413 }
boost::shared_ptr< store_base_type > m_data
template<class Tp>
ora::QueryableVector< Tp > & ora::QueryableVector< Tp >::operator= ( const QueryableVector< Tp > &  rhs)

Definition at line 215 of file QueryableVectorImpl.h.

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

215  {
216  if(&rhs != this){
217  m_data = rhs.m_data;
218  m_isLocked = rhs.m_isLocked;
219  m_isLoaded = rhs.m_isLoaded;
220  m_loader = rhs.m_loader;
221  }
222  return *this;
223 }
boost::shared_ptr< IVectorLoader > m_loader
boost::shared_ptr< store_base_type > m_data
template<class Tp >
bool ora::QueryableVector< Tp >::operator== ( const QueryableVector< Tp > &  vec) const

Definition at line 403 of file QueryableVectorImpl.h.

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

403  {
404  initialize();
405  vec.initialize();
406  return m_data->operator==(*vec.m_data);
407 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::reference ora::QueryableVector< Tp >::operator[] ( size_t  n)

Definition at line 334 of file QueryableVectorImpl.h.

References initialize(), and gen::n.

334  {
335  initialize();
336  return m_data->operator[](n);
337 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_reference ora::QueryableVector< Tp >::operator[] ( size_t  n) const

Definition at line 339 of file QueryableVectorImpl.h.

References initialize(), and gen::n.

339  {
340  initialize();
341  return m_data->operator[](n);
342 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
size_t ora::QueryableVector< Tp >::persistentSize ( ) const

Definition at line 415 of file QueryableVectorImpl.h.

415  {
416  // not sure needs init...
417  //initialize();
418  return m_data->persistentSize();
419 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
void ora::QueryableVector< Tp >::pop_back ( )

Definition at line 384 of file QueryableVectorImpl.h.

References initialize().

Referenced by cond::IOVSequence::truncate().

384  {
385  initialize();
386  m_isLocked = true;
387  m_data->pop_back();
388 }
boost::shared_ptr< store_base_type > m_data
template<class Tp>
void ora::QueryableVector< Tp >::push_back ( const Tp &  x)

Definition at line 378 of file QueryableVectorImpl.h.

References initialize().

Referenced by cond::IOVSequence::add().

378  {
379  initialize();
380  m_isLocked = true;
381  m_data->push_back(x);
382 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::Query< Tp > ora::QueryableVector< Tp >::query ( ) const

Definition at line 244 of file QueryableVectorImpl.h.

References ora::throwException().

Referenced by production_tasks.BaseDataset::run(), and edmIntegrityCheck.IntegrityCheck::test().

244  {
245  if(m_isLocked ){
246  throwException("The Vector is locked in writing mode, cannot make queries.","ora::QueryableVector<Tp>::query");
247  }
248  if(!m_loader.get()){
249  throwException("The Loader is not installed.","ora::QueryableVector<Tp>::query");
250  }
251  return Query<Tp>(m_loader);
252 }
boost::shared_ptr< IVectorLoader > m_loader
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
template<class Tp >
ora::QueryableVector< Tp >::reverse_iterator ora::QueryableVector< Tp >::rbegin ( )

Definition at line 284 of file QueryableVectorImpl.h.

References initialize().

284  {
285  initialize();
286  return m_data->rbegin();
287 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_reverse_iterator ora::QueryableVector< Tp >::rbegin ( ) const

Definition at line 294 of file QueryableVectorImpl.h.

References initialize().

294  {
295  initialize();
296  return m_data->rbegin();
297 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::reverse_iterator ora::QueryableVector< Tp >::rend ( )

Definition at line 289 of file QueryableVectorImpl.h.

References initialize().

289  {
290  initialize();
291  return m_data->rend();
292 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
ora::QueryableVector< Tp >::const_reverse_iterator ora::QueryableVector< Tp >::rend ( ) const

Definition at line 299 of file QueryableVectorImpl.h.

References initialize().

299  {
300  initialize();
301  return m_data->rend();
302 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
void ora::QueryableVector< Tp >::reserve ( size_t  n)

Definition at line 329 of file QueryableVectorImpl.h.

References initialize().

329  {
330  initialize();
331  m_data->reserve(n);
332 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
void ora::QueryableVector< Tp >::reset ( void  )

Definition at line 396 of file QueryableVectorImpl.h.

References initialize().

Referenced by MatrixReader.MatrixReader::__init__(), and MatrixReader.MatrixReader::showRaw().

396  {
397  initialize();
398  m_data->clear();
399  m_isLoaded = false;
400  m_isLocked = false;
401 }
boost::shared_ptr< store_base_type > m_data
template<class Tp>
void ora::QueryableVector< Tp >::resize ( size_t  n,
const Tp &  value = Tp() 
)
template<class Tp >
ora::Range< Tp > ora::QueryableVector< Tp >::select ( int  startIndex,
int  endIndex = Selection::endOfRange 
) const
template<class Tp >
ora::Range< Tp > ora::QueryableVector< Tp >::select ( const Selection sel) const

Definition at line 231 of file QueryableVectorImpl.h.

References ora::throwException().

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

231  {
232  if(m_isLocked ){
233  throwException("The Vector is locked in writing mode, cannot make queries.","ora::QueryableVector<Tp>::select");
234  }
235  if(!m_loader.get()){
236  throwException("The Loader is not installed.","ora::QueryableVector<Tp>::select");
237  }
238  typedef typename Range<Tp>::store_base_type range_store_base_type;
239  boost::shared_ptr<range_store_base_type> newData ( new range_store_base_type );
240  m_loader->loadSelection( sel, newData.get());
241  return Range<Tp>(newData);
242 }
boost::shared_ptr< IVectorLoader > m_loader
std::vector< std::pair< size_t, Tp > > range_store_base_type
void throwException(const std::string &message, const std::string &methodName) __attribute__((noreturn))
Definition: Exception.cc:10
template<class Tp >
size_t ora::QueryableVector< Tp >::size ( void  ) const

Definition at line 304 of file QueryableVectorImpl.h.

References initialize().

Referenced by cond::IOVSequence::add(), cond::IOVElementProxy::set(), and cond::IOVSequence::truncate().

304  {
305  initialize();
306  return m_data->size();
307 }
boost::shared_ptr< store_base_type > m_data
template<class Tp >
const void * ora::QueryableVector< Tp >::storageAddress ( ) const

Definition at line 421 of file QueryableVectorImpl.h.

421  {
422  return m_data.get();
423 }
boost::shared_ptr< store_base_type > m_data

Member Data Documentation

template<typename Tp>
boost::shared_ptr<store_base_type> ora::QueryableVector< Tp >::m_data
private
template<typename Tp>
bool ora::QueryableVector< Tp >::m_isLoaded
mutableprivate

Definition at line 284 of file QueryableVector.h.

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

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

Definition at line 283 of file QueryableVector.h.

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

template<typename Tp>
boost::shared_ptr<IVectorLoader> ora::QueryableVector< Tp >::m_loader
mutableprivate

Definition at line 285 of file QueryableVector.h.

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