KiCad PCB EDA Suite
PNS::LOGGER Class Reference

#include <pns_logger.h>

Classes

struct  EVENT_ENTRY
 

Public Types

enum  EVENT_TYPE {
  EVT_START_ROUTE = 0 , EVT_START_DRAG , EVT_FIX , EVT_MOVE ,
  EVT_ABORT , EVT_TOGGLE_VIA , EVT_UNFIX
}
 

Public Member Functions

 LOGGER ()
 
 ~LOGGER ()
 
void Save (const std::string &aFilename)
 
void Clear ()
 
void Log (EVENT_TYPE evt, const VECTOR2I &pos=VECTOR2I(), const ITEM *item=nullptr, const SIZES_SETTINGS *sizes=nullptr)
 
const std::vector< EVENT_ENTRY > & GetEvents ()
 

Private Attributes

std::vector< EVENT_ENTRYm_events
 

Detailed Description

Definition at line 42 of file pns_logger.h.

Member Enumeration Documentation

◆ EVENT_TYPE

Enumerator
EVT_START_ROUTE 
EVT_START_DRAG 
EVT_FIX 
EVT_MOVE 
EVT_ABORT 
EVT_TOGGLE_VIA 
EVT_UNFIX 

Definition at line 46 of file pns_logger.h.

Constructor & Destructor Documentation

◆ LOGGER()

PNS::LOGGER::LOGGER ( )

Definition at line 30 of file pns_logger.cpp.

31{
32}

◆ ~LOGGER()

PNS::LOGGER::~LOGGER ( )

Definition at line 35 of file pns_logger.cpp.

36{
37}

Member Function Documentation

◆ Clear()

void PNS::LOGGER::Clear ( )

Definition at line 40 of file pns_logger.cpp.

41{
42 m_events.clear();
43}
std::vector< EVENT_ENTRY > m_events
Definition: pns_logger.h:76

References m_events.

Referenced by PNS::SHOVE::ShoveLines(), PNS::SHOVE::ShoveMultiLines(), PNS::ROUTER::StartDragging(), and PNS::ROUTER::StartRouting().

◆ GetEvents()

const std::vector< EVENT_ENTRY > & PNS::LOGGER::GetEvents ( )
inline

Definition at line 70 of file pns_logger.h.

71 {
72 return m_events;
73 }

References m_events.

◆ Log()

void PNS::LOGGER::Log ( LOGGER::EVENT_TYPE  evt,
const VECTOR2I pos = VECTOR2I(),
const ITEM item = nullptr,
const SIZES_SETTINGS sizes = nullptr 
)

Definition at line 64 of file pns_logger.cpp.

65{
66 LOGGER::EVENT_ENTRY ent;
67
68 ent.type = evt;
69 ent.p = pos;
70 ent.uuid = KIID(0);
71
72 if( sizes )
73 {
74 ent.sizes = *sizes;
75 }
76
77 if( item && item->Parent() )
78 ent.uuid = item->Parent()->m_Uuid;
79
80 m_events.push_back( ent );
81}
Definition: kiid.h:48

References m_events, EDA_ITEM::m_Uuid, PNS::LOGGER::EVENT_ENTRY::p, PNS::ITEM::Parent(), PNS::LOGGER::EVENT_ENTRY::sizes, PNS::LOGGER::EVENT_ENTRY::type, and PNS::LOGGER::EVENT_ENTRY::uuid.

Referenced by PNS::ROUTER::FixRoute(), PNS::ROUTER::Move(), PNS::SHOVE::onReverseCollidingVia(), PNS::ROUTER::StartDragging(), PNS::ROUTER::StartRouting(), PNS::ROUTER::ToggleViaPlacement(), and PNS::ROUTER::UndoLastSegment().

◆ Save()

void PNS::LOGGER::Save ( const std::string &  aFilename)

Definition at line 46 of file pns_logger.cpp.

47{
48 FILE* f = fopen( aFilename.c_str(), "wb" );
49
50 wxLogTrace( wxT( "PNS" ), wxT( "Saving to '%s' [%p]" ), aFilename.c_str(), f );
51
52 for( const EVENT_ENTRY& evt : m_events )
53 {
54 uint64_t id = 0;
55
56 fprintf( f, "event %d %d %d %s\n", evt.type, evt.p.x, evt.p.y,
57 static_cast<const char*>( evt.uuid.AsString().c_str() ) );
58 }
59
60 fclose( f );
61}

References m_events.

Member Data Documentation

◆ m_events

std::vector<EVENT_ENTRY> PNS::LOGGER::m_events
private

Definition at line 76 of file pns_logger.h.

Referenced by Clear(), GetEvents(), Log(), and Save().


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