Skip to main content

Example C++ client

-> -> Improvements to language bindings
#include "ayyi.h"
 
main (int argc, char **argv)
{
    // establish messaging and shared data:
 
    Ayyi_client* ayyi = new Ayyi_client;
    if (!ayyi->connect()) return 1;
    if (!ayyi->get_shm()) return 1;
 
    // now we can access the model, eg, get a list of regions:
 
    Partlist region_list = ayyi->get_parts_list();
    for (Partlist::iterator i=region_list.begin(); i!=region_list.end(); i++){
        cout << "region name: " << (*i)->name << endl;
    }
 
    // modify the model contents, eg, move the first Part to bar 4:
 
    gpos pos = {16,0,0};
    ayyi->part_move(*region_list.begin(), &pos);
}