lcls2
C++ API: public headers of xtcdata, psalg, psdaq and psana
Loading...
Searching...
No Matches
XtcData::NameIndex Class Reference

Holds a malloc'd copy of a Names xtc (extent bytes) plus two maps: nameMap (field name to its position in the Names) and shapeMap (field name to its position among the array fields, those with rank > 0). More...

#include <NameIndex.hh>

Public Member Functions

 NameIndex ()
 Construct an empty index with no Names copy.
 
 NameIndex (Names &names)
 Copy names (names.extent bytes) with malloc, map each Name's name to its index (nameMap), and map each array field (rank > 0) to its running array index (shapeMap).
 
 NameIndex (const NameIndex &old)
 Deep copy: duplicate old's Names copy (if any) and copy both maps.
 
NameIndex & operator= (const NameIndex &rhs)
 Free the current Names copy, deep-copy rhs's (if any) and copy both maps.
 
 ~NameIndex ()
 Free the Names copy, if any.
 
IndexMap & shapeMap ()
 Return the map from array-field name to array index (rank > 0 fields only, in Names order).
 
IndexMap & nameMap ()
 Return the map from field name to its index in the Names.
 
Names & names ()
 Return the stored Names copy.
 
bool exists ()
 Return true if a Names copy is stored.
 

Detailed Description

Holds a malloc'd copy of a Names xtc (extent bytes) plus two maps: nameMap (field name to its position in the Names) and shapeMap (field name to its position among the array fields, those with rank > 0).

Constructor & Destructor Documentation

◆ NameIndex() [1/3]

XtcData::NameIndex::NameIndex ( )
inline

Construct an empty index with no Names copy.

The comment above notes NamesLookup uses it for missing keys; names() then throws.

◆ NameIndex() [2/3]

XtcData::NameIndex::NameIndex ( Names &  names)
inline

Copy names (names.extent bytes) with malloc, map each Name's name to its index (nameMap), and map each array field (rank > 0) to its running array index (shapeMap).

◆ NameIndex() [3/3]

XtcData::NameIndex::NameIndex ( const NameIndex &  old)
inline

Deep copy: duplicate old's Names copy (if any) and copy both maps.

◆ ~NameIndex()

XtcData::NameIndex::~NameIndex ( )
inline

Free the Names copy, if any.

Member Function Documentation

◆ exists()

bool XtcData::NameIndex::exists ( )
inline

Return true if a Names copy is stored.

◆ nameMap()

IndexMap & XtcData::NameIndex::nameMap ( )
inline

Return the map from field name to its index in the Names.

◆ names()

Names & XtcData::NameIndex::names ( )
inline

Return the stored Names copy.

If there is none (default-constructed), prints a message and throws a const char* exception.

◆ operator=()

NameIndex & XtcData::NameIndex::operator= ( const NameIndex &  rhs)
inline

Free the current Names copy, deep-copy rhs's (if any) and copy both maps.

Self-assignment is not handled (the copy is freed before it is read).

Returns
*this.

◆ shapeMap()

IndexMap & XtcData::NameIndex::shapeMap ( )
inline

Return the map from array-field name to array index (rank > 0 fields only, in Names order).


The documentation for this class was generated from the following file: