# Barry::MultiRecordParser Class Reference

`#include <parser.h>`

Inheritance diagram for Barry::MultiRecordParser:

[legend]
Collaboration diagram for Barry::MultiRecordParser:

[legend]

List of all members.

## Detailed Description

Container parser class that accepts multiple Parser objects (often RecordParser<> objects but they don't have to be) and automatically routes incoming records to the appropriate parser.

Note that this container owns *all* Parser objects, and will free them upon destruction.

Incoming records that have no matching parser are passed to the default parser object, if one exists, otherwise they are dropped silently. The default parser object is also owned by the container, and will be freed on destruction.

Do NOT derive your own personal parser classes from this, unless you are perfectly confident that you will catch future API changes on the devel tree without the compiler's help.

Definition at line 397 of file parser.h.

## Public Member Functions

void | Add (const std::string &dbname, Parser *parser)
| Adds given parser to list and takes ownership of it.
void | Add (RecordParserBase *parser)
| Adds given parser to list and takes ownership of it.
template<class RecordT>
void | Add (AllRecordStore &store)
| Creates a RecordParser<> object using the given record type and AllRecordStore.
template<class RecordT, class StorageT>
void | Add (StorageT *store)
| Two helper template functions that create the RecordParser<> automatically based on the function call.
bool | Add (const std::string &dbname, std::ostream &os)
| Creates a RecordParser<> object for the given database name, using DumpStore<> with the given stream for the output, and adds it to list.
bool | Add (const std::string &dbname, AllRecordStore &store)
| Creates a RecordParser<> object for the given database name, using the given store object.
virtual void | ParseRecord (const DBData &data, const IConverter *ic)
| Called to parse sub fields in the raw data packet.

## Member Function Documentation

void Barry::MultiRecordParser::Add | ( | const std::string & | dbname,
|  | Parser * | parser |
| ) |  |  |

Adds given parser to list and takes ownership of it.

Definition at line 98 of file parser.cc.

Referenced by Add().

Here is the caller graph for this function:

void Barry::MultiRecordParser::Add | ( | RecordParserBase * | parser | ) |

Adds given parser to list and takes ownership of it.

Definition at line 117 of file parser.cc.

References Add(), and Barry::RecordParserBase::GetDBName().

Here is the call graph for this function:

template<class RecordT>

void Barry::MultiRecordParser::Add | ( | AllRecordStore & | store | ) | `[inline]`

Creates a RecordParser<> object using the given record type and AllRecordStore.

Does NOT take ownership of the store object, since it can be used multiple times for multiple records.

Definition at line 426 of file parser.h.

template<class RecordT, class StorageT>

void Barry::MultiRecordParser::Add | ( | StorageT * | store | ) | `[inline]`

Two helper template functions that create the RecordParser<> automatically based on the function call.

Both pointer and reference versions.

Definition at line 436 of file parser.h.

bool Barry::MultiRecordParser::Add | ( | const std::string & | dbname,
|  | std::ostream & | os |
| ) |  |  |

Creates a RecordParser<> object for the given database name, using DumpStore<> with the given stream for the output, and adds it to list.

Returns false if there is no known Record class for dbname.

Definition at line 124 of file parser.cc.

References Add().

Here is the call graph for this function:

bool Barry::MultiRecordParser::Add | ( | const std::string & | dbname,
|  | AllRecordStore & | store |
| ) |  |  |

Creates a RecordParser<> object for the given database name, using the given store object.

Returns false if there is no known Record class for dbname.

Definition at line 144 of file parser.cc.

void Barry::MultiRecordParser::ParseRecord | ( | const DBData & | data,
|  | const IConverter * | ic |
| ) |  |  | `[virtual]`

Called to parse sub fields in the raw data packet.

Implements Barry::Parser.

Definition at line 161 of file parser.cc.

References Barry::DBData::GetDBName(), and Barry::Parser::ParseRecord().

Here is the call graph for this function:

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

- parser.h
- parser.cc