本文整理汇总了C++中CoreAssert函数的典型用法代码示例。如果您正苦于以下问题:C++ CoreAssert函数的具体用法?C++ CoreAssert怎么用?C++ CoreAssert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CoreAssert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CoreAssert
void Profiler::EndProfile(char const *_name)
{
CoreAssert(this != NULL);
if (!IsMasterThread()) return;
//CoreAssert(m_currentElement->m_wasExpanded == m_currentElement->m_parent->m_isExpanded);
if (m_currentElement &&
m_currentElement->m_parent )
{
if (m_currentElement->m_parent->m_isExpanded) {
if (m_doGlFinish && m_inRenderSection) {
#ifdef ENABLE_OPENGL
glFinish();
#endif
}
CoreAssert(m_currentElement != m_rootElement);
CoreAssert(CrissCross::Data::Compare(_name, (const char *)m_currentElement->m_name) == 0);
m_currentElement->End();
}
CoreAssert(CrissCross::Data::Compare(m_currentElement->m_name, m_currentElement->m_parent->m_name) != 0);
m_currentElement = m_currentElement->m_parent;
}
}
示例2: CoreAssert
int64_t CoreIOReader::Position()
{
CoreAssert(this != NULL);
CoreAssert(IsOpen());
#ifdef HAS_FPOS64
fpos64_t lastpos;
#if defined(TARGET_COMPILER_VC) || defined(TARGET_COMPILER_BORLAND) || \
(defined(TARGET_COMPILER_ICC) && defined(TARGET_OS_WINDOWS))
lastpos = _ftelli64(m_fileInputPointer);
return lastpos;
#elif defined (TARGET_OS_MACOSX) || defined (TARGET_OS_NETBSD) || \
defined (TARGET_OS_FREEBSD) || defined (TARGET_OS_OPENBSD) || \
defined (TARGET_COMPILER_MINGW)
fgetpos(m_fileInputPointer, &lastpos);
return lastpos;
#else
fgetpos64(m_fileInputPointer, &lastpos);
return lastpos.__pos;
#endif
#else
fpos_t lastpos;
lastpos = ftell(m_fileInputPointer);
return lastpos;
#endif
}
示例3: sprintf
Uint32 OpenGLGraphics::CreateFont(const char *_fontFace, int _height, bool _bold, bool _italic)
{
#ifdef ENABLE_FONTS
char fontpath[512];
MemMappedFile *file = NULL;
sprintf(fontpath, "fonts/%s.ttf", _fontFace);
file = g_app->m_resource->GetUncompressedFile(fontpath);
if ( !file ) {
#ifdef TARGET_OS_WINDOWS
char windir[128];
GetWindowsDirectory(windir, 128);
sprintf(fontpath, "%s/fonts/%s.ttf", windir, _fontFace);
#elif defined(TARGET_OS_MACOSX)
sprintf(fontpath, "/Library/Fonts/%s.ttf", windir, _fontFace);
#endif
file = g_app->m_resource->GetUncompressedFile(fontpath);
}
CoreAssert(file);
OpenGLFont *font = new OpenGLFont(file->m_data, file->m_size);
CoreAssert(font);
font->SetFontSize(_height);
font->SetBold(_italic);
font->SetItalic(_italic);
return m_fonts.insert(font);
#else
return 0;
#endif
}
示例4: m_type
Mutex::Mutex(MutexType _type)
: m_type(_type)
{
m_lockCount = 0;
#ifdef TARGET_OS_WINDOWS
InitializeCriticalSection(&m_mutex);
#else
int error;
error = pthread_mutexattr_init(&m_mutexAttr);
CoreAssert(error == 0);
int ptype = 0;
switch (m_type)
{
case MUTEX_TYPE_NORMAL:
ptype = PTHREAD_MUTEX_NORMAL;
break;
case MUTEX_TYPE_ERRORCHECK:
ptype = PTHREAD_MUTEX_ERRORCHECK;
break;
case MUTEX_TYPE_RECURSIVE:
default:
ptype = PTHREAD_MUTEX_RECURSIVE;
break;
}
error = pthread_mutexattr_settype(&m_mutexAttr, ptype);
CoreAssert(error == 0);
error = pthread_mutex_init(&m_mutex, &m_mutexAttr);
CoreAssert(error == 0);
#endif
}
示例5: CoreAssert
void Mutex::Lock()
{
CoreAssert(this != NULL);
#ifdef TARGET_OS_WINDOWS
EnterCriticalSection(&m_mutex);
#else
int error = pthread_mutex_lock(&m_mutex);
CoreAssert(error == 0);
#endif
m_lockCount++;
}
示例6: InitializeCriticalSection
Mutex::Mutex()
{
m_lockCount = 0;
#ifdef TARGET_OS_WINDOWS
InitializeCriticalSection(&m_criticalSection);
#else
int error;
error = pthread_mutexattr_init(&m_mutexAttr);
CoreAssert(error == 0);
error = pthread_mutexattr_settype(&m_mutexAttr, PTHREAD_MUTEX_RECURSIVE);
CoreAssert(error == 0);
error = pthread_mutex_init(&m_hMutex, &m_mutexAttr);
CoreAssert(error == 0);
#endif
}
示例7: CoreAssert
CrissCross::Errors CoreIOWriter::Write(const char *_format, ...)
{
CoreAssert(this != NULL);
if (!IsOpen()) return CC_ERR_INVALID_BUFFER;
if (_format == NULL)
return CC_ERR_BADPARAMETER;
#ifndef __GNUC__
MutexHolder mh(&m_ioMutex);
#endif
va_list args;
va_start(args, _format);
/* Print out the string */
if (vfprintf(m_fileOutputPointer, _format, args) < 0)
return CC_ERR_WRITE;
fflush(m_fileOutputPointer);
va_end(args);
return CC_ERR_NONE;
}
示例8: CoreAssert
void CPUID::DetectCacheInfo(int processor)
{
CoreAssert(this != NULL);
if (proc[processor]->Manufacturer) {
if (strcmp(proc[processor]->Manufacturer, "GenuineIntel") == 0) {
int ntlb = 255, i;
for (i = 0; i < ntlb; i++) {
ntlb = Std[2].eax & 0xff;
AddIntelCacheData(processor, Std[2].eax >> 8);
AddIntelCacheData(processor, Std[2].eax >> 16);
AddIntelCacheData(processor, Std[2].eax >> 24);
if ((Std[2].ebx & 0x80000000) == 0) {
AddIntelCacheData(processor, Std[2].ebx);
AddIntelCacheData(processor, Std[2].ebx >> 8);
AddIntelCacheData(processor, Std[2].ebx >> 16);
AddIntelCacheData(processor, Std[2].ebx >> 24);
}
if ((Std[2].ecx & 0x80000000) == 0) {
AddIntelCacheData(processor, Std[2].ecx);
AddIntelCacheData(processor, Std[2].ecx >> 8);
AddIntelCacheData(processor, Std[2].ecx >> 16);
AddIntelCacheData(processor, Std[2].ecx >> 24);
}
if ((Std[2].edx & 0x80000000) == 0) {
AddIntelCacheData(processor, Std[2].edx);
AddIntelCacheData(processor, Std[2].edx >> 8);
AddIntelCacheData(processor, Std[2].edx >> 16);
AddIntelCacheData(processor, Std[2].edx >> 24);
}
示例9: while
bool SortingHashTable<T>::erase(size_t _index)
{
bool retval = false;
/* */
/* Remove data */
if (this->m_keys[_index] != (char *)-1) {
retval = true;
delete [] this->m_keys[_index];
}
this->m_keys[_index] = (char *)-1;
this->m_slotsFree++;
/* */
/* Remove from ordered list */
short prevIndex = -1;
short index = m_firstOrderedIndex;
while (m_orderedIndices[index] != _index)
{
CoreAssert(index != -1);
prevIndex = index;
index = m_orderedIndices[index];
}
if (prevIndex == -1) {
m_firstOrderedIndex = -1;
} else {
m_orderedIndices[prevIndex] = m_orderedIndices[index];
}
return retval;
}
示例10: CoreAssert
CrissCross::Errors CoreIOWriter::WriteLine(const char *_format, ...)
{
CoreAssert(this != NULL);
if (!IsOpen()) return CC_ERR_INVALID_BUFFER;
if (_format == NULL)
return CC_ERR_BADPARAMETER;
#ifndef __GNUC__
m_ioMutex.Lock();
#endif
va_list args;
va_start(args, _format);
/* Print out the string */
vfprintf(m_fileOutputPointer, _format, args);
if (fprintf(m_fileOutputPointer, "%s", m_lineEnding) < 0)
return CC_ERR_WRITE;
va_end(args);
Flush();
#ifndef __GNUC__
m_ioMutex.Unlock();
#endif
return CC_ERR_NONE;
}
示例11: CoreAssert
/*
* Read a directory entry, and return a pointer to a dirent structure
* containing the name of the entry in d_name field. Individual directory
* entries returned by this very function include regular files,
* sub-directories, pseudo-directories "." and "..", but also volume labels,
* hidden files and system files may be returned.
*/
struct dirent *readdir(DIR *dirp)
{
CoreAssert(dirp);
if (dirp->search_handle == INVALID_HANDLE_VALUE) {
/* directory stream was opened/rewound incorrectly or it ended normally */
return NULL;
}
/* get next directory entry */
if (dirp->cached != 0) {
/* a valid directory entry already in memory */
dirp->cached = 0;
} else {
/* read next directory entry from disk */
if (FindNextFileA(dirp->search_handle, &dirp->current.data) == FALSE) {
/* the very last file has been processed or an error occured */
FindClose(dirp->search_handle);
dirp->search_handle = INVALID_HANDLE_VALUE;
return NULL;
}
}
/* copy as a multibyte character string */
strncpy(dirp->current.d_name, dirp->current.data.cFileName, sizeof(dirp->current.d_name));
dirp->current.d_name[MAX_PATH] = '\0';
return &dirp->current;
}
示例12: CoreAssert
CrissCross::Errors FileReader::Open(const char *_file)
{
CoreAssert(this != NULL);
Close();
int _filePathLength = 0;
if (_file == NULL)
return CC_ERR_BADPARAMETER;
if ((_filePathLength = (int)strlen(_file)) < 1)
return CC_ERR_BADPARAMETER;
delete [] (char *)m_filePath;
m_filePath = new char[_filePathLength + 1];
strcpy((char *)m_filePath, _file);
m_fileInputPointer = fopen(m_filePath, "rb");
if (m_fileInputPointer == NULL)
return CC_ERR_FILE_OPEN;
else
return CC_ERR_NONE;
}
示例13: m_lock
RWLockHolder::RWLockHolder(ReadWriteLock *_lock, RWLockHolderType _type)
: m_lock(_lock), m_type(_type), m_copied(false)
{
CoreAssert(_lock);
switch(_type)
{
case RW_LOCK_READ:
m_lock->LockRead();
break;
case RW_LOCK_WRITE:
m_lock->LockWrite();
break;
default:
CoreAssert(_type != RW_LOCK_READ && _type != RW_LOCK_WRITE);
}
}
示例14: grow
size_t SortingHashTable<T>::insert(char const *_key, T const &_data)
{
/* */
/* Make sure the table is big enough */
if (this->m_slotsFree * 2 <= this->m_size) {
grow();
}
/* */
/* Do the main insert */
size_t index = HashTable<T>::findInsertIndex(_key);
CoreAssert(this->m_keys[index] == NULL || this->m_keys[index] == (char*)-1);
this->m_keys[index] = cc_strdup(_key);
this->m_data[index] = _data;
this->m_slotsFree--;
/* */
/* Insert us into the alphabetically order index list */
size_t i = findPrevKey(_key);
if (i == -1) {
/* Handle the case when the table is empty, or the new element is going */
/* to be the new first alphabetical element */
m_orderedIndices[index] = m_firstOrderedIndex;
m_firstOrderedIndex = index;
} else {
m_orderedIndices[index] = m_orderedIndices[i];
m_orderedIndices[i] = index;
}
return index;
}
示例15: CoreAssert
void TigerHash::Reset()
{
CoreAssert(this != NULL);
delete [] m_hash; m_hash = NULL;
delete [] m_hashString; m_hashString = NULL;
tiger_init(&m_state);
}