本文整理汇总了C++中CE_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ CE_ASSERT函数的具体用法?C++ CE_ASSERT怎么用?C++ CE_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CE_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: m_resource
Controller::Controller(const ControllerResource* cr, SceneGraph& sg, UnitId id, PxPhysics* physics, PxControllerManager* manager)
: m_resource(cr)
, m_scene_graph(sg)
, _unit_id(id)
, m_manager(manager)
, m_controller(NULL)
{
TransformInstance ti = sg.get(id);
const Vector3 pos = sg.world_position(ti);
PxCapsuleControllerDesc desc;
desc.climbingMode = PxCapsuleClimbingMode::eCONSTRAINED;
desc.nonWalkableMode = PxCCTNonWalkableMode::eFORCE_SLIDING;
desc.radius = cr->radius;
desc.height = cr->height;
desc.slopeLimit = cos(cr->slope_limit);
desc.stepOffset = cr->step_offset;
desc.contactOffset = cr->contact_offset;
desc.upDirection = PxVec3(0.0, 1.0, 0.0);
desc.material = physics->createMaterial(0.5f, 0.5f, 0.5f);
desc.position = PxExtendedVec3(pos.x, pos.y, pos.z);
desc.reportCallback = &m_callback;
CE_ASSERT(desc.isValid(), "Capsule is not valid");
m_controller = manager->createController(desc);
CE_ASSERT(m_controller, "Failed to create controller");
}
示例2: _backing
PoolAllocator::PoolAllocator(Allocator& backing, uint32_t num_blocks, uint32_t block_size, uint32_t block_align)
: _backing(backing)
, _start(NULL)
, _freelist(NULL)
, _block_size(block_size)
, _block_align(block_align)
, _num_allocations(0)
, _allocated_size(0)
{
CE_ASSERT(num_blocks > 0, "Unsupported number of blocks");
CE_ASSERT(block_size > 0, "Unsupported block size");
CE_ASSERT(block_align > 0, "Unsupported block alignment");
uint32_t actual_block_size = block_size + block_align;
uint32_t pool_size = num_blocks * actual_block_size;
char* mem = (char*) backing.allocate(pool_size, block_align);
// Initialize intrusive freelist
char* cur = mem;
for (uint32_t bb = 0; bb < num_blocks - 1; bb++)
{
uintptr_t* next = (uintptr_t*) cur;
*next = (uintptr_t) cur + actual_block_size;
cur += actual_block_size;
}
uintptr_t* end = (uintptr_t*) cur;
*end = (uintptr_t) NULL;
_start = mem;
_freelist = mem;
}
示例3: CE_ASSERT
//-----------------------------------------------------------------------------
uint32_t Heightfield::coords_to_index(uint32_t x, uint32_t y) const
{
CE_ASSERT(x < m_width, "X coordinates beyond heightfield width");
CE_ASSERT(y < m_height, "Y coordinates beyond heightfield height");
return m_width * y + x;
}
示例4: CE_ASSERT
//-----------------------------------------------------------------------------
DiskFile* Filesystem::open(const char* relative_path, FileOpenMode mode)
{
CE_ASSERT(exists(relative_path), "File does not exist: %s", relative_path);
CE_ASSERT(is_file(relative_path), "File is not a regular file: %s", relative_path);
return CE_NEW(m_allocator, DiskFile)(mode, os_path(relative_path));
}
示例5: ENTER
static void TAU32_CALLBACK_TYPE ce_on_receive
(TAU32_UserContext *pContext, TAU32_UserRequest *req)
{
ce_buf_item_t *item = (ce_buf_item_t *)req;
ce_chan_t *c;
ce_board_t *b;
unsigned int error;
int len;
ENTER ();
if (!req || !req->sys) {
EXIT ();
}
c = (ce_chan_t *)req->sys;
b = c->board;
len = req->Io.Rx.Received;
error = req->ErrorCode;
c->rintr++;
if (error == TAU32_SUCCESSFUL) {
if (req->Io.Rx.FrameEnd) {
c->ipkts++;
} else {
CE_DDK_DEBUG (b, c, ("No FrameEnd\n"));
/* probably do something in some cases*/
}
c->ibytes += len;
if (c->receive)
c->receive (c, item->buf, len);
} else if (error & TAU32_ERROR_BUS) {
c->overrun++;
if (c->error)
c->error (c, CE_OVERRUN);
} else {
CE_DDK_DEBUG (b, c, ("Another receive error: %x\n", error));
/* Do some procesing */
}
CE_ASSERT (!req->pInternal);
CE_ENQUEUE (c->rx_queue, req);
while (c->rx_queue) {
CE_DEQUEUE (c->rx_queue, req);
CE_ASSERT (req);
item = (ce_buf_item_t *)req;
req->Command = TAU32_Rx_Data;
req->Io.Rx.Channel = c->num;
req->pCallback = ce_on_receive;
req->Io.Rx.BufferLength = BUFSZ+4;
req->Io.Rx.PhysicalDataAddress = item->phys;
if (!TAU32_SubmitRequest (b->ddk.pControllerObject, req)) {
CE_DDK_DEBUG (b, c, ("RX submition failure\n"));
c->rx_pending--;
CE_ENQUEUE_HEAD (c->rx_queue, req);
break;
}
}
EXIT ();
}
示例6: setsockopt
void TCPSocket::set_timeout(u32 seconds)
{
struct timeval timeout;
timeout.tv_sec = seconds;
timeout.tv_usec = 0;
int err = setsockopt(_socket, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout));
CE_ASSERT(err == 0, "setsockopt: last_error(): %d", last_error());
err = setsockopt(_socket, SOL_SOCKET, SO_SNDTIMEO, (char*)&timeout, sizeof(timeout));
CE_ASSERT(err == 0, "setsockopt: last_error(): %d", last_error());
CE_UNUSED(err);
}
示例7: m_argc
//-----------------------------------------------------------------------------
Args::Args(int argc, char** argv, const char* shortopts, const ArgsOption* longopts) :
m_argc(argc),
m_argv(argv),
m_shortopts(shortopts),
m_longopts(longopts),
m_optind(1), // Do not consider argv[0]
m_scope(argc),
m_optarg(NULL)
{
CE_ASSERT(argv != NULL, "Argument vector must be != NULL");
CE_ASSERT(shortopts != NULL, "Short argument list must be != NULL");
// longopts could be NULL
}
示例8: CE_ASSERT
void* PoolAllocator::allocate(uint32_t size, uint32_t align)
{
CE_ASSERT(size == _block_size, "Size must match block size");
CE_ASSERT(align == _block_align, "Align must match block align");
CE_ASSERT(_freelist != NULL, "Out of memory");
uintptr_t next_free = *((uintptr_t*) _freelist);
void* user_ptr = _freelist;
_freelist = (void*) next_free;
_num_allocations++;
_allocated_size += _block_size;
return user_ptr;
}
示例9: File
ApkFile::ApkFile(AAssetManager* asset_manager, const char* path)
: File(FOM_READ)
, _asset(NULL)
{
_asset = AAssetManager_open(asset_manager, path, AASSET_MODE_RANDOM);
CE_ASSERT(_asset != NULL, "AAssetManager_open: failed to open %s", path);
}
示例10: CE_ASSERT_NOT_NULL
void ApkFile::read(void* buffer, size_t size)
{
CE_ASSERT_NOT_NULL(buffer);
size_t bytes_read = (size_t) AAsset_read(_asset, buffer, size);
CE_ASSERT(bytes_read == size, "AAsset_read: requested: %lu, read: %lu", size, bytes_read);
CE_UNUSED(bytes_read);
}
示例11: CE_ASSERT
void SceneGraph::allocate(uint32_t num)
{
CE_ASSERT(num > _data.size, "num > _data.size");
const uint32_t bytes = num * (0
+ sizeof(UnitId)
+ sizeof(Matrix4x4)
+ sizeof(Pose)
+ sizeof(TransformInstance) * 4);
InstanceData new_data;
new_data.size = _data.size;
new_data.capacity = num;
new_data.buffer = _allocator.allocate(bytes);
new_data.unit = (UnitId*)(new_data.buffer);
new_data.world = (Matrix4x4*)(new_data.unit + num);
new_data.local = (Pose*)(new_data.world + num);
new_data.parent = (TransformInstance*)(new_data.local + num);
new_data.first_child = (TransformInstance*)(new_data.parent + num);
new_data.next_sibling = (TransformInstance*)(new_data.first_child + num);
new_data.prev_sibling = (TransformInstance*)(new_data.next_sibling + num);
memcpy(new_data.unit, _data.unit, _data.size * sizeof(UnitId));
memcpy(new_data.world, _data.world, _data.size * sizeof(Matrix4x4));
memcpy(new_data.local, _data.local, _data.size * sizeof(Pose));
memcpy(new_data.parent, _data.parent, _data.size * sizeof(TransformInstance));
memcpy(new_data.first_child, _data.first_child, _data.size * sizeof(TransformInstance));
memcpy(new_data.next_sibling, _data.next_sibling, _data.size * sizeof(TransformInstance));
memcpy(new_data.prev_sibling, _data.prev_sibling, _data.size * sizeof(TransformInstance));
_allocator.deallocate(_data.buffer);
_data = new_data;
}
示例12: CE_ASSERT
LinearAllocator::~LinearAllocator()
{
if (_backing)
_backing->deallocate(_physical_start);
CE_ASSERT(_offset == 0, "Memory leak of %ld bytes, maybe you forgot to call clear()?", _offset);
}
示例13: CE_ASSERT
//-----------------------------------------------------------------------------
void Device::shutdown()
{
CE_ASSERT(_is_init, "Engine is not initialized");
// Shutdowns the game
_lua_environment->call_global("shutdown", 0);
_boot_package->unload();
destroy_resource_package(_boot_package);
CE_LOGD("Releasing lua system...");
lua_system::shutdown();
CE_DELETE(_allocator, _lua_environment);
CE_LOGD("Releasing material manager...");
material_manager::shutdown();
CE_LOGD("Releasing world manager...");
CE_DELETE(_allocator, _world_manager);
CE_LOGD("Releasing resource manager...");
CE_DELETE(_allocator, _resource_manager);
Bundle::destroy(_allocator, _resource_bundle);
_allocator.clear();
_is_init = false;
}
示例14: wglCreateContext
//-----------------------------------------------------------------------------
void GLContext::create_context()
{
m_win_context = wglCreateContext(GetDC(s_handle_window));
wglMakeCurrent(GetDC(s_handle_window), m_win_context);
CE_ASSERT(m_win_context != NULL, "Unable to create a rendering context.");
}
示例15: CE_ASSERT
const ShaderData& ShaderManager::get(StringId32 id)
{
CE_ASSERT(sort_map::has(_shader_map, id), "Shader not found");
ShaderData deffault;
deffault.state = BGFX_STATE_DEFAULT;
deffault.program = BGFX_INVALID_HANDLE;
return sort_map::get(_shader_map, id, deffault);
}