Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 5779248eefe7
Choose a base ref
...
head repository: ngscopeclient/scopehal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 004e30c708ee
Choose a head ref
  • 3 commits
  • 18 files changed
  • 1 contributor

Commits on Oct 12, 2020

  1. Copy the full SHA
    70efbe2 View commit details
  2. Various cleanup and refactoring of constructors. Converted several st…

    …ring arguments to const references.
    azonenberg committed Oct 12, 2020
    Copy the full SHA
    990f027 View commit details
  3. SCPITransport: constructor and SendCommand arguments are now const re…

    …ferences. Fixes #306 and some static analysis warnings.
    azonenberg committed Oct 12, 2020
    Copy the full SHA
    004e30c View commit details
2 changes: 1 addition & 1 deletion graphwidget
Submodule graphwidget updated 2 files
+19 −2 Graph.cpp
+2 −21 Graph.h
6 changes: 1 addition & 5 deletions scopehal/FilterParameter.h
Original file line number Diff line number Diff line change
@@ -50,11 +50,7 @@ class FilterParameter
TYPE_STRING //arbitrary string
};

FilterParameter()
: m_unit(Unit::UNIT_PS)
{}

FilterParameter(ParameterTypes type, Unit unit);
FilterParameter(ParameterTypes type = FilterParameter::TYPE_FLOAT, Unit unit = Unit(Unit::UNIT_PS));

