ATLAS Offline Software
Loading...
Searching...
No Matches
columnar::ColumnarToolDataArray Struct Referencefinal

#include <ColumnarToolDataArray.h>

Collaboration diagram for columnar::ColumnarToolDataArray:

Classes

struct  StringHash

Public Member Functions

std::string convertInternalToUserName (std::string_view name) const
 convert a column name between user and internal names
std::vector< std::string > convertUserToInternalNames (std::string_view name) const
std::string linkTargetName (std::string_view ciName) const
 the name of the given container as a link target, i.e.
bool hasContainerUserName (std::string_view ciName) const
 whether the given container has a user name assigned
void notifyLinkTargetNameWatchers () const
 call all the container name watchers for containers that have a user name assigned

Public Attributes

ColumnarToolArray * mainTool = nullptr
 the main tool that is associated with this object
std::vector< ColumnarToolArray * > sharedTools
 the list of all tools that reference this object
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > containerInternalToUserNames
 the names associated with all container ids
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > containerUserToInternalNames
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > columnInternalToUserNames
 an extra map, for mapping individual column names
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > columnUserToInternalNames
std::unordered_map< std::string, ColumnDataArray, StringHash, std::equal_to<> > columns
 the name-column map
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > linkTargetNames
 the names to use for link targets that were set explicitly, instead of the name set by the ObjectColumn accessor
std::unordered_map< std::string, std::vector< std::function< void(const std::string &)> >, StringHash, std::equal_to<> > linkTargetNameWatchers
 the watchers for the link target names of containers

Detailed Description

Definition at line 59 of file ColumnarToolDataArray.h.

Member Function Documentation

◆ convertInternalToUserName()

std::string columnar::ColumnarToolDataArray::convertInternalToUserName ( std::string_view name) const
nodiscard

convert a column name between user and internal names

Definition at line 395 of file ColumnarToolArray.cxx.

397 {
398 if (name.empty())
399 return std::string{};
400 if (auto iter = columnInternalToUserNames.find (name);
401 iter != columnInternalToUserNames.end())
402 return iter->second;
403 auto split = name.find ('.');
404 if (split == std::string::npos)
405 split = name.size();
406 auto containerName = name.substr (0, split);
407 auto iter = containerInternalToUserNames.find (containerName);
408 if (iter == containerInternalToUserNames.end())
409 return std::string (name);
410 return iter->second + std::string (name.substr (split));
411 }
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > containerInternalToUserNames
the names associated with all container ids
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > columnInternalToUserNames
an extra map, for mapping individual column names

◆ convertUserToInternalNames()

std::vector< std::string > columnar::ColumnarToolDataArray::convertUserToInternalNames ( std::string_view name) const
nodiscard

Definition at line 415 of file ColumnarToolArray.cxx.

417 {
418 if (auto iter = columnUserToInternalNames.find (name);
419 iter != columnUserToInternalNames.end())
420 return iter->second;
421 auto split = name.find ('.');
422 if (split == std::string::npos)
423 split = name.size();
424 auto containerName = name.substr (0, split);
425 std::vector<std::string> result;
426 if (auto iter = containerUserToInternalNames.find (containerName);
427 iter != containerUserToInternalNames.end())
428 {
429 for (auto& internalContainerName : iter->second)
430 {
431 std::string subname = internalContainerName + std::string (name.substr (split));
432 if (!columnInternalToUserNames.contains (subname) && columns.contains (subname))
433 result.push_back (std::move (subname));
434 }
435 }
436 if (!containerInternalToUserNames.contains (containerName) && !columnInternalToUserNames.contains (name) && columns.contains (name))
437 result.push_back (std::string (name));
438 return result;
439 }
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > columnUserToInternalNames
std::unordered_map< std::string, std::vector< std::string >, StringHash, std::equal_to<> > containerUserToInternalNames
std::unordered_map< std::string, ColumnDataArray, StringHash, std::equal_to<> > columns
the name-column map

