int attributesMain(int argc, char *argv[]) { /* Attributes are set per thread. All objects created in a thread will be * created with the configured attributes specific to that thread. */ /* Create a low-footprint object with no attributes */ corto_attr prev = corto_setAttr(0); corto_int32 *i = corto_create(corto_int32_o); corto_setAttr(prev); /* Display attributes of the int32 object */ printAttr(i); return 0; }
corto_int16 corto_ser_initObservable(corto_walk_opt* s, corto_value* v, void* userData) { corto_member m = v->is.member.t; /* Initialize member to a new object of member type */ corto_type t = corto_value_typeof(v); corto_object p = corto_value_objectof(v); void* ptr = corto_value_ptrof(v); /* Create observable that is not added to the scope of its parent */ corto_attr prev = corto_setAttr(CORTO_OBSERVABLE); corto_object o = corto_createOrphan(p, corto_idof(m), t); corto_setAttr(prev); if (!o) { goto error; } *(corto_object*)ptr = o; return corto_walk_observable(s, v, userData); error: return -1; }