Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

eformat::write::SubDetectorFragment Class Reference

#include <SubDetectorFragment.h>

List of all members.

Public Member Functions

void append (eformat::write::ROSFragment *ros)
void append (eformat::write::ROSFragment *ros)
const eformat::write::node_tbind (void)
const eformat::write::node_tbind (void)
const ROSFragmentfirst_child (void) const
const ROSFragmentfirst_child (void) const
uint32_t meta_size_word (void) const
uint32_t meta_size_word (void) const
uint16_t minor_version (void) const
void minor_version (uint16_t v)
uint16_t minor_version (void) const
void minor_version (uint16_t v)
void next (const SubDetectorFragment *n)
const SubDetectorFragmentnext (void) const
void next (const SubDetectorFragment *n)
const SubDetectorFragmentnext (void) const
uint32_t nstatus (void) const
uint32_t nstatus (void) const
SubDetectorFragmentoperator= (const SubDetectorFragment &other)
SubDetectorFragmentoperator= (const SubDetectorFragment &other)
uint32_t page_count (void) const
uint32_t page_count (void) const
void parent (eformat::write::FullEventFragment *fe)
const FullEventFragmentparent (void) const
void parent (eformat::write::FullEventFragment *fe)
const FullEventFragmentparent (void) const
void size_change (uint32_t o, uint32_t n)
void size_change (uint32_t o, uint32_t n)
uint32_t size_word (void) const
uint32_t size_word (void) const
uint32_t source_id (void) const
void source_id (uint32_t s)
uint32_t source_id (void) const
void source_id (uint32_t s)
const uint32_t * status (void) const
void status (uint32_t n, const uint32_t *status)
const uint32_t * status (void) const
void status (uint32_t n, const uint32_t *status)
 SubDetectorFragment (const SubDetectorFragment &other)
 SubDetectorFragment ()
 SubDetectorFragment (eformat::write::node_t *sd)
 SubDetectorFragment (uint32_t *sd)
 SubDetectorFragment (uint32_t source_id)
 SubDetectorFragment (const SubDetectorFragment &other)
 SubDetectorFragment ()
 SubDetectorFragment (eformat::write::node_t *sd)
 SubDetectorFragment (uint32_t *sd)
 SubDetectorFragment (uint32_t source_id)
virtual ~SubDetectorFragment ()
virtual ~SubDetectorFragment ()

Private Attributes

eformat::write::ROSFragmentm_child
 my ROS children
eformat::write::ROSFragmentm_child
 my ROS children
eformat::write::node_t m_extra
 Extra pages I may have.
uint32_t m_extra_count
 How many extra pages I have.
uint32_t m_header [7]
 The SubDetector Header.
eformat::write::ROSFragmentm_last
 my last ROS child
eformat::write::ROSFragmentm_last
 my last ROS child
const eformat::write::SubDetectorFragmentm_next
 Next sibling.
const eformat::write::SubDetectorFragmentm_next
 Next sibling.
eformat::write::node_t m_node [3]
 Node representation.
eformat::write::FullEventFragmentm_parent
 my parent
eformat::write::FullEventFragmentm_parent
 my parent


Detailed Description

Defines a helper class to aid the creation of SubDetector fragments.


Constructor & Destructor Documentation

eformat::write::SubDetectorFragment::SubDetectorFragment uint32_t  source_id  ) 
 

Builds a new SubDetector fragment from scratch

Parameters:
source_id The source identifier to be using for this SubDetector
00020   : m_parent(0),
00021     m_child(0),
00022     m_last(0),
00023     m_next(0),
00024     m_extra_count(0)
00025 {
00026   m_header[0] = eformat::SUB_DETECTOR; //marker
00027   m_header[1] = 8; //this header size + status size
00028   m_header[2] = 8; //this header size + status size
00029   m_header[3] = eformat::DEFAULT_VERSION; //format version
00030   m_header[4] = source_id;
00031   m_header[5] = 1; //number of status
00032   m_header[6] = 0; //number of fragment specific
00033 
00034   //now initialize pages
00035   set(m_node[0], m_header, 6, &m_node[1]);
00036   set(m_node[1], &eformat::DEFAULT_STATUS, 1, &m_node[2]);
00037   set(m_node[2], &m_header[6], 1, 0);
00038   ERS_DEBUG_3("%s Source Id. = 0x%x.", 
00039               "Built (write) subdetector from scratch, with", 
00040               SubDetectorFragment::source_id());
00041 }

