当前位置: 首页>>代码示例>>C++>>正文


C++ CMmsgPrint函数代码示例

本文整理汇总了C++中CMmsgPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ CMmsgPrint函数的具体用法?C++ CMmsgPrint怎么用?C++ CMmsgPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CMmsgPrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CMmsgPrint

const char *NFtimePrint(NFtime_p timePtr, char *timeStr) {
    if (timeStr == (char *) NULL) {
        CMmsgPrint(CMmsgAppError, "Invalid time string pointer in %s:%d!\n", __FILE__, __LINE__);
    }
    else if (timePtr->Minute != NFtimeUnset)
        sprintf (timeStr, "%04d-%02d-%02d %02d %02d", timePtr->Year, timePtr->Month, timePtr->Day, timePtr->Hour,
                 timePtr->Minute);
    else if (timePtr->Hour != NFtimeUnset)
        sprintf (timeStr, "%04d-%02d-%02d %02d", timePtr->Year, timePtr->Month, timePtr->Day, timePtr->Hour);
    else if (timePtr->Day != NFtimeUnset)
        sprintf (timeStr, "%04d-%02d-%02d", timePtr->Year, timePtr->Month, timePtr->Day);
    else if (timePtr->Month != NFtimeUnset) sprintf (timeStr, "%04d-%02d", timePtr->Year, timePtr->Month);
    else
        sprintf (timeStr, "%04d", timePtr->Year);
    return (timeStr);
}
开发者ID:bmfekete,项目名称:nFrames,代码行数:16,代码来源:NFtime.c

示例2: _NCdsHandleGContTestNodata

