Public Member Functions

Barry::MultiRecordParser Class Reference

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. More...

#include <parser.h>

Inheritance diagram for Barry::MultiRecordParser:
Inheritance graph
[legend]
Collaboration diagram for Barry::MultiRecordParser:
Collaboration graph
[legend]

List of all members.

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.

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 421 of file parser.h.


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 102 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 121 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 148 of file parser.cc.

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 128 of file parser.cc.

References Add().

Here is the call graph for this function:

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 460 of file parser.h.

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 450 of file parser.h.

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 165 of file parser.cc.

References Barry::Parser::ParseRecord().

Here is the call graph for this function:


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