eformat::write::SubDetectorFragment::SubDetectorFragment uint32_t *  sd  ) 
 

Builds a new SubDetector fragment from an existing SubDetector fragment in contiguous memory.

Parameters:
sd The existing SubDetector fragment
00068   : m_parent(0),
00069     m_child(0),
00070     m_last(0),
00071     m_next(0),
00072     m_extra_count(0)
00073 {
00074   //now initialize pages
00075   set(m_node[0], sd, 6, &m_node[1]);
00076   set(m_node[1], &sd[6], sd[5], &m_node[2]);
00077   set(m_node[2], &sd[6+sd[5]], 1, &m_extra);
00078   eformat::write::set(m_extra, &sd[7+sd[5]], sd[1]-sd[2], 0);
00079   ++m_extra_count;
00080   ERS_DEBUG_3("%s Source Id. = 0x%x.", 
00081               "Built (write) subdetector from contiguous memory, with",
00082               source_id());
00083 }

eformat::write::SubDetectorFragment::SubDetectorFragment eformat::write::node_t sd  ) 
 

Builds a new SubDetector fragment from an existing SubDetector fragment in non-contiguous memory. The top-level fragment header is expected to be on a contiguous area of memory, together with the first word of the first child fragment (i.e. the ROS header marker). The following data can be spread around.

Parameters:
sd The existing SubDetector fragment, as a list of nodes, pre-concatenated by the caller.
00087   : m_parent(0),
00088     m_child(0),
00089     m_last(0),
00090     m_next(0),
00091     m_extra_count(0)
00092 {
00093   //now initialize pages
00094   set(m_node[0], sd->base, 6, &m_node[1]);
00095   set(m_node[1], &sd->base[6], sd->base[5], &m_node[2]);
00096   set(m_node[2], &sd->base[6+sd->base[5]], 1, &m_extra);
00097   eformat::write::set(m_extra, &sd->base[7+sd->base[5]],
00098                       sd->size_word - sd->base[2], sd->next);
00099   m_extra_count += eformat::write::count(m_extra);
00100   ERS_DEBUG_3("%s Source Id. = 0x%x.", 
00101               "Built (write) subdetector from paged memory, with", 
00102               source_id());
00103 }

eformat::write::SubDetectorFragment::SubDetectorFragment  ) 
 

Builds a new empty SubDetectorFragment, otherwise invalid. This is useful for array builds and standard containers.

00044   : m_parent(0),
00045     m_child(0),
00046     m_last(0),
00047     m_next(0),
00048     m_extra_count(0)
00049 {
00050   m_header[0] = eformat::SUB_DETECTOR; //marker
00051   m_header[1] = 8; //this header size + status size
00052   m_header[2] = 8; //this header size + status size
00053   m_header[3] = eformat::DEFAULT_VERSION; //format version
00054   m_header[4] = 0; //source identifier
00055   m_header[5] = 1; //number of status
00056   m_header[6] = 0; //number of fragment specific
00057 
00058   //now initialize pages
00059   set(m_node[0], m_header, 6, &m_node[1]);
00060   set(m_node[1], &eformat::DEFAULT_STATUS, 1, &m_node[2]);
00061   set(m_node[2], &m_header[6], 1, 0);
00062   ERS_DEBUG_3("%s Source Id. = 0x%x.", 
00063               "Built empty (write) subdetector from scratch, with", 
00064               SubDetectorFragment::source_id());
00065 }

eformat::write::SubDetectorFragment::SubDetectorFragment const SubDetectorFragment other  ) 
 

