ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
FloatArrayStore Class Reference

class FloatArrayStore Access and manipulate an indexed storage of float vectors More...

#include <FloatArrayStore.h>

Collaboration diagram for FloatArrayStore:

Public Types

typedef std::less< Identifierlessp
 
typedef std::map< Identifier, int, lesspBufferMap
 
typedef BufferMap::const_iterator map_citr
 
typedef std::vector< std::vector< float > > Buffer
 

Public Member Functions

 FloatArrayStore ()
 constructors, optionally with a tag More...
 
 FloatArrayStore (const std::string &tag)
 
virtual ~FloatArrayStore ()
 destructor
More...
 
FloatArrayStoreoperator= (FloatArrayStore &&other)
 move assignment More...
 
const std::string & tag () const
 Tag accessor. More...
 
int numberOfIDs () const
 Size accessor. More...
 
const std::vector< float > & operator[] (const Identifier &ident) const
 Overload [] const access. More...
 
bool sharedID (const Identifier &ident) const
 returns flag for index sharing data More...
 
bool existID (const Identifier &ident) const
 returns flag for index existing in the std::map More...
 
void dbg () const
 print method More...
 
map_citr cbegin () const
 begin/end const iterators More...
 
map_citr cend () const
 
std::vector< float > & operator[] (const Identifier &ident)
 Overload [] modifier. More...
 
void share (const Identifier &ident, const Identifier &referenceIdent)
 makes index ident share data with referenceIdent More...
 
void push_back (const Identifier &ident, const std::vector< float > &value)
 makes new indices More...
 
void push_back (const std::vector< Identifier > &identvec, const std::vector< float > &value)
 
void removeID (const Identifier &ident)
 remove new index More...
 
void clear ()
 remove all More...
 
void cleanUp ()
 remove data with no index pointing to it More...
 
map_citr begin () const
 begin/end iterators More...
 
map_citr end () const
 
const Bufferbuffer () const
 return stored vector More...
 

Private Attributes

std::string m_tag
 The tag std::string. More...
 
BufferMap m_bufmap
 The std::map. More...
 
Buffer m_buf
 The std::vector<float> stored in each second element. More...
 

Detailed Description

class FloatArrayStore Access and manipulate an indexed storage of float vectors

Author
Jorgen Beck Hansen

Definition at line 34 of file FloatArrayStore.h.

Member Typedef Documentation

◆ Buffer

typedef std::vector< std::vector<float> > FloatArrayStore::Buffer

Definition at line 50 of file FloatArrayStore.h.

◆ BufferMap

Definition at line 48 of file FloatArrayStore.h.

◆ lessp

typedef std::less<Identifier> FloatArrayStore::lessp

Definition at line 47 of file FloatArrayStore.h.

◆ map_citr

typedef BufferMap::const_iterator FloatArrayStore::map_citr

Definition at line 49 of file FloatArrayStore.h.

Constructor & Destructor Documentation

◆ FloatArrayStore() [1/2]

FloatArrayStore::FloatArrayStore ( )
inline

constructors, optionally with a tag

Definition at line 97 of file FloatArrayStore.h.

97 : m_tag("Undefined") { }

◆ FloatArrayStore() [2/2]

FloatArrayStore::FloatArrayStore ( const std::string &  tag)
inline

Definition at line 99 of file FloatArrayStore.h.

99 : m_tag(tag) { }

◆ ~FloatArrayStore()

FloatArrayStore::~FloatArrayStore ( )
inlinevirtual

destructor

Definition at line 111 of file FloatArrayStore.h.

111 {}

Member Function Documentation

◆ begin()

FloatArrayStore::map_citr FloatArrayStore::begin ( ) const
inline

begin/end iterators

Definition at line 157 of file FloatArrayStore.h.

157 { return m_bufmap.begin(); }

◆ buffer()

const Buffer& FloatArrayStore::buffer ( ) const
inline

return stored vector

Definition at line 93 of file FloatArrayStore.h.

◆ cbegin()

FloatArrayStore::map_citr FloatArrayStore::cbegin ( ) const
inline

begin/end const iterators

Definition at line 163 of file FloatArrayStore.h.

163 { return m_bufmap.begin(); }

◆ cend()

FloatArrayStore::map_citr FloatArrayStore::cend ( ) const
inline

Definition at line 165 of file FloatArrayStore.h.

165 { return m_bufmap.end(); }

◆ cleanUp()

void FloatArrayStore::cleanUp ( )

remove data with no index pointing to it

Definition at line 9 of file FloatArrayStore.cxx.

9  {
10  std::multimap<int,Identifier> indexmap;
11 
12  map_citr itr=m_bufmap.begin();
13  for (;itr!=m_bufmap.end();++itr)
14  indexmap.insert(std::pair<int,Identifier>(std::abs(itr->second),itr->first));
15  std::vector< std::vector<float> > tmp(m_buf);
16  dbg();
17  this->clear();
18  int i(-tmp.size());
19  for (;i<(int)tmp.size();i++){
20  bool first(true);
21  Identifier shared_id;
23  for ( pos=indexmap.lower_bound(i); pos!=indexmap.upper_bound(i); ++pos){
24  if (first){
25  first=false;
26  shared_id=pos->second;
27  this->push_back(shared_id,tmp[std::abs(i)]);
28  } else
29  this->share(pos->second,shared_id);
30  }
31  }
32 }

◆ clear()

void FloatArrayStore::clear ( )
inline

remove all

Definition at line 113 of file FloatArrayStore.h.

113 {m_bufmap.clear(); m_buf.clear(); }

◆ dbg()

void FloatArrayStore::dbg ( ) const

print method

Definition at line 34 of file FloatArrayStore.cxx.

34  {
35  std::cout << "dbg:" << m_bufmap.size() << " " << m_buf.size() << std::endl;
36 }

◆ end()

FloatArrayStore::map_citr FloatArrayStore::end ( ) const
inline

Definition at line 160 of file FloatArrayStore.h.

160 { return m_bufmap.end(); }

◆ existID()

bool FloatArrayStore::existID ( const Identifier ident) const
inline

returns flag for index existing in the std::map

Definition at line 134 of file FloatArrayStore.h.

135 { return m_bufmap.find(ident)!=m_bufmap.end(); }

◆ numberOfIDs()

int FloatArrayStore::numberOfIDs ( ) const
inline

Size accessor.

Definition at line 128 of file FloatArrayStore.h.

129 { return m_bufmap.size(); }

◆ operator=()

FloatArrayStore & FloatArrayStore::operator= ( FloatArrayStore &&  other)
inline

move assignment

Definition at line 101 of file FloatArrayStore.h.

101  {
102  if (this!=&other){
103  m_tag=std::move(other.m_tag);
104  m_bufmap = other.m_bufmap;//can't std::move a map, the keys are const
105  m_buf=std::move(other.m_buf);
106  }
107  return *this;
108 }

◆ operator[]() [1/2]

std::vector< float > & FloatArrayStore::operator[] ( const Identifier ident)
inline

Overload [] modifier.

Definition at line 143 of file FloatArrayStore.h.

144  {return m_buf[std::abs(m_bufmap[ident])]; }

◆ operator[]() [2/2]

const std::vector< float > & FloatArrayStore::operator[] ( const Identifier ident) const
inline

Overload [] const access.

Definition at line 139 of file FloatArrayStore.h.

141 {return m_buf[std::abs(m_bufmap.find(ident)->second)]; }

◆ push_back() [1/2]

void FloatArrayStore::push_back ( const Identifier ident,
const std::vector< float > &  value 
)
inline

makes new indices

Definition at line 115 of file FloatArrayStore.h.

116  {
117  m_buf.push_back(value);
118  m_bufmap[ident]= m_buf.size()-1;
119 }

◆ push_back() [2/2]

void FloatArrayStore::push_back ( const std::vector< Identifier > &  identvec,
const std::vector< float > &  value 
)
inline

Definition at line 121 of file FloatArrayStore.h.

121  {
122  m_buf.push_back(value);
123  size_t index = m_buf.size()-1;
124  for(std::vector<Identifier>::const_iterator it = identvec.begin() ; it != identvec.end(); ++it)
125  m_bufmap[*it] = index ;
126 }

◆ removeID()

void FloatArrayStore::removeID ( const Identifier ident)
inline

remove new index

Definition at line 131 of file FloatArrayStore.h.

132 { m_bufmap.erase(ident); }

◆ share()

void FloatArrayStore::share ( const Identifier ident,
const Identifier referenceIdent 
)
inline

makes index ident share data with referenceIdent

Definition at line 146 of file FloatArrayStore.h.

147  {
148  if (existID(referenceIdent)){
149  m_bufmap[ident] = -std::abs(m_bufmap[referenceIdent]);
150  m_bufmap[referenceIdent] = -std::abs(m_bufmap[referenceIdent]);
151  }
152 }

◆ sharedID()

bool FloatArrayStore::sharedID ( const Identifier ident) const
inline

returns flag for index sharing data

Definition at line 137 of file FloatArrayStore.h.

137 { return existID(ident)? m_bufmap.find(ident)->second <0 : false; }

◆ tag()

const std::string & FloatArrayStore::tag ( ) const
inline

Tag accessor.

Definition at line 154 of file FloatArrayStore.h.

154 {return m_tag;}

Member Data Documentation

◆ m_buf

Buffer FloatArrayStore::m_buf
private

The std::vector<float> stored in each second element.

Definition at line 100 of file FloatArrayStore.h.

◆ m_bufmap

BufferMap FloatArrayStore::m_bufmap
private

The std::map.

Definition at line 99 of file FloatArrayStore.h.

◆ m_tag

std::string FloatArrayStore::m_tag
private

The tag std::string.

Definition at line 98 of file FloatArrayStore.h.


The documentation for this class was generated from the following files:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
FloatArrayStore::m_tag
std::string m_tag
The tag std::string.
Definition: FloatArrayStore.h:98
FloatArrayStore::share
void share(const Identifier &ident, const Identifier &referenceIdent)
makes index ident share data with referenceIdent
Definition: FloatArrayStore.h:147
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
index
Definition: index.py:1
FloatArrayStore::tag
const std::string & tag() const
Tag accessor.
Definition: FloatArrayStore.h:154
skel.it
it
Definition: skel.GENtoEVGEN.py:423
athena.value
value
Definition: athena.py:122
FloatArrayStore::m_buf
Buffer m_buf
The std::vector<float> stored in each second element.
Definition: FloatArrayStore.h:100
FloatArrayStore::dbg
void dbg() const
print method
Definition: FloatArrayStore.cxx:34
lumiFormat.i
int i
Definition: lumiFormat.py:92
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
FloatArrayStore::existID
bool existID(const Identifier &ident) const
returns flag for index existing in the std::map
Definition: FloatArrayStore.h:134
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
FloatArrayStore::map_citr
BufferMap::const_iterator map_citr
Definition: FloatArrayStore.h:49
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
FloatArrayStore::m_bufmap
BufferMap m_bufmap
The std::map.
Definition: FloatArrayStore.h:99
DeMoScan.index
string index
Definition: DeMoScan.py:362
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
DeMoScan.first
bool first
Definition: DeMoScan.py:534
FloatArrayStore::clear
void clear()
remove all
Definition: FloatArrayStore.h:113
FloatArrayStore::push_back
void push_back(const Identifier &ident, const std::vector< float > &value)
makes new indices
Definition: FloatArrayStore.h:116