Skip to content
Snippets Groups Projects
Commit 3e5a1d45 authored by Emily Anne Thompson's avatar Emily Anne Thompson
Browse files

Remove unnecessary includes, move all default criticals to header files

parent 39057fc8
No related branches found
No related tags found
1 merge request!303[WIP] Interlock update
Pipeline #6463807 failed
...@@ -62,7 +62,7 @@ void GPIBNICom::setConfiguration(const nlohmann::json &config) { ...@@ -62,7 +62,7 @@ void GPIBNICom::setConfiguration(const nlohmann::json &config) {
} }
} }
} }
void GPIBNICom::send(char *buf, size_t length, bool critical = false) { void GPIBNICom::send(char *buf, size_t length, bool critical) {
checkInterlock(critical); checkInterlock(critical);
if (!m_good) if (!m_good)
throw std::runtime_error( throw std::runtime_error(
...@@ -77,7 +77,7 @@ void GPIBNICom::send(char *buf, size_t length, bool critical = false) { ...@@ -77,7 +77,7 @@ void GPIBNICom::send(char *buf, size_t length, bool critical = false) {
throw std::runtime_error("GPIBNICom::send error from ibwrt"); throw std::runtime_error("GPIBNICom::send error from ibwrt");
} }
} }
void GPIBNICom::send(const std::string &buf, bool critical = false) { void GPIBNICom::send(const std::string &buf, bool critical) {
checkInterlock(critical); checkInterlock(critical);
char *mybuf = new char[buf.length()]; char *mybuf = new char[buf.length()];
strcpy(mybuf, buf.c_str()); strcpy(mybuf, buf.c_str());
...@@ -120,14 +120,14 @@ uint32_t GPIBNICom::receive(char *buf, size_t length) { ...@@ -120,14 +120,14 @@ uint32_t GPIBNICom::receive(char *buf, size_t length) {
} }
return retval; return retval;
} }
std::string GPIBNICom::sendreceive(const std::string &cmd, bool critical = false) { std::string GPIBNICom::sendreceive(const std::string &cmd, bool critical) {
ScopeLock lock(this); ScopeLock lock(this);
send(cmd, critical); send(cmd, critical);
return receive(); return receive();
} }
void GPIBNICom::sendreceive(char *wbuf, size_t wlength, char *rbuf, void GPIBNICom::sendreceive(char *wbuf, size_t wlength, char *rbuf,
size_t rlength, bool critical = false) { size_t rlength, bool critical) {
ScopeLock lock(this); ScopeLock lock(this);
send(wbuf, wlength, critical); send(wbuf, wlength, critical);
......
...@@ -60,7 +60,7 @@ class GPIBNICom : public ICom { ...@@ -60,7 +60,7 @@ class GPIBNICom : public ICom {
* \param length Number of characters in `buf` that should be sent * \param length Number of characters in `buf` that should be sent
* \param critical Interlock flag, true if interlock is monitoring the command * \param critical Interlock flag, true if interlock is monitoring the command
*/ */
void send(char *buf, size_t length, bool critical); void send(char *buf, size_t length, bool critical = false);
/** Send data to device /** Send data to device
* *
...@@ -69,7 +69,7 @@ class GPIBNICom : public ICom { ...@@ -69,7 +69,7 @@ class GPIBNICom : public ICom {
* \param buf Data to be sent * \param buf Data to be sent
* \param critical Interlock flag, true if interlock is monitoring the command * \param critical Interlock flag, true if interlock is monitoring the command
*/ */
void send(const std::string &buf, bool critical); void send(const std::string &buf, bool critical = false);
/** Read data from device /** Read data from device
* *
...@@ -99,7 +99,7 @@ class GPIBNICom : public ICom { ...@@ -99,7 +99,7 @@ class GPIBNICom : public ICom {
* *
* \return Returned data * \return Returned data
*/ */
std::string sendreceive(const std::string &cmd, bool critical); std::string sendreceive(const std::string &cmd, bool critical = false);
/** Send data to device and receive reply /** Send data to device and receive reply
* *
...@@ -113,7 +113,7 @@ class GPIBNICom : public ICom { ...@@ -113,7 +113,7 @@ class GPIBNICom : public ICom {
* *
* \return Number of characters received * \return Number of characters received
*/ */
void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength, bool critical); void sendreceive(char *wbuf, size_t wlength, char *rbuf, size_t rlength, bool critical = false);
protected: protected:
/** Request exlusive access to device. /** Request exlusive access to device.
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
#include <netdb.h> //hostent #include <netdb.h> //hostent
#include <netinet/tcp.h> // linux extension: socket options (timeout) #include <netinet/tcp.h> // linux extension: socket options (timeout)
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
// Register com // Register com
#include "ComRegistry.h" #include "ComRegistry.h"
...@@ -156,13 +154,13 @@ void LXICom::init() { ...@@ -156,13 +154,13 @@ void LXICom::init() {
m_good = true; m_good = true;
} }
void LXICom::send(const std::string &buf, bool critical = false) { void LXICom::send(const std::string &buf, bool critical) {
checkInterlock(critical); checkInterlock(critical);
logger(logDEBUG) << "LXICom::send " << buf; logger(logDEBUG) << "LXICom::send " << buf;
tcp_send(buf.c_str()); tcp_send(buf.c_str());
} }
void LXICom::send(char *buf, size_t length, bool critical = false) { void LXICom::send(char *buf, size_t length, bool critical) {
checkInterlock(critical); checkInterlock(critical);
send(std::string(buf, length), critical); send(std::string(buf, length), critical);
} }
...@@ -186,7 +184,7 @@ uint32_t LXICom::receive(char *buf, size_t length) { ...@@ -186,7 +184,7 @@ uint32_t LXICom::receive(char *buf, size_t length) {
return (received.size() < length ? received.size() : length); return (received.size() < length ? received.size() : length);
} }
std::string LXICom::sendreceive(const std::string &cmd, bool critical = false) { std::string LXICom::sendreceive(const std::string &cmd, bool critical) {
send(cmd, critical); send(cmd, critical);
std::string ret = receive(); std::string ret = receive();
...@@ -194,7 +192,7 @@ std::string LXICom::sendreceive(const std::string &cmd, bool critical = false) { ...@@ -194,7 +192,7 @@ std::string LXICom::sendreceive(const std::string &cmd, bool critical = false) {
} }
void LXICom::sendreceive(char *wbuf, size_t wlength, char *rbuf, void LXICom::sendreceive(char *wbuf, size_t wlength, char *rbuf,
size_t rlength, bool critical = false) { size_t rlength, bool critical) {
send(wbuf, wlength, critical); send(wbuf, wlength, critical);
receive(rbuf, rlength); receive(rbuf, rlength);
} }
......
...@@ -57,7 +57,7 @@ class LXICom : public ICom { ...@@ -57,7 +57,7 @@ class LXICom : public ICom {
* \param length Number of characters in `buf` that should be sent * \param length Number of characters in `buf` that should be sent
* \param critical Interlock flag, true if interlock is monitoring the command * \param critical Interlock flag, true if interlock is monitoring the command
*/ */
virtual void send(char* buf, size_t length, bool critical); virtual void send(char* buf, size_t length, bool critical = false);
/** Send data to device /** Send data to device
* *
...@@ -66,7 +66,7 @@ class LXICom : public ICom { ...@@ -66,7 +66,7 @@ class LXICom : public ICom {
* \param buf Data to be sent * \param buf Data to be sent
* \param critical Interlock flag, true if interlock is monitoring the command * \param critical Interlock flag, true if interlock is monitoring the command
*/ */
virtual void send(const std::string& buf, bool critical); virtual void send(const std::string& buf, bool critical = false);
/** Read data from device /** Read data from device
* *
...@@ -96,7 +96,7 @@ class LXICom : public ICom { ...@@ -96,7 +96,7 @@ class LXICom : public ICom {
* *
* \return Returned data * \return Returned data
*/ */
virtual std::string sendreceive(const std::string& cmd, bool critical); virtual std::string sendreceive(const std::string& cmd, bool critical = false);
/** Write data to device and receive reply /** Write data to device and receive reply
* *
...@@ -111,7 +111,7 @@ class LXICom : public ICom { ...@@ -111,7 +111,7 @@ class LXICom : public ICom {
* \return Number of characters received * \return Number of characters received
*/ */
virtual void sendreceive(char* wbuf, size_t wlength, char* rbuf, virtual void sendreceive(char* wbuf, size_t wlength, char* rbuf,
size_t rlength, bool critical); size_t rlength, bool critical = false);
/** Locking is not supported! /** Locking is not supported!
* *
......
...@@ -7,14 +7,6 @@ ...@@ -7,14 +7,6 @@
#include "ScopeLock.h" #include "ScopeLock.h"
#include "StringUtils.h" #include "StringUtils.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/file.h>
#include <iostream>
// Register power supply // Register power supply
#include "PowerSupplyRegistry.h" #include "PowerSupplyRegistry.h"
REGISTER_POWERSUPPLY(SCPIPs) REGISTER_POWERSUPPLY(SCPIPs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment