Flip Reference

BackEndIR Class Reference

Declared in

flip/BackEndIR.h

class BackEndIR;

flip::BackEndIR represents an intermediate representation of the document. Instead of directly to matching to flip class members, this objects holds class and attribute names as strings, allowing to modify this representation before it is fed to the document.

The object holds the full document in memory.

This class is used to :

Member Types

Type

A generic flip Type representation

Member Functions Synopsys

Constructor

Constructs the BackEndIR

Destructor

Destructs the BackEndIR

clear

Empty the representation

empty

Returns true iff the representation is empty

complete_conversion

Update model version

Non-member Functions Synopsys

walk

Walk a subset of the model tree recursively

BackEnd format to/from Intermediate Representation

Member Functions Synopsys

register_backend

Registers a concrete format backend for reading

read

Reads from the provider and fill this object. Returns true iff the operation was successful

write

Writes to the consumer using the specified backend in the template parameter

Intermediate Representation to/from Document

read

Reads from this object and fill the document

write

Writes to this object from the document

Member Variables Synopsys

version

Version string as passed in the data model

root

Variable representing the root of the whole document model tree

member_names

Set of all member names in the document

typenames

Set of all type names in the document

Member Functions

Constructor

BackEndIR ();                       (1)
BackEndIR (const BackEndIR & rhs);  (2)
BackEndIR (BackEndIR && rhs);       (3)
  1. Default constructor. Constructs an empty representation
  2. Copy constructor. Constructs as a copy of rhs
  3. Move constructor. Constructs by moving rhs

Destructor

~BackEndIR ();

Destructor.


clear

void  clear ();

Empty the representation.


empty

bool  empty () const;

Returns true iff the representation is empty.


complete_conversion

void  complete_conversion (std::string version);

Update model version. Internally this post-process the document so that the backend is valid before a subsequent read.

Non-member Functions

walk

void  walk (BackEndIR::Type & type, std::function <void (BackEndIR::Type &)> && f);

Walk a subset of the model tree, starting from type, and apply f recursively.

Member Functions

register_backend

template <class BackEnd>
void  register_backend ();

Register a concrete format backend such as BackEndBinary or BackEndMl. Registering will allow this object to guess the format of the backend and do proper parsing.

The subsequent call to read will use all backends registered to this object.

Example:

// DataProviderMemory provider;
BackEndIR backend;
backend.register_backend <BackEndBinary> (); (1)
backend.read (provider);                     (2)
  1. Add BackEndBinary to the list of registered back end types to consider for reading
  2. Read document given provider. In this case the backend will only use BackEndBinary for reading

read

bool  read (DataProviderBase & provider);

Reads from the provider and fill the intermediate representation of the document stored in this object.

Returns true iff the operation was successful.

See BackEndMl or BackEndBinary for an example of use of this method.


write

template <class BackEnd>
void  write (DataConsumerBase & consumer);

Writes the intermediate representation of the document to the consumer using the specified backend in the template parameter.

Example:

// DataConsumerMemory consumer;
backend.write <BackEndBinary> (consumer);

See BackEndMl or BackEndBinary for a more detailed example of use of this method.


read

void  read (DocumentBase & document);

Reads from this object and fill the document. It will modify the document exactly as if executing a transaction. Changed made to the document should then be commited.

See BackEndMl or BackEndBinary for an example of use of this method.


write

void  write (DocumentBase & document);

Writes to this object from the document.

Member Variables

version

std::string version;

This variable represents the version string as passed in the data model when declaring it.


root

Type  root;

This variable represents the root of the whole document model tree.

Typically, converting a document to one model revision to another consists of manipulating the data stored in that tree. See BackEndIR::Type for more details.


member_names

Names member_names;

This variable represents the set of all member names in the document. It is used by some backend format to provide symbolic compression of names.


typenames

Names typenames;

This variable represents the set of all type names in the document. It is used by some backend format to provide symbolic compression of names.