ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
Py::DataStore Class Reference

#include <PyDataStore.h>

Inheritance diagram for Py::DataStore:
Collaboration diagram for Py::DataStore:

Public Member Functions

 DataStore (const Py::String &name="", bool owned=false)
 Constructor with parameters: More...
 
virtual ~DataStore ()
 Destructor: More...
 
virtual Py::Object repr ()
 
virtual Py::Object getattr (const char *name)
 
Py::Object value (const Py::Tuple &args)
 
Py::Object assign (const Py::Tuple &args)
 
Py::Object reference_count (const Py::Tuple &)
 
Py::Object c_value (const Py::Tuple &) const
 
void c_assign (const Py::Tuple &, const Py::Object &rhs)
 
Py::Object py_book (const Py::Tuple &args, const Py::Dict &kws)
 
Py::Object py_fill (const Py::Tuple &args, const Py::Dict &kws)
 fill some already registered node with data More...
 
Py::Object py_get (const Py::Tuple &args, const Py::Dict &kws)
 retrieve a data-node from a registered node/folder More...
 
void book (const std::string &nodeName, const std::string &path)
 
void book (const std::string &nodeName, const std::list< std::string > &path)
 register a node with the store More...
 
template<typename Data >
void fill (const std::string &name, const std::list< std::string > &dataPath, const Data &data)
 fill some already registered node with data More...
 
template<typename Data >
void fill (const std::string &name, const std::string &dataPath, const Data &data)
 fill some already registered node with data More...
 

Static Public Member Functions

static void init_type (void)
 python registration of this type More...
 

Private Member Functions

Py::List bucket (const Py::Dict &store, const Py::Tuple &path)
 acces a data bucket More...
 
template<typename T >
void tokenize (const std::string &in, std::list< T > &tokens, const std::string &delimiters="/") const
 helper method to tokenize stuff More...
 
Py::Tuple tokenize (const Py::Object &obj, const std::string &delimiter="/") const
 helper method to tokenize a Py::Object More...
 

Private Attributes

Py::String m_name
 Name of that store. More...
 
Py::Dict m_store
 data store More...
 

Detailed Description

Definition at line 120 of file PyDataStore.h.

Constructor & Destructor Documentation

◆ DataStore()

Py::DataStore::DataStore ( const Py::String &  name = "",
bool  owned = false 
)

Constructor with parameters:

◆ ~DataStore()

virtual Py::DataStore::~DataStore ( )
virtual

Destructor:

Member Function Documentation

◆ assign()

Py::Object Py::DataStore::assign ( const Py::Tuple args)

◆ book() [1/2]

void Py::DataStore::book ( const std::string &  nodeName,
const std::list< std::string > &  path 
)

register a node with the store

◆ book() [2/2]

void Py::DataStore::book ( const std::string &  nodeName,
const std::string &  path 
)

C++ API register a node with the store

◆ bucket()

Py::List Py::DataStore::bucket ( const Py::Dict &  store,
const Py::Tuple path 
)
private

acces a data bucket

◆ c_assign()

void Py::DataStore::c_assign ( const Py::Tuple ,
const Py::Object &  rhs 
)

◆ c_value()

Py::Object Py::DataStore::c_value ( const Py::Tuple ) const
inline

Definition at line 146 of file PyDataStore.h.

147  {
149  result.append( m_name );
150  result.append( m_store );
151  return result;
152  }

◆ fill() [1/2]

template<typename Data >
void Py::DataStore::fill ( const std::string &  name,
const std::list< std::string > &  dataPath,
const Data data 
)
inline

fill some already registered node with data

Definition at line 182 of file PyDataStore.h.

185  {
186  Py::Tuple path( dataPath.size() );
187  std::size_t idx = 0;
188  for ( std::list<std::string>::const_iterator
189  itr = dataPath.begin(),
190  iEnd= dataPath.end();
191  itr != iEnd;
192  ++itr, ++idx ) {
193  path[idx] = Py::String(*itr);
194  }
195 // std::cout << "--fill( name=[" << name << "], "
196 // << "dataPath=[" << path << "], "
197 // << "data )..."
198 // << std::endl;
199  Py::Dict store;
200  if ( !m_store.hasKey(name) ) {
201  throw Py::KeyError( "no such key["
202  +name
203  +"] registered in Py::DataStore !!" );
204  }
205  store = m_store[name];
206  this->bucket( store, path ).append( Py::cnv<Data>::to(data) );
207 // std::cout << "--fill( name=[" << name << "], "
208 // << "dataPath=[" << path << "], "
209 // << "data )..."
210 // << " [OK]"
211 // << std::endl;
212  }

