EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Splitter.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Splitter.h
1 /* -------------------------------------------------------------------------- */
2 /* Splitter.h */
3 /* */
4 /* Definitions related to Splitter.cc (C string disassembler) code. */
5 /* */
6 /* A.Kisselev, PNPI, St.Petersburg, Russia. */
7 /* e-mail: kisselev@hermes.desy.de */
8 /* -------------------------------------------------------------------------- */
9 
10 #include <cstdio>
11 
12 #ifndef _SPLITTER_H
13 #define _SPLITTER_H
14 
15 // Yes, do not care about dynamic allocation;
16 #define STRING_LEN_MAX 256
17 #define SUBSTRINGS_MAX 256
18 
19 class Splitter {
20 public:
21  Splitter() {argn = 0;};
22 
23  int splitString(char *str);
24  int splitNextString(FILE *ff);
25 
26  // Public access to "argn" & "argp" variables;
27  int getArgn() { return argn;};
28  // 'const': yes, read access is assumed;
29  const char *getArgp(unsigned id) { return id < argn ? argp[id] : 0;};
30 
31 private:
32  // Array with substring pointers;
33  unsigned argn;
35 
36  // Well, see no good reason to allow too long strings; if ever need this,
37  // just malloc/free this pointer dynamically;
39 
40  int splitStringCore();
41 } ;
42 
43 #endif