◆ hasContainerUserName()

bool columnar::ColumnarToolDataArray::hasContainerUserName ( std::string_view ciName) const
nodiscard

whether the given container has a user name assigned

Definition at line 453 of file ColumnarToolArray.cxx.

455 {
456 return containerInternalToUserNames.contains (ciName);
457 }

◆ linkTargetName()

std::string columnar::ColumnarToolDataArray::linkTargetName ( std::string_view ciName) const
nodiscard

the name of the given container as a link target, i.e.

the name that enters the key of links pointing to it

Definition at line 443 of file ColumnarToolArray.cxx.

445 {
446 if (auto iter = linkTargetNames.find (ciName); iter != linkTargetNames.end())
447 return iter->second;
448 return containerInternalToUserNames.find (ciName)->second;
449 }
std::unordered_map< std::string, std::string, StringHash, std::equal_to<> > linkTargetNames
the names to use for link targets that were set explicitly, instead of the name set by the ObjectColu...

◆ notifyLinkTargetNameWatchers()

void columnar::ColumnarToolDataArray::notifyLinkTargetNameWatchers ( ) const

call all the container name watchers for containers that have a user name assigned

Definition at line 461 of file ColumnarToolArray.cxx.

463 {
464 for (auto& [ciName, watchers] : linkTargetNameWatchers)
465 {
466 if (!hasContainerUserName (ciName))
467 continue;
468 const std::string name = linkTargetName (ciName);
469 for (auto& watcher : watchers)
470 watcher (name);
471 }
472 }
std::string linkTargetName(std::string_view ciName) const
the name of the given container as a link target, i.e.
bool hasContainerUserName(std::string_view ciName) const
whether the given container has a user name assigned
std::unordered_map< std::string, std::vector< std::function< void(const std::string &)> >, StringHash, std::equal_to<> > linkTargetNameWatchers
the watchers for the link target names of containers

Member Data Documentation

◆ columnInternalToUserNames

std::unordered_map<std::string,std::string,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::columnInternalToUserNames

an extra map, for mapping individual column names

Definition at line 79 of file ColumnarToolDataArray.h.

◆ columns

std::unordered_map<std::string,ColumnDataArray,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::columns

the name-column map

Definition at line 83 of file ColumnarToolDataArray.h.

◆ columnUserToInternalNames

std::unordered_map<std::string,std::vector<std::string>,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::columnUserToInternalNames

Definition at line 80 of file ColumnarToolDataArray.h.

◆ containerInternalToUserNames

std::unordered_map<std::string,std::string,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::containerInternalToUserNames

the names associated with all container ids

Definition at line 75 of file ColumnarToolDataArray.h.

◆ containerUserToInternalNames

std::unordered_map<std::string,std::vector<std::string>,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::containerUserToInternalNames

Definition at line 76 of file ColumnarToolDataArray.h.

◆ linkTargetNames

std::unordered_map<std::string,std::string,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::linkTargetNames

the names to use for link targets that were set explicitly, instead of the name set by the ObjectColumn accessor

Definition at line 87 of file ColumnarToolDataArray.h.

◆ linkTargetNameWatchers

std::unordered_map<std::string,std::vector<std::function<void(const std::string&)> >,StringHash,std::equal_to<> > columnar::ColumnarToolDataArray::linkTargetNameWatchers

the watchers for the link target names of containers

Definition at line 90 of file ColumnarToolDataArray.h.

◆ mainTool

ColumnarToolArray* columnar::ColumnarToolDataArray::mainTool = nullptr

the main tool that is associated with this object

Definition at line 69 of file ColumnarToolDataArray.h.

◆ sharedTools

std::vector<ColumnarToolArray*> columnar::ColumnarToolDataArray::sharedTools

the list of all tools that reference this object

Definition at line 72 of file ColumnarToolDataArray.h.


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