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 Valueget (const OksString *key) const
const Valueget (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 451 of file kernel.hpp.

Constructor & Destructor Documentation

◆ ~OksAliasTable()

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

Definition at line 651 of file kernel.cpp.

652{
653 if (p_aliases.empty())
654 return;
655
656 for (auto& i : p_aliases)
657 {
658 if (OksString *s = i.second->class_name)
659 delete s;
660
661 delete i.second;
662 delete const_cast<OksString *>(i.first);
663 }
664
665 p_aliases.clear();
666}

Member Function Documentation

◆ add_key()

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

Inline methods for struct OksAliasTable

Definition at line 494 of file kernel.hpp.

495{
496 p_aliases[key] = new Value(p_nameTable.get(), 0);
497}

◆ add_value()

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

Definition at line 500 of file kernel.hpp.

501{
502 p_aliases[p_nameTable.get()] = new Value(vn, vp);
503}

◆ get() [1/2]

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

Definition at line 478 of file kernel.hpp.

478{ OksString str(key); return get(&str); }
const Value * get(const OksString *key) const
Definition kernel.hpp:506

◆ get() [2/2]

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

Definition at line 506 of file kernel.hpp.

507{
508 Value::Map::const_iterator i = p_aliases.find(key);
509
510 if(i != p_aliases.end()) return i->second;
511 else return 0;
512}

Member Data Documentation

◆ p_aliases

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

Definition at line 483 of file kernel.hpp.

◆ p_nameTable

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

Definition at line 484 of file kernel.hpp.


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