Beispiel #1
0
bool ResourceManager::can_get(StringId64 type, StringId64 name)
{
	ResourceId id;
	id.type = type;
	id.name = name;
	return can_get(id);
}
Beispiel #2
0
const void* ResourceManager::get(StringId64 type, StringId64 name)
{
	const ResourcePair id = { type, name };
	TempAllocator128 ta;
	DynamicString type_str(ta);
	DynamicString name_str(ta);
	type.to_string(type_str);
	name.to_string(name_str);

	CE_ASSERT(can_get(type, name)
		, "Resource not loaded #ID(%s-%s)"
		, type_str.c_str()
		, name_str.c_str()
		);
	CE_UNUSED(type_str);
	CE_UNUSED(name_str);

	if (_autoload && !sort_map::has(_rm, id))
	{
		load(type, name);
		flush();
	}

	const ResourceEntry& entry = sort_map::get(_rm, id, ResourceEntry::NOT_FOUND);
	return entry.data;
}
Beispiel #3
0
uint32_t message_queue::get(uint8_t *command, uint8_t *buf, uint32_t len) {
    assert(command);
    assert(buf);

    if (!can_get()) {
        return 0;
    }

    if (command_length_ > len) {
        for (uint32_t i = 0; i < command_length_; i++) {
            pop();
        }

        return MESSAGE_QUEUE_BUFFER_TOO_SMALL;
    }
    *command = command_;
    for (uint32_t i = 0; i < command_length_; i++) {
        buf[i] = pop();
    }

    local_fill_ = false;

    return command_length_;
}
Beispiel #4
0
bool ResourceManager::can_get(const char* type, const char* name)
{
	return can_get(ResourceId(type, name));
}