本文整理汇总了C++中CHECK_PTR函数的典型用法代码示例。如果您正苦于以下问题:C++ CHECK_PTR函数的具体用法?C++ CHECK_PTR怎么用?C++ CHECK_PTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CHECK_PTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calloc
TypedList *new_TypedList( void )
{
TypedList *result = ( TypedList * ) calloc( 1, sizeof( TypedList ) );
CHECK_PTR(result);
result->name = NULL;
result->type = NULL;
result->n = -1;
return result;
}
示例2: CHECK_PTR
bool SGFParser::exportSGFtoClipB(QString *str, Tree *tree)
{
CHECK_PTR(tree);
if (stream != NULL)
delete stream;
stream = new QTextStream(str, IO_WriteOnly);
bool res = writeStream(tree);
delete stream;
stream = NULL;
return res;
}
示例3: boardHandler
StoneHandler::StoneHandler(BoardHandler *bh)
: boardHandler(bh)
{
CHECK_PTR(boardHandler);
stones = new QIntDict<Stone>(367); // prime number larger than 361 (19*19)
// TODO: Dynamic for different board size?
stones->setAutoDelete(TRUE);
groups = new QPtrList<Group>;
groups->setAutoDelete(TRUE);
workingOnNewMove = false;
}
示例4: CHECK_PTR
void
SensorCard::displayNowHeader(Args& args)
{
const char* delimiter;
delimiter = args.getDelimiter();
CHECK_PTR(delimiter);
printf("Chan. 1 Temperature now%s", delimiter);
printf("Chan. 2 Temperature now%s", delimiter);
printf("Irradiance now%s", delimiter);
printf("Chan. 1 Value now%s", delimiter);
printf("Chan. 2 Value now%s", delimiter);
}
示例5: calloc
BfsHashEntry *new_BfsHashEntry( void )
{
BfsHashEntry *result = ( BfsHashEntry * ) calloc( 1, sizeof( BfsHashEntry ) );
CHECK_PTR(result);
result->bfs_node = NULL;
result->next = NULL;
return result;
}
示例6: xmp_files_close
bool xmp_files_close(XmpFilePtr xf, XmpCloseFileOptions options)
{
CHECK_PTR(xf, false);
RESET_ERROR;
try {
SXMPFiles *txf = (SXMPFiles*)xf;
txf->CloseFile(options);
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return true;
}
示例7: xmp_files_free
bool xmp_files_free(XmpFilePtr xf)
{
CHECK_PTR(xf, false);
RESET_ERROR;
SXMPFiles *txf = (SXMPFiles*)xf;
try {
delete txf;
}
catch(const XMP_Error & e) {
set_error(e);
return false;
}
return true;
}
示例8: CHECK_PTR
QGCache::QGCache( int maxCost, uint size, KeyType kt, bool caseSensitive,
bool copyKeys )
{
keytype = kt;
lruList = new QCList;
CHECK_PTR( lruList );
lruList->setAutoDelete( TRUE );
copyk = ((keytype == AsciiKey) && copyKeys);
dict = new QCDict( size, kt, caseSensitive, FALSE );
CHECK_PTR( dict );
mCost = maxCost;
tCost = 0;
#if defined(DEBUG)
lruList->inserts = 0;
lruList->insertCosts = 0;
lruList->insertMisses = 0;
lruList->finds = 0;
lruList->hits = 0;
lruList->hitCosts = 0;
lruList->dumps = 0;
lruList->dumpCosts = 0;
#endif
}
示例9: xmp_files_open_new
XmpFilePtr xmp_files_open_new(const char *path, XmpOpenFileOptions options)
{
CHECK_PTR(path, NULL);
RESET_ERROR;
SXMPFiles *txf = NULL;
try {
txf = new SXMPFiles(path, XMP_FT_UNKNOWN, options);
}
catch(const XMP_Error & e) {
set_error(e);
}
return (XmpFilePtr)txf;
}
示例10: calloc
EasyTemplate *new_EasyTemplate( NormOperator *op )
{
EasyTemplate *result = ( EasyTemplate * ) calloc( 1, sizeof( EasyTemplate ) );
CHECK_PTR(result);
result->op = op;
result->prev = NULL;
result->next = NULL;
return result;
}
示例11: input_parser
/*******************************************************************************************
* NAME : input_parse
*
* DESCRIPTION : Parses the input from a file of the cnf sat form.
*
* INPUTS :
* PARAMETERS :
* FILE *fp file
* INPUT *input input
*
* OUTPUTS :
* RETURN : 1 on success, -1 on failure/error
*/
int input_parser(FILE *fp, INPUT *input)
{
int i, file_size, *nbvar, *nbclauses, **data, *clause_lengths, *pos_val_sums, *neg_val_sums;
char *line;
// Finding the size of the file in bytes.
file_size = get_file_size(fp);
// Pass over comments.
line = parse_comments(fp, file_size);
nbvar = malloc(sizeof(int)); // ndicates variables will be from [-1, -nbvar] and [1, nbvar].
CHECK_PTR(nbvar);
*nbvar = 0;
nbclauses = malloc(sizeof(int)); // indicates the number of rows (clauses), indicated by the number of zeros.
CHECK_PTR(nbclauses);
*nbclauses = 0;
if (parse_cnf_header(line, nbvar, nbclauses) != 1) { return -1; }
data = malloc(sizeof(int*) * (*nbclauses));
CHECK_PTR(data);
clause_lengths = malloc(sizeof(int) * (*nbclauses));
CHECK_PTR(clause_lengths);
pos_val_sums = malloc(sizeof(int) * ((*nbvar)));
CHECK_PTR(pos_val_sums);
neg_val_sums = malloc(sizeof(int) * ((*nbvar)));
CHECK_PTR(neg_val_sums);
// Load array with 0s.
for (i = 0; i < *nbvar; i++)
{
pos_val_sums[i] = 0;
neg_val_sums[i] = 0;
}
// Loops over all clauses.
if (parse_clauses(fp, file_size, data, nbclauses, clause_lengths, pos_val_sums, neg_val_sums) != 1) { return -1; }
// Load values into structs.
input->data = data;
input->nbclauses = *nbclauses;
input->nbvars = *nbvar;
input->clause_lengths = clause_lengths;
input->pos_val_sums = pos_val_sums;
input->neg_val_sums = neg_val_sums;
free(nbvar);
free(nbclauses);
return 1;
}
示例12: calloc
PlOperator *new_PlOperator( char *name )
{
PlOperator *result = ( PlOperator * ) calloc( 1, sizeof( PlOperator ) );
CHECK_PTR(result);
if ( name ) {
result->name = new_Token(strlen(name)+1);
CHECK_PTR(result->name);
strcpy(result->name, name);
} else {
result->name = NULL;
}
result->params = NULL;
result->preconds = NULL;
result->effects = NULL;
result->number_of_real_params = 0;
result->next = NULL;
return result;
}
示例13: CHECK_PTR
QMenuData::QMenuData()
{
actItem = -1; // no active menu item
mitems = new QMenuItemList; // create list of menu items
CHECK_PTR( mitems );
mitems->setAutoDelete( TRUE );
parentMenu = 0; // assume top level
isPopupMenu = FALSE;
isMenuBar = FALSE;
mouseBtDn = FALSE;
badSize = TRUE;
avoid_circularity = 0;
actItemDown = FALSE;
d = new QMenuDataData;
}
示例14: qDebug
void RS_Engine::start(bool autoplay)
{
qDebug("start");
ASSERT( !autoplay );
CHECK_PTR( timer );
if( timer->isActive() )
{
timer->stop();
}
new_block();
updateUI();
timer->start(1000);
}
示例15: xmp_files_check_file_format
XmpFileType xmp_files_check_file_format(const char *filePath)
{
CHECK_PTR(filePath, XMP_FT_UNKNOWN);
RESET_ERROR;
XmpFileType file_type = XMP_FT_UNKNOWN;
try {
file_type = (XmpFileType)SXMPFiles::CheckFileFormat(filePath);
}
catch(const XMP_Error & e) {
set_error(e);
return XMP_FT_UNKNOWN;
}
return file_type;
}