Last change
on this file since 1 was
1,
checked in by zerwas, 11 years ago
|
first import of structure, PYTHIA8 and DELPHES
|
File size:
1.1 KB
|
Line | |
---|
1 | |
---|
2 | /** \class DelphesStream |
---|
3 | * |
---|
4 | * Provides an interface to manipulate c strings as if they were input streams |
---|
5 | * |
---|
6 | * |
---|
7 | * $Date: 2012-11-15 13:57:55 $ |
---|
8 | * $Revision: 1.1 $ |
---|
9 | * |
---|
10 | * |
---|
11 | * \author P. Demin - UCL, Louvain-la-Neuve |
---|
12 | * |
---|
13 | */ |
---|
14 | |
---|
15 | #include "classes/DelphesStream.h" |
---|
16 | |
---|
17 | #include <stdlib.h> |
---|
18 | #include <string.h> |
---|
19 | #include <stdio.h> |
---|
20 | #include <errno.h> |
---|
21 | |
---|
22 | using namespace std; |
---|
23 | |
---|
24 | //------------------------------------------------------------------------------ |
---|
25 | |
---|
26 | DelphesStream::DelphesStream(char *buffer) : |
---|
27 | fBuffer(buffer) |
---|
28 | { |
---|
29 | } |
---|
30 | |
---|
31 | //------------------------------------------------------------------------------ |
---|
32 | |
---|
33 | bool DelphesStream::ReadDbl(double &value) |
---|
34 | { |
---|
35 | char *start = fBuffer; |
---|
36 | errno = 0; |
---|
37 | value = strtod(start, &fBuffer); |
---|
38 | return start != fBuffer && errno != ERANGE; |
---|
39 | } |
---|
40 | |
---|
41 | //------------------------------------------------------------------------------ |
---|
42 | |
---|
43 | bool DelphesStream::ReadInt(int &value) |
---|
44 | { |
---|
45 | char *start = fBuffer; |
---|
46 | errno = 0; |
---|
47 | value = strtol(start, &fBuffer, 10); |
---|
48 | return start != fBuffer && errno != ERANGE; |
---|
49 | } |
---|
50 | |
---|
51 | //------------------------------------------------------------------------------ |
---|
Note: See
TracBrowser
for help on using the repository browser.