Example #1
0
bool  DPO_BasicSequenceFit::ReadFromFile()
{
    ReadObjectHeader();

    // base class
    ReadFuncObjRef(simResultsObjRef);
    fitCalcType = FitCalcType(ReadInt());
    fitSigma = ReadDouble();
    fitIsNormed = ReadBool();

    if (currentObjReadMajorVersion > 0)
    {
        minCoverage = ReadDouble();
        coveragePenalty = ReadDouble();
    }

    if (currentObjReadMajorVersion > 1)
    {
        removeFieldDuplicates = ReadBool();
        removeSimDuplicates = ReadBool();
        duplicateEps = ReadDouble();
    }

    // derived current
    ReadFuncObjRef(xyInputObjRef);
    ReadTimeLimits(timeLimits);

    ReadInterpPoints(interpPoints);

    CheckForInputFailure("Reading DPO_BasicSequenceFit");
    return true;
}
Example #2
0
void ReadContourSpec(PSC_ContourSpec& contourSpec)
{
    int scalarReadVer = ReadInt();

    ReadFuncObjRef(contourSpec.dataObjRef);
    ReadFuncObjRef(contourSpec.specMasterObjRef);

    contourSpec.specIsMaster = ReadBool();
    contourSpec.calcIncVal = ReadBool();
    contourSpec.doLogInc = ReadBool();
    contourSpec.startVal = ReadDouble();
    contourSpec.endVal = ReadDouble();
    contourSpec.incVal = ReadDouble();
    contourSpec.nIncs = ReadInt();

    contourSpec.contourLineSpec.linePen = ReadInt();
    contourSpec.contourLineSpec.lineThickness= ReadInt();
    contourSpec.contourLineSpec.lineType = PlotLineType(ReadInt());
    if (scalarReadVer > 1)
        contourSpec.contourLineSpec.mitreLines = ReadBool();

    if (scalarReadVer > 0)
        contourSpec.overrideMasterLineSpec = ReadBool();

    ReadLegendOverride(contourSpec.legendGC);
}
Example #3
0
bool  PPO_SeriesLegend::ReadFromFile()
{
    ReadObjectHeader();
    PPO_AnnoBase::ReadFromFile();
    ReadFuncObjRef(penSetObjRef);

    int nRead = 6; // old max
    if (currentObjReadMajorVersion > 0)
        nRead = ReadInt();

    for ( int i = 0; i < nRead; i++)
    {
        ReadFuncObjRef(legendData[i].seriesObjRef);
        legendData[i].doSeries   = ReadBool();
    }

    ulLocation.pX = ReadDouble();
    ulLocation.pY = ReadDouble();

    seriesSize = ReadDouble();
    seriesNpts = ReadInt();

    ReadText(legendTitle, PSC_AnnoSpec::legendTitleLen);

    frameLegend       = ReadBool();
    frameThick        = ReadInt();
    opaqueBackground  = ReadBool();
    legendPen         = ReadInt();

    ReadFont(legendFont);

    CheckForInputFailure("Reading PPO_SeriesLegend");
    return true;
}
Example #4
0
bool  DPO_CurveInterp::ReadFromFile()
{
    ReadObjectHeader();

    ReadFuncObjRef(curveObjRef);
    ReadFuncObjRef(xyInputObjRef);

    if ( currentObjReadMajorVersion == 0)
    {
        bool isXYInput = ReadBool();
        bool isLinear  = ReadBool();
        if (isXYInput)
        {
            interpData.interpPointsOp = DSC_InterpPoints::ipoAtInput;
        }
        else if (isLinear)
        {
            interpData.interpPointsOp = DSC_InterpPoints::ipoLinear;
        }
        else
        {
            interpData.interpPointsOp = DSC_InterpPoints::ipoLogRelative;
        }
        interpData.useDataLimits  = ReadBool();
        interpData.minUserLimit = ReadDouble();
        interpData.maxUserLimit = ReadDouble();
        interpData.numInterpPoints = ReadInt();
    }
    else
        ReadInterpPoints(interpData);

    CheckForInputFailure("Reading DPO_CurveInterp");
    return true;
}
   /// reads vector
   Vector3d ReadVector()
   {
      double x = ReadDouble();
      double y = ReadDouble();
      double z = ReadDouble();

      return Vector3d(x,y,z);
   }
