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
}
 

Public Member Functions

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

Private Attributes

std::vector< EVENT_ENTRYm_events
 

Detailed Description

Definition at line 39 of file pns_logger.h.

Member Enumeration Documentation

◆ EVENT_TYPE

Enumerator
EVT_START_ROUTE 
EVT_START_DRAG 
EVT_FIX 
EVT_MOVE 
EVT_ABORT 

Definition at line 43 of file pns_logger.h.

Constructor & Destructor Documentation

◆ LOGGER()

PNS::LOGGER::LOGGER ( )

Definition at line 37 of file pns_logger.cpp.

38 {
39 }

◆ ~LOGGER()

PNS::LOGGER::~LOGGER ( )

Definition at line 42 of file pns_logger.cpp.

43 {
44 }

Member Function Documentation

◆ Clear()

void PNS::LOGGER::Clear ( )

Definition at line 47 of file pns_logger.cpp.

48 {
49  m_events.clear();
50 }
std::vector< EVENT_ENTRY > m_events
Definition: pns_logger.h:70

References m_events.

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

◆ GetEvents()

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

Definition at line 64 of file pns_logger.h.

65  {
66  return m_events;
67  }
std::vector< EVENT_ENTRY > m_events
Definition: pns_logger.h:70

References m_events.

◆ Log()

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

◆ Save()

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

Definition at line 53 of file pns_logger.cpp.

54 {
55  FILE* f = fopen( aFilename.c_str(), "wb" );
56 
57  wxLogTrace( "PNS", "Saving to '%s' [%p]", aFilename.c_str(), f );
58 
59  for( const auto evt : m_events )
60  {
61  uint64_t id = 0;
62  if( evt.item && evt.item->Parent() )
63  {
64  const char* idString = evt.item->Parent()->m_Uuid.AsString().c_str();
65  fprintf( f, "event %d %d %d %s\n", evt.type, evt.p.x, evt.p.y, idString );
66  }
67  }
68 
69  fclose( f );
70 }
std::vector< EVENT_ENTRY > m_events
Definition: pns_logger.h:70

References m_events.

Member Data Documentation

◆ m_events

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

Definition at line 70 of file pns_logger.h.

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


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