void ParseString(std::string str);
std::string ToString();
7 changes: 6 additions & 1 deletion scopehal/IBISParser.h
Original file line number Diff line number Diff line change
@@ -121,9 +121,14 @@ class VTCurves
class IBISModel
{
public:
IBISModel(std::string name)
IBISModel(const std::string& name)
: m_type(TYPE_IO)
, m_name(name)
, m_vil{0}
, m_vih{0}
, m_temps{0}
, m_voltages{0}
, m_dieCapacitance{0}
{}

//Model type
4 changes: 2 additions & 2 deletions scopehal/SCPILxiTransport.cpp
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ using namespace std;

bool SCPILxiTransport::m_lxi_initialized = false;

SCPILxiTransport::SCPILxiTransport(string args)
SCPILxiTransport::SCPILxiTransport(const string& args)
{
if (!m_lxi_initialized)
{
@@ -132,7 +132,7 @@ string SCPILxiTransport::GetConnectionString()
return string(tmp);
}

bool SCPILxiTransport::SendCommand(string cmd)
bool SCPILxiTransport::SendCommand(const string& cmd)
{
LogTrace("Sending %s\n", cmd.c_str());

4 changes: 2 additions & 2 deletions scopehal/SCPILxiTransport.h
Original file line number Diff line number Diff line change
@@ -44,13 +44,13 @@
class SCPILxiTransport : public SCPITransport
{
public:
SCPILxiTransport(std::string args);
SCPILxiTransport(const std::string& args);
virtual ~SCPILxiTransport();

virtual std::string GetConnectionString();
static std::string GetTransportName();

virtual bool SendCommand(std::string cmd);
virtual bool SendCommand(const std::string& cmd);
virtual std::string ReadReply(bool endOnSemicolon = true);
virtual void ReadRawData(size_t len, unsigned char* buf);
virtual void SendRawData(size_t len, const unsigned char* buf);
4 changes: 2 additions & 2 deletions scopehal/SCPINullTransport.cpp
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

SCPINullTransport::SCPINullTransport(string args)
SCPINullTransport::SCPINullTransport(const string& args)
: m_args(args)
{
}
@@ -74,7 +74,7 @@ string SCPINullTransport::GetConnectionString()
return m_args;
}

bool SCPINullTransport::SendCommand(string /*cmd*/)
bool SCPINullTransport::SendCommand(const string& /*cmd*/)
{
return true;
}
4 changes: 2 additions & 2 deletions scopehal/SCPINullTransport.h
Original file line number Diff line number Diff line change
@@ -42,13 +42,13 @@
class SCPINullTransport : public SCPITransport
{
public:
SCPINullTransport(std::string args);
SCPINullTransport(const std::string& args);
virtual ~SCPINullTransport();

virtual std::string GetConnectionString();
static std::string GetTransportName();

virtual bool SendCommand(std::string cmd);
virtual bool SendCommand(const std::string& cmd);
virtual std::string ReadReply(bool endOnSemicolon = true);
virtual void ReadRawData(size_t len, unsigned char* buf);
virtual void SendRawData(size_t len, const unsigned char* buf);
4 changes: 2 additions & 2 deletions scopehal/SCPISocketTransport.cpp
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

SCPISocketTransport::SCPISocketTransport(string args)
SCPISocketTransport::SCPISocketTransport(const string& args)
: m_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
{
char hostname[128];
@@ -101,7 +101,7 @@ string SCPISocketTransport::GetConnectionString()
return string(tmp);
}

bool SCPISocketTransport::SendCommand(string cmd)
bool SCPISocketTransport::SendCommand(const string& cmd)
{
LogTrace("Sending %s\n", cmd.c_str());
string tempbuf = cmd + "\n";
6 changes: 3 additions & 3 deletions scopehal/SCPISocketTransport.h
Original file line number Diff line number Diff line change
@@ -44,13 +44,13 @@
class SCPISocketTransport : public SCPITransport
{
public:
SCPISocketTransport(std::string args);
SCPISocketTransport(const std::string& args);
virtual ~SCPISocketTransport();

virtual std::string GetConnectionString();
static std::string GetTransportName();

virtual bool SendCommand(std::string cmd);
virtual bool SendCommand(const std::string& cmd);
virtual std::string ReadReply(bool endOnSemicolon = true);
virtual void ReadRawData(size_t len, unsigned char* buf);
virtual void SendRawData(size_t len, const unsigned char* buf);
@@ -60,7 +60,7 @@ class SCPISocketTransport : public SCPITransport

TRANSPORT_INITPROC(SCPISocketTransport)

std::string GetHostname()
const std::string& GetHostname()
{ return m_hostname; }

protected:
4 changes: 2 additions & 2 deletions scopehal/SCPITMCTransport.cpp
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

SCPITMCTransport::SCPITMCTransport(string args)
SCPITMCTransport::SCPITMCTransport(const string& args)
{
// TODO: add configuration options:
// - set the maximum request size of usbtmc read requests (currently 2032)
@@ -103,7 +103,7 @@ string SCPITMCTransport::GetConnectionString()
return m_devicePath;
}

bool SCPITMCTransport::SendCommand(string cmd)
bool SCPITMCTransport::SendCommand(const string& cmd)
{
if (!IsConnected())
return false;
6 changes: 3 additions & 3 deletions scopehal/SCPITMCTransport.h
Original file line number Diff line number Diff line change
@@ -42,13 +42,13 @@
class SCPITMCTransport : public SCPITransport
{
public:
SCPITMCTransport(std::string args);
SCPITMCTransport(const std::string& args);
virtual ~SCPITMCTransport();

virtual std::string GetConnectionString();
static std::string GetTransportName();

virtual bool SendCommand(std::string cmd);
virtual bool SendCommand(const std::string& cmd);
virtual std::string ReadReply(bool endOnSemicolon = true);
virtual void ReadRawData(size_t len, unsigned char* buf);
virtual void SendRawData(size_t len, const unsigned char* buf);
@@ -58,7 +58,7 @@ class SCPITMCTransport : public SCPITransport

TRANSPORT_INITPROC(SCPITMCTransport)

std::string GetDevicePath()
const std::string& GetDevicePath()
{ return m_devicePath; }

protected:
2 changes: 1 addition & 1 deletion scopehal/SCPITransport.cpp
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ void SCPITransport::EnumTransports(vector<string>& names)
names.push_back(it->first);
}

SCPITransport* SCPITransport::CreateTransport(string transport, string args)
SCPITransport* SCPITransport::CreateTransport(const string& transport, const string& args)
{
if(m_createprocs.find(transport) != m_createprocs.end())
return m_createprocs[transport](args);
4 changes: 2 additions & 2 deletions scopehal/SCPITransport.h
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ class SCPITransport
virtual std::string GetConnectionString() =0;
virtual std::string GetName() =0;

virtual bool SendCommand(std::string cmd) =0;
virtual bool SendCommand(const std::string& cmd) =0;
virtual std::string ReadReply(bool endOnSemicolon = true) =0;
virtual void ReadRawData(size_t len, unsigned char* buf) =0;
virtual void SendRawData(size_t len, const unsigned char* buf) =0;
@@ -61,7 +61,7 @@ class SCPITransport
static void DoAddTransportClass(std::string name, CreateProcType proc);

static void EnumTransports(std::vector<std::string>& names);
static SCPITransport* CreateTransport(std::string transport, std::string args);
static SCPITransport* CreateTransport(const std::string& transport, const std::string& args);

protected:
//Class enumeration
4 changes: 2 additions & 2 deletions scopehal/SCPIUARTTransport.cpp
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

SCPIUARTTransport::SCPIUARTTransport(string args)
SCPIUARTTransport::SCPIUARTTransport(const string& args)
{
char devfile[128];
unsigned int baudrate = 0;
@@ -90,7 +90,7 @@ string SCPIUARTTransport::GetConnectionString()
return string(tmp);
}

bool SCPIUARTTransport::SendCommand(string cmd)
bool SCPIUARTTransport::SendCommand(const string& cmd)
{
LogTrace("Sending %s\n", cmd.c_str());
string tempbuf = cmd + "\n";
4 changes: 2 additions & 2 deletions scopehal/SCPIUARTTransport.h
Original file line number Diff line number Diff line change
@@ -44,13 +44,13 @@
class SCPIUARTTransport : public SCPITransport
{
public:
SCPIUARTTransport(std::string args);
SCPIUARTTransport(const std::string& args);
virtual ~SCPIUARTTransport();

virtual std::string GetConnectionString();
static std::string GetTransportName();

virtual bool SendCommand(std::string cmd);
virtual bool SendCommand(const std::string& cmd);
virtual std::string ReadReply(bool endOnSemicolon = true);
virtual void ReadRawData(size_t len, unsigned char* buf);
virtual void SendRawData(size_t len, const unsigned char* buf);
4 changes: 2 additions & 2 deletions scopehal/VICPSocketTransport.cpp
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Construction / destruction

VICPSocketTransport::VICPSocketTransport(string args)
VICPSocketTransport::VICPSocketTransport(const string& args)
: m_nextSequence(1)
, m_lastSequence(1)
, m_socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)
@@ -116,7 +116,7 @@ uint8_t VICPSocketTransport::GetNextSequenceNumber()
return m_lastSequence;
}

bool VICPSocketTransport::SendCommand(string cmd)
bool VICPSocketTransport::SendCommand(const string& cmd)
{
//Operation and flags header
string payload;
4 changes: 2 additions & 2 deletions scopehal/VICPSocketTransport.h
Original file line number Diff line number Diff line change
@@ -46,13 +46,13 @@
class VICPSocketTransport : public SCPITransport
{
public:
VICPSocketTransport(std::string args);
VICPSocketTransport(const std::string& args);
virtual ~VICPSocketTransport();

virtual std::string GetConnectionString();
static std::string GetTransportName();

virtual bool SendCommand(std::string cmd);
virtual bool SendCommand(const std::string& cmd);
virtual std::string ReadReply(bool endOnSemicolon = true);
virtual void ReadRawData(size_t len, unsigned char* buf);
virtual void SendRawData(size_t len, const unsigned char* buf);
10 changes: 5 additions & 5 deletions scopehal/Waveform.h
Original file line number Diff line number Diff line change
@@ -80,11 +80,11 @@ class WaveformBase
{
public:
WaveformBase()
{
m_triggerPhase = 0;
m_startTimestamp = 0;
m_startPicoseconds = 0;
}
: m_timescale(0)
, m_startTimestamp(0)
, m_startPicoseconds(0)
, m_triggerPhase(0)
{}

//empty virtual destructor in case any derived classes need one
virtual ~WaveformBase()