Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
openlcb::CDIUtils::CDINodeRep Struct Reference

Public Member Functions

 CDINodeRep ()
 Default constructor.
 
 CDINodeRep (const XMLNode *node, std::nullptr_t)
 Initializes a group rep from an arbitrary XML element (e.g.
 
 CDINodeRep (const XMLNode *segment)
 Initializes a group rep from a segment root.
 
 CDINodeRep (const CDINodeRep *parent, const XMLNode *child)
 Initializes a group rep which has no replication or an entry rep.
 
 CDINodeRep (const CDINodeRep *parent, const XMLNode *group, unsigned replica)
 Initializes a group rep for a given replica.
 
template<typename... Args>
void reset (Args &&... args)
 Resets the current representation.
 
unsigned get_child_address (const XMLNode *child) const
 Gets the absolute address of a given child in the current segment.
 
unsigned get_child_size (const XMLNode *child) const
 Gets the size of a child (number of bytes occupied).
 

Public Attributes

const XMLNode * node_
 Element in the XML where we are. This is a segment or a group node.
 
unsigned address_
 address in the current space of the beginning of the current node.
 

Detailed Description

Definition at line 398 of file CDIUtils.hxx.

Constructor & Destructor Documentation

◆ CDINodeRep() [1/5]

openlcb::CDIUtils::CDINodeRep::CDINodeRep ( )
inline

Default constructor.

Probably should not be used; maybe only for the root of the CDI which is not inside any segment.

Definition at line 411 of file CDIUtils.hxx.

◆ CDINodeRep() [2/5]

openlcb::CDIUtils::CDINodeRep::CDINodeRep ( const XMLNode *  node,
std::nullptr_t   
)
inline

Initializes a group rep from an arbitrary XML element (e.g.

the cdi root). Tihs does not allow child computations.

Parameters
nodeis the XML element.

Definition at line 420 of file CDIUtils.hxx.

◆ CDINodeRep() [3/5]

openlcb::CDIUtils::CDINodeRep::CDINodeRep ( const XMLNode *  segment)
inline

Initializes a group rep from a segment root.

Parameters
segmentis the XML element representing the segment root.

Definition at line 428 of file CDIUtils.hxx.

◆ CDINodeRep() [4/5]

openlcb::CDIUtils::CDINodeRep::CDINodeRep ( const CDINodeRep parent,
const XMLNode *  child 
)
inline

Initializes a group rep which has no replication or an entry rep.

Parameters
parentis the Node representation of the parent group or segment.
childis the XML element for the current (child). If it is a group, it must have no replication.

Definition at line 442 of file CDIUtils.hxx.

◆ CDINodeRep() [5/5]

openlcb::CDIUtils::CDINodeRep::CDINodeRep ( const CDINodeRep parent,
const XMLNode *  group,
unsigned  replica 
)
inline

Initializes a group rep for a given replica.

Parameters
parentis the Node representation of the parent group or segment.
groupis the XML element for the current (child) group. it must have replication.
replicais the number of the replication (zero to replication - 1).

Definition at line 460 of file CDIUtils.hxx.

Member Function Documentation

◆ get_child_address()

unsigned openlcb::CDIUtils::CDINodeRep::get_child_address ( const XMLNode *  child) const
inline

Gets the absolute address of a given child in the current segment.

Parameters
childan element which is a child of node_
Returns
the absolute address within the CDI segment of child.

Definition at line 484 of file CDIUtils.hxx.

◆ get_child_size()

unsigned openlcb::CDIUtils::CDINodeRep::get_child_size ( const XMLNode *  child) const
inline

Gets the size of a child (number of bytes occupied).

Definition at line 494 of file CDIUtils.hxx.

◆ reset()

template<typename... Args>
void openlcb::CDIUtils::CDINodeRep::reset ( Args &&...  args)
inline

Resets the current representation.

Use any constructor argument set.

Definition at line 476 of file CDIUtils.hxx.

Member Data Documentation

◆ address_

unsigned openlcb::CDIUtils::CDINodeRep::address_

address in the current space of the beginning of the current node.

For segments, this is the origin; for groups this is the address of the virtual zero-length data element at the beginning of the group. For repeated groups this is meaningful only with a given repetition of a group.

Definition at line 407 of file CDIUtils.hxx.

◆ node_

const XMLNode* openlcb::CDIUtils::CDINodeRep::node_

Element in the XML where we are. This is a segment or a group node.

Definition at line 401 of file CDIUtils.hxx.


The documentation for this struct was generated from the following file: