ndmspc  v1.2.0-0.1.rc3
Ndmspc::NThreadData Class Reference

Thread-local data object for NDMSPC processing. More...

#include <NThreadData.h>

Inheritance diagram for Ndmspc::NThreadData:
Ndmspc::NGnThreadData

Public Member Functions

void SetItemCount (long long itemCount)
 Setters for data members. More...
 
void SetCoordSum (long long coordSum)
 Set the sum of coordinates processed by the thread. More...
 
void SetThreadId (std::thread::id threadId)
 Set the thread's unique identifier. More...
 
void SetIdSet (bool idSet)
 Set whether the thread ID has been assigned. More...
 
void SetAssignedIndex (size_t assignedIndex)
 Set the assigned index for the thread. More...
 
void SetResourceMonitor (NResourceMonitor *monitor)
 Sets the resource monitor for this thread data. More...
 
long long GetItemCount () const
 Getters for data members. More...
 
long long GetCoordSum () const
 Get the sum of coordinates processed by the thread. More...
 
std::thread::id GetThreadId () const
 Get the thread's unique identifier. More...
 
bool GetIdSet () const
 Check if the thread ID has been assigned. More...
 
size_t GetAssignedIndex () const
 Get the assigned index for the thread. More...
 
NResourceMonitorGetResourceMonitor () const
 Gets the resource monitor associated with this thread data. More...
 
 NThreadData ()
 Default constructor. More...
 
virtual ~NThreadData ()
 Virtual destructor. More...
 
virtual void Process (const std::vector< int > &coords)
 Process method for thread data. More...
 
virtual void Print (Option_t *option="") const
 Print method override. More...
 

Static Public Attributes

static std::mutex fSharedMutex
 Shared mutex for thread-safe operations.
 

Protected Attributes

NResourceMonitorfResourceMonitor {nullptr}
 Pointer to resource monitor.
 

Private Attributes

long long fItemCount = 0
 Number of items processed.
 
long long fCoordSum = 0
 Sum of coordinates.
 
std::thread::id fThreadId
 Thread ID.
 
bool fIdSet = false
 Flag to indicate if the thread ID is set.
 
size_t fAssignedIndex = 0
 Index assigned to this object.
 

Detailed Description

Thread-local data object for NDMSPC processing.

Stores per-thread statistics, thread ID, assigned index, and provides thread-safe access. Supports processing, printing, and management of thread-specific data.

Author
Martin Vala mvala.nosp@m.@cer.nosp@m.n.ch

Definition at line 21 of file NThreadData.h.

Constructor & Destructor Documentation

◆ NThreadData()

Ndmspc::NThreadData::NThreadData ( )

Default constructor.

Constructor

Definition at line 13 of file NThreadData.cxx.

◆ ~NThreadData()

Ndmspc::NThreadData::~NThreadData ( )
virtual

Virtual destructor.

Destructor

Definition at line 20 of file NThreadData.cxx.

Member Function Documentation

◆ GetAssignedIndex()

size_t Ndmspc::NThreadData::GetAssignedIndex ( ) const
inline

Get the assigned index for the thread.

Returns
Index assigned to the thread.

Definition at line 96 of file NThreadData.h.

References fAssignedIndex.

Referenced by Ndmspc::NDimensionalExecutor::ExecuteParallel(), Ndmspc::NGnThreadData::FlushDeferredDeletes(), Ndmspc::NGnThreadData::Merge(), and Ndmspc::NGnThreadData::Process().

◆ GetCoordSum()

long long Ndmspc::NThreadData::GetCoordSum ( ) const
inline

Get the sum of coordinates processed by the thread.

Returns
Sum of coordinates.

Definition at line 78 of file NThreadData.h.

References fCoordSum.

◆ GetIdSet()

bool Ndmspc::NThreadData::GetIdSet ( ) const
inline

Check if the thread ID has been assigned.

Returns
True if ID is set, false otherwise.

Definition at line 90 of file NThreadData.h.

References fIdSet.

◆ GetItemCount()

long long Ndmspc::NThreadData::GetItemCount ( ) const
inline

Getters for data members.

Get the number of items processed by the thread.

Returns
Number of items.

Definition at line 72 of file NThreadData.h.

References fItemCount.

◆ GetResourceMonitor()

NResourceMonitor* Ndmspc::NThreadData::GetResourceMonitor ( ) const
inline

Gets the resource monitor associated with this thread data.

Returns a pointer to the NResourceMonitor instance currently associated with this thread data. The caller does not take ownership of the returned pointer.

Returns
Pointer to the associated NResourceMonitor instance.

Definition at line 108 of file NThreadData.h.

References fResourceMonitor.

◆ GetThreadId()

std::thread::id Ndmspc::NThreadData::GetThreadId ( ) const
inline

Get the thread's unique identifier.

Returns
Thread ID.

Definition at line 84 of file NThreadData.h.

References fThreadId.

◆ Print()

void Ndmspc::NThreadData::Print ( Option_t *  option = "") const
virtual

Print method override.

Parameters
optionPrint options.

Definition at line 43 of file NThreadData.cxx.

References fAssignedIndex, fCoordSum, fItemCount, and fThreadId.

◆ Process()

void Ndmspc::NThreadData::Process ( const std::vector< int > &  coords)
virtual

Process method for thread data.

Parameters
coordsVector of coordinates to process.

Reimplemented in Ndmspc::NGnThreadData.

Definition at line 26 of file NThreadData.cxx.

References fCoordSum, fIdSet, fItemCount, and fThreadId.

◆ SetAssignedIndex()

void Ndmspc::NThreadData::SetAssignedIndex ( size_t  assignedIndex)
inline

Set the assigned index for the thread.

Parameters
assignedIndexIndex assigned to the thread.

Definition at line 53 of file NThreadData.h.

References fAssignedIndex.

Referenced by Ndmspc::NGnThreadData::Init().

◆ SetCoordSum()

void Ndmspc::NThreadData::SetCoordSum ( long long  coordSum)
inline

Set the sum of coordinates processed by the thread.

Parameters
coordSumSum of coordinates.

Definition at line 35 of file NThreadData.h.

References fCoordSum.

◆ SetIdSet()

void Ndmspc::NThreadData::SetIdSet ( bool  idSet)
inline

Set whether the thread ID has been assigned.

Parameters
idSetTrue if ID is set, false otherwise.

Definition at line 47 of file NThreadData.h.

References fIdSet.

◆ SetItemCount()

void Ndmspc::NThreadData::SetItemCount ( long long  itemCount)
inline

Setters for data members.

Set the number of items processed by the thread.

Parameters
itemCountNumber of items.

Definition at line 29 of file NThreadData.h.

References fItemCount.

◆ SetResourceMonitor()

void Ndmspc::NThreadData::SetResourceMonitor ( NResourceMonitor monitor)
inline

Sets the resource monitor for this thread data.

This function assigns the given NResourceMonitor pointer to the internal resource monitor member. Ownership of the pointer is not transferred; the caller is responsible for managing the lifetime of the monitor object.

Parameters
monitorPointer to an NResourceMonitor instance to be associated with this thread data.

Definition at line 64 of file NThreadData.h.

References fResourceMonitor.

◆ SetThreadId()

void Ndmspc::NThreadData::SetThreadId ( std::thread::id  threadId)
inline

Set the thread's unique identifier.

Parameters
threadIdThread ID.

Definition at line 41 of file NThreadData.h.

References fThreadId.

Referenced by Ndmspc::NGnThreadData::Init().


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