Esempio n. 1
0
void KVList::Streamer(TBuffer &R__b)
{
    // Backwards-compatible streamer

    UInt_t R__s, R__c;
    if (R__b.IsReading()) {
        Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
        if (R__v < 3) {
            // read in old KVList object which inherited from TList
            TList list;
            list.Streamer(R__b);
            TQObjSender fQObj;
            fQObj.Streamer(R__b);
            SetOwner(list.IsOwner()); // was list owner of objects ?
            list.SetOwner(kFALSE); // make sure old list doesn't delete objects when it goes out of scope
            TIter next(&list);
            TObject* obj;
            while ( (obj = next()) ) Add(obj);
            list.Clear();
        }
        else
            R__b.ReadClassBuffer(KVList::Class(),this,R__v,R__s,R__c);
    } else {
        R__b.WriteClassBuffer(KVList::Class(),this);
    }
}
Esempio n. 2
0
void KVReconstructedEvent::Streamer(TBuffer & R__b)
{
   //Stream an object of class KVReconstructedEvent.
   //We set the particles' angles depending on whether mean or random angles
   //are wanted (fMeanAngles = kTRUE or kFALSE)

   if (R__b.IsReading()) {
      R__b.ReadClassBuffer(KVReconstructedEvent::Class(), this);
      // if the multidetector object exists, update some informations
      // concerning the detectors etc. hit by this particle
      if ( gMultiDetArray ){
      	//set angles
      	KVReconstructedNucleus *par;
      	while ((par = GetNextParticle())) {
         	if (HasMeanAngles())
               par->GetAnglesFromStoppingDetector("mean");
         	else
                par->GetAnglesFromStoppingDetector("random");
         	//reconstruct fAnalStatus information for KVReconstructedNucleus
         	if (par->GetStatus() == 99)        //AnalStatus has not been set for particles in group
            	if (par->GetGroup())
                KVReconstructedNucleus::AnalyseParticlesInGroup( par->GetGroup() );
         }
      }
   } else {
      R__b.WriteClassBuffer(KVReconstructedEvent::Class(), this);
   }
}
Esempio n. 3
0
//______________________________________________________________________________
void RunStat::Streamer(TBuffer &R__b)
{
   // Stream an object of class RunStat.

   UInt_t R__s, R__c;
   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
      TObject::Streamer(R__b);
      R__b >> RunNumber;
      R__b >> IsCalib;
      R__b >> Axis;
      R__b >> Source;
      R__b >> Z;
      R__b >> Site;
      R__b >> StartSec;
      R__b >> StartNano;
      R__b >> EndSec;
      R__b >> EndNano;
      R__b >> FullTime;
      R__b >> Veto1;
      R__b >> Veto2;
      R__b >> Veto3;
      R__b >> Veto4;
      R__b >> Scale1;
      R__b >> Scale2;
      R__b >> Scale3;
      R__b >> Scale4;
      R__b >> ScaleE1;
      R__b >> ScaleE2;
      R__b >> ScaleE3;
      R__b >> ScaleE4;
      R__b.CheckByteCount(R__s, R__c, RunStat::IsA());
   } else {
Esempio n. 4
0
EnHandleResult CTcpPullServer::FireReceive(TSocketObj* pSocketObj, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = m_bfPool[pSocketObj->connID];
	ASSERT(pBuffer && pBuffer->IsValid());

	pBuffer->Cat(pData, iLength);

	return __super::FireReceive(pSocketObj, pBuffer->Length());
}
Esempio n. 5
0
std::string DecryptSymmetrical(const std::string& key, const TBuffer& data) {
    assert(key.size() == AES::MAX_KEYLENGTH + AES::BLOCKSIZE);
    string result;
    result.resize(data.Size());
    CFB_Mode<AES>::Decryption cfbDecryption((byte*)key.data(), AES::MAX_KEYLENGTH,
                                            (byte*)key.data() + AES::MAX_KEYLENGTH);
    cfbDecryption.ProcessData((byte*)result.data(), (byte*)data.Data(), data.Size());
    return result;
}
Esempio n. 6
0
//______________________________________________________________________________
void GmpNormAna::Streamer(TBuffer &R__b)
{
   // Stream an object of class GmpNormAna.

   if (R__b.IsReading()) {
      R__b.ReadClassBuffer(GmpNormAna::Class(),this);
   } else {
      R__b.WriteClassBuffer(GmpNormAna::Class(),this);
   }
}
Esempio n. 7
0
 void SaveResult(xmlDocPtr doc, xsltStylesheetPtr stylesheet, TBuffer& to) {
     xmlOutputBufferPtr buf = xmlAllocOutputBuffer(NULL); // NULL means UTF8
     xsltSaveResultTo(buf, doc, stylesheet);
     if (buf->conv != NULL) {
         to.Assign((const char*)buf->conv->content, buf->conv->use);
     } else {
         to.Assign((const char*)buf->buffer->content, buf->buffer->use);
     }
     xmlOutputBufferClose(buf);
 }
Esempio n. 8
0
//_______________________________________________________________________
void TArrayL64::Streamer(TBuffer &b)
{
    // Stream a TArrayL64 object.

    if (b.IsReading()) {
        Int_t n;
        b >> n;
        Set(n);
        b.ReadFastArray(fArray,n);
    } else {
Esempio n. 9
0
//______________________________________________________________________________
void Event::Streamer(TBuffer &R__b)
{
   // Stream an object of class Event.

   if (R__b.IsReading()) {
      R__b.ReadClassBuffer(Event::Class(),this);
   } else {
      R__b.WriteClassBuffer(Event::Class(),this);
   }
}
Esempio n. 10
0
EnHandleResult CTcpPullAgent::FireReceive(TSocketObj* pSocketObj, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = nullptr;
	GetConnectionReserved(pSocketObj, (PVOID*)&pBuffer);
	ASSERT(pBuffer && pBuffer->IsValid());

	pBuffer->Cat(pData, iLength);

	return __super::FireReceive(pSocketObj, pBuffer->Length());
}
Esempio n. 11
0
//______________________________________________________________________________
void RapidRun::Streamer(TBuffer &R__b)
{
   // Stream an object of class RapidRun.

   if (R__b.IsReading()) {
      R__b.ReadClassBuffer(RapidRun::Class(),this);
   } else {
      R__b.WriteClassBuffer(RapidRun::Class(),this);
   }
}
Esempio n. 12
0
//______________________________________________________________________________
void TMatlab::Streamer(TBuffer &R__b)
{
   // Stream an object of class TMatlab.

   UInt_t R__s, R__c;
   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion(&R__s, &R__c); if (R__v) { }
      TQQObject::Streamer(R__b);
      R__b >> fEvalReturn;
      R__b.CheckByteCount(R__s, R__c, TMatlab::IsA());
   } else {
Esempio n. 13
0
void TClient::SendOfflineMessage(const string& friendLogin, const TBuffer& data) {
    string response;
    response.resize(1);
    response[0] = RT_SendMessage;
    TOfflineMessage offlineMessage;
    offlineMessage.set_friendlogin(friendLogin);
    offlineMessage.set_encryptedmessage(data.Data(), data.Size());
    response += offlineMessage.SerializeAsString();
    response = EncryptSymmetrical(State.sessionkey(), Compress(response));
    UdtClient->Send(Serialize(response));
}
Esempio n. 14
0
//___________________________________________________________________________________________
void KVIntegerList::Streamer(TBuffer& R__b)
{
//Streamer specifique
//l'écriture dans un fichier root se fait par l'intermédiaire de la classe TNamed
//seul, le nom et la partition et sa population sont enregistrées dans le fichier
//la lecture utilise aussi le streamer de TNamed, puis il y a un appel a la routine
// protected DeducePartitionFromTNamed() qui permet de recréer complètement l'objet KVIntegerList
   if (R__b.IsReading()) {
      R__b.ReadClassBuffer(TNamed::Class(), this);
      DeducePartitionFromTNamed();
   } else {
      SetTitle(Form("%d", GetPopulation()));
      R__b.WriteClassBuffer(TNamed::Class(), this);
   }
}
Esempio n. 15
0
void KVINDRAReconEvent::Streamer(TBuffer & R__b)
{
   //Stream an object of class KVINDRAReconEvent.
   //We loop over the newly-read particles in order to set their
   //IsOK() status by comparison with the event's code mask.

    if (R__b.IsReading()) {
        R__b.ReadClassBuffer(KVINDRAReconEvent::Class(), this);
        KVINDRAReconNuc *par;
        while ((par = GetNextParticle())) {
            par->SetIsOK(CheckCodes(par->GetCodes()));
        }
    } else {
        R__b.WriteClassBuffer(KVINDRAReconEvent::Class(), this);
    }
}
Esempio n. 16
0
void FeatureBuilder1::Serialize(TBuffer & data) const
{
  CHECK ( CheckValid(), (*this) );

  data.clear();

  serial::CodingParams cp;

  SerializeBase(data, cp, true /* store additional info from FeatureParams */);

  PushBackByteSink<TBuffer> sink(data);

  if (m_params.GetGeomType() != GEOM_POINT)
  {
    WriteVarUint(sink, static_cast<uint32_t>(m_polygons.size()));

    for (TPointSeq const & points : m_polygons)
      serial::SaveOuterPath(points, cp, sink);

    WriteVarInt(sink, m_coastCell);
  }

  // save OSM IDs to link meta information with sorted features later
  rw::WriteVectorOfPOD(sink, m_osmIds);

  // check for correct serialization
#ifdef DEBUG
  TBuffer tmp(data);
  FeatureBuilder1 fb;
  fb.Deserialize(tmp);
  ASSERT ( fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb) );
#endif
}
Esempio n. 17
0
// ADD-BY-LEETEN 07/22/2011-BEGIN
void
ITLRandomField::_CollectRandomSamplesInBlock
(
	const int iBlock,
	const int iRandomVariable,	// CRandomVariable& cRandomVariable,
	float pfRandomSamples[],
	// ADD-BY-LEETEN 07/31/2011-BEGIN
	const bool bIsMappingToBins
	// ADD-BY-LEETEN 07/31/2011-END
)
{
	const CRandomVariable& cRandomVariable = this->CGetRandomVariable(iRandomVariable);
	int iFeatureLength = cRandomVariable.piFeatureVector.USize();

	// allocate the feature vector
	TBuffer<double> pdFeatureVector;
	pdFeatureVector.alloc(iFeatureLength);

	const CBlock& cBlock = this->CGetBlock(iBlock);
	int iNrOfCells = 1;
	for(int d = 0; d < CBlock::MAX_DIM; d++)
		iNrOfCells *= cBlock.piDimLengths[d];

	for(int c = 0; c < iNrOfCells; c++)
	{
		// collect the feature vector
		for(int f = 0; f < iFeatureLength; f++)
		{
			int iDataComponent = cRandomVariable.piFeatureVector[f];
			const CDataComponent& cDataComponent = this->CGetDataComponent(iDataComponent);

			const CArray &cArray = this->CGetArray(iBlock, iDataComponent);
			const double *pdData = cArray.pdData;
			int iBase = cArray.iBase;
			int iStep = cArray.iStep;
			double dValue = pdData[iBase + c * iStep];
			pdFeatureVector[f] = cDataComponent.cRange.DClamp(dValue);
		}
		double dSample = cRandomVariable.DGetRandomVariable(&pdFeatureVector[0]);
		dSample = cRandomVariable.cRange.DClamp(dSample);
		if( bIsMappingToBins )
		  {
		    dSample = cRandomVariable.DMapToBin(dSample);
		  }
		pfRandomSamples[c] = (float)dSample;
	}
}
 inline void Validate(const TVector<T>& ref, const TBuffer& buffer) {
     TVector<T> target;
     buffer.Read(target);
     UNIT_ASSERT_VALUES_EQUAL(ref.size(), target.size());
     for (ui64 i = 0; i < ref.size(); ++i) {
         Y_ASSERT(ref[i] == target[i]);
         UNIT_ASSERT_VALUES_EQUAL(ref[i], target[i]);
     }
 }
Esempio n. 19
0
EnFetchResult CTcpPullAgent::Fetch(CONNID dwConnID, BYTE* pData, int iLength)
{
	ASSERT(pData != nullptr && iLength > 0);

	EnFetchResult result	= FR_DATA_NOT_FOUND;
	TBuffer* pBuffer		= m_bfPool[dwConnID];

	if(pBuffer != nullptr && pBuffer->IsValid())
	{
		CCriSecLock locallock(pBuffer->CriSec());

		if(pBuffer->IsValid())
		{
			if(pBuffer->Length() >= iLength)
			{
				pBuffer->Fetch(pData, iLength);
				result = FR_OK;
			}
			else
				result = FR_LENGTH_TOO_LONG;
		}
	}

	return result;
}
Esempio n. 20
0
void KVBIC::Streamer(TBuffer& R__b)
{
   // Stream an object of class KVBIC.
   // We set the pointers to the calibrator objects
   // We add the linear calibrator if it is missing

   if (R__b.IsReading()) {
      KVBIC::Class()->ReadBuffer(R__b, this);
      fLinCal = (KVLinCal*)GetCalibrator("Linear calibration PG");
   } else {
      KVBIC::Class()->WriteBuffer(R__b, this);
   }
}
Esempio n. 21
0
void KVCsI_e475s::Streamer(TBuffer& R__b)
{
   // Stream an object of class KVCsI.
   // We set the pointers to the calibrator objects

   if (R__b.IsReading()) {
      KVCsI_e475s::Class()->ReadBuffer(R__b, this);
      fcalibLT  = (KVFunctionCal*)GetCalibrator("Channel->MeV(LT)");
      //printf("")
   } else {
      KVCsI_e475s::Class()->WriteBuffer(R__b, this);
   }
}
Esempio n. 22
0
void KVChIo::Streamer(TBuffer &R__b)
{
    // Stream an object of class KVChIo.
    // We set the pointers to the calibrator objects

    if (R__b.IsReading()) {
        KVChIo::Class()->ReadBuffer(R__b, this);
        fVoltE = (KVVoltEnergy *) GetCalibrator("Volt-Energy");
        fChVoltPG  =  (KVChannelVolt *) GetCalibrator("Channel-Volt PG");
        fChVoltGG  =  (KVChannelVolt *) GetCalibrator("Channel-Volt GG");
    } else {
        KVChIo::Class()->WriteBuffer(R__b, this);
    }
}
Esempio n. 23
0
void KVCalibrator::Streamer(TBuffer & R__b)
{
   // Stream an object of class KVCalibrator.
   //customised in case no parameters are initialised (fPar null pointer)

   UInt_t R__s, R__c;
   if (R__b.IsReading()) {
      Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
      if (R__v) {
      }
      KVBase::Streamer(R__b);
      R__b >> fParamNumber;
      if (fPar) {
         delete[]fPar;
         fPar = 0;
      }
      if (fParamNumber) {
         fPar = new Double_t[fParamNumber];
         R__b.ReadFastArray(fPar, fParamNumber);
      }
      R__b >> fDetector;
      R__b >> fReady;
      R__b.CheckByteCount(R__s, R__c, KVCalibrator::IsA());
   } else {
Esempio n. 24
0
void KVTGID::Streamer(TBuffer & R__b)
{
    // Stream an object of class KVTGID.
    // If the name of the KVTGIDFunction has been set (version > 1) then
    // we use it to reset the function pointer

    if (R__b.IsReading()) {
        KVTGID::Class()->ReadBuffer(R__b, this);
        if (fTGIDFunctionName != "") {
            SetFunction((Double_t(*)(Double_t *, Double_t *)) gROOT->
                        ProcessLineFast(fTGIDFunctionName.Data()));
        }
    } else {
        KVTGID::Class()->WriteBuffer(R__b, this);
    }
}
Esempio n. 25
0
void KVHarpeeSi::Streamer(TBuffer &R__b){
   // Stream an object of class KVHarpeeSi.
   // We set the pointers to the calibrator objects

   if (R__b.IsReading()) {
      KVHarpeeSi::Class()->ReadBuffer(R__b, this);
	  TIter next( GetListOfCalibrators() );
	  TObject *cal = NULL;
	  while( ( cal = next() ) ){
		  if( cal->InheritsFrom("KVRecombination") )
      		  fPHD  =  (KVRecombination *)cal;
		  else if( cal->InheritsFrom("KVFunctionCal") )
			  fCanalE = (KVFunctionCal *)cal;
	  }
   } else {
      KVHarpeeSi::Class()->WriteBuffer(R__b, this);
   }
}
Esempio n. 26
0
EBDB_ErrCode
CBDB_BLobFile::ReadRealloc(TBuffer& buffer)
{
    EBDB_ErrCode ret;
    // use the maximum capacity
    size_t capacity = buffer.capacity();
    if (capacity > buffer.size()) {
        buffer.resize_mem(capacity);
    }
    if (buffer.size() == 0) {
        buffer.resize_mem(10);
    }
    while(1) {
        try {
            void* p = &buffer[0];
            ret = Fetch(&p, buffer.size(), eReallocForbidden);
            if (ret != eBDB_Ok) {
                buffer.resize_mem(0);
                return ret;
            }
            buffer.resize(LobSize());
        }
        catch (CBDB_ErrnoException& ex) {
            // check if we have insufficient buffer
            if (ex.IsBufferSmall() || ex.IsNoMem()) {
                // increase the buffer and re-read
                buffer.resize_mem(LobSize());
            } else {
                throw;
            }
            continue;
        }
        break;
    } // while
    return ret;
}
Esempio n. 27
0
 void OnCaptcha(const TBuffer& data) {
     SaveFile("captcha.png", data.ToString());
     cout << "input captcha.png text: ";
     string captchaText;
     string password;
     cin >> captchaText;
     cout << "input password: "******"", // e-mail
                          captchaText);
     } else if (Status == ST_Logining) {
         Client->Login(password, captchaText);
     } else {
         cout << "wrong state\n";
         _exit(42);
     }
 }
Esempio n. 28
0
ISocketListener::EnHandleResult CTcpPullServer::FireReceive(CONNID dwConnID, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = m_bfPool[dwConnID];

	if(pBuffer != nullptr && pBuffer->IsValid())
	{
		int len = 0;

		{
			CCriSecLock locallock(pBuffer->CriSec());

			if(pBuffer->IsValid())
			{
				pBuffer->Cat(pData, iLength);
				len = pBuffer->Length();
			}
		}

		if(len > 0) return __super::FireReceive(dwConnID, len);
	}

	return ISocketListener::HR_IGNORE;
}
Esempio n. 29
0
EnHandleResult CTcpPullAgent::FireReceive(TSocketObj* pSocketObj, const BYTE* pData, int iLength)
{
	TBuffer* pBuffer = m_bfPool[pSocketObj->connID];

	if(pBuffer != nullptr && pBuffer->IsValid())
	{
		int len = 0;

		{
			CCriSecLock locallock(pBuffer->CriSec());

			if(pBuffer->IsValid())
			{
				pBuffer->Cat(pData, iLength);
				len = pBuffer->Length();
			}
		}

		if(len > 0) return __super::FireReceive(pSocketObj, len);
	}

	return HR_IGNORE;
}
Esempio n. 30
0
void TVocaGuiApp::OnCaptcha(const TBuffer& data) {
    qDebug() << Q_FUNC_INFO;
    QImage captchaImage;
    captchaImage.loadFromData((const unsigned char*)data.Data(), data.Size());
    emit CaptchaAvailable(captchaImage);
}