◆ fill() [2/2]

template<typename Data >
void Py::DataStore::fill ( const std::string &  name,
const std::string &  dataPath,
const Data data 
)
inline

fill some already registered node with data

Definition at line 216 of file PyDataStore.h.

219  {
220  std::list<std::string> path;
221  this->tokenize( dataPath, path, "/" );
222  this->fill( name, path, data );
223  }

◆ getattr()

virtual Py::Object Py::DataStore::getattr ( const char *  name)
virtual

◆ init_type()

static void Py::DataStore::init_type ( void  )
static

python registration of this type

◆ py_book()

Py::Object Py::DataStore::py_book ( const Py::Tuple args,
const Py::Dict &  kws 
)

python-API register a node in the store and some path to some optional data

◆ py_fill()

Py::Object Py::DataStore::py_fill ( const Py::Tuple args,
const Py::Dict &  kws 
)

fill some already registered node with data

◆ py_get()

Py::Object Py::DataStore::py_get ( const Py::Tuple args,
const Py::Dict &  kws 
)

retrieve a data-node from a registered node/folder

◆ reference_count()

Py::Object Py::DataStore::reference_count ( const Py::Tuple )

◆ repr()

virtual Py::Object Py::DataStore::repr ( )
virtual

◆ tokenize() [1/2]

Py::Tuple Py::DataStore::tokenize ( const Py::Object &  obj,
const std::string &  delimiter = "/" 
) const
private

helper method to tokenize a Py::Object

◆ tokenize() [2/2]

template<typename T >
void Py::DataStore::tokenize ( const std::string &  in,
std::list< T > &  tokens,
const std::string &  delimiters = "/" 
) const
inlineprivate

helper method to tokenize stuff

Definition at line 236 of file PyDataStore.h.

239  {
240  // Skip delimiters at beginning.
241  std::string::size_type lastPos = in.find_first_not_of(delimiters, 0);
242  // Find first "non-delimiter".
243  std::string::size_type pos = in.find_first_of(delimiters, lastPos);
244 
245  while ( std::string::npos != pos || std::string::npos != lastPos ) {
246  // Found a token, add it to the vector.
247  tokens.push_back( T( in.substr(lastPos, pos - lastPos) ) );
248  // Skip delimiters. Note the "not_of"
249  lastPos = in.find_first_not_of(delimiters, pos);
250  // Find next "non-delimiter"
251  pos = in.find_first_of(delimiters, lastPos);
252  }
253 
254  return;
255  }

◆ value()

Py::Object Py::DataStore::value ( const Py::Tuple args)

Member Data Documentation

◆ m_name

Py::String Py::DataStore::m_name
private

Name of that store.

Definition at line 267 of file PyDataStore.h.

◆ m_store

Py::Dict Py::DataStore::m_store
private

data store

Definition at line 270 of file PyDataStore.h.


The documentation for this class was generated from the following file:
store
StoreGateSvc * store
Definition: fbtTestBasics.cxx:69
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
get_generator_info.result
result
Definition: get_generator_info.py:21
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:126
RunTileCalibRec.dataPath
dataPath
Definition: RunTileCalibRec.py:418
Py::cnv
helper method to convert a type to a Py::Object
Definition: PyDataStore.h:28
beamspotman.tokens
tokens
Definition: beamspotman.py:1284
Py::DataStore::fill
void fill(const std::string &name, const std::list< std::string > &dataPath, const Data &data)
fill some already registered node with data
Definition: PyDataStore.h:182
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Py::DataStore::m_store
Py::Dict m_store
data store
Definition: PyDataStore.h:270
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
Py::DataStore::m_name
Py::String m_name
Name of that store.
Definition: PyDataStore.h:267
Py::DataStore::bucket
Py::List bucket(const Py::Dict &store, const Py::Tuple &path)
acces a data bucket
Py::DataStore::tokenize
void tokenize(const std::string &in, std::list< T > &tokens, const std::string &delimiters="/") const
helper method to tokenize stuff
Definition: PyDataStore.h:236
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
compileRPVLLRates.List
List
GET FILTER EVENT DATA FROM RPVLL LOG FILE ## open list of filter data.
Definition: compileRPVLLRates.py:143
Tuple
PerfMon::Tuple Tuple
Definition: PerfMonSvc.cxx:91