예제 #1
0
_Object
_ObjectAlloc (
    _ObjectKind     kind,
    long            size,
    gapi_boolean    (*deallocator)(void *))
{
    gapi_handle handle = NULL;
    _Object     object = NULL;

    if ( deallocator != NULL ) {
        handle = (gapi_handle) gapi__malloc(gapi_handleFree, 0, (C_SIZEOF(gapi_handle)));
    } else {
        handle = (gapi_handle) gapi__malloc(NULL, 0, (C_SIZEOF(gapi_handle)));
    }
    if ( handle != NULL ) {
        os_result osResult;
        os_mutexAttr osMutexAttr;
        os_condAttr  osCondAttr;

        handle->magic    = MAGIC;
        handle->kind     = kind;
        handle->registry = NULL;
        handle->userData = NULL;
        handle->busy     = FALSE;
        handle->deleteActionInfo.action   = NULL;
        handle->deleteActionInfo.argument = NULL;

        handle->beingDeleted = FALSE;

        osResult = os_mutexAttrInit (&osMutexAttr);
        osMutexAttr.scopeAttr = OS_SCOPE_PRIVATE;
        osResult = os_mutexInit (&handle->mutex, &osMutexAttr);

        osResult = os_condAttrInit (&osCondAttr);
        osCondAttr.scopeAttr = OS_SCOPE_PRIVATE;
        osResult = os_condInit (&handle->cv, &handle->mutex, &osCondAttr);

#ifdef _RWLOCK_
        osResult = os_mutexInit (&handle->read, &osMutexAttr);
        handle->count = 0;
#endif

        object = (_Object) os_malloc(size);
        if ( object != NULL ) {
            memset(object, 0, size);

            handle->deallocator  = deallocator;

            os_mutexLock(&handle->mutex);

            handle->object   = object;
            object->handle   = (gapi_object)handle;
        } else {
            gapi__free(handle);
        }
    }
    return object;

}
예제 #2
0
void *
gapi_alloc (
    gapi_unsigned_long l)
{
    void *m;

    m = gapi__malloc (NULL, 0, l);
    return m;
}
예제 #3
0
gapi_topicQos *
gapi_topicQos__alloc (
    void)
{
    gapi_topicQos *_this = NULL;

    _this = gapi__malloc (gapi_topicQos_free, 0, sizeof (gapi_topicQos));

    assert(gapi_sequence_is_valid(&_this->topic_data));
    return _this;
}
예제 #4
0
void *
DDS__malloc (
    DDS_boolean (*ff)(void *),
    DDS_unsigned_long hl,
    DDS_unsigned_long len)
{
    return
        gapi__malloc (
            ff,
            (gapi_unsigned_long) hl,
            (gapi_unsigned_long) len
        );
}
예제 #5
0
void *
gapi_sequence_allocbuf (
    gapi_boolean (*ff)(void *),
    gapi_unsigned_long len,
    gapi_unsigned_long count)
{
    void *buffer;
    gapi_unsigned_long *bufcount;

    if (count > 0) {
        buffer = gapi__malloc (ff, sizeof(gapi_unsigned_long), len * count);
        bufcount = gapi__header (buffer);
        *bufcount = count;
    } else {
        buffer = NULL;
    }

    return buffer;
}
예제 #6
0
gapi_offeredIncompatibleQosStatus *
gapi_offeredIncompatibleQosStatus_alloc (
    void)
{
    gapi_offeredIncompatibleQosStatus *newStatus;

    newStatus = (gapi_offeredIncompatibleQosStatus *)
                    gapi__malloc(gapi_offeredIncompatibleQosStatus_free, 0, sizeof(gapi_offeredIncompatibleQosStatus));

    if ( newStatus ) {
        newStatus->policies._buffer  = gapi_qosPolicyCountSeq_allocbuf(MAX_POLICY_COUNT_ID);
        newStatus->policies._length  = 0;
        newStatus->policies._maximum = MAX_POLICY_COUNT_ID;
        newStatus->policies._release = TRUE;

        if ( newStatus->policies._buffer == NULL ) {
            gapi_free(newStatus);
            newStatus = NULL;
        }
    }

    return newStatus;
}
예제 #7
0
gapi_publicationBuiltinTopicData *
gapi_publicationBuiltinTopicData__alloc (
    void)
{
    return (gapi_publicationBuiltinTopicData *)gapi__malloc (gapi_publicationBuiltinTopicData_free, 0, sizeof (gapi_publicationBuiltinTopicData));
}
예제 #8
0
gapi_topicBuiltinTopicData *
gapi_topicBuiltinTopicData__alloc (
    void)
{
    return (gapi_topicBuiltinTopicData *)gapi__malloc (gapi_topicBuiltinTopicData_free, 0, sizeof (gapi_topicBuiltinTopicData));
}
예제 #9
0
gapi_participantBuiltinTopicData *
gapi_participantBuiltinTopicData__alloc (
    void)
{
    return (gapi_participantBuiltinTopicData *)gapi__malloc (gapi_participantBuiltinTopicData_free, 0, sizeof (gapi_participantBuiltinTopicData));
}
예제 #10
0
gapi_subscriberQos *
gapi_subscriberQos__alloc (
    void)
{
    return (gapi_subscriberQos *)gapi__malloc (gapi_subscriberQos_free, 0, sizeof (gapi_subscriberQos));
}
예제 #11
0
gapi_dataReaderViewQos *
gapi_dataReaderViewQos__alloc (
    void)
{
    return (gapi_dataReaderViewQos *)gapi__malloc (gapi_dataReaderViewQos_free, 0, sizeof (gapi_dataReaderViewQos));
}
예제 #12
0
gapi_publisherQos *
gapi_publisherQos__alloc (
    void)
{
    return (gapi_publisherQos *)gapi__malloc (gapi_publisherQos_free, 0, sizeof (gapi_publisherQos));
}
예제 #13
0
gapi_time_t *
gapi_time_t__alloc (
    void)
{
    return (gapi_time_t *)gapi__malloc (NULL, 0, sizeof (gapi_time_t));
}
예제 #14
0
gapi_domainParticipantQos *
gapi_domainParticipantQos__alloc (
    void)
{
    return (gapi_domainParticipantQos *)gapi__malloc (gapi_domainParticipantQos_free, 0, sizeof (gapi_domainParticipantQos));
}
예제 #15
0
struct gapi_domainParticipantListener *
gapi_domainParticipantListener__alloc (
    void)
{
    return (struct gapi_domainParticipantListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_domainParticipantListener));
}
예제 #16
0
struct gapi_subscriberListener *
gapi_subscriberListener__alloc (
    void)
{
    return (struct gapi_subscriberListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_subscriberListener));
}
예제 #17
0
struct gapi_dataReaderListener *
gapi_dataReaderListener__alloc (
    void)
{
    return (struct gapi_dataReaderListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_dataReaderListener));
}
예제 #18
0
struct gapi_publisherListener *
gapi_publisherListener__alloc (
    void)
{
    return (struct gapi_publisherListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_publisherListener));
}
예제 #19
0
struct gapi_topicListener *
gapi_topicListener__alloc (
    void)
{
    return (struct gapi_topicListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_topicListener));
}
예제 #20
0
gapi_subscriptionBuiltinTopicData *
gapi_subscriptionBuiltinTopicData__alloc (
    void)
{
    return (gapi_subscriptionBuiltinTopicData *)gapi__malloc (gapi_subscriptionBuiltinTopicData_free, 0, sizeof (gapi_subscriptionBuiltinTopicData));
}
예제 #21
0
gapi_char *
gapi_string_alloc (
    gapi_unsigned_long len)
{
    return gapi__malloc (NULL, 0, len+1);
}
예제 #22
0
gapi_duration_t *
gapi_duration_t__alloc (
    void)
{
    return (gapi_duration_t *)gapi__malloc (NULL, 0, sizeof (gapi_duration_t));
}
예제 #23
0
gapi_dataWriterQos *
gapi_dataWriterQos__alloc (
    void)
{
    return (gapi_dataWriterQos *)gapi__malloc (gapi_dataWriterQos_free, 0, sizeof (gapi_dataWriterQos));
}
예제 #24
0
void *
gapi_sequence_malloc (
    void)
{
    return gapi__malloc (gapi_sequence_free, 0, sizeof(gapiSequenceType));
}