simulavr  1.1.0
DumpManager Class Reference

#include <traceval.h>

Public Member Functions

void SetSingleDeviceApp (void)
 Tell DumpManager, that we have only one device. More...
 
void addDumper (Dumper *dump, const TraceSet &vals)
 
void start ()
 
void stopApplication (void)
 Stop processing on all dumpers and removes it from dumpers list. More...
 
void cycle ()
 
 ~DumpManager ()
 Destroys the DumpManager instance and shut down all dumpers. More...
 
void save (std::ostream &os) const
 
TraceSet load (std::istream &is)
 
TraceSet load (const std::string &istr)
 
const TraceSetall ()
 

Static Public Member Functions

static DumpManagerInstance (void)
 Singleton class access. More...
 
static void Reset (void)
 Reset DumpManager instance (e.g. delete available instance) More...
 

Private Member Functions

 DumpManager ()
 Private instance constructor. More...
 
void appendDeviceName (std::string &s)
 append a unique device name to a string More...
 
void registerAvrDevice (AvrDevice *dev)
 Add a device to devicelist. More...
 
void unregisterAvrDevice (AvrDevice *dev)
 Remove a device from devicelist. More...
 
void detachAvrDevices ()
 detach all devices More...
 
TraceValueseekValueByName (const std::string &name)
 Seek value by name in all devices. More...
 

Private Attributes

bool singleDeviceApp
 Flag, if we use only one device, e.g. assign no device name. More...
 
TraceSet active
 Set of active tracing values. More...
 
TraceSet _all
 Set of all traceable values (placeholder instance for all() method) More...
 
std::vector< Dumper * > dumps
 All dumpers, which we want to use. More...
 
std::vector< AvrDevice * > devices
 Device list. More...
 

Static Private Attributes

static int _devidx = 0
 
static DumpManager_instance = NULL
 

Friends

class TraceValueRegister
 
class AvrDevice
 

Detailed Description

Manages all active Dumper instances for a given AvrDevice. It also manages all trace values and sets them active as necessary.

Definition at line 344 of file traceval.h.

Constructor & Destructor Documentation

◆ ~DumpManager()

DumpManager::~DumpManager ( )
inline

Destroys the DumpManager instance and shut down all dumpers.

Definition at line 379 of file traceval.h.

◆ DumpManager()

DumpManager::DumpManager ( )
private

Private instance constructor.

Definition at line 582 of file traceval.cpp.

Member Function Documentation

◆ addDumper()

void DumpManager::addDumper ( Dumper dump,
const TraceSet vals 
)

Add a dumper to the list. The vector vals contains all the values this dumper should trace.

Definition at line 641 of file traceval.cpp.

References avr_error, and Dumper::setActiveSignals().

◆ all()

const TraceSet & DumpManager::all ( )

Gives all available tracers as a set.

Definition at line 658 of file traceval.cpp.

References devices.

◆ appendDeviceName()

void DumpManager::appendDeviceName ( std::string &  s)
private

append a unique device name to a string

Definition at line 586 of file traceval.cpp.

References avr_error, and int2str().

Referenced by TraceValueRegister::TraceValueRegister().

◆ cycle()

void DumpManager::cycle ( )

Process one AVR clock cycle. Must be done after the AVR did all processing so that changed values etc. can be collected.

Definition at line 686 of file traceval.cpp.

References DumpVCD::cycle(), and DumpVCD::enabled().

Referenced by AvrDevice::Step(), and HWTimerTinyX5::Step().

◆ detachAvrDevices()

void DumpManager::detachAvrDevices ( )
private

detach all devices

Definition at line 608 of file traceval.cpp.

References AvrDevice::detachDumpManager(), and devices.

◆ Instance()

DumpManager * DumpManager::Instance ( void  )
static

◆ load() [1/2]

TraceSet DumpManager::load ( std::istream &  is)

Load a list of tracing values from the given input stream. Checks whether the values are part of the set of traceable values.