Copy constructor. This will only copy the meta data, not the fragment relationships and block-data (children, parent and status block) contained in the to-be-copied fragment. If you wish this fragment has the same parents, and children of the copied fragment, you have to do this operation manually, after copying. If you wish to make a copy of the status as well, do it manually and then assign it to this fragment using the status() method.

Parameters:
other The other fragment to take the meta data from.
00107   : m_parent(0),
00108     m_child(0),
00109     m_last(0),
00110     m_next(0),
00111     m_extra_count(0)
00112 {
00113   *this = other;
00114   ERS_DEBUG_3("%s Source Id. = 0x%x.", 
00115               "Built (write) subdetector from copy, with", 
00116               source_id());
00117 }

virtual eformat::write::SubDetectorFragment::~SubDetectorFragment  )  [inline, virtual]
 

Base destructor

00081 {}

eformat::write::SubDetectorFragment::SubDetectorFragment uint32_t  source_id  ) 
 

Builds a new SubDetector fragment from scratch

Parameters:
source_id The source identifier to be using for this SubDetector

eformat::write::SubDetectorFragment::SubDetectorFragment uint32_t *  sd  ) 
 

Builds a new SubDetector fragment from an existing SubDetector fragment in contiguous memory.

Parameters:
sd The existing SubDetector fragment

eformat::write::SubDetectorFragment::SubDetectorFragment eformat::write::node_t sd  ) 
 

Builds a new SubDetector fragment from an existing SubDetector fragment in non-contiguous memory. The top-level fragment header is expected to be on a contiguous area of memory, together with the first word of the first child fragment (i.e. the ROS header marker). The following data can be spread around.

Parameters:
sd The existing SubDetector fragment, as a list of nodes, pre-concatenated by the caller.

eformat::write::SubDetectorFragment::SubDetectorFragment  ) 
 

Builds a new empty SubDetectorFragment, otherwise invalid. This is useful for array builds and standard containers.

eformat::write::SubDetectorFragment::SubDetectorFragment const SubDetectorFragment other  ) 
 

Copy constructor. This will only copy the meta data, not the fragment relationships and block-data (children, parent and status block) contained in the to-be-copied fragment. If you wish this fragment has the same parents, and children of the copied fragment, you have to do this operation manually, after copying. If you wish to make a copy of the status as well, do it manually and then assign it to this fragment using the status() method.

Parameters:
other The other fragment to take the meta data from.

virtual eformat::write::SubDetectorFragment::~SubDetectorFragment  )  [inline, virtual]
 

Base destructor

00081 {}


Member Function Documentation

void eformat::write::SubDetectorFragment::append eformat::write::ROSFragment ros  ) 
 

Appends a new ROS fragment to this SubDetector fragment.

Warning:
This will change the page structure of the last ROS fragment inserted here, in order to concatenate the ROS fragments together. Please note that this operation is not compatible with multiple threads of operation, if you would like to share eformat::write::ROSFragment's between threads. A better strategy would be create, for every thread of operation, a proper ROSFragment instead.
Parameters:
ros The ROS fragment to be appended to myself

void eformat::write::SubDetectorFragment::append eformat::write::ROSFragment ros  ) 
 

Appends a new ROS fragment to this SubDetector fragment.

Warning:
This will change the page structure of the last ROS fragment inserted here, in order to concatenate the ROS fragments together. Please note that this operation is not compatible with multiple threads of operation, if you would like to share eformat::write::ROSFragment's between threads. A better strategy would be create, for every thread of operation, a proper ROSFragment instead.
Parameters:
ros The ROS fragment to be appended to myself
00161 {
00162   ERS_DEBUG_3("%s Source Id. = 0x%x to subdetector with Source Id. = 0x%x", 
00163               "Appending ros fragment with",
00164               ros->source_id(), source_id());
00165   ros->parent(this);
00166   uint32_t old_size = m_node[0].base[1];
00167   m_node[0].base[1] += ros->size_word();
00168 
00169   //adjust `m_last' and `m_child' to point to the new last ROB
00170   if (m_last) m_last->next(ros);
00171   else m_child = ros;
00172   m_last = ros;
00173 
00174   //propagate changes to my parent
00175   if (m_parent) m_parent->size_change(old_size, m_node[0].base[1]);
00176 }