Example #6
0
 void ReadThreshold(DSC_Threshold& threshold)
 {
     int readVer = ReadInt();
     threshold.minThreshold = DSC_Threshold::ThresholdOp(ReadInt());
     threshold.maxThreshold = DSC_Threshold::ThresholdOp(ReadInt());
     threshold.minVal       = ReadDouble();
     threshold.maxVal       = ReadDouble();
 }
Example #7
0
Pointf Painter::ReadPoint(CParser& p, Pointf current, bool rel)
{
	Pointf t;
	t.x = ReadDouble(p);
	t.y = ReadDouble(p);
	if(rel)
		t += current;
	return t;
}
Example #8
0
void LoadTIMER(SAVESTATE_t* save, timerc* time) {
	CHUNK_t* chunk = FindChunk(save,TIMER_tag);
	chunk->pnt = 0;

	time->tstates	= ReadLong(chunk);
	time->freq		= (uint32_t) ReadLong(chunk);
	time->elapsed	= ReadDouble(chunk);
	time->lasttime	= ReadDouble(chunk);	// this isn't used.
}
Example #9
0
    void ReadPointArray(SC_PointArray& pointArray)
    {
        int nPt = ReadInt();
        pointArray.Alloc(nPt);
        Point2D tmp;
        for (int i = 0; i < nPt; i++)
            {
                tmp.pX = ReadDouble();
                tmp.pY = ReadDouble();
                pointArray += tmp;

                //      pointArray += Point2D(ReadDouble(), ReadDouble());  // MS bug -- reads Y first
            }
    }