Returns
TraceSet with found TraceValue's

Definition at line 739 of file traceval.cpp.

References avr_error, int2str(), readline(), and split().

◆ load() [2/2]

TraceSet DumpManager::load ( const std::string &  istr)

Load a list of tracing values from the given input string. Checks whether the values are part of the set of traceable values.

Returns
TraceSet with found TraceValue's

Definition at line 783 of file traceval.cpp.

◆ registerAvrDevice()

void DumpManager::registerAvrDevice ( AvrDevice dev)
private

Add a device to devicelist.

Definition at line 594 of file traceval.cpp.

References devices.

Referenced by AvrDevice::AvrDevice().

◆ Reset()

void DumpManager::Reset ( void  )
static

Reset DumpManager instance (e.g. delete available instance)

Definition at line 573 of file traceval.cpp.

◆ save()

void DumpManager::save ( std::ostream &  os) const

Write a list of all tracing value names into the given output stream.

Definition at line 709 of file traceval.cpp.

References TraceValue::barename(), devices, TraceValue::index(), and DumpVCD::tv.

◆ seekValueByName()

TraceValue * DumpManager::seekValueByName ( const std::string &  name)
private

Seek value by name in all devices.

Definition at line 617 of file traceval.cpp.

References devices.

◆ SetSingleDeviceApp()

void DumpManager::SetSingleDeviceApp ( void  )

Tell DumpManager, that we have only one device.

In normal simulavr application we have only one device aka processor. But it's possible to make a simulation with 2 or more devices together. For that, we have to assign a unique name for every device to identify a device and to get a unique namespace in trace output.

This method has to be called before the device instance will be created in single device application! Default is multi device application.

Definition at line 635 of file traceval.cpp.

References avr_error, and devices.

◆ start()

void DumpManager::start ( )

Start processing on all dumpers. They will be stopped when stopApplication method will be called or the dump manager gets destroyed.

Definition at line 680 of file traceval.cpp.

References DumpVCD::start().

Referenced by avr_dump_start_tf().

◆ stopApplication()

void DumpManager::stopApplication ( void  )

Stop processing on all dumpers and removes it from dumpers list.

Definition at line 701 of file traceval.cpp.

Referenced by avr_dump_stop_tf(), RWExit::get(), RWAbort::get(), RWExit::set(), and RWAbort::set().

◆ unregisterAvrDevice()

void DumpManager::unregisterAvrDevice ( AvrDevice dev)
private

Remove a device from devicelist.

Definition at line 598 of file traceval.cpp.

References devices.

Friends And Related Function Documentation

◆ AvrDevice

friend class AvrDevice
friend

Definition at line 402 of file traceval.h.

◆ TraceValueRegister

friend class TraceValueRegister
friend

Definition at line 401 of file traceval.h.

Member Data Documentation

◆ _all

TraceSet DumpManager::_all
private

Set of all traceable values (placeholder instance for all() method)

Definition at line 428 of file traceval.h.

◆ _devidx

int DumpManager::_devidx = 0
staticprivate

Definition at line 436 of file traceval.h.

Referenced by DumpVCD::~DumpVCD().

◆ _instance

DumpManager * DumpManager::_instance = NULL
staticprivate

Definition at line 437 of file traceval.h.

Referenced by DumpVCD::~DumpVCD().

◆ active

TraceSet DumpManager::active
private

Set of active tracing values.

Definition at line 426 of file traceval.h.

◆ devices

std::vector<AvrDevice*> DumpManager::devices
private

Device list.

Definition at line 434 of file traceval.h.

◆ dumps

std::vector<Dumper*> DumpManager::dumps
private

All dumpers, which we want to use.

Definition at line 431 of file traceval.h.

◆ singleDeviceApp

bool DumpManager::singleDeviceApp
private

Flag, if we use only one device, e.g. assign no device name.

Definition at line 423 of file traceval.h.


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