CA Service Management

How create objects in top_object() 

Feb 20, 2017 07:57 AM

Now it is very easy to program in the SPEL language by declaring objects instead of using arrays. Here is an example code:

 

void z_myMethod()
{
    object zo_obj;
    zo_obj = z_createObject('name', 'daniel', 'age', 39, 'birthday', now());

    printf("Object: '%s'\n", (string) zo_obj);
    printf("# '%s'\n", zo_obj.name);
    printf("# '%s'\n", zo_obj.age);
    printf("# '%s'\n", zo_obj.birthday);
}


object z_createObject(...)
{
    // Create a object in top_object() context
    // The parameters may be informed in paires

 

    ///////////////////////////////////////////////////////////////////////////////////////
    // Begin
    int zi_i;
    for (zi_i=0; zi_i<argc; zi_i+=2) {
        send_wait(0, this, "call_attr", argv[zi_i], "set_val", argv[zi_i+1]);
    }
    return this;
    // Finish
    ///////////////////////////////////////////////////////////////////////////////////////
}

Statistics
0 Favorited
11 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.