src/Mode.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 23 May 2021 21:28:26 +0200
branchv_0
changeset 6 779897b055c6
parent 1 da114916734b
permissions -rw-r--r--
implement DataMode – scans all values and recognizes boolean and integer attributes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * Relational pipes
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info)
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, version 3 of the License.
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 *
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * GNU General Public License for more details.
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 *
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 */
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
#pragma once
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
#include <relpipe/common/type/typedefs.h>
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
#include <relpipe/reader/handlers/AttributeMetadata.h>
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
namespace relpipe {
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
namespace tr {
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
namespace infertypes {
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
6
779897b055c6 implement DataMode – scans all values and recognizes boolean and integer attributes
František Kučera <franta-hg@frantovo.cz>
parents: 1
diff changeset
    26
// TODO: use RelationalWriter interface instead?
1
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
class Mode {
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
protected:
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	shared_ptr<writer::RelationalWriter> relationalWriter;
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    30
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    31
	Mode(shared_ptr<writer::RelationalWriter> relationalWriter) : relationalWriter(relationalWriter) {
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    32
	}
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    34
public:
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    35
	virtual ~Mode() = default;
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    36
	virtual void startRelation(const relpipe::common::type::StringX name, std::vector<relpipe::reader::handlers::AttributeMetadata> attributes) = 0;
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    37
	virtual void attribute(const relpipe::common::type::StringX& value) = 0;
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
};
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
}
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
}
da114916734b multiple modes infrastructure
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
}