const eformat::write::node_t* eformat::write::SubDetectorFragment::bind void   ) 
 

Returns the first node of a list of nodes that represent the fragment you have constructed. To make use of it, just browse the list as defined in node.h

const eformat::write::node_t * eformat::write::SubDetectorFragment::bind void   ) 
 

Returns the first node of a list of nodes that represent the fragment you have constructed. To make use of it, just browse the list as defined in node.h

00188 {
00189   //the header is already concatenated by construction
00190   eformat::write::node_t* last = &m_node[2];
00191   if (m_extra_count) {
00192     last = &m_extra;
00193     while (last->next) last = last->next;
00194   }
00195   for (ROSFragment* curr = m_child; curr; 
00196        curr = const_cast<ROSFragment*>(curr->next())) {
00197     last->next = const_cast<eformat::write::node_t*>(curr->bind());
00198     while (last->next) last = last->next; //advance until end
00199   }
00200   return m_node;
00201 }

const ROSFragment* eformat::write::SubDetectorFragment::first_child void   )  const [inline]
 

This returns the first child of this fragment. The system operates as a concatenated list of fragments. From this child you can get to the next.

00178 { return m_child; }

const ROSFragment* eformat::write::SubDetectorFragment::first_child void   )  const [inline]
 

This returns the first child of this fragment. The system operates as a concatenated list of fragments. From this child you can get to the next.

00178 { return m_child; }

uint32_t eformat::write::SubDetectorFragment::meta_size_word void   )  const [inline]
 

Returns the total size for the meta data (everything that does not encompass the contents of the m_data pointer in the private representation of this class) in the fragment, in words

00150       { return m_node[0].base[2]; }

uint32_t eformat::write::SubDetectorFragment::meta_size_word void   )  const [inline]
 

Returns the total size for the meta data (everything that does not encompass the contents of the m_data pointer in the private representation of this class) in the fragment, in words

00150       { return m_node[0].base[2]; }

uint16_t eformat::write::SubDetectorFragment::minor_version void   )  const [inline]
 

Returns the minor version number of the fragment

00128       { return 0xffff & m_node[0].base[3]; }

void eformat::write::SubDetectorFragment::minor_version uint16_t  v  )  [inline]
 

Changes the minor version number of the fragment

Parameters:
s The new minor version for this header
00122       { m_node[0].base[3] = eformat::DEFAULT_VERSION | v; }

uint16_t eformat::write::SubDetectorFragment::minor_version void   )  const [inline]
 

Returns the minor version number of the fragment

00128       { return 0xffff & m_node[0].base[3]; }

void eformat::write::SubDetectorFragment::minor_version uint16_t  v  )  [inline]
 

Changes the minor version number of the fragment

Parameters:
s The new minor version for this header
00122       { m_node[0].base[3] = eformat::DEFAULT_VERSION | v; }

void eformat::write::SubDetectorFragment::next const SubDetectorFragment n  )  [inline]
 

Sets the next sibling

Parameters:
n The sibling following this fragment
00213 { m_next = n; }

const SubDetectorFragment* eformat::write::SubDetectorFragment::next void   )  const [inline]
 

Returns the next sibling

00206 { return m_next; }

void eformat::write::SubDetectorFragment::next const SubDetectorFragment n  )  [inline]
 

Sets the next sibling

Parameters:
n The sibling following this fragment
00213 { m_next = n; }

const SubDetectorFragment* eformat::write::SubDetectorFragment::next void   )  const [inline]
 

Returns the next sibling

00206 { return m_next; }

uint32_t eformat::write::SubDetectorFragment::nstatus void   )  const [inline]
 

Returns the number of status wors in this fragment

00109 { return m_node[0].base[5]; }

uint32_t eformat::write::SubDetectorFragment::nstatus void   )  const [inline]
 

Returns the number of status wors in this fragment

00109 { return m_node[0].base[5]; }

SubDetectorFragment& eformat::write::SubDetectorFragment::operator= const SubDetectorFragment other  ) 
 