size_t PlayerPositionAndLook::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadDouble(_src, _offset, _pf_x);
	_offset = ReadDouble(_src, _offset, _pf_stance);
	_offset = ReadDouble(_src, _offset, _pf_y);
	_offset = ReadDouble(_src, _offset, _pf_z);
	_offset = ReadFloat(_src, _offset, _pf_yaw);
	_offset = ReadFloat(_src, _offset, _pf_pitch);
	_offset = ReadBool(_src, _offset, _pf_onGround);
	_pf_initialized = true;
	return _offset;
}
Example #11
0
bool  DPO_ExtractSASteps::ReadFromFile()
{
    ReadObjectHeader();
    ReadFuncObjRef(inputTableObjRef);

    extractByIndexes = ReadBool();
    minIndex = ReadInt();
    maxIndex = ReadInt();
    indexIncrement = ReadInt();
    minValue = ReadDouble();
    maxValue = ReadDouble();

    CheckForInputFailure("Reading DPO_ExtractSASteps");
    return true;
}
Example #12
0
int main (void)
{
	printf ("Hello World\n");
	OpenIniFile ("Test.Ini");
#ifdef INIFILE_TEST_READ_AND_WRITE
	WriteString  ("Test", "Name", "Value");
	WriteString  ("Test", "Name", "OverWrittenValue");
	WriteString  ("Test", "Port", "COM1");
	WriteString  ("Test", "User", "James Brown jr.");
	WriteString  ("Configuration", "eDriver", "MBM2.VXD");
	WriteString  ("Configuration", "Wrap", "LPT.VXD");
	WriteInt 	 ("IO-Port", "Com", 2);
	WriteBool 	 ("IO-Port", "IsValid", 0);
	WriteDouble  ("TheMoney", "TheMoney", 67892.00241);
	WriteInt     ("Test"    , "ToDelete", 1234);
	WriteIniFile ("Test.Ini");
	printf ("Key ToDelete created. Check ini file. Any key to continue");
	while (!kbhit());
	OpenIniFile  ("Test.Ini");
	DeleteKey    ("Test"	  , "ToDelete");
	WriteIniFile ("Test.Ini");
#endif
	printf ("[Test] Name = %s\n", ReadString ("Test", "Name", "NotFound"));
	printf ("[Test] Port = %s\n", ReadString ("Test", "Port", "NotFound"));
	printf ("[Test] User = %s\n", ReadString ("Test", "User", "NotFound"));
	printf ("[Configuration] eDriver = %s\n", ReadString ("Configuration", "eDriver", "NotFound"));
	printf ("[Configuration] Wrap = %s\n", ReadString ("Configuration", "Wrap", "NotFound"));
	printf ("[IO-Port] Com = %d\n", ReadInt ("IO-Port", "Com", 0));
	printf ("[IO-Port] IsValid = %d\n", ReadBool ("IO-Port", "IsValid", 0));
	printf ("[TheMoney] TheMoney = %1.10lf\n", ReadDouble ("TheMoney", "TheMoney", 111));
	CloseIniFile ();
	return 0;
}
Example #13
0
int main(void)
{
    // initialize to zeros
    struct Product prod = { 0 };

    printf("Enter item number: ");
    ReadInt(&prod.id, &OnInvalidInputHandler);

    printf("Enter unit price: ");
    ReadDouble(&prod.price, &OnInvalidInputHandler);

    printf("Enter purchase date (mm/dd/yyyy): ");
    ReadDate(&prod.purchaseDate, &OnInvalidInputHandler);

    printf("%s\t%s\t%s\n", "Item", "Unit Price", "Purchase Date");
    printf("%d\t$%.2Lf\t\t%02d/%02d/%d\n",
        prod.id,
        prod.price,
        prod.purchaseDate.tm_mon,
        prod.purchaseDate.tm_mday,
        prod.purchaseDate.tm_year);
    getchar();

    return EXIT_SUCCESS;
}
Example #14
0
bool  DPO_PATTRN::ReadFromFile()
{
    ReadObjectHeader();
    ReadFuncObjRef(indepVarObjRef);
    ReadFuncObjRef(depVarObjRef);
    ReadText(title, titleLen);

    ReadText(obsStr, inpStrLen);
    ReadText(mcRepStr, inpStrLen);
    nreplicates = ReadInt();
    randSeed = ReadInt();
    nxintInp = ReadInt();
    nyintInp = ReadInt();
    nrandomPatterns = ReadInt();
    logarithms = ReadBool();
    alphaCutoff = ReadDouble();
    mtest1      = ReadInt();
    ReadRealFormat(coeffFormat);

    verbose = ReadBool();
    verboseMC = ReadBool();
    verboseCV = ReadBool();
    coefficients = ReadBool();
    rankCoefficients = ReadBool();

    for (int i = ptCC; i < ptLastTest; i++)
        tests[i] = ReadBool();


    CheckForInputFailure("Reading DPO_PATTRN");
    return true;
}
Example #15
0
    void ReadFont(PSC_Font& font)
    {
        int readVer = ReadInt();

        font.fontFamily      = PSC_Font::FontFamily(ReadInt());
        font.slantRegular    = ReadBool();
        font.weightMedium    = ReadBool();
        font.fontSize        = double(ReadInt());

        if (readVer > 0)
            {
                if (readVer < 3)
                    {
                        int strokeFontWeight  = ReadInt();
                        font.weightMedium = (strokeFontWeight < 2);
                    }

                if (readVer > 1)
                    font.fontRotation  = PSC_Font::FontRotation(ReadInt());

                if (readVer > 2)
                    font.fontThickness = ReadDouble();

            }

    }
