Exemple #1
0
DaoChannel* DaoChannel_New( DaoType *type, int dtype )
{
	DaoChannel *self = (DaoChannel*) dao_calloc( 1, sizeof(DaoChannel) );
	if( dtype ) type = DaoType_Specialize( dao_type_channel, & type, type != NULL );
	DaoCstruct_Init( (DaoCstruct*) self, type );
	self->buffer = DList_New( DAO_DATA_VALUE );
	return self;
}
Exemple #2
0
DaoFuture* DaoFuture_New( DaoType *type, int vatype )
{
	DaoFuture *self = (DaoFuture*) dao_calloc( 1, sizeof(DaoFuture) );
	if( vatype ) type = DaoType_Specialize( dao_type_future, & type, type != NULL );
	DaoCstruct_Init( (DaoCstruct*) self, type );
	GC_IncRC( dao_none_value );
	self->state = DAO_CALL_PAUSED;
	self->value = dao_none_value;
	return self;
}
Exemple #3
0
DaoxGraph* DaoxGraph_New( DaoType *type, int directed )
{
	DaoxGraph *self = (DaoxGraph*) dao_calloc( 1, sizeof(DaoxGraph) );
	DaoCstruct_Init( (DaoCstruct*) self, type );
	self->nodes = DList_New(DAO_DATA_VALUE);
	self->edges = DList_New(DAO_DATA_VALUE);
	self->directed = directed;
	self->nodeType = NULL;
	self->edgeType = NULL;
	if( type ){
		DaoType **types = type->args->items.pType;
		daoint count = type->args->size;
		self->nodeType = DaoType_Specialize( daox_node_template_type, types, count );
		self->edgeType = DaoType_Specialize( daox_edge_template_type, types, count );
		GC_IncRC( self->nodeType );
		GC_IncRC( self->edgeType );
	}
	return self;
}