Program Listing for File meta.hpp

(Latest Version)

Return to documentation for file (morpheus/_lib/include/morpheus/messages/meta.hpp)


/* * SPDX-FileCopyrightText: Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include "morpheus/objects/data_table.hpp" // for IDataTable #include "morpheus/objects/table_info.hpp" #include "morpheus/types.hpp" // for TensorIndex #include <cudf/io/types.hpp> #include <pybind11/pytypes.h> #include <memory> #include <optional> #include <string> #include <vector> namespace morpheus { #pragma GCC visibility push(default) /****** Component public implementations ******************/ /****** MessageMeta****************************************/ class MutableTableCtxMgr; class MessageMeta { public: TensorIndex count() const; virtual TableInfo get_info() const; virtual MutableTableInfo get_mutable_info() const; bool has_sliceable_index() const; virtual std::optional<std::string> ensure_sliceable_index(); static std::shared_ptr<MessageMeta> create_from_python(pybind11::object&& data_table); static std::shared_ptr<MessageMeta> create_from_cpp(cudf::io::table_with_metadata&& data_table, int index_col_count = 0); protected: MessageMeta(std::shared_ptr<IDataTable> data); static pybind11::object cpp_to_py(cudf::io::table_with_metadata&& table, int index_col_count = 0); std::shared_ptr<IDataTable> m_data; }; class SlicedMessageMeta : public MessageMeta { public: SlicedMessageMeta(std::shared_ptr<MessageMeta> other, TensorIndex start = 0, TensorIndex stop = -1, std::vector<std::string> columns = {}); TableInfo get_info() const override; MutableTableInfo get_mutable_info() const override; std::optional<std::string> ensure_sliceable_index() override; private: TensorIndex m_start{0}; TensorIndex m_stop{-1}; std::vector<std::string> m_column_names; }; /****** Python Interface **************************/ /****** MessageMetaInterfaceProxy**************************/ struct MessageMetaInterfaceProxy { static std::shared_ptr<MessageMeta> init_cpp(const std::string& filename); static std::shared_ptr<MessageMeta> init_python(pybind11::object&& data_frame); static TensorIndex count(MessageMeta& self); static pybind11::object get_data_frame(MessageMeta& self); static pybind11::object df_property(MessageMeta& self); static MutableTableCtxMgr mutable_dataframe(MessageMeta& self); static bool has_sliceable_index(MessageMeta& self); static std::optional<std::string> ensure_sliceable_index(MessageMeta& self); }; #pragma GCC visibility pop// end of group } // namespace morpheus

© Copyright 2023, NVIDIA. Last updated on Apr 11, 2023.