Example #16
0
bool  DPO_XYRemoveDuplicate::ReadFromFile()
{
    ReadObjectHeader();
    ReadFuncObjRef(xyInputObjRef);
    ReadText(outputDesc, DFO_XYBase::outputDescLen);

    removeDuplicateXValues = ReadBool();
    yValueToKeepOp =  DFO_XYRemoveDuplicate::RemoveDuplicateOp(ReadInt());
    duplicateXLimit = ReadDouble();
    removeOutOfSeq = ReadBool();
    removeDuplicateYValues = ReadBool();
    duplicateYLimit = ReadDouble();

    CheckForInputFailure("Reading DPO_XYRemoveDuplicate");
    return true;
}
Example #17
0
bool Loader::ReadBool(bool *k)
{
	double d = 0;
	char token[LOADER_INPUT_LENGTH];

	if (ReadDouble(d))
	{	
		if (IsEqual(d, 1.0))
			*k = true;
		else if (IsZero(d))
			*k = false;
		else
			return false;
		return true;
	}
	else if (ReadToken(token))
	{
		if (token[0] == 't')
			*k = true;
		else if (token[0] == 'f')
			*k = false;
		else 
			return false;
		return true;
	}
	else
		return false;
}
Example #18
0
void LoadSTDINT(SAVESTATE_t* save, STDINT_t* stdint) {
	int i;
	CHUNK_t* chunk		= FindChunk(save,STDINT_tag);
	chunk->pnt = 0;

	stdint->intactive	= ReadChar(chunk);
	stdint->lastchk1	= ReadDouble(chunk);
	stdint->timermax1	= ReadDouble(chunk);
	stdint->lastchk2	= ReadDouble(chunk);
	stdint->timermax2	= ReadDouble(chunk);
	for(i = 0; i < 4; i++) {
		stdint->freq[i]	= ReadDouble(chunk);
	}
	stdint->mem			= ReadInt(chunk);
	stdint->xy			= ReadInt(chunk);
}
size_t Explosion::deserialize(const Buffer& _src, size_t _offset)
{
	_offset = _pm_checkPacketId(_src, _offset);

	_offset = ReadDouble(_src, _offset, _pf_x);
	_offset = ReadDouble(_src, _offset, _pf_y);
	_offset = ReadDouble(_src, _offset, _pf_z);
	_offset = ReadFloat(_src, _offset, _pf_radius);
	_offset = ReadInt32(_src, _offset, _pf_recordCount);
	_offset = ReadByteArray(_src, _offset, _pf_recordCount * 3, _pf_records);
	_offset = ReadFloat(_src, _offset, _pf_playerMotionX);
	_offset = ReadFloat(_src, _offset, _pf_playerMotionY);
	_offset = ReadFloat(_src, _offset, _pf_playerMotionZ);
	_pf_initialized = true;
	return _offset;
}
Example #20
0
void ReadHistogram(PSC_Histogram& histogram)
{
    ReadEdgeSpec(histogram);
    int ver = ReadInt();
    histogram.orientationX = ReadBool();
    histogram.baselineIsValue = ReadBool();
    histogram.baselineValue = ReadDouble();
    histogram.positionIsValue = ReadBool();
    histogram.widthSpec = PSC_Histogram::WidthSpec(ReadInt());
    histogram.widthLineThk = ReadInt();
    histogram.widthSpecValue = ReadDouble();
    histogram.widthSpecPixel = ReadInt();
    histogram.widthSpecPct = ReadDouble();
    if (ver > 0)
        histogram.indexOffset = ReadDouble();
}
Example #21
0
void ReadAnnoSpec(PSC_AnnoSpec& annoSpec)
{
    int ver = ReadInt();

    annoSpec.ulLocation.pX = ReadDouble();
    annoSpec.ulLocation.pY = ReadDouble();

    ReadText(annoSpec.legendTitle, PSC_AnnoSpec::legendTitleLen);

    annoSpec.frameLegend        = ReadBool();
    annoSpec.frameThick         = ReadInt ();
    annoSpec.opaqueBackground   = ReadBool();
    annoSpec.legendPen          = ReadInt ();

    ReadFont(annoSpec.legendFont);
}
Example #22
0
double Reader::ReadDoubleOrDie(void) {
  double d;
  if (! ReadDouble(&d)) {
    fprintf(stderr, "Couldn't read double: file %s\n", filename_.c_str());
    exit(-1);
  }
  return d;
}
Example #23
0
	__int32 MarketBuy(const std::string& symbol, const double& price, double& volume, double& amount)
	{
		MemoryBuffer buffer;
		m_channel->Initialize(buffer);

		WriteAString(symbol, buffer);
		WriteDouble(price, buffer);
		WriteDouble(volume, buffer);

		const HRESULT _status = m_channel->Invoke(1, 1, buffer);
		Throw(_status, buffer);

		volume = ReadDouble(buffer);
		amount = ReadDouble(buffer);
		auto _result = ReadInt32(buffer);
		return _result;
	}
