BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
eformat::write Namespace Reference

Classes

class  FullEventFragment
 
struct  node_t
 
class  ROBFragment
 forward More...
 
class  ROSFragment
 forward More...
 
class  SubDetectorFragment
 forward More...
 

Typedefs

typedef struct eformat::write::node_t node_t
 

Functions

void set (node_t &i, const uint32_t *b, size_t l, node_t *n=0)
 
void set (node_t &i, const struct iovec &v, node_t *n=0)
 
void cat (node_t *n, const struct iovec *v, uint32_t count)
 
void cat (node_t *n, uint32_t count)
 
uint32_t count (const node_t &list)
 
uint32_t count_words (const node_t &list)
 
uint32_t copy (const node_t &list, uint32_t *dest, size_t max)
 
uint32_t shallow_copy (const node_t &list, struct iovec *dest, uint32_t max)
 

Typedef Documentation

◆ node_t

Defines what is a valid "I/O vector" (a.k.a. iov) node list for eformat

Function Documentation

◆ cat() [1/2]

void eformat::write::cat ( node_t n,
const struct iovec *  v,
uint32_t  count 
)

Concatenates a set of IOV's to make up a list as required by some eformat::write functionality.

Parameters
nthe first node_t of a vector of node_t's. The C array pointed by n should have at least "count" available positions
vthe first IOV node of a vector
countthe number of IOV nodes pointed by "v"

Definition at line 30 of file node.cxx.

31{
32 for (size_t i=0; i<(count-1); ++i) set(n[i], v[i], &n[i+1]);
33 set(n[count-1], v[count-1], 0);
34}
const Int_t n
DOUBLE_PRECISION count[3]
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
void set(node_t &i, const uint32_t *b, size_t l, node_t *n=0)
Definition: node.cxx:16

◆ cat() [2/2]

void eformat::write::cat ( node_t n,
uint32_t  count 
)

Concatenates an already set vector of eformat::write::node_t to make up a valid list.

Parameters
nthe first node_t of a vector of node_t's. The C array pointed by n should have, exactly, "count" available positions
countthe number of IOV nodes pointed by "v"

Definition at line 36 of file node.cxx.

37{
38 for (size_t i=0; i<(count-1); ++i) n[i].next = &n[i+1];
39 n[count-1].next = 0;
40}

◆ copy()

uint32_t eformat::write::copy ( const node_t list,
uint32_t *  dest,
size_t  max 
)

Performs a memcpy like operation, concatenating the list given as parameter to a block of memory, as fast as possible.

Parameters
listThe top of the list
destThe destination block of memory
maxThe number of 32-bit words allocated in "dest"
Returns
The number of words copied, in total. If the return value was zero, a problem with the total destination size length was detected and the copy operation may have undergone in an incomplete way

Definition at line 64 of file node.cxx.

66{
67 const eformat::write::node_t* current = &list;
68 uint32_t cpos = 0;
69 while (current) {
70 if (cpos + current->size_word > max) return 0;
71 if (current->size_word > 0 && current->base) {
72 memcpy(&dest[cpos], current->base, sizeof(uint32_t)*current->size_word);
73 cpos += current->size_word;
74 }
75 current = current->next;
76 }
77 return cpos;
78}
node_t * next
The next node.
Definition: node.h:29
uint32_t * base
The base address for this page.
Definition: node.h:27
size_t size_word
The size, in 4-byte words for this page.
Definition: node.h:28

Referenced by eformat::old::convert(), convert_ros(), and RawDataOutputSvc::putEvent().

◆ count()

uint32_t eformat::write::count ( const node_t list)

Counts how many pages I'm made of

Parameters
listThe top of the list

Definition at line 42 of file node.cxx.

43{
44 const eformat::write::node_t* current = &list;
45 uint32_t retval = 0;
46 while (current) {
47 ++retval;
48 current = current->next;
49 }
50 return retval;
51}

Referenced by eformat::write::FullEventFragment::FullEventFragment(), eformat::write::ROSFragment::ROSFragment(), and eformat::write::SubDetectorFragment::SubDetectorFragment().

◆ count_words()

uint32_t eformat::write::count_words ( const node_t list)

Count how many words I'm made of

Parameters
listThe top of the list

Definition at line 53 of file node.cxx.

54{
55 const eformat::write::node_t* current = &list;
56 uint32_t retval = 0;
57 while (current) {
58 retval += current->size_word;
59 current = current->next;
60 }
61 return retval;
62}

◆ set() [1/2]

void eformat::write::set ( node_t i,
const struct iovec &  v,
node_t n = 0 
)

Sets an IOV base values

Parameters
ithe node to be set
vthe I/O vector node to use as basis
nthe next node this node should point to

Definition at line 23 of file node.cxx.

24{
25 i.base = reinterpret_cast<uint32_t*>(v.iov_base);
26 i.size_word = v.iov_len/4;
27 i.next = n;
28}

◆ set() [2/2]

void eformat::write::set ( node_t i,
const uint32_t *  b,
size_t  l,
node_t n = 0 
)

Sets an IOV base values

Parameters
ithe node to be set
bthe base address to be used by this IOV
lthe size of the page, in words
nthe next node this node should point to

Definition at line 16 of file node.cxx.

17{
18 i.base = const_cast<uint32_t*>(b);
19 i.size_word = l;
20 i.next = n;
21}
const double b
Definition: slope.cxx:9

Referenced by cat(), eformat::write::FullEventFragment::FullEventFragment(), eformat::write::FullEventFragment::operator=(), eformat::write::ROBFragment::operator=(), eformat::write::ROSFragment::operator=(), eformat::write::SubDetectorFragment::operator=(), eformat::write::ROBFragment::ROBFragment(), eformat::write::ROSFragment::ROSFragment(), and eformat::write::SubDetectorFragment::SubDetectorFragment().

◆ shallow_copy()

uint32_t eformat::write::shallow_copy ( const node_t list,
struct iovec *  dest,
uint32_t  max 
)

Performs a shallow copy like operation, concatenating the list given as parameter to a vector of iovec nodes. This will only copy pointers and sizes, but not real data.

Parameters
listThe top of the list
destThe destination vector of iovec nodes
maxThe number of iovec nodes I can use there
Returns
The number of pages used, in total. If the return value was zero, a problem with the total destination size length was detected and the copy operation may have undergone in an incomplete way

Definition at line 80 of file node.cxx.

82{
83 const eformat::write::node_t* current = &list;
84 uint32_t cpos = 0;
85 while (current) {
86 if (cpos > max) return 0;
87 if (current->size_word > 0 && current->base) {
88 dest[cpos].iov_base =
89 reinterpret_cast<void*>(const_cast<uint32_t*>(current->base));
90 dest[cpos].iov_len = sizeof(uint32_t)*current->size_word;
91 ++cpos;
92 }
93 current = current->next;
94 }
95 return cpos;
96}