BOSS 8.0.0
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

typedef struct eformat::write::node_t eformat::write::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 28 of file node.cxx.

28 {
29 for ( size_t i = 0; i < ( count - 1 ); ++i ) set( n[i], v[i], &n[i + 1] );
30 set( n[count - 1], v[count - 1], 0 );
31}
const Int_t n
**********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
uint32_t count(const node_t &list)
Definition node.cxx:38
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 33 of file node.cxx.

33 {
34 for ( size_t i = 0; i < ( count - 1 ); ++i ) n[i].next = &n[i + 1];
35 n[count - 1].next = 0;
36}

◆ 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 60 of file node.cxx.

60 {
61 const eformat::write::node_t* current = &list;
62 uint32_t cpos = 0;
63 while ( current )
64 {
65 if ( cpos + current->size_word > max ) return 0;
66 if ( current->size_word > 0 && current->base )
67 {
68 memcpy( &dest[cpos], current->base, sizeof( uint32_t ) * current->size_word );
69 cpos += current->size_word;
70 }
71 current = current->next;
72 }
73 return cpos;
74}
#define max(a, b)
uint32_t * base
The base address for this page.
size_t size_word
The size, in 4-byte words for this page.

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 38 of file node.cxx.

38 {
39 const eformat::write::node_t* current = &list;
40 uint32_t retval = 0;
41 while ( current )
42 {
43 ++retval;
44 current = current->next;
45 }
46 return retval;
47}

Referenced by cat(), cat(), 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 49 of file node.cxx.

49 {
50 const eformat::write::node_t* current = &list;
51 uint32_t retval = 0;
52 while ( current )
53 {
54 retval += current->size_word;
55 current = current->next;
56 }
57 return retval;
58}

◆ 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 22 of file node.cxx.

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

◆ set() [2/2]

◆ 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 76 of file node.cxx.

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

Referenced by main().