DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::oks::OksAliasTable Struct Reference

The struct OksAliasTable is used to support aliases. More...

#include <kernel.hpp>

Collaboration diagram for dunedaq::oks::OksAliasTable:
[legend]

Classes

struct  Value

Public Member Functions

 ~OksAliasTable ()
void add_key (OksString *)
void add_value (OksString *vn, const OksClass *vp)
const Value * get (const OksString *key) const
const Value * get (const char *key) const

Private Attributes

Value::Map p_aliases
OksNameTable p_nameTable

Detailed Description

The struct OksAliasTable is used to support aliases.

The technique of aliases is used to reduce size of OKS data files: if a class name appears first time somewhere in OKS data file it is marked in front by '@' symbol and the alias to it is used later, e.g.:

  • first object stored in data file is "Detector@First" and it will be stored as "@Detector@First"
  • second object stored in data file is "Detector@Second" and it will be stored as "0@Second"
  • in this case "0" is alias for "Detector"

The technique of aliases is used to keep compatibility with old data format: new method to read OKS data files may read new and old format at the same time

Definition at line 477 of file kernel.hpp.

Constructor & Destructor Documentation

◆ ~OksAliasTable()

dunedaq::oks::OksAliasTable::~OksAliasTable ( )

Definition at line 594 of file kernel.cpp.

595{
596 if (p_aliases.empty())
597 return;
598
599 for (auto& i : p_aliases) {
600 if (OksString* s = i.second->class_name)
601 delete s;
602
603 delete i.second;
604 delete const_cast<OksString*>(i.first);
605 }
606
607 p_aliases.clear();
608}

Member Function Documentation

◆ add_key()

void dunedaq::oks::OksAliasTable::add_key ( OksString * key)
inline

Inline methods for struct OksAliasTable

Definition at line 524 of file kernel.hpp.

525{
526 p_aliases[key] = new Value(p_nameTable.get(), 0);
527}
Value(OksString *n, const OksClass *p)
Definition kernel.hpp:494

◆ add_value()

void dunedaq::oks::OksAliasTable::add_value ( OksString * vn,
const OksClass * vp )
inline

Definition at line 530 of file kernel.hpp.

531{
532 p_aliases[p_nameTable.get()] = new Value(vn, vp);
533}

◆ get() [1/2]

const Value * dunedaq::oks::OksAliasTable::get ( const char * key) const
inline

Definition at line 508 of file kernel.hpp.

509 {
510 OksString str(key);
511 return get(&str);
512 }
const Value * get(const OksString *key) const
Definition kernel.hpp:536

◆ get() [2/2]

const OksAliasTable::Value * dunedaq::oks::OksAliasTable::get ( const OksString * key) const
inline

Definition at line 536 of file kernel.hpp.

537{
538 Value::Map::const_iterator i = p_aliases.find(key);
539
540 if (i != p_aliases.end())
541 return i->second;
542 else
543 return 0;
544}

Member Data Documentation

◆ p_aliases

Value::Map dunedaq::oks::OksAliasTable::p_aliases
private

Definition at line 515 of file kernel.hpp.

◆ p_nameTable

OksNameTable dunedaq::oks::OksAliasTable::p_nameTable
private

Definition at line 516 of file kernel.hpp.


The documentation for this struct was generated from the following files: