GNU Octave 11.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ls-mat-subsys.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2025-2026 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_ls_mat_subsys_h)
27#define octave_ls_mat_subsys_h 1
28
29#include "octave-config.h"
30
31#include <cstdint>
32
33#include <array>
34#include <iosfwd>
35#include <string>
36#include <tuple>
37#include <utility>
38#include <vector>
39
40#include "Cell.h"
41#include "oct-map.h"
42#include "ov.h"
43#include "str-vec.h"
44
46
47OCTINTERP_API octave_value
48load_mcos_object (const octave_value& objmetadata, bool as_struct = false);
49
51{
52 public:
53
54 // load methods
55 bool read_mat_subsystem (const octave_value& subsys, bool swap);
56
57 bool read_filewrapper (const Cell& fwrap_data, bool swap);
58
59 std::string get_class_name (const uint32_t class_id);
60
61 std::tuple<bool, uint32_t, uint32_t>
62 get_object_dependencies (const uint32_t obj_id);
63
65 get_object_properties (const uint32_t obj_type_id, const uint32_t class_id,
66 const bool saveobj_type, bool as_struct = false);
67
68 bool check_dyn_props (const uint32_t obj_dep_id);
69
70 // save methods
72
74
76
77 octave_value get_serialized_data () const { return m_serialized_data; }
78
79 bool has_serialized_data () const
80 { return m_serialized_data.is_defined (); }
81
82 private:
83
84 uint32_t get_name_index (const std::string& name);
85
86 // helper functions for set_mcos_object_metadata
87 std::pair<std::string, std::string>
88 parse_class_name (const std::string& full_class_name);
89
90 uint32_t
91 get_or_create_class_id (const std::string& namespace_name,
92 const std::string& class_name);
93
95 create_metadata_array (const dim_vector& obj_dims,
96 const std::vector<uint32_t>& object_ids,
97 uint32_t class_id);
98
99 void
100 process_object_properties (const std::vector<std::tuple<octave_map, uint32_t, bool>>& saveobj_data,
101 const std::vector<bool>& is_new,
102 uint32_t class_id);
103
104 private:
105
106 const uint32_t m_filewrapper_version = 4;
107
108 // load variables
109 octave_value m_type_java;
110 octave_value m_type_handle;
111
112 // save variables
113 // uint32_t m_object_id_counter = 0; // To manage dependency graphs; FIXME: unused?
114 uint32_t m_class_id_counter = 0;
115 uint32_t m_saveobj_object_counter = 0;
116 uint32_t m_normal_object_counter = 0;
117
118 octave_value m_serialized_data; // required for writing nbytes when saving
119
120 // load-save variables
121 uint32_t m_num_names; // number of unique class and property names
122 string_vector m_prop_class_names;
123
124 std::array<uint32_t, 8> m_region_offsets;
125
126 std::vector<uint32_t> m_class_name_refs;
127 std::vector<uint32_t> m_object_id_refs;
128 std::vector<uint32_t> m_object_prop_fields;
129 std::vector<uint32_t> m_saveobj_prop_fields;
130 std::vector<uint32_t> m_dynamic_prop_refs;
131
132 std::vector<octave_value> m_fwrap_prop_vals;
133 Cell m_fwrap_default_vals;
134
135};
136
137OCTAVE_END_NAMESPACE(octave)
138
139#endif
Definition Cell.h:41
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:92
bool is_defined() const
Definition ov.h:590
uint8NDArray create_filewrapper_metadata()
std::string get_class_name(const uint32_t class_id)
bool read_mat_subsystem(const octave_value &subsys, bool swap)
bool read_filewrapper(const Cell &fwrap_data, bool swap)
octave_map get_object_properties(const uint32_t obj_type_id, const uint32_t class_id, const bool saveobj_type, bool as_struct=false)
octave_value get_serialized_data() const
bool check_dyn_props(const uint32_t obj_dep_id)
uint32NDArray set_mcos_object_metadata(const octave_value &obj)
bool has_serialized_data() const
std::tuple< bool, uint32_t, uint32_t > get_object_dependencies(const uint32_t obj_id)
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
octave_value load_mcos_object(const octave_value &objmetadata, bool as_struct=false)