↰ Return to documentation for file (morpheus/_lib/include/morpheus/stages/serialize.hpp
)
#pragma once
#include "morpheus/messages/meta.hpp"// for MessageMeta
#include "morpheus/messages/multi.hpp"
#include "morpheus/objects/table_info.hpp"// for TableInfo
#include <mrc/channel/status.hpp>// for Status
#include <mrc/node/sink_properties.hpp>// for SinkProperties<>::sink_type_t
#include <mrc/node/source_properties.hpp>// for SourceProperties<>::source_type_t
#include <mrc/segment/builder.hpp>
#include <mrc/segment/object.hpp>// for Object
#include <pymrc/node.hpp>
#include <rxcpp/rx.hpp>// for apply, make_subscriber, observable_member, is_on_error<>::not_void, is_on_next_of<>::not_void, from
#include <memory>
#include <regex>
#include <string>
#include <vector>// for vector
namespace morpheus {
/****** Component public implementations *******************/
/****** SerializeStage********************************/
#pragma GCC visibility push(default)
class SerializeStage : public mrc::pymrc::PythonNode<std::shared_ptr<MultiMessage>, std::shared_ptr<MessageMeta>>
{
public:
using base_t = mrc::pymrc::PythonNode<std::shared_ptr<MultiMessage>, std::shared_ptr<MessageMeta>>;
using typename base_t::sink_type_t;
using typename base_t::source_type_t;
using typename base_t::subscribe_fn_t;
SerializeStage(const std::vector<std::string> &include,
const std::vector<std::string> &exclude,
bool fixed_columns = true);
private:
void make_regex_objs(const std::vector<std::string> ®ex_strs, std::vector<std::regex> ®ex_objs);
bool match_column(const std::vector<std::regex> &patterns, const std::string &column) const;
bool include_column(const std::string &column) const;
bool exclude_column(const std::string &column) const;
TableInfo get_meta(sink_type_t &msg);
subscribe_fn_t build_operator();
bool m_fixed_columns;
std::vector<std::regex> m_include;
std::vector<std::regex> m_exclude;
std::vector<std::string> m_column_names;
};
/****** WriteToFileStageInterfaceProxy******************/
struct SerializeStageInterfaceProxy
{
static std::shared_ptr<mrc::segment::Object<SerializeStage>> init(mrc::segment::Builder& builder,
const std::string& name,
const std::vector<std::string>& include,
const std::vector<std::string>& exclude,
bool fixed_columns = true);
};
#pragma GCC visibility pop// end of group
} // namespace morpheus