Skip to content

Commit 3a57832

Browse files
author
Nithin Lakshmisha
committed
Add subsystem for managing information for classdef objects in MAT-files (bug #45833).
* libinterp/corefcn/ls-mat-subsys.h: Add new class octave::subsystem_handler to manage subsystem data. * libinterp/corefcn/ls-mat-subsys.cc: Add new file containing methods to read and write subsystem data in MAT-files. * libinterp/corefcn/module.mk: Include new files in build system. * libinterp/corefcn/load-save.h (load_save_system): Add new member m_subsystem_handler to manage subsystem_handler object. * libinterp/corefcn/load-save.cc (load_save_system::create_subsystem_handler, load_save_system::get_subsystem_handler, load_save_system::clear_subsystem_handler): Add new methods to access and manage m_subsystem_handler.
1 parent 38f2d4a commit 3a57832

File tree

5 files changed

+1045
-0
lines changed

5 files changed

+1045
-0
lines changed

libinterp/corefcn/load-save.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "ls-mat5.h"
7979
#include "ls-oct-text.h"
8080
#include "ls-oct-binary.h"
81+
#include "ls-mat-subsys.h"
8182

8283
// Remove gnulib definitions, if any.
8384
#if defined (close)
@@ -1622,6 +1623,24 @@ load_save_system::get_mcos_object_cache_id (const void *obj, bool& new_entry)
16221623
return id;
16231624
}
16241625

1626+
void
1627+
load_save_system::create_subsystem_handler ()
1628+
{
1629+
m_subsystem_handler = std::make_unique<subsystem_handler> ();
1630+
}
1631+
1632+
subsystem_handler*
1633+
load_save_system::get_subsystem_handler ()
1634+
{
1635+
return m_subsystem_handler.get ();
1636+
}
1637+
1638+
void
1639+
load_save_system::clear_subsystem_handler ()
1640+
{
1641+
m_subsystem_handler.reset ();
1642+
}
1643+
16251644
DEFMETHOD (load, interp, args, nargout,
16261645
doc: /* -*- texinfo -*-
16271646
@deftypefn {} {} load file

libinterp/corefcn/load-save.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ OCTAVE_BEGIN_NAMESPACE(octave)
4141
class interpreter;
4242
class load_save_format;
4343
class symbol_info;
44+
class subsystem_handler;
4445

4546
class load_save_system
4647
{
@@ -208,8 +209,17 @@ class load_save_system
208209
OCTINTERP_API uint32_t
209210
get_mcos_object_cache_id (const void *obj, bool& new_entry);
210211

212+
OCTINTERP_API void create_subsystem_handler ();
213+
214+
OCTINTERP_API subsystem_handler * get_subsystem_handler ();
215+
216+
OCTINTERP_API void clear_subsystem_handler ();
217+
211218
private:
212219

220+
// Subsystem handler is used to read and write MCOS objects in MAT-files
221+
std::unique_ptr<subsystem_handler> m_subsystem_handler;
222+
213223
interpreter& m_interpreter;
214224

215225
// Write octave-workspace file if Octave crashes or is killed by a

0 commit comments

Comments
 (0)