_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; }
void * gapi_alloc ( gapi_unsigned_long l) { void *m; m = gapi__malloc (NULL, 0, l); return m; }
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; }
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 ); }
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; }
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; }
gapi_publicationBuiltinTopicData * gapi_publicationBuiltinTopicData__alloc ( void) { return (gapi_publicationBuiltinTopicData *)gapi__malloc (gapi_publicationBuiltinTopicData_free, 0, sizeof (gapi_publicationBuiltinTopicData)); }
gapi_topicBuiltinTopicData * gapi_topicBuiltinTopicData__alloc ( void) { return (gapi_topicBuiltinTopicData *)gapi__malloc (gapi_topicBuiltinTopicData_free, 0, sizeof (gapi_topicBuiltinTopicData)); }
gapi_participantBuiltinTopicData * gapi_participantBuiltinTopicData__alloc ( void) { return (gapi_participantBuiltinTopicData *)gapi__malloc (gapi_participantBuiltinTopicData_free, 0, sizeof (gapi_participantBuiltinTopicData)); }
gapi_subscriberQos * gapi_subscriberQos__alloc ( void) { return (gapi_subscriberQos *)gapi__malloc (gapi_subscriberQos_free, 0, sizeof (gapi_subscriberQos)); }
gapi_dataReaderViewQos * gapi_dataReaderViewQos__alloc ( void) { return (gapi_dataReaderViewQos *)gapi__malloc (gapi_dataReaderViewQos_free, 0, sizeof (gapi_dataReaderViewQos)); }
gapi_publisherQos * gapi_publisherQos__alloc ( void) { return (gapi_publisherQos *)gapi__malloc (gapi_publisherQos_free, 0, sizeof (gapi_publisherQos)); }
gapi_time_t * gapi_time_t__alloc ( void) { return (gapi_time_t *)gapi__malloc (NULL, 0, sizeof (gapi_time_t)); }
gapi_domainParticipantQos * gapi_domainParticipantQos__alloc ( void) { return (gapi_domainParticipantQos *)gapi__malloc (gapi_domainParticipantQos_free, 0, sizeof (gapi_domainParticipantQos)); }
struct gapi_domainParticipantListener * gapi_domainParticipantListener__alloc ( void) { return (struct gapi_domainParticipantListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_domainParticipantListener)); }
struct gapi_subscriberListener * gapi_subscriberListener__alloc ( void) { return (struct gapi_subscriberListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_subscriberListener)); }
struct gapi_dataReaderListener * gapi_dataReaderListener__alloc ( void) { return (struct gapi_dataReaderListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_dataReaderListener)); }
struct gapi_publisherListener * gapi_publisherListener__alloc ( void) { return (struct gapi_publisherListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_publisherListener)); }
struct gapi_topicListener * gapi_topicListener__alloc ( void) { return (struct gapi_topicListener *)gapi__malloc (NULL, 0, sizeof (struct gapi_topicListener)); }
gapi_subscriptionBuiltinTopicData * gapi_subscriptionBuiltinTopicData__alloc ( void) { return (gapi_subscriptionBuiltinTopicData *)gapi__malloc (gapi_subscriptionBuiltinTopicData_free, 0, sizeof (gapi_subscriptionBuiltinTopicData)); }
gapi_char * gapi_string_alloc ( gapi_unsigned_long len) { return gapi__malloc (NULL, 0, len+1); }
gapi_duration_t * gapi_duration_t__alloc ( void) { return (gapi_duration_t *)gapi__malloc (NULL, 0, sizeof (gapi_duration_t)); }
gapi_dataWriterQos * gapi_dataWriterQos__alloc ( void) { return (gapi_dataWriterQos *)gapi__malloc (gapi_dataWriterQos_free, 0, sizeof (gapi_dataWriterQos)); }
void * gapi_sequence_malloc ( void) { return gapi__malloc (gapi_sequence_free, 0, sizeof(gapiSequenceType)); }