30 fConfigurationsStrings(),
32 fPrefixString(prefixString),
33 fDelimiter(delimiterCharacter)
47 AliInfoStream() <<
"Adding configuration \"" << configurationName <<
"\" as an empty YAML node.\n";
65 AliErrorStream() <<
"Configuration filename \"" << configurationFilename <<
"\" does not exist!\n";
70 auto node = YAML::LoadFile(configurationFilename);
72 if (node.IsNull() ==
true) {
73 AliErrorStream() <<
"The node at configuration filename \"" << configurationFilename <<
"\" is null and will not be added!\n";
77 AliInfoStream() <<
"Adding configuration \"" << configurationName <<
"\" located at \"" << configurationFilename <<
"\".\n";
91 if (configurationName ==
"")
98 if (configurationName ==
"") {
99 AliErrorStream() <<
"Could not determine a name for the configuration:\n\"\n" << node <<
"\n\" Configuration will not be added!\n";
104 AliDebugStream(2) <<
"Adding configuration \"" << configurationName <<
"\".\n";
120 bool returnValue =
false;
142 std::string localFilename = tempUUID.AsString();
143 localFilename +=
".yaml";
146 AliWarningStream() <<
"Requested configuration index " << index <<
" does not exist - it cannot be written!\n";
150 std::ofstream outputFile(localFilename);
151 outputFile << configPair.second;
157 remove(localFilename.c_str());
185 bool returnValue =
false;
187 bool configsExist =
true;
188 std::vector<int> configs = {configIndex1, configIndex2};
189 for (
auto config : configs) {
191 AliErrorStream() <<
"Configuration at index " << config <<
" does not exist.\n";
192 configsExist =
false;
204 std::stringstream config1SS;
205 config1SS << configPair1.second;
206 std::stringstream config2SS;
207 config2SS << configPair2.second;
212 if (config1SS.str() == config2SS.str()) {
220 std::stringstream errorMessageSS;
221 errorMessageSS <<
"Configuration mismatch between configuration at index " << configIndex1 <<
" and at index " << configIndex2 <<
"\n";
222 errorMessageSS <<
"Config 1:\n";
223 Print(errorMessageSS, configIndex1);
224 errorMessageSS <<
"Config 2:\n";
225 Print(errorMessageSS, configIndex2);
226 AliWarningStream() << errorMessageSS.str();
244 std::ifstream inFile(filename);
245 return inFile.good();
261 filename =
gSystem->ExpandPathName(filename.c_str());
264 if(filename.find(
"alien://") != std::string::npos)
266 AliDebug(2, TString::Format(
"Opening file \"%s\" on the grid!", filename.c_str()));
269 TGrid::Connect(
"alien://");
273 std::string localFilename =
gSystem->BaseName(filename.c_str());
275 if (fileIdentifier !=
"") {
276 localFilename = fileIdentifier +
"." + localFilename;
280 localFilename =
"." + localFilename;
281 localFilename = tempUUID.AsString() + localFilename;
284 TFile::Cp(filename.c_str(), localFilename.c_str());
287 filename = localFilename;
301 bool cannotWriteFile =
false;
302 if (localFilename ==
"") {
303 AliErrorStream() <<
"Local filename is null, so the file cannot be written!\n";
304 cannotWriteFile =
true;
306 if (filename ==
"") {
307 AliErrorStream() <<
"Filename is null, so the file cannot be written\n";
308 cannotWriteFile =
true;
311 if (cannotWriteFile ==
false) {
313 filename =
gSystem->ExpandPathName(filename.c_str());
316 if(filename.find(
"alien://") != std::string::npos)
318 AliDebugStream(2) <<
"Writing file \"" << filename <<
"\" on the grid!\n";
321 TGrid::Connect(
"alien://");
326 AliDebugStream(2) <<
"Copying localFilename \"" << localFilename <<
"\" to filename \"" << filename <<
"\".\n";
327 TFile::Cp(localFilename.c_str(), filename.c_str());
344 std::stringstream tempSS;
348 tempSS << configPair.second;
368 bool returnValue =
false;
376 AliFatalGeneral(
"AliYAMLConfiguration",
"Attempted to re-initialize the YAML nodes, but the string based configurations are not available. Did you remember to call initialize?");
381 YAML::Node node =
YAML::Load(configStrPair.second);
402 std::string stringToFind =
"sharedParameters:";
403 std::size_t sharedParameterLocation = value.find(stringToFind);
404 if (sharedParameterLocation != std::string::npos)
406 value.erase(sharedParameterLocation, sharedParameterLocation + stringToFind.length());
421 stream <<
"\nConfiguration Name: \"" << configPair.first <<
"\"\n\n";
422 stream << configPair.second <<
"\n";
435 std::stringstream tempSS;
439 tempSS << std::boolalpha;
440 tempSS <<
"AliYAMLConfiguration:\n";
443 tempSS <<
"Delimiter: \"" <<
fDelimiter <<
"\"\n";
445 tempSS <<
"\nYAML Configurations:\n";
458 tempSS <<
"Index " << index <<
" is out of range!\n";
516 std::ostream & result = myTask.
Print(in);
Namespace for PWG framework classes.