|
ATLAS Offline Software
|
#include <CoraCoolFolder.h>
|
| CoraCoolFolder (const std::string &coolfolder, coral::ISessionProxy *proxy, cool::IDatabasePtr cooldb, CoraCoolDatabase *coradb, coral::MessageStream &log) |
|
| ~CoraCoolFolder () |
|
| CoraCoolFolder (const CoraCoolFolder &)=delete |
|
CoraCoolFolder & | operator= (const CoraCoolFolder &)=delete |
|
std::string | coralTableName () const |
|
const std::string & | coralFKey () const |
|
const std::string & | coralPKey () const |
|
const cool::IRecordSpecification & | fkSpecification () const |
|
const cool::RecordSpecification | payloadSpecification () const |
|
coral::AttributeList | emptyAttrList () const |
|
cool::IFolderPtr | coolFolder () |
|
int | storeObject (const cool::ValidityKey &since, const cool::ValidityKey until, const_iterator begin, const_iterator end, const cool::ChannelId &channelId=0, const std::string &tagName="", const bool userTagOnly=false) |
|
bool | setupStorageBuffer () |
|
void | flushStorageBuffer () |
|
void | referenceObject (const cool::ValidityKey &since, const cool::ValidityKey &until, const coral::Attribute &fkey, const cool::ChannelId &channelId=0, const std::string &tagName="", const bool userTagOnly=false) |
|
void | referenceObject (const cool::ValidityKey &since, const cool::ValidityKey &until, const int ifkey, const cool::ChannelId &channelId=0, const std::string &tagName="", const bool userTagOnly=false) |
|
void | addPayload (const_iterator begin, const_iterator end) |
|
CoraCoolObjectPtr | findObject (const cool::ValidityKey &pointInTime, const cool::ChannelId &channelId=0, const std::string &tagName="") |
|
CoraCoolObjectIterPtr | browseObjects (const cool::ValidityKey &pointInTime, const cool::ChannelSelection &channels, const std::string &tagName="") |
|
CoraCoolObjectIterPtr | browseObjects (const cool::ValidityKey &since=cool::ValidityKeyMin, const cool::ValidityKey &until=cool::ValidityKeyMax, const cool::ChannelSelection &channels=cool::ChannelSelection(0), const std::string &tagName="") |
|
void | setPrefetchAll (const bool prefetchAll) |
|
bool | setAttrKey (coral::Attribute &attr, const int keyval) |
|
bool | setFieldKey (cool::IField &attr, const int keyval) |
|
bool | setFieldAttr (cool::IField &attr, const coral::Attribute &keyval) |
|
int | getAttrKey (const coral::Attribute &attr) |
|
|
typedef std::vector< std::pair< std::string, std::string > > | AttrVec |
|
typedef AttrVec::const_iterator | AttrItr |
|
Definition at line 37 of file CoraCoolFolder.h.
◆ AttrItr
◆ AttrVec
◆ const_iterator
◆ CoraCoolFolder() [1/2]
CoraCoolFolder::CoraCoolFolder |
( |
const std::string & |
coolfolder, |
|
|
coral::ISessionProxy * |
proxy, |
|
|
cool::IDatabasePtr |
cooldb, |
|
|
CoraCoolDatabase * |
coradb, |
|
|
coral::MessageStream & |
log |
|
) |
| |
Definition at line 40 of file CoraCoolFolder.cxx.
53 m_log << coral::Debug <<
"Initialize CoraCoolFolder " << coolfolder <<
56 std::string folderdesc;
61 catch (cool::Exception&
e) {
64 m_log << coral::Debug <<
"COOL Folder description is: " << folderdesc
73 "CoraCoolFolder::CoraCoolFolder");
78 m_proxy->transaction().start(
true);
85 "Problem extracting attribute specification",
86 "CoraCoolFolder::CoraCoolFolder");
87 m_proxy->transaction().commit();
89 catch (coral::SessionException&
e) {
91 "CoraCoolFolder::CoraCoolFolder");
◆ ~CoraCoolFolder()
CoraCoolFolder::~CoraCoolFolder |
( |
| ) |
|
◆ CoraCoolFolder() [2/2]
◆ addPayload()
Definition at line 293 of file CoraCoolFolder.cxx.
299 "CoralCoolFolder::addPayload");
307 m_log << coral::Debug <<
"Adding " << nrow <<
" into CoraCool folder "
312 m_proxy->transaction().start(
false);
314 pkey=seqfk.fetch(nrow);
316 m_proxy->transaction().commit();
318 catch (coral::Exception&
e) {
323 m_proxy->transaction().start(
false);
326 coral::ITableDataEditor& editor=
m_table->dataEditor();
332 editor.insertRow(
data);
334 m_proxy->transaction().commit();
336 catch (coral::Exception&
e) {
◆ browseObjects() [1/2]
◆ browseObjects() [2/2]
CoraCoolObjectIterPtr CoraCoolFolder::browseObjects |
( |
const cool::ValidityKey & |
since = cool::ValidityKeyMin , |
|
|
const cool::ValidityKey & |
until = cool::ValidityKeyMax , |
|
|
const cool::ChannelSelection & |
channels = cool::ChannelSelection(0) , |
|
|
const std::string & |
tagName = "" |
|
) |
| |
◆ bulkInsert()
◆ coolFolder()
cool::IFolderPtr CoraCoolFolder::coolFolder |
( |
| ) |
|
|
inline |
◆ coralFKey()
const std::string & CoraCoolFolder::coralFKey |
( |
| ) |
const |
|
inline |
◆ coralPKey()
const std::string & CoraCoolFolder::coralPKey |
( |
| ) |
const |
|
inline |
◆ coralTableName()
std::string CoraCoolFolder::coralTableName |
( |
| ) |
const |
|
inline |
◆ decodeAttrSpec()
bool CoraCoolFolder::decodeAttrSpec |
( |
| ) |
|
|
private |
Definition at line 423 of file CoraCoolFolder.cxx.
426 coral::IQuery*
query=0;
428 coral::ITable&
table=
m_proxy->nominalSchema().tableHandle(
432 bindvar.extend<std::string>(
"SNAME");
434 query->setCondition(
"NAME=:SNAME",bindvar);
435 query->setRowCacheSize(1);
436 query->defineOutputType(
"NAME",
"string");
440 std::string
spec=
res[
"ATTRSPEC"].data<std::string>();
442 std::string::size_type iofs1,iofs2,iofs3;
446 iofs2=
spec.find(
':',iofs1);
447 iofs3=
spec.find(
',',iofs2);
448 if (iofs3==std::string::npos) {
452 m_attrvec.emplace_back(
spec.substr(iofs1,iofs2-iofs1),
spec.substr(iofs2+1,iofs3-iofs2-1));
453 if (!last) iofs1=iofs3+1;
457 m_log << coral::Error <<
"No data obtained for CORACOOLATTR" <<
461 catch (coral::Exception &
e) {
462 m_log << coral::Error <<
"Exception reading CORACOOLATTR table: "
◆ emptyAttrList()
coral::AttributeList CoraCoolFolder::emptyAttrList |
( |
| ) |
const |
◆ findObject()
◆ fkSpecification()
const cool::IRecordSpecification & CoraCoolFolder::fkSpecification |
( |
| ) |
const |
◆ flushStorageBuffer()
void CoraCoolFolder::flushStorageBuffer |
( |
| ) |
|
◆ getAttrKey()
int CoraCoolFolder::getAttrKey |
( |
const coral::Attribute & |
attr | ) |
|
Definition at line 406 of file CoraCoolFolder.cxx.
407 const std::string typen=attr.specification().typeName();
409 return attr.data<
int>();
410 }
else if (typen==
"unsigned int") {
411 return static_cast<int>(attr.data<
unsigned int>());
412 }
else if (typen==
"long long") {
413 return static_cast<int>(attr.data<
long long>());
414 }
else if (typen==
"unsigned long long") {
415 return static_cast<int>(attr.data<
unsigned long long>());
417 m_log << coral::Error <<
"Unrecognised key type " << typen <<
◆ nameToCoolType()
cool::StorageType::TypeId CoraCoolFolder::nameToCoolType |
( |
const std::string & |
coolName | ) |
const |
|
private |
Definition at line 469 of file CoraCoolFolder.cxx.
471 if (coolName==
"Int16")
return cool::StorageType::Int16;
472 if (coolName==
"UInt16")
return cool::StorageType::UInt16;
473 if (coolName==
"Int32")
return cool::StorageType::Int32;
474 if (coolName==
"UInt32")
return cool::StorageType::UInt32;
475 if (coolName==
"UInt63")
return cool::StorageType::UInt63;
476 if (coolName==
"Int64")
return cool::StorageType::Int64;
477 if (coolName==
"Float")
return cool::StorageType::Float;
478 if (coolName==
"Double")
return cool::StorageType::Double;
479 if (coolName==
"String255")
return cool::StorageType::String255;
480 if (coolName==
"String4k")
return cool::StorageType::String4k;
481 if (coolName==
"String64k")
return cool::StorageType::String64k;
482 if (coolName==
"String16M")
return cool::StorageType::String16M;
483 if (coolName==
"Blob64k")
return cool::StorageType::Blob64k;
486 "CoraCoolFolder::nameToCoolType");
◆ operator=()
◆ payloadSpecification()
const cool::RecordSpecification CoraCoolFolder::payloadSpecification |
( |
| ) |
const |
◆ proxy() [1/2]
coral::ISessionProxy * CoraCoolFolder::proxy |
( |
| ) |
|
|
inlineprivate |
◆ proxy() [2/2]
const coral::ISessionProxy * CoraCoolFolder::proxy |
( |
| ) |
const |
|
inlineprivate |
◆ referenceObject() [1/2]
void CoraCoolFolder::referenceObject |
( |
const cool::ValidityKey & |
since, |
|
|
const cool::ValidityKey & |
until, |
|
|
const coral::Attribute & |
fkey, |
|
|
const cool::ChannelId & |
channelId = 0 , |
|
|
const std::string & |
tagName = "" , |
|
|
const bool |
userTagOnly = false |
|
) |
| |
◆ referenceObject() [2/2]
void CoraCoolFolder::referenceObject |
( |
const cool::ValidityKey & |
since, |
|
|
const cool::ValidityKey & |
until, |
|
|
const int |
ifkey, |
|
|
const cool::ChannelId & |
channelId = 0 , |
|
|
const std::string & |
tagName = "" , |
|
|
const bool |
userTagOnly = false |
|
) |
| |
◆ setAttrKey()
bool CoraCoolFolder::setAttrKey |
( |
coral::Attribute & |
attr, |
|
|
const int |
keyval |
|
) |
| |
Definition at line 342 of file CoraCoolFolder.cxx.
345 const std::string typen=attr.specification().typeName();
347 attr.data<
int>()=keyval;
348 }
else if (typen==
"unsigned int") {
349 attr.data<
unsigned int>()=keyval;
350 }
else if (typen==
"long long") {
351 attr.data<
long long>()=keyval;
352 }
else if (typen==
"unsigned long long") {
353 attr.data<
unsigned long long>()=keyval;
356 m_log << coral::Error <<
"Unrecognised key type " << typen <<
◆ setFieldAttr()
bool CoraCoolFolder::setFieldAttr |
( |
cool::IField & |
attr, |
|
|
const coral::Attribute & |
keyval |
|
) |
| |
Definition at line 384 of file CoraCoolFolder.cxx.
387 const cool::StorageType& typen=attr.specification().storageType();
388 if (typen==cool::StorageType::Int32) {
389 attr.setValue<
int>(keyval.data<
int>());
390 }
else if (typen==cool::StorageType::UInt32) {
391 attr.setValue<
unsigned int>(keyval.data<
unsigned int>());
392 }
else if (typen==cool::StorageType::Int64) {
393 attr.setValue<
long long>(keyval.data<
long long>());
394 }
else if (typen==cool::StorageType::UInt63) {
395 attr.setValue<
unsigned long long>(keyval.data<
unsigned long long>());
398 m_log << coral::Error <<
"Unrecognised key type " << typen.name() <<
◆ setFieldKey()
bool CoraCoolFolder::setFieldKey |
( |
cool::IField & |
attr, |
|
|
const int |
keyval |
|
) |
| |
Definition at line 363 of file CoraCoolFolder.cxx.
366 const cool::StorageType& typen=attr.specification().storageType();
367 if (typen==cool::StorageType::Int32) {
368 attr.setValue<
int>(keyval);
369 }
else if (typen==cool::StorageType::UInt32) {
370 attr.setValue<
unsigned int>(keyval);
371 }
else if (typen==cool::StorageType::Int64) {
372 attr.setValue<
long long>(keyval);
373 }
else if (typen==cool::StorageType::UInt63) {
374 attr.setValue<
unsigned long long>(keyval);
377 m_log << coral::Error <<
"Unrecognised key type " << typen.name() <<
◆ setOutputSpec()
void CoraCoolFolder::setOutputSpec |
( |
coral::IQuery * |
query | ) |
|
|
private |
Definition at line 489 of file CoraCoolFolder.cxx.
491 query->defineOutputType(itr->first,
492 coral::AttributeSpecification::typeNameForId(
493 cool::StorageType::storageType(
nameToCoolType(itr->second)).cppType()));
◆ setPrefetchAll()
void CoraCoolFolder::setPrefetchAll |
( |
const bool |
prefetchAll | ) |
|
◆ setupStorageBuffer()
bool CoraCoolFolder::setupStorageBuffer |
( |
| ) |
|
◆ storeObject()
Definition at line 125 of file CoraCoolFolder.cxx.
145 m_log << coral::Debug <<
"Storing " << nrow <<
" rows in CoraCool folder "
152 m_proxy->transaction().start(
false);
157 pkey=seqfk.fetch(nrow);
162 m_proxy->transaction().commit();
164 catch (coral::Exception&
e) {
170 m_proxy->transaction().start(
false);
173 coral::ITableDataEditor& editor=
m_table->dataEditor();
175 coral::IBulkOperation* bulki=editor.bulkInsert(
data,
WB_SIZE);
179 data.fastCopyData(*payitr);
184 bulki->processNextIteration();
187 m_proxy->transaction().commit();
189 catch (coral::Exception&
e) {
196 cool::Record coolfk(
m_coolfolder->payloadSpecification());
202 catch (cool::Exception &
e) {
◆ table()
coral::ITable * CoraCoolFolder::table |
( |
| ) |
|
|
private |
◆ CoraCoolObjectIter
◆ m_attrvec
◆ m_bulkactive
bool CoraCoolFolder::m_bulkactive |
|
private |
◆ m_bulki
coral::IBulkOperation* CoraCoolFolder::m_bulki |
|
private |
◆ m_cooldb
cool::IDatabasePtr CoraCoolFolder::m_cooldb |
|
private |
◆ m_coolfolder
cool::IFolderPtr CoraCoolFolder::m_coolfolder |
|
private |
◆ m_coradb
◆ m_dbname
std::string CoraCoolFolder::m_dbname |
|
private |
◆ m_foldername
std::string CoraCoolFolder::m_foldername |
|
private |
◆ m_keycolcool
std::string CoraCoolFolder::m_keycolcool |
|
private |
◆ m_keycolcoral
std::string CoraCoolFolder::m_keycolcoral |
|
private |
◆ m_log
coral::MessageStream& CoraCoolFolder::m_log |
|
private |
◆ m_nextfk
int CoraCoolFolder::m_nextfk |
|
private |
◆ m_nextpk
int CoraCoolFolder::m_nextpk |
|
private |
◆ m_payloadbuf
coral::AttributeList* CoraCoolFolder::m_payloadbuf |
|
private |
◆ m_pkey
bool CoraCoolFolder::m_pkey |
|
private |
◆ m_pkeycolcoral
std::string CoraCoolFolder::m_pkeycolcoral |
|
private |
◆ m_proxy
coral::ISessionProxy* CoraCoolFolder::m_proxy |
|
private |
◆ m_seqfk
◆ m_seqpk
◆ m_table
coral::ITable* CoraCoolFolder::m_table |
|
private |
◆ m_tabledesc
const coral::ITableDescription* CoraCoolFolder::m_tabledesc |
|
private |
◆ m_tablename
std::string CoraCoolFolder::m_tablename |
|
private |
◆ m_usedfk
int CoraCoolFolder::m_usedfk |
|
private |
◆ m_usedpk
int CoraCoolFolder::m_usedpk |
|
private |
The documentation for this class was generated from the following files:
cool::StorageType::TypeId nameToCoolType(const std::string &coolName) const
char data[hepevt_bytes_allocation_ATLAS]
bool setFieldKey(cool::IField &attr, const int keyval)
bool querySeq(int &keyval, bool update=false, bool gettable=false)
std::string m_pkeycolcoral
CoraCoolSequence * m_seqfk
CoraCoolObjectIterPtr browseObjects(const cool::ValidityKey &pointInTime, const cool::ChannelSelection &channels, const std::string &tagName="")
void bulkInsert(const_iterator begin, const_iterator end, const int fkey, bool updatefk)
coral::AttributeList emptyAttrList() const
coral::AttributeList * m_payloadbuf
coral::IBulkOperation * m_bulki
bool setAttrKey(coral::Attribute &attr, const int keyval)
int fetch(const int inc=1)
friend class CoraCoolObjectIter
std::string m_keycolcoral
std::vector< coral::AttributeList >::const_iterator const_iterator
const std::string & dbname() const
std::pair< std::vector< unsigned int >, bool > res
cool::IDatabasePtr m_cooldb
coral::ISessionProxy * proxy()
bool parseFolderDescription(const std::string &folderdesc, std::string &tablename, std::string &keycolcool, std::string &fkeycolcoral, std::string &pkeycolcoral)
cool::IFolderPtr m_coolfolder
bool setFieldAttr(cool::IField &attr, const coral::Attribute &keyval)
AttrVec::const_iterator AttrItr
boost::shared_ptr< CoraCoolObjectIter > CoraCoolObjectIterPtr
CoraCoolSequence * m_seqpk
boost::shared_ptr< CoraCoolObject > CoraCoolObjectPtr
void flushStorageBuffer()
coral::MessageStream & m_log
coral::ISessionProxy * m_proxy
const coral::ITableDescription * m_tabledesc
CoraCoolDatabase * m_coradb