Exemplo n.º 1
0
static
void mexcpp(double num1, double num2)
{
    #ifdef _WIN32
        mexPrintf("\nThe initialized data in object:\n");
    #else
        cout << "\nThe initialized data in object:\n";
    #endif
    
    MyData *d = new MyData; // Create a  MyData object
    d->display();           // It should be initialized to
                            // zeros
    d->set_data(num1,num2); // Set data members to incoming
                          // values
    #ifdef _WIN32
        mexPrintf("After setting the object's data to your input:\n");
    #else
        cout << "After setting the object's data to your input:\n";
    #endif
        
    d->display();           // Make sure the set_data() worked
    delete(d);
    flush(cout);
    return;
}
void read ( const FileNode& node, MyData& x, const MyData& default_value = MyData ( ) )
{
    if ( node.empty ( ) )
	{
        x = default_value;
	}
    else
	{
        x.read ( node );
	}
}
Exemplo n.º 3
0
static void read(const FileNode& node, MyData& x, const MyData& default_value = MyData()){
    if(node.empty())
        x = default_value;
    else
        x.read(node);
}
Exemplo n.º 4
0
//These write and read functions must be defined for the serialization in FileStorage to work
static void write(FileStorage& fs, const std::string&, const MyData& x)
{
    x.write(fs);
}