DUECA/DUSIME
|
An XmlSnapshot can be used to communicate RTW module settings (inputs, states, and parameters) from and to RTW modules. More...
#include <XmlSnapshot.hxx>
Public Types | |
typedef XmlSnapshot | __ThisDCOType__ |
typedef for internal reference | |
Public Types inherited from dueca::Snapshot | |
enum | SnapCoding { UnSpecified , Base64 , JSON , XML , Floats , Doubles , BinaryFile , FloatFile , DoubleFile , JSONFile , XMLFile , Base64File } |
Enumerated type for an automatically generated object class. More... | |
typedef Snapshot | __ThisDCOType__ |
typedef for internal reference | |
Public Member Functions | |
XmlSnapshot () | |
default constructor. | |
XmlSnapshot (const Snapshot &parent_Snapshot) | |
Constructor with arguments. | |
XmlSnapshot (const XmlSnapshot &o) | |
copy constructor. | |
XmlSnapshot (::dueca::AmorphReStore &r) | |
constructor to restore an XmlSnapshot from amorphous storage. | |
~XmlSnapshot () | |
destructor. | |
void | packData (::dueca::AmorphStore &s) const |
packs the XmlSnapshot into amorphous storage. | |
void | packDataDiff (::dueca::AmorphStore &s, const XmlSnapshot &ref) const |
packs the XmlSnapshot into amorphous storage. | |
void | unPackData (::dueca::AmorphReStore &s) |
unpacks the XmlSnapshot from an amorphous storage. | |
void | unPackDataDiff (::dueca::AmorphReStore &s) |
unpacks the differences for XmlSnapshot from an amorphous storage. | |
bool | operator== (const XmlSnapshot &o) const |
Test for equality. | |
bool | operator!= (const XmlSnapshot &o) const |
Test for inequality. | |
XmlSnapshot & | operator= (const XmlSnapshot &o) |
Assignment operator. | |
std::ostream & | print (std::ostream &s) const |
prints the XmlSnapshot to a stream. | |
Public Member Functions inherited from dueca::Snapshot | |
Snapshot () | |
default constructor. | |
Snapshot (const dueca::smartstring &data, const NameSet &originator, const SnapCoding &coding) | |
Constructor with arguments. | |
Snapshot (const Snapshot &o) | |
copy constructor. | |
Snapshot (::dueca::AmorphReStore &r) | |
constructor to restore an Snapshot from amorphous storage. | |
~Snapshot () | |
destructor. | |
void | packData (::dueca::AmorphStore &s) const |
packs the Snapshot into amorphous storage. | |
void | packDataDiff (::dueca::AmorphStore &s, const Snapshot &ref) const |
packs the Snapshot into amorphous storage. | |
void | unPackData (::dueca::AmorphReStore &s) |
unpacks the Snapshot from an amorphous storage. | |
void | unPackDataDiff (::dueca::AmorphReStore &s) |
unpacks the differences for Snapshot from an amorphous storage. | |
bool | operator== (const Snapshot &o) const |
Test for equality. | |
bool | operator!= (const Snapshot &o) const |
Test for inequality. | |
Snapshot & | operator= (const Snapshot &o) |
Assignment operator. | |
std::ostream & | print (std::ostream &s) const |
prints the Snapshot to a stream. | |
Static Public Member Functions | |
static void * | operator new (size_t size) |
new operator "new", which places objects not on a heap, but in one of the memory arenas. | |
static void | operator delete (void *p) |
new operator "delete", to go with the new version of operator new. | |
static void * | operator new (size_t size, XmlSnapshot *&o) |
placement "new", needed for stl. | |
Static Public Member Functions inherited from dueca::Snapshot | |
static void * | operator new (size_t size) |
new operator "new", which places objects not on a heap, but in one of the memory arenas. | |
static void | operator delete (void *p) |
new operator "delete", to go with the new version of operator new. | |
static void * | operator new (size_t size, Snapshot *&o) |
placement "new", needed for stl. | |
Static Public Attributes | |
static const char *const | classname |
The name of this class. | |
static const uint32_t | magic_check_number |
a "magic" number, hashed out of the class definition, that will be used to check consistency of the sent objects across the dueca nodes. | |
Static Public Attributes inherited from dueca::Snapshot | |
static const char *const | classname |
The name of this class. | |
static const uint32_t | magic_check_number |
a "magic" number, hashed out of the class definition, that will be used to check consistency of the sent objects across the dueca nodes. | |
Additional Inherited Members | |
Public Attributes inherited from dueca::Snapshot | |
dueca::smartstring | data |
A place for the data, variable size. | |
NameSet | originator |
Identifies the object that sent the snapshot. | |
SnapCoding | coding |
Snapshot encoding, if specified. | |
An XmlSnapshot can be used to communicate RTW module settings (inputs, states, and parameters) from and to RTW modules.
Common scenarios are for instance loading a MATLAB generated initial condition for your simulink model into your RTW model, or retrieving the current state of your model to store in an xml file (for instance for later use in MATLAB). DUECA's new-module script gives you the option to generate scripts that you can use to communicate state, input and parameter settings between simulink and DUECA. If you choose to use this, new-module generates MATLAB scripts to export simulink model settings to an xml file, and to import simulink model settings from an xml file. You can choose to edit the generated xml files by and. If you want, you can remove variables from the xml file that you know you will never change. Loading and saving of these xml files in DUECA should be done outside of the actual RTW module: preferably in your 'ECI' module. The following example shows how to load and send an xml snapshot:
You can also use xml snapshots to store the current state in an xml file. This is done in two steps: first you send a command to the RTW module to prepare for a snapshot, at a certain time given by you. The RTW module then stores its states at the chosen time, to be sent in an xml snapshot when a second command is given: this is when you send the command to actually send the snapshot. The following three examples show how to retrieve a snapshot from the module with these two commands, and subsequently how to handle the reply:
new operator "new", which places objects not on a heap, but in one of the memory arenas.
This to speed up memory management.
void dueca::XmlSnapshot::packDataDiff | ( | ::dueca::AmorphStore & | s, |
const XmlSnapshot & | ref ) const |
packs the XmlSnapshot into amorphous storage.
only differences with a previous object are packed.