本文整理汇总了C++中KVString::Tokenize方法的典型用法代码示例。如果您正苦于以下问题:C++ KVString::Tokenize方法的具体用法?C++ KVString::Tokenize怎么用?C++ KVString::Tokenize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KVString
的用法示例。
在下文中一共展示了KVString::Tokenize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetPartition
//___________________________________________________________________________________________
void KVIntegerList::SetPartition(const Char_t* par)
{
//protected method, utilisée par le Streamer qui utilise le champ fName de la classe TNamed
//voir également KVIntegerList::DeducePartitionFromTNamed
KVString st(par);
st.Begin(" ");
TObjArray* toks = 0;
while (!st.End()) {
KVString tamp = st.Next();
Int_t val;
Int_t freq;
if (tamp.Contains("(")) {
if (!tamp.Contains(")")) {
Warning("SetPartition", "%s ->pb de coherence dans les parentheses", tamp.Data());
return;
} else {
toks = tamp.Tokenize("(");
val = ((TObjString*)toks->At(0))->GetString().Atoi();
freq = ((TObjString*)toks->At(1))->GetString().Atoi();
delete toks;
}
} else {
val = tamp.Atoi();
freq = 1;
}
Add(val, freq);
}
}
示例2: Init
void KVBatchSystemManager::Init()
{
//Set up list of available batch systems
gBatchSystem = 0;
KVString list = gEnv->GetValue("BatchSystem", "");
fBatchSystems.Clear();
TObjArray* systems = list.Tokenize(" ");
TIter next(systems);
TObjString* batch_sys;
while ((batch_sys = (TObjString*)next())) {
KVBatchSystem* bs = KVBatchSystem::GetBatchSystem(batch_sys->GetString().Data());
fBatchSystems.Add(bs);
}
delete systems;
//set default
fDefault = (KVBatchSystem*)fBatchSystems.FindObjectByName(gEnv->GetValue("Default.BatchSystem", ""));
}
示例3: SetFiredBitmask
//________________________________________________________________
void KVVAMOSDetector::SetFiredBitmask(KVString& lpar_dummy)
{
// Set bitmask used to determine which acquisition parameters are
// taken into account by KVVAMOSDetector::Fired based on the environment variables
// [dataset].KVACQParam.[par name].Working: NO
// [dataset].KVDetector.Fired.ACQParameterList.[type]: Q,T,T_HF,E,X,Y
// The first allows to define certain acquisition parameters as not functioning;
// they will not be taken into account.
// The second allows to "fine-tune" what is meant by "all" or "any" acquisition parameters
// (i.e. when using Fired("all"), Fired("any"), Fired("Pall", etc.).
// For each detector type, give a comma-separated list of the acquisition
// parameter types to be taken into account in the KVDetector::Fired method.
// Only those parameters which appear in the list will be considered:
// then "all" means => for each type in the list at least one acquisition
// parameter has to be fired
// and "any" means => at least for one type of the list an acquisition parameter
// has to be fired
// These lists are read during construction of VAMOS (KVVAMOS::Build),
// the method KVVAMOS::SetACQParams uses them to define a mask for each detector
// of the spectrometer.
// X, Y and Z types that we can set in a list are not associated to acquisition
// parameters. In the bitmask, the 3 first bits are kept for these coordinates.
// If one of these 3 bits is 1 then the methode GetRawPosition(Double_t *)
// is called and the returned values is compared to these 3 bits.
// If no variable [dataset].KVDetector.Fired.ACQParameterList.[type] exists,
// we set a bitmask authorizing all acquisition parameters of the detector, e.g.
// if the detector has 3 types of acquisition parameters which are fired byt
// no position type then the bitmask will be "111000"
UNUSED(lpar_dummy); // lpar is determined below
fFiredMask.Set("");
KVString inst;
//inst.Form("KVVAMOSDetector.Fired.ACQParameterList.%s", GetType());
inst.Form(GetFiredACQParameterListFormatString(), GetType());
KVString lpar = gDataSet->GetDataSetEnv(inst);
TObjArray* toks = lpar.Tokenize(",");
if (!toks->GetEntries()) {
fFiredMask.Set("11111111");
delete toks;
return;
}
// 3 first bits for XYZ positions
UChar_t idx;
const Char_t* pos[3] = {"X", "Y", "Z"};
for (Int_t i = 0; i < 3; i++) {
idx = GetPositionTypeIdx(pos[i]) ;
if ((idx < 9) && (toks->FindObject(pos[i]))) fFiredMask.SetBit(i);
}
UChar_t Nbits = 3;
// other bits for Acquisition parameters
UChar_t idx_max = 0;
Bool_t found = kFALSE;
TIter next(toks);
TObject* obj = NULL;
while ((obj = next())) {
idx = GetACQParamTypeIdx(obj->GetName());
if (idx < 9) {
found = kTRUE;
fFiredMask.SetBit(idx + Nbits);
if (idx > idx_max) idx_max = idx;
}
}
delete toks;
if (found) Nbits += idx_max + 1;
fFiredMask.SetNBits(Nbits);
}