Example #24
0
void ReadEdgeSpec(PSC_EdgeSpec& edgeSpec)
{
    int readVer = ReadInt();

    edgeSpec.plotEdges       = ReadBool();
    edgeSpec.edgePen         = ReadInt();
    edgeSpec.edgeThk         = ReadInt();
    edgeSpec.edgePolyOffset  = ReadDouble();
}
Example #25
0
void  ReadColorLegendSpec(PSC_ColorLegendSpec& legendSpec)
{
    int ver = ReadInt();

    ReadFuncObjRef(legendSpec.colorLegendObjRef);
    legendSpec.barLength    = ReadDouble();
    legendSpec.barAspect    = ReadDouble();

    legendSpec.orientation = PSC_Font::FontRotation(ReadInt());
    legendSpec.ticsAtIncs  = ReadBool();
    legendSpec.dataTypeLabel = ReadBool();

    legendSpec.dataLabelAboveLeft = ReadBool();
    legendSpec.incLabelAboveLeft = ReadBool();
    legendSpec.overrideLabel = ReadBool();

    ReadText(legendSpec.newLabel, stdMsgStrLen);
}
Example #26
0
bool  PPD_LinLogAxis::ReadFromFile()
{
    ReadDefaultObjectHeader();
    axisData.autoScaleAxes   = ReadBool();
    axisData.axesAreLinear   = ReadBool();
    if (currentObjReadMajorVersion > 4)
        axisData.incrFont.fontRotation = PSC_Font::FontRotation(ReadInt());
    axisData.axisLinMin      = ReadDouble();
    axisData.axisLinMax      = ReadDouble();
    axisData.axisLogMin      = ReadDouble();
    axisData.axisLogMax      = ReadDouble();

    axisData.axisMajorIncs   = PC_Axes::AxesIncType(ReadInt());
    axisData.autoMajorIncs   = ReadBool();
    axisData.majorIncVal     = ReadDouble();
    if (currentObjReadMajorVersion > 3)
        axisData.startAtFirst  = ReadBool();

    axisData.axisMinorIncs   = PC_Axes::AxesIncType(ReadInt());
    axisData.autoMinorIncs   = ReadBool();
    axisData.nminorPerMajor  = ReadInt();

    axisData.axisIncFormat.format             = NumConvFormat(ReadInt());
    axisData.axisIncFormat.digitsPrecision    = ReadInt();
    if (currentObjReadMajorVersion > 2)
    {
        axisData.cursorReportFormat.format             = NumConvFormat(ReadInt());
        axisData.cursorReportFormat.digitsPrecision    = ReadInt();
    }

    if (currentObjReadMajorVersion > 1)
    {
        // to get inc settings right
        setaxisData = axisData;

        setaxisData.autoScaleAxes   = false; // by definition
        setaxisData.axesAreLinear   = ReadBool();
        setaxisData.axisLinMin      = ReadDouble();
        setaxisData.axisLinMax      = ReadDouble();
        setaxisData.axisLogMin      = ReadDouble();
        setaxisData.axisLogMax      = ReadDouble();

        if (axisPD.axesHaveBeenSet)  // this should have already been read
            axisData = setaxisData;
    }

    CheckForInputFailure("Reading PPD_LinLogAxis");
    return true;
}
Example #27
0
bool  DPO_XYReduction::ReadFromFile()
{
    ReadObjectHeader();
    ReadFuncObjRef(xyInputObjRef);
    ReadText(outputDesc, DFO_XYBase::outputDescLen);

    dataReductionOperation = ReductionOp(ReadInt());
    pointSkipInterval = ReadInt();
    maxXChange = ReadDouble();
    maxYChange = ReadDouble();
    if (currentObjReadMajorVersion > 0)
    {
        logXChange = ReadBool();
        logYChange = ReadBool();
    }

    CheckForInputFailure("Reading DPO_XYReduction");
    return true;
}
Example #28
0
void ReadTubeExtrusionSpec(PSC_TubeExtrusionSpec& extrusionSpec)
{
    int readVer = ReadInt();

    extrusionSpec.nextrusionPoints   = ReadInt();
    extrusionSpec.usePixelSizing     = ReadBool();
    extrusionSpec.extrusionPixelSize = ReadInt();
    extrusionSpec.extrusionRealSize  = ReadDouble();
    extrusionSpec.capEnds            = ReadBool();
    extrusionSpec.adjustForScaling   = ReadBool();
}
Example #29
0
bool  DPO_Normalize::ReadFromFile()
{
    int stVer = ReadInt();

    ReadRealMSSpec(bpRef.normPowerMS);
    bpRef.isMaster = ReadBool();

    bpRef.normalizeDC.normalizeOp    = DC_Normalize::NormalizeOp(ReadInt());
    bpRef.normalizeDC.autoLimit      = ReadBool();
    bpRef.normalizeDC.inputMinimum   = ReadDouble();
    bpRef.normalizeDC.inputMaximum   = ReadDouble();
    bpRef.normalizeDC.outputMinimum  = ReadDouble();
    bpRef.normalizeDC.outputMaximum  = ReadDouble();
    bpRef.normalizeDC.normPower      = ReadDouble();

    exposedNormPower.ReadExposed();

    CheckForInputFailure("Reading DPO_Normalize");
    return true;
}
Example #30
0
bool  PPO_DataLabels::ReadFromFile()
{
    ReadObjectHeader();
    PPO_AnnoBase::ReadFromFile();
    ReadFuncObjRef(penSetObjRef);

    int nread = PFO_DataLabels::maxDataLabels;
    if (currentObjReadMajorVersion < 1)
        nread = 6;

    for ( int i = 0; i < nread; i++)
    {
        ReadFuncObjRef(labelData[i].labelObjRef);
        labelData[i].doLabel   = ReadBool();
        labelData[i].labAlign  = HorizontalTextAlignment(ReadInt());

        labelData[i].overrideFormat                 = ReadBool();
        labelData[i].labelFormat.format             = NumConvFormat(ReadInt());
        labelData[i].labelFormat.digitsPrecision    = ReadInt();

        labelData[i].overrideMainLabel     = ReadBool();
        ReadText(labelData[i].mainLabel, DO_Label::maxLabelLen);
        ReadText(labelData[i].unitsLabel, DO_Label::maxLabelLen);
    }

    ulLocation.pX = ReadDouble();
    ulLocation.pY = ReadDouble();

    ReadText(legendTitle, PSC_AnnoSpec::legendTitleLen);

    frameLegend        = ReadBool();
    frameThick         = ReadInt();
    opaqueBackground   = ReadBool();
    legendPen          = ReadInt();
    minDataFieldWidth  = ReadInt();

    ReadFont(legendFont);

    CheckForInputFailure("Reading PPO_DataLabels");
    return true;
}