EVL

Table of Contents


Products, services and company names referenced in this document may be either trademarks or registered trademarks of their respective owners.

Copyright © 2017–2020 EVL Tool, s.r.o.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts.

Output Functions

There are several functions which can modify standard component behaviour regarding output of each record.

discard and reject

Using ‘discard()’ simply doesn’t output current record anywhere. (It has better performance than output to /dev/null, i.e. using Trash.)

But then it doesn’t end processing the mapping, so mostly the use would be:

discard(); return;

which immediately ends up the current mapping and iterate to another record.

Compare to ‘discard()’, ‘reject()’ function redirects input (with input evd) into specified output following way:

reject();                    // redirect input record to reject port
reject(6);                   // redirect input record to output /dev/fd/6
reject("out.csv");           // redirect input record to file "out.csv",
                             // if such exists, will be overwritten
reject("out.csv", open_mode::overwrite); // same as previous
reject("out.csv", open_mode::append);    // same as previous,
                                         // but append, not overwrite
reject("out.csv", open_mode::create);    // redirect input to "out.csv",
                                         // but fail if such exists

Function headers:

void discard() const;

void reject() const;
void reject(const int file_descriptor) const;
void reject(const char* const path, \
            const open_mode mode = open_mode::overwrite);
void reject(const std::string& path, \
            const open_mode mode = open_mode::overwrite);

And variants for join mapping:

void reject_left(const char* const path, \
                 const open_mode mode = open_mode::overwrite);
void reject_right(const char* const path, \
                  const open_mode mode = open_mode::overwrite);
void reject_left(const std::string& path, \
                 const open_mode mode = open_mode::overwrite);
void reject_right(const std::string& path, \
                  const open_mode mode = open_mode::overwrite);

add_record and output

Both these functions produce records with the output evd. Example first:

add_record();                 // add new record to stdout
add_record(4);                // add new record to output /dev/fd/4
add_record("out.csv");        // add new record to file "out.csv",
                              // if such exists, will be overwritten
add_record("out.csv", open_mode::overwrite); // same as previous
add_record("out.csv", open_mode::append);    // same as previous,
                                             // but append, not overwrite
add_record("out.csv", open_mode::create);    // add record to "out.csv",
                                             // but fail if such exists

Function ‘add_record()’ sends current output record to the specified output and continue in processing of the mapping.

Function ‘output()’ behave the same way as ‘add_record()’, but doesn’t produce additional record, only redirect the current output record.

The ‘open_mode’ is taken only from the very first call of the function, the others are ignored and the file is still open for writing in the same mode. So for example calling in some mapping

output("out.csv")

will delete file out.csv if it exists and starts to append every output record, keeping this file open.

Functions headers:

void add_record() const;
void add_record(const int file_descriptor) const;
void add_record(const char* const path, \
                const open_mode mode = open_mode::overwrite) const;
void add_record(const std::string& path, \
                const open_mode mode = open_mode::overwrite) const;

void output(const int file_descriptor = 4);
void output(const char* const path, \
            const open_mode mode = open_mode::overwrite);
void output(const std::string& path, \
            const open_mode mode = open_mode::overwrite);

Note:output(-1)’ is the same as ‘discard()’.

unmatched_left, unmatched_right

In Join component there these two functions which catch unmatched left and/or right join.

Usual example is for Join of --type left:

out->field = left->field;
if (!right) unmatched_left();

It means, that to the output goes inner joined records and to the --left-unmatched port goes not-joined records from left.

Function headers:

void reject_left(const int output = 7);
void reject_right(const int output = 7);

reject_left, reject_right

Actually similar to ‘unmatched_left/right()’ functions, just redirect input record (with input evd).

Function headers:

void reject_left(const int output = 7);
void reject_right(const int output = 7);