MetaCC::Pattern Class Reference

#include <metacc_compilation.h>

Collaboration diagram for MetaCC::Pattern:

Collaboration graph
[legend]
List of all members.

Detailed Description

Pattern description.

Pattern consist of ordered list of records, or entries.

Each entry is either binary digit (0 or 1), "don't care" (X) bit, Bitfield, or Template. Bitfields and Templates are defined by their name and bit length.

To retrieve more information about bitfield or template, use get_bitfield() and get_template() methods of the Compilation object, and use "name" from the corresponding Entry to retrieve them.

Definition at line 151 of file metacc_compilation.h.

Public Member Functions

 Pattern ()
 Construct new Pattern.
void set_identifier (std::string identifier)
 Set pattern identifier to be used in generated code.
std::string get_identifier () const
 Retrieve pattern identifier used in generated code.
void set_id (int id)
 Set pattern ID to be used in generated code.
int get_id () const
 Retrieve pattern ID used in generated code.
void set_domain_name (std::string domain_name)
 Set domain name for this pattern.
std::string get_domain_name () const
 Retrieve domain name of this pattern.
void set_text_loc (int text_row, int text_col)
 Set text location of this pattern in source file, which may be used in code generation step to report errors about this pattern.
int get_text_row () const
 Retrieve text row where this pattern is defined in source file, which may be used in code generation step to report errors about this pattern.
int get_text_col () const
 Retrieve text column where this pattern is defined in source file, which may be used in code generation step to report errors about this pattern.
CodeSnippetsCollectionuser_code ()
 Returns reference to code snippets collection (one snippet per section) under this pattern.
const CodeSnippetsCollectionuser_code () const
 Returns const reference to code snippets collection (one snippet per section) under this pattern.
void append_digit (int digit)
 Append digit to the pattern.
void append_X ()
 Append "don't care" (X) to the pattern.
void append_bitfield (const std::string name, int length)
 Append [bitfield] to the pattern.
void append_template (const std::string name, int length)
 Append [template] to the pattern.
void append_entry (const Pattern::Entry &entry)
 Append pre-initialized Entry.
unsigned int get_bit_len () const
 Retrieve total length of this pattern in bits.
unsigned int get_entries_count () const
 Retrieve count of entries in this pattern.
const Entryget_entry (unsigned int index) const
 Retrieve specific entry.
void dump () const

Classes

struct  Entry
 Single entry (or "record") in Pattern. More...


Constructor & Destructor Documentation

MetaCC::Pattern::Pattern (  ) 

Construct new Pattern.

After construction the pattern is empty, and user should make multiple calls to append_*() functions to fill it.

Then, use user_code() to retrieve reference to vector of strings to add user (C++) code using push_back() calls on it.

Definition at line 21 of file metacc.cpp.


Member Function Documentation

void MetaCC::Pattern::set_identifier ( std::string  identifier  )  [inline]

Set pattern identifier to be used in generated code.

Definition at line 199 of file metacc_compilation.h.

std::string MetaCC::Pattern::get_identifier (  )  const [inline]

Retrieve pattern identifier used in generated code.

Definition at line 202 of file metacc_compilation.h.

void MetaCC::Pattern::set_id ( int  id  )  [inline]

Set pattern ID to be used in generated code.

Definition at line 205 of file metacc_compilation.h.

int MetaCC::Pattern::get_id (  )  const [inline]

Retrieve pattern ID used in generated code.

Definition at line 208 of file metacc_compilation.h.

void MetaCC::Pattern::set_domain_name ( std::string  domain_name  )  [inline]

Set domain name for this pattern.

Definition at line 211 of file metacc_compilation.h.

std::string MetaCC::Pattern::get_domain_name (  )  const [inline]

Retrieve domain name of this pattern.

Definition at line 214 of file metacc_compilation.h.

void MetaCC::Pattern::set_text_loc ( int  text_row,
int  text_col 
) [inline]

Set text location of this pattern in source file, which may be used in code generation step to report errors about this pattern.

Definition at line 219 of file metacc_compilation.h.

int MetaCC::Pattern::get_text_row (  )  const [inline]

Retrieve text row where this pattern is defined in source file, which may be used in code generation step to report errors about this pattern.

Definition at line 224 of file metacc_compilation.h.

int MetaCC::Pattern::get_text_col (  )  const [inline]

Retrieve text column where this pattern is defined in source file, which may be used in code generation step to report errors about this pattern.

Definition at line 229 of file metacc_compilation.h.

CodeSnippetsCollection& MetaCC::Pattern::user_code (  )  [inline]

Returns reference to code snippets collection (one snippet per section) under this pattern.

Definition at line 232 of file metacc_compilation.h.

const CodeSnippetsCollection& MetaCC::Pattern::user_code (  )  const [inline]

Returns const reference to code snippets collection (one snippet per section) under this pattern.

Definition at line 235 of file metacc_compilation.h.

void MetaCC::Pattern::append_digit ( int  digit  ) 

Append digit to the pattern.

Definition at line 26 of file metacc.cpp.

void MetaCC::Pattern::append_X (  ) 

Append "don't care" (X) to the pattern.

Definition at line 32 of file metacc.cpp.

void MetaCC::Pattern::append_bitfield ( const std::string  name,
int  length 
)

Append [bitfield] to the pattern.

Definition at line 38 of file metacc.cpp.

void MetaCC::Pattern::append_template ( const std::string  name,
int  length 
)

Append [template] to the pattern.

Definition at line 44 of file metacc.cpp.

void MetaCC::Pattern::append_entry ( const Pattern::Entry entry  ) 

Append pre-initialized Entry.

Definition at line 50 of file metacc.cpp.

unsigned int MetaCC::Pattern::get_bit_len (  )  const [inline]

Retrieve total length of this pattern in bits.

Definition at line 253 of file metacc_compilation.h.

Referenced by dump().

unsigned int MetaCC::Pattern::get_entries_count (  )  const [inline]

Retrieve count of entries in this pattern.

Definition at line 256 of file metacc_compilation.h.

Referenced by dump().

const Pattern::Entry & MetaCC::Pattern::get_entry ( unsigned int  index  )  const

Retrieve specific entry.

Definition at line 56 of file metacc.cpp.

Referenced by dump().

void MetaCC::Pattern::dump (  )  const

Todo:
remove this function, it's used for debugging purposes while testing the code

Definition at line 62 of file metacc.cpp.


The documentation for this class was generated from the following files:
Generated on Sat Sep 9 03:50:56 2006 for Openem APIs by  doxygen 1.4.7