bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
name_map Class Reference

#include <name_map.h>

Collaboration diagram for name_map:
Collaboration graph

Public Member Functions

void add (char *raw_equiv)
 
void delete_all ()
 
string lookup (string name, const bool canonical_names=false)
 
 name_map ()
 
 name_map (char *raw_equiv)
 

Detailed Description

This class can be used to build up a simple thesaurus which maps names from one string to another. The thesaurus is built by calling the add# mfunc with a string of the form <source>:<dest> where <source> and <dest> are string literals. Once the thesaurus is built, the lookup# mfunc can be used to get the equivalent of any string in the thesaurus.

As an additional feature, this class can canonicalize an identifier (remove non-alphanumeric characters) when performing the lookup operation. This is performed as a separate step from the thesaurus scan so words with no entry in the thesaurus will still be canonicalized.

You can interleave calls to add# and calls to lookup#.

@memo Map names using a simple thesaurus.

Author
jhrg

Definition at line 54 of file name_map.h.

Constructor & Destructor Documentation

◆ name_map() [1/2]

name_map::name_map ( char * raw_equiv)

Create a new instance of the thesaurus and add the first equivalence string to it.

@memo Create a new instance of the thesaurus.

Definition at line 46 of file name_map.cc.

◆ name_map() [2/2]

name_map::name_map ( )

Create an empty thesaurus.

Definition at line 51 of file name_map.cc.

Member Function Documentation

◆ add()

void name_map::add ( char * raw_equiv)

Add a new entry to the thesaurus. The form of the new entry is <source>:<dest>.

Definition at line 56 of file name_map.cc.

◆ delete_all()

void name_map::delete_all ( )

Delete all the entries from the thesaurus.

Definition at line 95 of file name_map.cc.

◆ lookup()

string name_map::lookup ( string name,
const bool canonical_names = false )

Lookup a word in the thesaurus. If the name appears in the thesaurus, return its equivalent. If #canonical_names# is true, pass the string #name# or its equivalent through a filter to replace all characters that are not alphanumerics with the underscore. Sequences matching ‘%[0-9][0-9a-fA-F]’ are considered to be hex escape codes and are replaced by a single underscore.

Returns
The string #name#, its equivalent or its canonicalized equivalent.

Definition at line 69 of file name_map.cc.


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