Skip to content

Commit

Permalink
Code reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
MatejBartosovic committed Feb 15, 2019
1 parent 81be1c9 commit 9cb1aef
Show file tree
Hide file tree
Showing 10 changed files with 397 additions and 281 deletions.
25 changes: 16 additions & 9 deletions include/phoxi_camera/PhoXiConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,30 @@
#include <PhoXi.h>
#include <phoxi_camera/PhoXiDeviceInformation.h>

void toPhoXiCameraDeviceInforamtion(const pho::api::PhoXiDeviceInformation& phoXiDeviceInformation,phoxi_camera::PhoXiDeviceInformation &phoXiCameraDeviceInformation){
void toPhoXiCameraDeviceInforamtion(const pho::api::PhoXiDeviceInformation& phoXiDeviceInformation,
phoxi_camera::PhoXiDeviceInformation& phoXiCameraDeviceInformation) {
phoXiCameraDeviceInformation.name = phoXiDeviceInformation.Name;
phoXiCameraDeviceInformation.type = phoxi_camera::PhoXiDeviceInformation::PhoXiDeviceType((int)phoXiDeviceInformation.Type);
phoXiCameraDeviceInformation.type = phoxi_camera::PhoXiDeviceInformation::PhoXiDeviceType(
(int)phoXiDeviceInformation.Type);
phoXiCameraDeviceInformation.hwIdentification = phoXiDeviceInformation.HWIdentification;
if (phoXiDeviceInformation.Status.Ready == true ){
phoXiCameraDeviceInformation.status = phoXiDeviceInformation.Status.Ready ? phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Ready : phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Starting;
}
else{
phoXiCameraDeviceInformation.status = phoXiDeviceInformation.Status.Attached ? phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Ready : phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Occupied;
if (phoXiDeviceInformation.Status.Ready == true) {
phoXiCameraDeviceInformation.status = phoXiDeviceInformation.Status.Ready
? phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Ready
: phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Starting;
} else {
phoXiCameraDeviceInformation.status = phoXiDeviceInformation.Status.Attached
? phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Ready
: phoxi_camera::PhoXiDeviceInformation::PhoXiConnectionStatus::Occupied;
}
phoXiCameraDeviceInformation.firmwareVersion = phoXiDeviceInformation.FirmwareVersion;
}
void toPhoXiCameraDeviceInforamtion(const std::vector<pho::api::PhoXiDeviceInformation>& phoXiDeviceInformation,std::vector<phoxi_camera::PhoXiDeviceInformation> &phoXiCameraDeviceInformation){

void toPhoXiCameraDeviceInforamtion(const std::vector<pho::api::PhoXiDeviceInformation>& phoXiDeviceInformation,
std::vector<phoxi_camera::PhoXiDeviceInformation>& phoXiCameraDeviceInformation) {
phoXiCameraDeviceInformation.clear();
phoXiCameraDeviceInformation.resize(phoXiDeviceInformation.size());
for (int i = 0; i < phoXiDeviceInformation.size(); ++i) {
toPhoXiCameraDeviceInforamtion(phoXiDeviceInformation[i],phoXiCameraDeviceInformation[i]);
toPhoXiCameraDeviceInforamtion(phoXiDeviceInformation[i], phoXiCameraDeviceInformation[i]);
}
}

Expand Down
14 changes: 9 additions & 5 deletions include/phoxi_camera/PhoXiDeviceInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,36 @@

#include <string>

namespace phoxi_camera{
namespace phoxi_camera {
class PhoXiInterface;

class PhoXiDeviceInformation {
public:
friend PhoXiInterface;
enum PhoXiConnectionStatus{
enum PhoXiConnectionStatus {
Unknown = 0,
Ready = 1,
Occupied = 2,
Starting = 3
};
enum PhoXiDeviceType{
enum PhoXiDeviceType {
PhoXiScanner,
PhoXiCamera, //future camera support
NoValue
};

operator std::string() const {
return hwIdentification;
}
bool operator==(const PhoXiDeviceInformation & other){

bool operator==(const PhoXiDeviceInformation& other) {
return hwIdentification == other.hwIdentification;
}
bool operator==(const std::string & hwIdentification){

bool operator==(const std::string& hwIdentification) {
return this->hwIdentification == hwIdentification;
}

std::string name;
PhoXiDeviceType type;
std::string hwIdentification;
Expand Down
41 changes: 22 additions & 19 deletions include/phoxi_camera/PhoXiException.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,54 @@
#define PROJECT_PHOXIEXCEPTION_H

#include <exception>
namespace phoxi_camera{

namespace phoxi_camera {
class PhoXiInterfaceException : public std::exception {
public:
PhoXiInterfaceException(std::string message) : message(message){
PhoXiInterfaceException(std::string message) : message(message) {
}
virtual const char* what() const throw()
{

virtual const char* what() const throw() {
return message.c_str();
}

private:
std::string message;
};

class PhoXiControlNotRunning : public PhoXiInterfaceException {
public:
PhoXiControlNotRunning(std::string message) : PhoXiInterfaceException(message){
PhoXiControlNotRunning(std::string message) : PhoXiInterfaceException(message) {
}
};

class PhoXiScannerNotFound : public PhoXiInterfaceException {
public:
PhoXiScannerNotFound(std::string message) : PhoXiInterfaceException(message){
PhoXiScannerNotFound(std::string message) : PhoXiInterfaceException(message) {
}
};

class UnableToConnect : public PhoXiInterfaceException {
public:
UnableToConnect(std::string message) : PhoXiInterfaceException(message){
UnableToConnect(std::string message) : PhoXiInterfaceException(message) {
}
};

class UnableToStartAcquisition : public PhoXiInterfaceException {
public:
UnableToStartAcquisition(std::string message) : PhoXiInterfaceException(message){
UnableToStartAcquisition(std::string message) : PhoXiInterfaceException(message) {
}
};

class UnableToStopAcquisition : public PhoXiInterfaceException {
public:
UnableToStopAcquisition(std::string message) : PhoXiInterfaceException(message){
UnableToStopAcquisition(std::string message) : PhoXiInterfaceException(message) {
}
};

class CorruptedFrame : public PhoXiInterfaceException {
public:
CorruptedFrame(std::string message) : PhoXiInterfaceException(message){
CorruptedFrame(std::string message) : PhoXiInterfaceException(message) {
}
};

Expand All @@ -61,27 +64,27 @@ namespace phoxi_camera{
};


class PhoXiScannerNotConnected : public PhoXiInterfaceException {
class PhoXiScannerNotConnected : public PhoXiInterfaceException {
public:
PhoXiScannerNotConnected(std::string message) : PhoXiInterfaceException(message){
PhoXiScannerNotConnected(std::string message) : PhoXiInterfaceException(message) {
}
};

class CoordinateSpaceNotSupported : public PhoXiInterfaceException {
public:
CoordinateSpaceNotSupported(std::string message) : PhoXiInterfaceException(message){
class CoordinateSpaceNotSupported : public PhoXiInterfaceException {
public:
CoordinateSpaceNotSupported(std::string message) : PhoXiInterfaceException(message) {
}
};

class InvalidTransformationMatrix : public PhoXiInterfaceException {
class InvalidTransformationMatrix : public PhoXiInterfaceException {
public:
InvalidTransformationMatrix(std::string message) : PhoXiInterfaceException(message){
InvalidTransformationMatrix(std::string message) : PhoXiInterfaceException(message) {
}
};

class InvalidTriggerMode : public PhoXiInterfaceException {
class InvalidTriggerMode : public PhoXiInterfaceException {
public:
InvalidTriggerMode(std::string message) : PhoXiInterfaceException(message){
InvalidTriggerMode(std::string message) : PhoXiInterfaceException(message) {
}
};
}
Expand Down
Loading

0 comments on commit 9cb1aef

Please sign in to comment.