This script shows how to make a simple iterative server that can accept connections while handling currently open connections.
const int kIncremental = 0;
{
}
}
} else {
}
}
}
}
{
if (
dir==
nullptr)
return;
}
} else {
} else {
}
dir->GetListOfKeys()->Remove(key);
delete key;
}
}
}
}
{
}
}
} else {
}
return;
}
}
}
}
{
}
{
if (file != fFile) {
if (fFile) {
delete file;
} else {
fFile = file;
}
}
}
};
{
{
}
{
for(
unsigned int f = 0 ;
f < fClients.size(); ++
f) {
}
++iter)
{
delete iter->fFile;
}
}
{
}
const char *GetName() const override
{
return fFilename;
}
{
}
{
for(
unsigned int f = 0 ;
f < fClients.size(); ++
f) {
}
for(
unsigned int f = 0 ;
f < fClients.size(); ++
f) {
} else {
delete file;
}
}
}
{
}
{
if (fClients.empty()) {
}
for(
unsigned int c = 0 ;
c < fClients.size(); ++
c) {
sum += fClients[
c].fTimeSincePrevContact;
sum2 += fClients[
c].fTimeSincePrevContact*fClients[
c].fTimeSincePrevContact;
}
}
}
{
}
}
};
if (!dummy) {
Error(
"fastMergeServer",
"Cannot create temporary file for socket\n");
return;
}
return;
}
};
while (true) {
printf(
"only accept 100 clients connections\n");
} else {
}
continue;
}
Error(
"fastMergeServer",
"The client did not send a message\n");
char str[64];
mess->ReadString(str, 64);
printf(
"No more active clients... stopping\n");
break;
}
}
info->InitialMerge(transient);
}
Info(
"fastMergeServerHist",
"Merging input from %ld clients (%d)",
info->fClients.size(),
clientId);
}
transient = nullptr;
printf(
"got object of class: %s\n",
mess->GetClass()->GetName());
} else {
printf(
"*** Unexpected message ***\n");
}
}
if (
info->NeedFinalMerge())
{
}
}
}
#define ClassDefOverride(name, id)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h length
UInt_t Hash(const TString &s)
R__EXTERN TSystem * gSystem
const_iterator begin() const
const_iterator end() const
TClass instances represent classes, structs and namespaces in the ROOT type system.
ROOT::ResetAfterMergeFunc_t GetResetAfterMerge() const
Return the wrapper around Merge.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Describe directory structure in memory.
A cache when writing files over the network.
This class provides file copy and merging services.
virtual Bool_t OutputFile(const char *url, Bool_t force)
Open merger output file.
TFile * GetOutputFile() const
virtual Bool_t AddFile(TFile *source, Bool_t own, Bool_t cpProgress)
Add the TFile to this file merger and give ownership of the TFile to this object (unless kFALSE is re...
void SetPrintLevel(Int_t level)
@ kIncremental
Merge the input file with the content of the output file (if already existing).
@ kResetable
Only the objects with a MergeAfterReset member function.
@ kAllIncremental
Merge incrementally all type of objects.
virtual Bool_t PartialMerge(Int_t type=kAll|kIncremental)
Merge the files.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Int_t Write(const char *name=nullptr, Int_t opt=0, Int_t bufsiz=0) override
Write memory objects to this file.
THashTable implements a hash table to store TObject's.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
void Delete(Option_t *option="") override
Delete an object from the file.
virtual const char * GetClassName() const
virtual TObject * ReadObj()
To read a TObject* from the file.
A TMemFile is like a normal TFile except that it reads and writes only from memory.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
UInt_t GetBytesRecv() const
virtual Int_t Recv(TMessage *&mess)
Receive a TMessage object.
UInt_t GetBytesSent() const
virtual void Close(Option_t *opt="")
Close the socket.
TClass * IsA() const override
virtual Int_t Send(const TMessage &mess)
Send a TMessage object.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
virtual FILE * TempFileName(TString &base, const char *dir=nullptr, const char *suffix=nullptr)
Create a secure temporary file by appending a unique 6 letter string to base.
virtual int GetPid()
Get process id.
The TTimeStamp encapsulates seconds and ns since EPOCH.
Double_t Sqrt(Double_t x)
Returns the square root of x.
static uint64_t sum(uint64_t i)