u_int32_t CDFData::GetUInt32FromGenericHdr(const std::wstring& name) { int32_t result = 0; ParameterNameValueType paramType; GenericDataHeader* hdr = genericData.Header().GetGenericDataHdr(); if (hdr->FindNameValParam(name, paramType)) { result = paramType.GetValueUInt32(); } return result; }
void CDFDataTest::GetGenericDataTest() { // Put something into the header. data->SetArrayCols(33); // Get the generic data. GenericData& gd = data->GetGenericData(); // Try to read the thing from the header. ParameterNameValueType pvt; CPPUNIT_ASSERT(gd.Header().GetGenericDataHdr()->FindNameValParam(CDF_COLS_PARAM, pvt)); CPPUNIT_ASSERT(pvt.GetValueUInt32() == 33); }
void CDFDataTest::FileHeaderTest() { // Put something into the header. data->SetArrayCols(45); // Get the header. FileHeader* fh = data->GetFileHeader(); CPPUNIT_ASSERT(fh); // Try to read the thing from the header. ParameterNameValueType pvt; CPPUNIT_ASSERT(fh->GetGenericDataHdr()->FindNameValParam(CDF_COLS_PARAM, pvt)); CPPUNIT_ASSERT(pvt.GetValueUInt32() == 45); }
int CalvinCELDataAdapter::GetCellMargin() { ParameterNameValueType nvt; if (calvinCel.FindAlgorithmParameter(CELLMARGIN_PARAM_NAME, nvt)) { switch(nvt.GetParameterType()) { case ParameterNameValueType::Int32Type: return nvt.GetValueInt32(); break; case ParameterNameValueType::Int16Type: return (int)nvt.GetValueInt16(); break; case ParameterNameValueType::Int8Type: return (int)nvt.GetValueInt8(); break; case ParameterNameValueType::UInt32Type: return (int)nvt.GetValueUInt32(); break; case ParameterNameValueType::UInt16Type: return (int)nvt.GetValueUInt16(); break; case ParameterNameValueType::UInt8Type: return (int)nvt.GetValueUInt8(); break; case ParameterNameValueType::AsciiType: return (int)atoi(nvt.GetValueAscii().c_str()); default: return 0; break; } } else { return 0; } }