static bool _NCdsHandleGContTestNodata(const NCdsHandleGCont_t *gCont, double val) {
    switch (gCont->GType) {
        default:
            CMmsgPrint(CMmsgAppError, "Invalid data NetCDF type in: %s %d", __FILE__, __LINE__);
            break;
        case NC_BYTE:
        case NC_SHORT:
        case NC_INT:
            return ((gCont->MissingVal.Int == (int) val) || (gCont->FillValue.Int == (int) val) ? true : false);
        case NC_FLOAT:
        case NC_DOUBLE:
            return (NCmathEqualValues(gCont->MissingVal.Float, val) || NCmathEqualValues(gCont->FillValue.Float, val)
                    ? true : false);
    }
    return (true);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:16,代码来源:NCdsHandleGCont.c

示例3: _MDCParamAlbedo

static void _MDCParamAlbedo (int itemID) {
// Input
	int   cover;
	float snowPack;
// Local
	static float albedo []     = { 0.14, 0.18, 0.18, 0.20, 0.20, 0.22, 0.26, 0.10 };
	static float albedoSnow [] = { 0.14, 0.23, 0.35, 0.50, 0.50, 0.50, 0.50, 0.50 };

	cover    = MFVarGetInt   (_MDInCoverID,    itemID,   7); // defaulting missing value to water.
	if ((cover < 0) || (cover >= (int) (sizeof (albedo) / sizeof (albedo [0])))) {
		CMmsgPrint (CMmsgWarning,"Warning: Invalid cover [%d] in: %s:%d\n",cover,__FILE__,__LINE__);
		return;
	}
	snowPack = MFVarGetFloat (_MDInSnowPackID, itemID, 0.0);
	MFVarSetFloat (_MDOutCParamAlbedoID,itemID,snowPack > 0.0 ? albedoSnow[cover] : albedo[cover]);	
}
开发者ID:ArielMiara,项目名称:WBMplus,代码行数:16,代码来源:MDCParams.c

示例4: _NCgridVariableCreate

static NCgridVariable_p _NCgridVariableCreate(size_t fileNum) {
    size_t i;
    NCgridVariable_p gridVariable;

    if (((gridVariable = (NCgridVariable_p) calloc(1, sizeof(NCgridVariable_t))) == (NCgridVariable_p) NULL) ||
        ((gridVariable->VarIDs = (int *) calloc(fileNum, sizeof(int))) == (int *) NULL) ||
        ((gridVariable->Units = (ut_unit **) calloc(fileNum, sizeof(ut_unit *))) == (ut_unit **) NULL)) {
        CMmsgPrint(CMmsgSysError, "Memory alloction error in %s:%s!\n", __FILE__, __LINE__);
        return ((NCgridVariable_p) NULL);
    }
    for (i = 0; i < fileNum; ++i) {
        gridVariable->VarIDs[i] = CMfailed;
        gridVariable->Units[i] = (ut_unit *) NULL;
    }
    return (gridVariable);
}
开发者ID:bmfekete,项目名称:nFrames,代码行数:16,代码来源:NCgrid.c

示例5: NCdataGetType

NCdataType NCdataGetType(int ncid) {
    int status;
    char dTypeStr[NC_MAX_NAME];

    if ((status = nc_get_att_text(ncid, NC_GLOBAL, NCnameGADataType, dTypeStr)) == NC_NOERR) {
        if (strncmp(dTypeStr, NCnameTypeGCont, strlen(NCnameTypeGCont)) == 0) return (NCtypeGCont);
        else if (strncmp(dTypeStr, NCnameTypeGDisc, strlen(NCnameTypeGDisc)) == 0) return (NCtypeGDisc);
        else if (strncmp(dTypeStr, NCnameTypePoint, strlen(NCnameTypePoint)) == 0) return (NCtypePoint);
        else if (strncmp(dTypeStr, NCnameTypeLine, strlen(NCnameTypeLine)) == 0) return (NCtypeLine);
        else if (strncmp(dTypeStr, NCnameTypePolygon, strlen(NCnameTypePolygon)) == 0) return (NCtypePolygon);
        else if (strncmp(dTypeStr, NCnameTypeNetwork, strlen(NCnameTypeNetwork)) == 0) return (NCtypeNetwork);
        CMmsgPrint(CMmsgAppError, "Invalid data type in: %s %d", __FILE__, __LINE__);
        return (NCtypeUndefined);
    }
    return (NCtypeGCont);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:16,代码来源:NCdata.c

示例6: RGlibGenFuncFieldCompare

DBInt RGlibGenFuncFieldCompare (DBObjTable *table,char *f0Text,char *f1Text,char *rText,DBInt diffMethod)

	{
	DBInt intVal, ret, i, rowID;
	DBFloat val [2];
	DBObjTableField *field [2];
	DBObjTableField *result;
	DBObjRecord *record;
		
	field [0] = table->Field (f0Text);
	field [1] = table->Field (f1Text);
	result = table->Field (rText);
	if ((field [0] == (DBObjTableField *) NULL) || (field [1] == (DBObjTableField *) NULL))
		{ CMmsgPrint (CMmsgAppError, "Invalid Compare Fields in: %s %d",__FILE__,__LINE__); return (DBFault); }
	if (result == (DBObjTableField *) NULL)
		table->AddField (result = new DBObjTableField (rText,DBTableFieldFloat,"%10.3f",sizeof (DBFloat4)));
	if (diffMethod > 0) result->Format ("%6.2f");
	for (rowID = 0;rowID < table->ItemNum ();++rowID)
		{
		record = table->Item (rowID);
		if ((record->Flags () & DBObjectFlagIdle) == DBObjectFlagIdle)
			result->Float (record,result->FloatNoData ());
		else
			{
			for (i = 0;i < 2;++i)
				if (field [i]->Type () == DBTableFieldInt) 
					{
					intVal = field [i]->Int (record);
					ret = intVal == field [i]->IntNoData ();
					val [i] = (DBFloat) intVal;
					}
				else
					{
					val [i] = field [i]->Float (record);
					ret = CMmathEqualValues (val [i],field [i]->FloatNoData ());
					}
			if (ret) result->Float (record,result->FloatNoData ());
			else switch (diffMethod)
				{
				default:	result->Float (record, val [0] - val [1]);	break;
				case 1: 	result->Float (record,(val [0] - val [1]) * 100.0 /  val [0]);	break;
				case 2: 	result->Float (record,(val [0] - val [1]) * 100.0 / (val [0] > val [1] ? val [0] : val [1]));	break;
				}
			}
		}
	return (DBSuccess);
	}
开发者ID:bandi13,项目名称:RGIS,代码行数:47,代码来源:RGlibGenFuncs.C

示例7: Finalize_Hamon

void Finalize_Hamon(void *userData) {
    size_t i;
    HamonData_t *data = (HamonData_t *) userData;

    CMmsgPrint(CMmsgUsrError, "Parameter0: %lf\n", data->Parameter0);
    CMmsgPrint(CMmsgUsrError, "Parameter1: %lf\n", data->Parameter1);
    CMmsgPrint(CMmsgUsrError, "Airtemp: %lf\n", data->Airtemp);
    CMmsgPrint(CMmsgUsrError, "VaporPressure: %lf\n", data->VaporPressure);
    CMmsgPrint(CMmsgUsrError, "PotEvap: %lf\n", data->PotEvap);
    for (i = 0; i < VectorLen; ++i) CMmsgPrint(CMmsgInfo, "Vector: %lf\n", data->Vector[i]);
}
开发者ID:bmfekete,项目名称:nFrames,代码行数:11,代码来源:PETlib.c

示例8: NCdsHandleDefine

NCstate NCdsHandleDefine (NCdsHandle_t *dsh, int *ncids, size_t n)
{
	NCdataType dataType;
	int i;

	dsh->NCIds   = (int *)  NULL;
	NCdsHandleClear (dsh);

	if (n < 1) return (NCfailed);
	if ((dataType = NCdataGetType (ncids [0])) == NCtypeUndefined) return (NCfailed);
	dsh->DataType = dataType;
	if ((dsh->NCIds = (int *) calloc (n,sizeof (int))) == (int *) NULL)
	{ CMmsgPrint (CMmsgSysError, "Memory allocation error in: %s %d",__FILE__,__LINE__); return (NCfailed); }
	for (i = 0;i < n;++i) dsh->NCIds [i] = ncids [i];
	dsh->NCnum = n;
	return (NCsucceeded);
}
开发者ID:bandi13,项目名称:RGIS,代码行数:17,代码来源:NCdsHandle.c

示例9: main

int main( int argc, char* argv[] )
{
  fData* theData;
  int errCheck;

  setInputFiles( argc,argv );
  
  theData = readFile( dataFile, dataTypesFile, &errCheck );
  
  if(errCheck)
    CMmsgPrint (CMmsgUsrError, "errors were reported, but continuing anyways.");
  
  printDataTypes( *theData );
  freeFData( theData );
  
  return 0;
}
开发者ID:amiara,项目名称:RGIS,代码行数:17,代码来源:FPrintDataTypes.c

示例10: NFcontextCreate

NFcontext_p NFcontextCreate () {
	NFcontext_p context;
	
	if ((context = (NFcontext_p ) malloc (sizeof (NFcontext_t))) == (NFcontext_p)  NULL) {
		CMmsgPrint (CMmsgSysError,"Memory allocation error in %s:%d\n",__FILE__,__LINE__);
		return ((NFcontext_p) NULL);
	}
	context->TimeStepUnit = (const char *) NULL;
	context->MinTimeStep  = 0;
	context->MaxTimeStep  = 0;
	context->ParameterNum = context->VariableNum  = 0;
	context->Parameters   = (struct NFparameter_s *) NULL;
	context->Variables    = (struct NFvariable_s  *)  NULL;
	context->UserDataSize = 0;
	context->UserData     = (void *) NULL;
	return (context);
}
开发者ID:ztessler,项目名称:nFrames,代码行数:17,代码来源:NFcontext.c

示例11: DBExportNetCDF

int DBObjData::Write (const char *fileName)

	{
	DBInt ret;
	FILE *file;

	if (strncmp(CMfileExtension(fileName),"nc",2) == 0)
		ret = DBExportNetCDF (this,fileName);
	else
		{
		if ((file = fopen (fileName,"w")) == (FILE *) NULL)
		{ CMmsgPrint (CMmsgSysError, "File (%s) Opening Error in: %s %d", fileName, __FILE__,__LINE__); return (DBFault); }
		ret = Write (file);
		fclose (file);
		}
	return (ret);
	}
开发者ID:gyelnats,项目名称:RGIS,代码行数:17,代码来源:DBObjReadWrit.C

示例12: MDBgcRiverGPPDef

int MDBgcRiverGPPDef () {
	int optID = MFUnset;
    const char *optStr;
		const char *options [] = { "none", "calculate", (char *) NULL };

	if (_MDRiverGPPID != MFUnset) return (_MDRiverGPPID);

	MFDefEntering ("Calculate river GPP");
	
	if (((optStr = MFOptionGet (MDOptReservoirs))  == (char *) NULL) || ((optID = CMoptLookup ( options, optStr, true)) == CMfailed)) {
				CMmsgPrint(CMmsgUsrError,"Reservoir Option not specified! Option none or calculate \n");
				return CMfailed;
			}
    if (optID==1){
//  	printf ("Resoption=%i\n",optID);
    if (((_MDInResStorageID           = MFVarGetID (MDVarReservoirStorage,       "km3",     MFInput, MFState, MFInitial))   == CMfailed) ||
        ((_MDInResStorageChangeID     = MFVarGetID (MDVarReservoirStorageChange, "km3/s",   MFInput, MFState, MFBoundary))  == CMfailed))
    	return CMfailed;
    }
	
//input
	if (//((_MDInDischargeID            = MDDischargeDef    ()) == CMfailed) ||
		 ((_MDInRiverLightID          = MDBgcRiverLightDef ()) == CMfailed) ||
         ((_MDInDischargeID           = MFVarGetID (MDVarDischarge,              "m3/s",    MFInput, MFState,  MFBoundary)) == CMfailed) ||
         ((_MDInRiverWidthID          = MFVarGetID (MDVarRiverWidth,             "m",       MFInput, MFState,  MFBoundary)) == CMfailed) ||
         ((_MDInPAR2BottomID          = MFVarGetID (MDVarPAR2Bottom,             "MJ/m2/d", MFInput,  MFState, MFBoundary)) == CMfailed) ||
// output
     	((_MDBenthicAlgaeCHLID        = MFVarGetID (MDVarBenthicAlgaeCHL,        "g/m2",    MFOutput, MFState, MFInitial))  == CMfailed) ||
        ((_MDBenthicAlgaeCID          = MFVarGetID (MDVarBenthicAlgaeC,          "g/m2",    MFOutput, MFState, MFInitial))  == CMfailed) ||
        ((_MDBenthicGPPID             = MFVarGetID (MDVarBenthicGPP,             "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicRaID              = MFVarGetID (MDVarBenthicRa,              "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicNPPID             = MFVarGetID (MDVarBenthicNPP,             "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicMortalityID       = MFVarGetID (MDVarBenthicMortality,       "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicAlgaeC_REACHID    = MFVarGetID (MDVarBenthicAlgaeC_REACH,    "g/m2",    MFOutput, MFState, MFInitial))  == CMfailed) ||
        ((_MDBenthicGPP_REACHID       = MFVarGetID (MDVarBenthicGPP_REACH,       "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicRa_REACHID        = MFVarGetID (MDVarBenthicRa_REACH,        "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicNPP_REACHID       = MFVarGetID (MDVarBenthicNPP_REACH,       "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||
        ((_MDBenthicMortality_REACHID = MFVarGetID (MDVarBenthicMortality_REACH, "g/m2/d",  MFOutput, MFState, MFBoundary)) == CMfailed) ||


       (MFModelAddFunction (_MDRiverGPP) == CMfailed)) return (CMfailed);
      
	   MFDefLeaving ("Calculate river GPP");
	   return (_MDRiverGPPID);
}
开发者ID:wk1984,项目名称:wbmsed,代码行数:45,代码来源:MDBgcRiverGPP.c

示例13: NCdsHandleGContSetFill

NCstate NCdsHandleGContSetFill(NCdsHandleGCont_t *gCont, size_t row, size_t col) {
    if (row > gCont->RowNum) return (NCfailed);
    if (col > gCont->ColNum) return (NCfailed);
    switch (gCont->GType) {
        default:
            CMmsgPrint(CMmsgAppError, "Invalide NetCDF type in: %s %d", __FILE__, __LINE__);
            return (NCfailed);
        case NC_BYTE:
        case NC_SHORT:
        case NC_INT:
            gCont->Data[gCont->ColNum * row + col] = (double) gCont->FillValue.Int;
            break;
        case NC_FLOAT:
        case NC_DOUBLE:
            gCont->Data[gCont->ColNum * row + col] = gCont->FillValue.Float;
            break;
    }
    return (NCsucceeded);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:19,代码来源:NCdsHandleGCont.c

示例14: CMmsgPrint

char *NCdataGetTextAttribute(int ncid, int varid, const char *attName) {
    int status;
    char *att;
    size_t attlen;

    if ((status = nc_inq_attlen(ncid, varid, attName, &attlen)) != NC_NOERR) return ("undefined");

    if ((att = (char *) malloc(attlen + 1)) == (char *) NULL) {
        CMmsgPrint(CMmsgSysError, "Memory allocation error in: %s %d", __FILE__, __LINE__);
        return ((char *) NULL);
    }
    if ((status = nc_get_att_text(ncid, varid, attName, att)) != NC_NOERR) {
        NCprintNCError (status, "NCdataGetTextAttribute");
        free(att);
        return ((char *) NULL);
    }
    att[attlen] = '\0';
    return (att);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:19,代码来源:NCdata.c

示例15: CMmsgPrint

char *UISelection(Widget widget, char *items, int itemSize, int itemNum) {
    int i;
    XmString *strings;

    if ((strings = (XmString *) calloc(itemNum, sizeof(XmString))) == NULL) {
        CMmsgPrint(CMmsgSysError, "Memory Allocation Error in: %s %d", __FILE__, __LINE__);
        return (NULL);
    }
    for (i = 0; i < itemNum; ++i) strings[i] = XmStringCreate(items + i * itemSize, UICharSetNormal);
    _UISelection = NULL;
    XtVaSetValues(widget, XmNlistItems, strings, XmNlistItemCount, itemNum, NULL);
    XtManageChild(widget);

    while (UILoop());
    XtUnmanageChild(widget);

    for (i = 0; i < itemNum; ++i) XmStringFree(strings[i]);
    free(strings);
    return (_UISelection);
}
开发者ID:bmfekete,项目名称:RGIS,代码行数:20,代码来源:UISelect.C


注:本文中的CMmsgPrint函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。