Assigment operator. This will only copy the meta data, not the fragment relationships and block-data (children and parent and status block) contained in the to-be-copied fragment. If you wish this fragment has the same parents, and children of the copied fragment, you have to do this operation manually, after copying. If you wish to make a copy of the status as well, do it manually and then assign it to this fragment using the status() method.

Parameters:
other The other fragment to take the meta data from.

eformat::write::SubDetectorFragment & eformat::write::SubDetectorFragment::operator= const SubDetectorFragment other  ) 
 

Assigment operator. This will only copy the meta data, not the fragment relationships and block-data (children and parent and status block) contained in the to-be-copied fragment. If you wish this fragment has the same parents, and children of the copied fragment, you have to do this operation manually, after copying. If you wish to make a copy of the status as well, do it manually and then assign it to this fragment using the status() method.

Parameters:
other The other fragment to take the meta data from.
00122 {
00123   memcpy(reinterpret_cast<void*>(m_header),
00124          reinterpret_cast<const void*>(other.m_node[0].base), 
00125          6*sizeof(uint32_t));
00126   m_header[6] = other.m_node[2].base[0];
00127 
00128   //now initialize pages
00129   set(m_node[0], m_header, 6, &m_node[1]);
00130   set(m_node[1], other.m_node[1].base, other.m_node[1].size_word, &m_node[2]);
00131   set(m_node[2], &m_header[6], 1, 0);
00132   ERS_DEBUG_3("%s Source Id. = 0x%x.",
00133               "Copied (write) subdetector with",
00134               SubDetectorFragment::source_id());
00135   return *this;
00136 }

uint32_t eformat::write::SubDetectorFragment::page_count void   )  const
 

Returns the total number of (raw memory) pages this fragment is composed of.

Warning:
This operation navigates at a potentially large list of child page nodes (for a full ATLAS event this should be bigger than 2,000 pages when built from scratch). If you don't do your bookkeeping, avoid calling this too often.

uint32_t eformat::write::SubDetectorFragment::page_count void   )  const
 

Returns the total number of (raw memory) pages this fragment is composed of.

Warning:
This operation navigates at a potentially large list of child page nodes (for a full ATLAS event this should be bigger than 2,000 pages when built from scratch). If you don't do your bookkeeping, avoid calling this too often.
00179 {
00180   uint32_t retval = 3 + m_extra_count;
00181   for (const ROSFragment* curr = m_child; curr; curr = curr->next())
00182     retval += curr->page_count();
00183   return retval;
00184 }

void eformat::write::SubDetectorFragment::parent eformat::write::FullEventFragment fe  )  [inline]
 

This sets the parent fragment

Parameters:
fe The FullEventFragment parent fragment of this SubDetector
00201       { m_parent = fe; }

const FullEventFragment* eformat::write::SubDetectorFragment::parent void   )  const [inline]
 

This returns the parent fragment

00193       { return m_parent; }

void eformat::write::SubDetectorFragment::parent eformat::write::FullEventFragment fe  )  [inline]
 

This sets the parent fragment

Parameters:
fe The FullEventFragment parent fragment of this SubDetector
00201       { m_parent = fe; }

const FullEventFragment* eformat::write::SubDetectorFragment::parent void   )  const [inline]
 

This returns the parent fragment

00193       { return m_parent; }

void eformat::write::SubDetectorFragment::size_change uint32_t  o,
uint32_t  n
 

This method is used by children of this fragment to notify fragment size changes.

Parameters:
o The old size, in 32-bit words
n The new size, in 32-bit words

void eformat::write::SubDetectorFragment::size_change uint32_t  o,
uint32_t  n
 

This method is used by children of this fragment to notify fragment size changes.

Parameters:
o The old size, in 32-bit words
n The new size, in 32-bit words
00152 { 
00153   uint32_t old_size = m_node[0].base[1];
00154   m_node[0].base[1] -= o;
00155   m_node[0].base[1] += n;
00156   if (m_parent) m_parent->size_change(old_size, m_node[0].base[1]);
00157 }

uint32_t eformat::write::SubDetectorFragment::size_word void   )  const [inline]
 

Returns the total size for this fragment, in words

00156       { return m_node[0].base[1]; }

uint32_t eformat::write::SubDetectorFragment::size_word void   )  const [inline]
 

Returns the total size for this fragment, in words

00156       { return m_node[0].base[1]; }

uint32_t eformat::write::SubDetectorFragment::source_id void   )  const [inline]
 

Returns the source identifier of this fragment

00142       { return m_node[0].base[4]; }

void eformat::write::SubDetectorFragment::source_id uint32_t  s  )  [inline]
 

Changes the source identifier for this fragment

Parameters:
s The new value to set
00136       { m_node[0].base[4] = s; }

uint32_t eformat::write::SubDetectorFragment::source_id void   )  const [inline]
 

Returns the source identifier of this fragment

00142       { return m_node[0].base[4]; }

void eformat::write::SubDetectorFragment::source_id uint32_t  s  )  [inline]
 

Changes the source identifier for this fragment

Parameters:
s The new value to set
00136       { m_node[0].base[4] = s; }

const uint32_t* eformat::write::SubDetectorFragment::status void   )  const [inline]
 

Returns a pointer to the first status word to be used by this fragment

00114 { return m_node[1].base; }

void eformat::write::SubDetectorFragment::status uint32_t  n,
const uint32_t *  status
 

Changes the number of status words and the status words themselves from the fragment

Parameters:
n How many status words the underlying SubDetectorFragment fragment supposed to have.
status A pointer to n pre-allocated words

const uint32_t* eformat::write::SubDetectorFragment::status void   )  const [inline]
 

Returns a pointer to the first status word to be used by this fragment

00114 { return m_node[1].base; }

void eformat::write::SubDetectorFragment::status uint32_t  n,
const uint32_t *  status
 

Changes the number of status words and the status words themselves from the fragment

Parameters:
n How many status words the underlying SubDetectorFragment fragment supposed to have.
status A pointer to n pre-allocated words
00140 {
00141   if (m_parent) m_parent->size_change(m_node[0].base[1],
00142                                       m_node[0].base[1]-m_node[0].base[5]+n);
00143   m_node[0].base[1] -= m_node[0].base[5]; //remove count from previous status
00144   m_node[0].base[2] -= m_node[0].base[5]; //remove count from previous status
00145   m_node[1].size_word = m_node[0].base[5] = n; //set new values
00146   m_node[0].base[1] += n;
00147   m_node[0].base[2] += n;
00148   m_node[1].base = const_cast<uint32_t*>(status);
00149 }


Member Data Documentation

eformat::write::ROSFragment* eformat::write::SubDetectorFragment::m_child [private]
 

my ROS children

eformat::write::ROSFragment* eformat::write::SubDetectorFragment::m_child [private]
 

my ROS children

eformat::write::node_t eformat::write::SubDetectorFragment::m_extra [private]
 

Extra pages I may have.

uint32_t eformat::write::SubDetectorFragment::m_extra_count [private]
 

How many extra pages I have.

uint32_t eformat::write::SubDetectorFragment::m_header [private]
 

The SubDetector Header.

eformat::write::ROSFragment* eformat::write::SubDetectorFragment::m_last [private]
 

my last ROS child

eformat::write::ROSFragment* eformat::write::SubDetectorFragment::m_last [private]
 

my last ROS child

const eformat::write::SubDetectorFragment* eformat::write::SubDetectorFragment::m_next [private]
 

Next sibling.

const eformat::write::SubDetectorFragment* eformat::write::SubDetectorFragment::m_next [private]
 

Next sibling.

eformat::write::node_t eformat::write::SubDetectorFragment::m_node [private]
 

Node representation.

eformat::write::FullEventFragment* eformat::write::SubDetectorFragment::m_parent [private]
 

my parent

eformat::write::FullEventFragment* eformat::write::SubDetectorFragment::m_parent [private]
 

my parent


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 19:19:09 2011 for BOSS6.5.5 by  doxygen 1.3.9.1