ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
packet_idcstr.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file packet_idcstr.cc
1
#include "
packet_idcstr.h
"
2
#include <stdio.h>
3
4
Packet_idcstr::Packet_idcstr
(
PACKET_ptr
data
)
5
:
Packet_w1
(data)
6
{
7
sarray
= 0;
8
}
9
10
Packet_idcstr::~Packet_idcstr
()
11
{
12
if
(
sarray
)
delete
[]
sarray
;
13
}
14
15
16
int
Packet_idcstr::iValue
(
const
int
i)
17
{
18
19
int
n
;
20
if
( !
sarray
)
decode
( &n);
21
22
if
( i < 0 || i >=
allocated_length
)
23
{
24
return
0;
25
}
26
27
int
c
=
sarray
[i];
28
return
c
;
29
30
}
31
32
33
34
int
*
Packet_idcstr::decode
(
int
*nwout)
35
{
36
37
int
dlength =
getDataLength
();
38
39
// std::cout << __FILE__ << " " << __LINE__ << " datalength: "
40
// << getDataLength() << " padding " << getPadding() << std::endl;
41
42
unsigned
char
*SubeventData = (
unsigned
char
* )
findPacketDataStart
(
packet
);
43
sarray
=
new
unsigned
char
[dlength+1];
44
memcpy (
sarray
, SubeventData,dlength);
45
sarray
[dlength] = 0;
46
allocated_length
= dlength;
47
48
return
0;
49
50
}
51
52
void
Packet_idcstr::dump
(
OSTREAM
&os)
53
{
54
55
int
n
;
56
if
( !
sarray
)
decode
( &n);
57
58
os.write( (
const
char
*)
sarray
,
allocated_length
);
59
os << std::flush;
60
61
}
62
online_distribution
blob
master
newbasic
packet_idcstr.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:59
using
1.8.2 with
ECCE GitHub integration