SG++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dataVectorSerializeDemo.cpp

This example shows how to initialize, serialize, and deserialize a DataVector object.

#include <iostream>
int main() {

We create a DataVector with 3 elements and initialize the values.

DataVector v;
v.append(1.0);
v.append(2.0);
v.append(3.0);

Store it to a file using the toFile() method

v.toFile("dataVectorTest.vec");

Restore it from a file using the fromFile() class method.

DataVector w = DataVector::fromFile("dataVectorTest.vec");

Store again (for no reason).

w.toFile("dataVectorTest2.vec");
}