v_dataViewInstance v_dataViewInstanceNew( v_dataView dataView, v_dataViewSample viewSample) { v_dataViewInstance instance; assert(dataView); assert(viewSample); assert(C_TYPECHECK(dataView,v_dataView)); assert(C_TYPECHECK(viewSample,v_dataViewSample)); instance = v_dataViewInstance(c_new(dataView->instanceType)); if (instance) { v_object(instance)->kernel = v_objectKernel(dataView); v_objectKind(instance) = K_DATAVIEWINSTANCE; v_instanceInit(v_instance(instance), v_entity(dataView)); viewSample->next = viewSample; v_dataViewInstanceTemplate(instance)->sample = viewSample; instance->sampleCount = 1; v_stateSet(v_instanceState(instance),L_NEW); v_stateClear(v_readerSample(viewSample)->sampleState,L_READ); assert(C_TYPECHECK(instance,v_dataViewInstance)); CHECK_INSTANCE(instance); } else { OS_REPORT(OS_FATAL, OS_FUNCTION, V_RESULT_INTERNAL_ERROR, "Failed to allocate v_dataViewInstance"); assert(FALSE); } return instance; }
void v_publicDispose( v_public o) { assert(C_TYPECHECK(o,v_public)); if (o == NULL) { return; } switch(v_objectKind(o)) { case K_PARTICIPANT: v_participantDeinit(v_participant(o)); break; case K_PUBLISHER: v_publisherDeinit(v_publisher(o)); break; case K_SUBSCRIBER: v_subscriberDeinit(v_subscriber(o)); break; case K_WRITER: v_writerDeinit(v_writer(o)); break; case K_DATAREADER: v_dataReaderDeinit(v_dataReader(o)); break; case K_DELIVERYSERVICE:v_deliveryServiceDeinit(v_deliveryService(o)); break; case K_NETWORKREADER: v_networkReaderDeinit(v_networkReader(o)); break; case K_READER: v_readerDeinit(v_reader(o)); break; case K_GROUPQUEUE: v_groupQueueDeinit(v_groupQueue(o)); break; case K_TOPIC: v_topicDeinit(v_topic(o)); break; case K_ENTITY: break; case K_DOMAIN: v_partitionDeinit(v_partition(o)); break; case K_GROUP: v_groupDeinit(v_group(o)); break; case K_SERVICEMANAGER: /* Is never freed! */ break; case K_SPLICED: v_splicedDeinit(v_spliced(o)); break; case K_NETWORKING: case K_DURABILITY: case K_CMSOAP: case K_SERVICE: v_serviceDeinit(v_service(o)); break; case K_SERVICESTATE: /* Is never freed! */ break; case K_CONFIGURATION: break; case K_QUERY: OS_REPORT(OS_ERROR, "v_publicDispose failure", 0, "deinit of abstract class K_QUERY"); break; case K_DATAREADERQUERY: v_dataReaderQueryDeinit(v_dataReaderQuery(o)); break; case K_DATAVIEWQUERY: v_dataViewQueryDeinit(v_dataViewQuery(o)); break; case K_DATAVIEW: v_dataViewDeinit(v_dataView(o)); break; case K_WAITSET: v_waitsetDeinit(v_waitset(o)); break; case K_WRITERINSTANCE: v_writerInstanceDeinit(v_writerInstance(o)); break; case K_DATAREADERINSTANCE: v_dataReaderInstanceDeinit(v_dataReaderInstance(o)); break; case K_DATAVIEWINSTANCE: v_dataViewInstanceDeinit(v_dataViewInstance(o)); break; default: OS_REPORT_1(OS_ERROR,"v_publicDispose failed",0, "illegal entity kind (%d) specified",v_objectKind(o)); assert(FALSE); break; } c_free(o); }
void v_dataViewSampleRemove( v_dataViewSample sample) { v_dataViewInstance instance; assert(C_TYPECHECK(sample,v_dataViewSample)); instance = v_dataViewInstance(v_readerSample(sample)->instance); CHECK_INSTANCE(instance); if (instance->sampleCount > 1) { if (sample->next != NULL) { v_dataViewSample(sample->next)->prev = sample->prev; } else { v_dataViewInstanceTemplate(instance)->sample = sample->prev; } if (sample->prev != NULL) { v_dataViewSample(sample->prev)->next = sample->next; } sample->prev = NULL; sample->next = NULL; c_free(sample); } instance->sampleCount--; if (instance->sampleCount > 0) { CHECK_INSTANCE(instance); } else { CHECK_ZERO_INSTANCE(instance); } }
void v_dataViewSampleListRemove( v_dataViewSampleList sample) { assert(C_TYPECHECK(sample,v_dataViewSampleList)); assert(v_dataViewInstance(v_readerSample(sample)->instance)->sampleCount > 0); CHECK_INSTANCE(v_dataViewInstance(v_readerSample(sample)->instance)); if (sample->next != NULL) { v_dataViewSampleList(sample->next)->prev = sample->prev; } if (sample->prev != NULL) { v_dataViewSampleList(sample->prev)->next = sample->next; } else { assert(v_dataViewSampleTemplate(sample)->sample->viewSamples == sample); v_dataViewSampleTemplate(sample)->sample->viewSamples = sample->next; } sample->prev = NULL; sample->next = NULL; CHECK_INSTANCE(v_dataViewInstance(v_readerSample(sample)->instance)); }
v_dataViewInstance v_dataViewInstanceNew( v_dataView dataView, v_readerSample sample) { v_dataViewInstance instance; v_dataViewSample viewSample; assert(dataView); assert(sample); assert(C_TYPECHECK(dataView,v_dataView)); assert(C_TYPECHECK(sample,v_readerSample)); instance = v_dataViewInstance(c_new(dataView->instanceType)); if (instance) { v_object(instance)->kernel = v_objectKernel(dataView); v_objectKind(instance) = K_DATAVIEWINSTANCE; instance->dataView = (c_voidp)dataView; viewSample = v_dataViewSampleNew(instance,sample); if (viewSample) { v_dataViewInstanceTemplate(instance)->sample = viewSample; viewSample->next = NULL; viewSample->prev = NULL; v_readerSampleAddViewSample(sample,viewSample); instance->sampleCount = 1; v_stateSet(instance->instanceState,L_NEW); v_stateClear(v_readerSample(viewSample)->sampleState,L_READ); assert(C_TYPECHECK(instance,v_dataViewInstance)); v_dataViewNotifyDataAvailable(dataView, viewSample); } CHECK_INSTANCE(instance); } else { OS_REPORT(OS_ERROR, "v_dataViewInstanceNew",0, "Failed to allocate v_dataViewInstancem"); assert(FALSE); } return instance; }