Example #1
0
v_partition
v_partitionNew(
    v_kernel kernel,
    const c_char *name,
    v_partitionQos qos)
{
    v_partition partition, found;

    assert(kernel != NULL);
    assert(C_TYPECHECK(kernel,v_kernel));

    assert(name != NULL);
    assert(v_partitionExpressionIsAbsolute(name));

    partition = v_partition(v_objectNew(kernel,K_DOMAIN));
    v_entityInit(v_entity(partition),name, NULL, TRUE);

    found = v_addPartition(kernel,partition);

    if (found != partition) {
        v_partitionFree(partition);
        c_free(partition); /* v_partitionFree has removed all dependancies, now delete local reference */
        partition = c_keep(found); /* this one will be returned, so a keep is required */
    }
    return partition;
}
Example #2
0
void
v_topicAdapterInit(
    v_topicAdapter adapter,
    v_topic        topic,
    v_participant  p,
    const c_char  *name)
{
    v_eventMask mask = V_EVENT_ALL_DATA_DISPOSED | V_EVENT_INCONSISTENT_TOPIC;

    assert(adapter != NULL);
    assert(p != NULL);
    assert(C_TYPECHECK(adapter, v_topicAdapter));
    assert(C_TYPECHECK(p,v_participant));
    assert(C_TYPECHECK(topic,v_topic));

    v_entityInit(v_entity(adapter), name);
    adapter->topic = c_keep(topic);
    (void)v_entityEnable(v_entity(adapter));

    (void)v_observerSetEvent(v_observer(adapter), mask);

    OSPL_ADD_OBSERVER(topic, adapter, mask, NULL);
    v_participantAdd(p, v_object(adapter));
    v_topic(adapter)->owner = p;
}