BackEndIR Class Reference
Declared in |
|
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 :
- Read and write a document stored on a media
- Convert from one revision of the document model to another one
- Make the difference between two documents and make a transaction out of it, which allows to produce 3-way merges
Member Types
| A generic flip Type representation |
Member Functions Synopsys
Constructs the | |
Destructs the | |
Empty the representation | |
Returns | |
Update model version |
Non-member Functions Synopsys
Walk a subset of the model tree recursively |
BackEnd format to/from Intermediate Representation
Member Functions Synopsys
Registers a concrete format backend for reading | |
Reads from the provider and fill this object. Returns | |
Writes to the consumer using the specified backend in the template parameter |
Intermediate Representation to/from Document
Reads from this object and fill the document | |
Writes to this object from the document |
Member Variables Synopsys
Version string as passed in the data model | |
Variable representing the root of the whole document model tree | |
Set of all member names in the document | |
Set of all type names in the document |
Member Functions
Constructor
BackEndIR (); (1) |
BackEndIR (const BackEndIR & rhs); (2) |
BackEndIR (BackEndIR && rhs); (3) |
- Default constructor. Constructs an empty representation
- Copy constructor. Constructs as a copy of
rhs - 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) |
- Add
BackEndBinaryto the list of registered back end types to consider for reading - Read document given provider. In this case the backend will only use
BackEndBinaryfor 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.