Beispiel #1
0
DataVaultPtr DataBank_OpenNameSpace (
	DataBankPtr self,
	esif_string nameSpace
	)
{
	DataVaultPtr DB = NULL;
	UInt32 ns;

	// Exit if NameSpace already exists
	// TODO: Change this to a linked list or array of pointers so each DataVaultPtr is static
	esif_ccb_read_lock(&self->lock);
	for (ns = 0; ns < self->size; ns++) {
		if (esif_ccb_stricmp(nameSpace, self->elements[ns].name) == 0) {
			DB = &self->elements[ns];
			break;
		}
	}
	esif_ccb_read_unlock(&self->lock);
	if (DB != NULL || ns >= ESIF_MAX_NAME_SPACES) {
		return DB;
	}

	// Not Found. Create NameSpace
	esif_ccb_write_lock(&self->lock);
	DB = &self->elements[self->size++];
	DataVault_ctor(DB);
	esif_ccb_strcpy(DB->name, nameSpace, ESIF_NAME_LEN);
	esif_ccb_strlwr(DB->name, sizeof(DB->name));
	esif_ccb_write_unlock(&self->lock);
	return DB;
}
Beispiel #2
0
DataVaultPtr DataBank_OpenNameSpace (
	DataBankPtr self,
	esif_string nameSpace
	)
{
	DataVaultPtr DB = NULL;
	UInt32 ns;

	// TODO: Locking

	// Exit if NameSpace already exists
	// TODO: Change this to a linked list or array of pointers so each DataVaultPtr is static
	for (ns = 0; ns < self->size; ns++)
		if (strcmp(nameSpace, self->elements[ns].name) == 0) {
			return &self->elements[ns];
		}
	if (ns >= ESIF_MAX_NAME_SPACES) {
		return NULL;
	}

	// Not Found. Create NameSpace
	DB = &self->elements[self->size++];
	DataVault_ctor(DB);
	esif_ccb_strcpy(DB->name, nameSpace, ESIF_NAME_LEN);
	return DB;
}
Beispiel #3
0
// new operator
DataVaultPtr DataVault_Create(char* name)
{
	DataVaultPtr self = (DataVaultPtr)esif_ccb_malloc(sizeof(*self));
	DataVault_ctor(self);

	esif_ccb_strcpy(self->name, name, sizeof(self->name));
	esif_ccb_strlwr(self->name, sizeof(self->name));

	return self;
}
Beispiel #4
0
// new operator
DataVaultPtr DataVault_Create ()
{
	DataVaultPtr self = (DataVaultPtr)esif_ccb_malloc(sizeof(*self));
	DataVault_ctor(self);
	return self;
}