本文整理汇总了C++中errMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ errMsg函数的具体用法?C++ errMsg怎么用?C++ errMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了errMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PROGRAM
// <program> -> PROGRAM <var> <block> .
APTNode* PROGRAM(void)
{
if (strcmp(currentTok.sym, "PROGRAMtk") == 0)
{
scanner();
//BUILD <VAR> NODE
APTNode* varNode = VAR();
//BUILD <BLOCK> NODE
APTNode* blockNode = BLOCK();
if (strcmp(currentTok.sym, "DOTtk") == 0)
{
scanner();
//BUILD <PROGRAM> NODE
APTNode* programNode = createNonIdAPTNode("<PROGRAMtk>");
addChildNode(programNode, varNode);
addChildNode(programNode, blockNode);
return programNode;
} else errMsg("DOTtk");
} else errMsg("PROGRAMtk");
}
示例2: switch
bool CaptureCAM_XIMEA::setProperty( int property_id, double value )
{
int ival = (int) value;
float fval = (float) value;
int mvret = XI_OK;
switch(property_id)
{
// OCV parameters
case CAP_PROP_FRAME_WIDTH : mvret = xiSetParamInt( hmv, XI_PRM_WIDTH, ival); width = ival; break;
case CAP_PROP_FRAME_HEIGHT : mvret = xiSetParamInt( hmv, XI_PRM_HEIGHT, ival); height=ival; break;
case CAP_PROP_FPS : mvret = xiSetParamFloat( hmv, XI_PRM_FRAMERATE, fval); break;
case CAP_PROP_GAIN : mvret = xiSetParamFloat( hmv, XI_PRM_GAIN, fval); break;
case CAP_PROP_EXPOSURE : mvret = xiSetParamInt( hmv, XI_PRM_EXPOSURE, ival); break;
// XIMEA camera properties
case CAP_PROP_XI_DOWNSAMPLING : mvret = xiSetParamInt( hmv, XI_PRM_DOWNSAMPLING, ival); break;
case CAP_PROP_XI_DATA_FORMAT : mvret = xiSetParamInt( hmv, XI_PRM_IMAGE_DATA_FORMAT, ival); break;
case CAP_PROP_XI_OFFSET_X : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_X, ival); xoffset = ival; break;
case CAP_PROP_XI_OFFSET_Y : mvret = xiSetParamInt( hmv, XI_PRM_OFFSET_Y, ival); yoffset = ival; break;
case CAP_PROP_XI_TRG_SOURCE : xiStopAcquisition(hmv);mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, ival);xiStartAcquisition(hmv); break;
case CAP_PROP_XI_OUTPUT_DATA_BIT_DEPTH : xiStopAcquisition(hmv);mvret = xiSetParamInt( hmv, XI_PRM_OUTPUT_DATA_BIT_DEPTH, ival); xiStartAcquisition(hmv); break;
case CAP_PROP_XI_DATA_PACKING : xiStopAcquisition(hmv);mvret = xiSetParamInt( hmv, XI_PRM_OUTPUT_DATA_PACKING, ival); xiStartAcquisition(hmv); break;
case CAP_PROP_XI_GPI_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_GPI_SELECTOR, ival); break;
case CAP_PROP_XI_TRG_SOFTWARE : mvret = xiSetParamInt( hmv, XI_PRM_TRG_SOURCE, 1); break;
case CAP_PROP_XI_GPI_MODE : mvret = xiSetParamInt( hmv, XI_PRM_GPI_MODE, ival); break;
case CAP_PROP_XI_GPI_LEVEL : mvret = xiSetParamInt( hmv, XI_PRM_GPI_LEVEL, ival); break;
case CAP_PROP_XI_GPO_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_GPO_SELECTOR, ival); break;
case CAP_PROP_XI_GPO_MODE : mvret = xiSetParamInt( hmv, XI_PRM_GPO_MODE, ival); break;
case CAP_PROP_XI_LED_SELECTOR : mvret = xiSetParamInt( hmv, XI_PRM_LED_SELECTOR, ival); break;
case CAP_PROP_XI_LED_MODE : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
case CAP_PROP_XI_AUTO_WB : mvret = xiSetParamInt( hmv, XI_PRM_AUTO_WB, ival); break;
case CAP_PROP_XI_MANUAL_WB : mvret = xiSetParamInt( hmv, XI_PRM_LED_MODE, ival); break;
case CAP_PROP_XI_AEAG : mvret = xiSetParamInt( hmv, XI_PRM_AEAG, ival); break;
case CAP_PROP_XI_EXP_PRIORITY : mvret = xiSetParamFloat( hmv, XI_PRM_EXP_PRIORITY, fval); break;
case CAP_PROP_XI_AE_MAX_LIMIT : mvret = xiSetParamInt( hmv, XI_PRM_EXP_PRIORITY, ival); break;
case CAP_PROP_XI_AG_MAX_LIMIT : mvret = xiSetParamFloat( hmv, XI_PRM_AG_MAX_LIMIT, fval); break;
case CAP_PROP_XI_AEAG_LEVEL : mvret = xiSetParamInt( hmv, XI_PRM_AEAG_LEVEL, ival); break;
case CAP_PROP_XI_TIMEOUT : timeout = ival; break;
}
if(mvret != XI_OK)
{
errMsg("Set parameter error", mvret);
return false;
}
else
return true;
}
示例3: fatalErrMsg
/******************************************************
Fatal error message popup
******************************************************/
void fatalErrMsg(const char *fmt, ...)
{
va_list vargs;
static char lstring[1024]; /* DANGER: Fixed buffer size */
va_start(vargs,fmt);
vsprintf(lstring,fmt,vargs);
va_end(vargs);
if(lstring[0] == '\0') return;
errMsg(lstring);
if (warningbox) XtAddCallback(warningbox,XmNokCallback,exit_quit,NULL);
}
示例4: errMsg
void OutputFileFITS::throwException(const char *msg, int status) {
std::string errMsg(msg);
if(status != 0)
{
char errDesc[ERRMSGSIZ];
fits_read_errmsg(errDesc);
errMsg += errDesc;
}
else
errMsg += "Reading from a closed file.";
throw IOException(msg, status);
}
示例5: listFiles
static void /* List all files in directory 'dirpath' */
listFiles(const char *dirpath)
{
DIR *dirp;
struct dirent *dp;
Boolean isCurrent; /* True if 'dirpath' is "." */
isCurrent = strcmp(dirpath, ".") == 0;
dirp = opendir(dirpath);
if (dirp == NULL) {
errMsg("opendir failed on '%s'", dirpath);
return;
}
/* For each entry in this directory, print directory + filename */
for (;;) {
errno = 0; /* To distinguish error from end-of-directory */
dp = readdir(dirp);
if (dp == NULL)
break;
if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
continue; /* Skip . and .. */
if (!isCurrent)
printf("%s/", dirpath);
printf("%s\n", dp->d_name);
}
if (errno != 0)
errExit("readdir");
if (closedir(dirp) == -1)
errMsg("closedir");
}
示例6: main
int main(int argc, char *argv[]) {
struct sockaddr_un addr;
int sfd, cfd;
ssize_t numRead;
char buf[BUF_SIZE];
sfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sfd == -1)
errExit("socket");
/* Construct server socket address, bind socket to it,
and make this a listening socket */
if (remove(SV_SOCK_PATH) == -1 && errno != ENOENT)
errExit("remove-%s", SV_SOCK_PATH);
memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, SV_SOCK_PATH, sizeof(addr.sun_path) - 1);
if (bind(sfd, (struct sockaddr *) &addr, sizeof(struct sockaddr_un)) == -1)
errExit("bind");
if (listen(sfd, BACKLOG) == -1)
errExit("listen");
for (;;) { /* Handle client connections iteratively */
/* Accept a connection. The connection is returned on a new
socket, 'cfd'; the listening socket ('sfd') remains open
and can be used to accept further connections. */
cfd = accept(sfd, NULL, NULL);
if (cfd == -1)
errExit("accept");
/* Transfer data from connected socket to stdout until EOF */
while ((numRead = read(cfd, buf, BUF_SIZE)) > 0)
if (write(STDOUT_FILENO, buf, numRead) != numRead)
fatal("partial/failed write");
if (numRead == -1)
errExit("read");
if (close(cfd) == -1)
errMsg("close");
}
}
示例7: main
int
main(int argc, char *argv[])
{
switch (vfork()) {
case -1: errExit("vfork");
case 0: if (close(STDOUT_FILENO) == -1)
errMsg("close - child");
_exit(EXIT_SUCCESS);
default: break;
}
/* Now parent closes STDOUT_FILENO twice: only the second close
should fail, indicating that the close(STDOUT_FILENO) by the
child did not affect the parent. */
if (close(STDOUT_FILENO) == -1)
errMsg("close");
if (close(STDOUT_FILENO) == -1)
errMsg("close");
exit(EXIT_SUCCESS);
}
示例8: staticCreate
QObject *AQSWrapperFactory::create(const QString &className, void *ptr)
{
QObject *ret = staticCreate(className, ptr);
if (ret)
return (ret == ptr ? 0 : ret);
QString errMsg(
QString::fromLatin1("Failed to create wrapper for class %1")
.arg(className)
);
throwError(errMsg);
qWarning(errMsg);
return 0;
}
示例9: alSetNotConnected
/*****************************************************************
alSetNotConnected
*****************************************************************/
void alSetNotConnected(struct mainGroup *pmainGroup)
{
GCLINK *gclink;
struct gcData *gcdata;
struct chanData *cdata;
int type;
if (!toBeConnectedCount) return;
if (pmainGroup->heartbeatPV.chid && !alCaIsConnected(pmainGroup->heartbeatPV.chid) ) {
errMsg("Heartbeat PV %s Not Connected\n",pmainGroup->heartbeatPV.name);
}
if (!pmainGroup) return;
gclink = firstGroupChannel((SLIST *)pmainGroup,&type);
while (gclink) {
gcdata = gclink->pgcData;
alForcePVSetNotConnected(gcdata->pforcePV,gcdata->name);
if (gcdata->sevrchid && !alCaIsConnected(gcdata->sevrchid) ) {
errMsg("Severity PV %s for %s Not Connected\n",
gcdata->sevrPVName, gcdata->name);
}
if (type == CHANNEL ) {
cdata = ((struct chanData *)gcdata);
if (cdata && cdata->ackPVId && !alCaIsConnected(cdata->ackPVId) ) {
errMsg("Acknowledge PV %s for %s Not Connected\n",
cdata->ackPVName, cdata->name);
}
if (cdata && cdata->chid && !alCaIsConnected(cdata->chid)) {
alNewEvent(NOT_CONNECTED,ERROR_STATE,0,-1,"",(CLINK *)gclink);
}
}
gclink = nextGroupChannel(gclink,&type);
}
}
示例10: isValidSolutionType
bool
isValidSolutionType(char c, bool toss)
{
if (SOLUTION_TYPES.find(c) == string::npos)
{
if (toss)
{
string errMsg("Invalid Solution Type: ");
errMsg += c;
Exception err(errMsg);
GPSTK_THROW(err);
}
return false;
}
return true;
}
示例11: errMsg
//__________________________________________________________________________________
void SetStatusLine (_String s)
{
#ifdef _MINGW32_MEGA_
if (_HY_MEGA_Pipe != INVALID_HANDLE_VALUE) {
DWORD bytesWritten = 0;
if (WriteFile (_HY_MEGA_Pipe,(LPCVOID)s.sData,s.sLength,&bytesWritten,NULL) == FALSE || bytesWritten != s.sLength) {
_String errMsg ("Failed to write the entire status update to a named MEGA pipe");
StringToConsole (errMsg);
}
FlushFileBuffers(_HY_MEGA_Pipe);
} else {
StringToConsole (s);
}
#endif
}
示例12: isValidConstraintCode
bool
isValidConstraintCode(char c, bool toss)
{
if (CONSTRAINT_CODES.find(c) == string::npos)
{
if (toss)
{
string errMsg("Invalid Constraint Code: ");
errMsg += c;
Exception err(errMsg);
GPSTK_THROW(err);
}
return false;
}
return true;
}
示例13: isValidObsCode
bool
isValidObsCode(char c, bool toss)
{
if (OBS_CODES.find(c) == string::npos)
{
if (toss)
{
string errMsg("Invalid Observation Code: ");
errMsg += c;
Exception err(errMsg);
GPSTK_THROW(err);
}
return false;
}
return true;
}
示例14: writePng
//-----------------------------------------------------------------------------
//! write png image
int writePng(const char *fileName, unsigned char **rowsp, int w, int h)
{
// defaults for elbeem
const int colortype = PNG_COLOR_TYPE_RGBA;
const int bitdepth = 8;
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
png_bytep *rows = rowsp;
//FILE *fp = fopen(fileName, "wb");
FILE *fp = NULL;
string doing = "open for writing";
if (!(fp = fopen(fileName, "wb"))) goto fail;
if(!png_ptr) {
doing = "create png write struct";
if (!(png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL))) goto fail;
}
if(!info_ptr) {
doing = "create png info struct";
if (!(info_ptr = png_create_info_struct(png_ptr))) goto fail;
}
if (setjmp(png_jmpbuf(png_ptr))) goto fail;
doing = "init IO";
png_init_io(png_ptr, fp);
doing = "write header";
png_set_IHDR(png_ptr, info_ptr, w, h, bitdepth, colortype, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
doing = "write info";
png_write_info(png_ptr, info_ptr);
doing = "write image";
png_write_image(png_ptr, rows);
doing = "write end";
png_write_end(png_ptr, NULL);
doing = "write destroy structs";
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose( fp );
return 0;
fail:
errMsg("writePng","Write_png: could not "<<doing<<" !");
if(fp) fclose( fp );
if(png_ptr || info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr);
return -1;
}
示例15: name
already_AddRefed<mozIStorageError>
AsyncBindingParams::bind(sqlite3_stmt * aStatement)
{
// We should bind by index using the super-class if there is nothing in our
// hashtable.
if (!mNamedParameters.Count())
return BindingParams::bind(aStatement);
nsCOMPtr<mozIStorageError> err;
for (auto iter = mNamedParameters.Iter(); !iter.Done(); iter.Next()) {
const nsACString &key = iter.Key();
// We do not accept any forms of names other than ":name", but we need to
// add the colon for SQLite.
nsAutoCString name(":");
name.Append(key);
int oneIdx = ::sqlite3_bind_parameter_index(aStatement, name.get());
if (oneIdx == 0) {
nsAutoCString errMsg(key);
errMsg.AppendLiteral(" is not a valid named parameter.");
err = new Error(SQLITE_RANGE, errMsg.get());
break;
}
// XPCVariant's AddRef and Release are not thread-safe and so we must not
// do anything that would invoke them here on the async thread. As such we
// can't cram aValue into mParameters using ReplaceObjectAt so that
// we can freeload off of the BindingParams::Bind implementation.
int rc = variantToSQLiteT(BindingColumnData(aStatement, oneIdx - 1),
iter.UserData());
if (rc != SQLITE_OK) {
// We had an error while trying to bind. Now we need to create an error
// object with the right message. Note that we special case
// SQLITE_MISMATCH, but otherwise get the message from SQLite.
const char *msg = "Could not covert nsIVariant to SQLite type.";
if (rc != SQLITE_MISMATCH) {
msg = ::sqlite3_errmsg(::sqlite3_db_handle(aStatement));
}
err = new Error(rc, msg);
break;
}
}
return err.forget();
}