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 446 of file kernel.hpp.

Constructor & Destructor Documentation

◆ ~OksAliasTable()

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

Definition at line 646 of file kernel.cpp.

647{
648 if (p_aliases.empty())
649 return;
650
651 for (auto& i : p_aliases)
652 {
653 if (OksString *s = i.second->class_name)
654 delete s;
655
656 delete i.second;
657 delete const_cast<OksString *>(i.first);
658 }
659
660 p_aliases.clear();
661}

Member Function Documentation

◆ add_key()

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

Inline methods for struct OksAliasTable

Definition at line 489 of file kernel.hpp.

490{
491 p_aliases[key] = new Value(p_nameTable.get(), 0);
492}

◆ add_value()

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

Definition at line 495 of file kernel.hpp.

496{
497 p_aliases[p_nameTable.get()] = new Value(vn, vp);
498}

◆ get() [1/2]

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

Definition at line 473 of file kernel.hpp.

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

◆ get() [2/2]

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

Definition at line 501 of file kernel.hpp.

502{
503 Value::Map::const_iterator i = p_aliases.find(key);
504
505 if(i != p_aliases.end()) return i->second;
506 else return 0;
507}

Member Data Documentation

◆ p_aliases

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

Definition at line 478 of file kernel.hpp.

◆ p_nameTable

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

Definition at line 479 of file kernel.hpp.


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