LDMX Software
Public Member Functions | Friends | List of all members
framework::Bus::Seat Class Referenceabstract

The handle of a bus passenger. More...

Public Member Functions

virtual ~Seat ()
 Destructor.
 
virtual TBranch * attach (TTree *tree, const std::string &branch_name, bool can_create)=0
 Attach this passenger to the input tree.
 
virtual void clear ()=0
 Clear this passenger.
 
virtual void stream (std::ostream &s) const =0
 Define how we should stream the object to the input stream.
 

Friends

std::ostream & operator<< (std::ostream &s, const std::unique_ptr< framework::Bus::Seat > &seat)
 Stream this object to the output stream.
 

Detailed Description

The handle of a bus passenger.

This is the foundation of the bus. Each bus passenger (which does know the type of object it is carrying) is given a seat on the bus that doesn't know the type of object it is carrying. This allows the bus to have one container for all the passengers carrying different types of objects and tell each of these objects to reset themselves at the end of the event.

Definition at line 180 of file Bus.h.

Constructor & Destructor Documentation

◆ ~Seat()

virtual framework::Bus::Seat::~Seat ( )
inlinevirtual

Destructor.

Virtual so that the derived classes we will be pointing to with this class will be destructed when this is destructed.

Definition at line 188 of file Bus.h.

188{}

Member Function Documentation

◆ attach()

virtual TBranch * framework::Bus::Seat::attach ( TTree *  tree,
const std::string &  branch_name,
bool  can_create 
)
pure virtual

Attach this passenger to the input tree.

We don't define the attachement here, but this pure virtual function allows for us to make the attachment without knowledge of the type of object the derived class is storing.

Parameters
[in]treepointer to TTree to attach to
[in]branch_namename of branch we should attach to
[in]can_createif true, we can create a new branch if we don't find one
Returns
pointer to branch that we attached to (maybe be null if no branch found)

Implemented in framework::Bus::Passenger< BaggageType >.

◆ clear()

virtual void framework::Bus::Seat::clear ( )
pure virtual

Clear this passenger.

Basically, we need to allow for this handle to reset the contents of the passenger because we won't know the type that is being stored when we wish to reset the event bus to an "undefined" state.

Implemented in framework::Bus::Passenger< BaggageType >.

◆ stream()

virtual void framework::Bus::Seat::stream ( std::ostream &  s) const
pure virtual

Define how we should stream the object to the input stream.

Parameters
[in]sostream to write to

Implemented in framework::Bus::Passenger< BaggageType >.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  s,
const std::unique_ptr< framework::Bus::Seat > &  seat 
)
friend

Stream this object to the output stream.

Notice that the input Seat is a uniqe_ptr. This is because that is what is stored in the Bus.

May contain newlines if large object.

See also
stream for detailed implementation
Parameters
[in]sostream to write to
[in]seatSeat to write out
Returns
modified ostream

Definition at line 238 of file Bus.h.

239 {
240 seat->stream(s);
241 return s;
242 }

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