Export

Export
can export objects and classes to a directory. Get[directory] loads the automatically created "init.m" file that reads in all necessary definitions without the need of loading the class package.
Export[directory, object]
exports object and all related objects into a file "object.m" written to directory.
Export[directory, class]
exports class into a file "class.m" written to directory. The file contains all definitions directly related to class such as parent class definitions and automatically created definitions.
  • With the option TakeObject, no related objects are saved.
  • If the objects to be saved are derived from an anonymous class, an option Classdir can specify where these classes are saved.
  • For classes that have attributes ReadProtected and Locked the read protected definitions are saved by DumpSave to "class.mx". The directory also contains a runtime version of this package.
  • The builtin behavior of Export is not affected.
This loads the package.
In[1]:=
Click for copyable input
First, we define a class with one field bound to the class and another one bound to an object.
In[2]:=
Click for copyable input
We create an object.
In[3]:=
Click for copyable input
Classes as well as objects can be exported into a directory. The message is a hint that the generated runtime will only work with the current license, while the ClassMessage[] wrapper is only used to format the filenames.
In[4]:=
Click for copyable input
Out[4]=
In[5]:=
Click for copyable input
Out[5]=
Finally, we remove the created directories.
In[6]:=
Click for copyable input