Bug fix: When moving from C style pointer based strings to the C++ string
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSFileWriter.cxx
1 #include  "AliHLTPHOSFileWriter.h"
2 #include <string>
3 #include <cstdlib>
4
5 using std::string;
6
7
8 AliHLTPHOSFileWriter::AliHLTPHOSFileWriter():fCurrentEvntCnt(0), fCurrentFile(0), fDirectory(""), fCurrentFilename("")
9 {
10
11 }
12
13
14 AliHLTPHOSFileWriter::~AliHLTPHOSFileWriter()
15 {
16
17 }
18
19
20 void
21 AliHLTPHOSFileWriter::SetDirectory(string& directory)
22 {
23
24 }
25
26 void
27 AliHLTPHOSFileWriter::MakeFilename(int eventNr, const AliHLTComponentDataType& dataType)
28 {
29
30   int charPos =fDirectory.size() +1;
31   cout <<"charPos.size() = "<< charPos << endl;
32
33   fCurrentFilename.erase(charPos);
34
35   char tmpOr[kAliHLTComponentDataTypefOriginSize+1];
36   char tmpID[kAliHLTComponentDataTypefIDsize+1];
37   char tmpEvntNr[30];
38
39   for(int i = 0; i< kAliHLTComponentDataTypefOriginSize; i++)
40     {
41       tmpOr[i] = dataType.fOrigin[i]; 
42     }
43   tmpOr[kAliHLTComponentDataTypefOriginSize] = '\0';
44
45   for(int j = 0; j< kAliHLTComponentDataTypefIDsize; j++)
46     {
47       tmpID[j] = dataType.fID[j]; 
48     }
49   tmpID[kAliHLTComponentDataTypefIDsize] = '\0';
50
51   fCurrentFilename.insert(charPos, tmpOr);
52   charPos+= kAliHLTComponentDataTypefOriginSize;
53   fCurrentFilename.insert(charPos, tmpID);
54   charPos = fCurrentFilename.size();
55   sprintf(tmpEvntNr,"%.16d", eventNr);
56   fCurrentFilename.insert(charPos, tmpEvntNr);
57   cout <<"AliHLTPHOSFileWriterComponent::MakeFilename, filename = " << fCurrentFilename <<endl;
58   
59 }