Skip to content
Snippets Groups Projects
Commit 0cd67865 authored by Max Breitenfeldt's avatar Max Breitenfeldt
Browse files

Remove unused classes

Some classes are never instantiated:

- null_Model
- null_Controller
- TrackedComponentFactory
- StringHelper
parent c86e4ef5
No related branches found
No related tags found
No related merge requests found
...@@ -12,17 +12,13 @@ add_behavior_plugin(${target} ...@@ -12,17 +12,13 @@ add_behavior_plugin(${target}
"BioTrackerPlugin.cpp" "BioTrackerPlugin.cpp"
"View/TrackedElementView.cpp" "View/TrackedElementView.cpp"
"View/TrackerParameterView.cpp" "View/TrackerParameterView.cpp"
"Model/null_Model.cpp"
"Model/BioTrackerTrackingAlgorithm.cpp" "Model/BioTrackerTrackingAlgorithm.cpp"
"Model/TrackerParameter.cpp" "Model/TrackerParameter.cpp"
"Model/TrackedComponents/TrackedComponentFactory.cpp"
"Model/TrackedComponents/TrackedElement.cpp" "Model/TrackedComponents/TrackedElement.cpp"
"Model/TrackedComponents/TrackedTrajectory.cpp" "Model/TrackedComponents/TrackedTrajectory.cpp"
"Model/TrackedComponents/pose/FishPose.cpp" "Model/TrackedComponents/pose/FishPose.cpp"
"helper/StringHelper.cpp"
"Controller/ControllerTrackedComponent.cpp" "Controller/ControllerTrackedComponent.cpp"
"Controller/ControllerTrackingAlgorithm.cpp" "Controller/ControllerTrackingAlgorithm.cpp"
"Controller/null_Controller.cpp"
) )
install(TARGETS ${target} OPTIONAL DESTINATION .) install(TARGETS ${target} OPTIONAL DESTINATION .)
......
#include "null_Controller.h"
null_Controller::null_Controller()
{
}
void null_Controller::createModel()
{
}
void null_Controller::createView()
{
}
void null_Controller::connectModelToController()
{
}
void null_Controller::connectControllerToController()
{
}
#ifndef NULL_CONTROLLER_H
#define NULL_CONTROLLER_H
#include "Interfaces/IController/IController.h"
class null_Controller : public IController
{
public:
null_Controller();
// IController interface
protected:
void createModel() override;
void createView() override;
void connectModelToController() override;
void connectControllerToController() override;
};
#endif // NULL_CONTROLLER_H
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "BioTrackerTrackingAlgorithm.h" #include "BioTrackerTrackingAlgorithm.h"
#include <future> #include <future>
#include "TrackedComponents/TrackedComponentFactory.h"
#include "TrackedComponents/pose/FishPose.h" #include "TrackedComponents/pose/FishPose.h"
#include <chrono> #include <chrono>
#include <zmq.hpp> #include <zmq.hpp>
......
#include "TrackedComponentFactory.h"
#include "TrackedTrajectory.h"
#include "TrackedElement.h"
namespace BST{
TrackedComponentFactory::TrackedComponentFactory()
{
}
TrackedComponentFactory::~TrackedComponentFactory()
{
}
QList<QString> TrackedComponentFactory::getElementTypes() {
return QList<QString>{ "TrackedElement" };
}
IModelTrackedComponent *TrackedComponentFactory::createTrackedElement(QString name)
{
return new BST::TrackedElement(this, "n.a.");
}
IModelTrackedComponent *TrackedComponentFactory::createTrackedObject(QString name)
{
BST::TrackedTrajectory *t = new BST::TrackedTrajectory();
BST::TrackedElement *e = new BST::TrackedElement(this, "n.a.", 0);
t->add(e, 0);
return t;
}
IModelTrackedComponent *TrackedComponentFactory::createTrackedTrajectory(QString name)
{
return new BST::TrackedTrajectory();
}
}
#pragma once
#include "Interfaces/IModel/IModelTrackedComponentFactory.h"
namespace BST{
class TrackedComponentFactory : public IModelTrackedComponentFactory
{
Q_OBJECT
public:
TrackedComponentFactory();
~TrackedComponentFactory();
QList<QString> getElementTypes() override;
// ITrackedComponentFactory interface
protected:
IModelTrackedComponent *createTrackedElement(QString name) override;
IModelTrackedComponent *createTrackedObject(QString name) override;
IModelTrackedComponent *createTrackedTrajectory(QString name) override;
};
}
#include "null_Model.h"
null_Model::null_Model()
{
}
#ifndef NULL_MODEL_H
#define NULL_MODEL_H
#include "Interfaces/IModel/IModel.h"
class null_Model : public IModel
{
Q_OBJECT
public:
null_Model();
};
#endif // NULL_MODEL_H
#include "StringHelper.h"
#include <algorithm>
#include <string>
bool StringHelper::hasEnding(std::string const &fullString, std::string const &ending)
{
if (fullString.length() >= ending.length())
return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));
else
return false;
}
bool StringHelper::startsWithDigit(std::string const &fullString)
{
if(fullString.empty())
return false;
if(isdigit(fullString.at(0)))
{
return true;
}
return false;
}
bool StringHelper::startsWithDigitQ(QString fullString)
{
return StringHelper::startsWithDigit(fullString.toLocal8Bit().data());
}
bool StringHelper::isNumber(QString fullStringQ)
{
std::string fullString = fullStringQ.toLocal8Bit().data();
for(int i = 0; i < fullString.length(); i++)
{
if(isdigit(fullString.at(i)))
{
return true;
}
}
return false;
}
std::string StringHelper::iToSS(int int_num)
{
return QString::number(int_num).toUtf8().constData();
}
std::string StringHelper::boolToSS(bool bool_value)
{
if(bool_value)
return std::string("true");
return std::string("false");
}
std::string StringHelper::fToSS(float float_num)
{
return QString::number(float_num).toUtf8().constData();
}
std::string StringHelper::toStdString(QString qString)
{
return qString.toUtf8().constData();
}
QString StringHelper::toQString(std::string stdString)
{
return QString::fromUtf8(stdString.c_str());
}
std::string StringHelper::toLowerCase(std::string stringValue)
{
std::string lowCaseString(stringValue);
std::transform(lowCaseString.begin(), lowCaseString.end(), lowCaseString.begin(), tolower);
return lowCaseString;
}
int StringHelper::split(std::string &txt, std::vector<std::string> &strs, char ch)
{
std::string::size_type pos = txt.find( ch );
std::string::size_type initialPos = 0;
strs.clear();
// Decompose statement
while( pos != std::string::npos ) {
strs.push_back( txt.substr( initialPos, pos - initialPos ) );
initialPos = pos + 1;
pos = txt.find( ch, initialPos );
}
// Add the last one
strs.push_back(txt.substr(initialPos, std::min(pos, txt.size()) - initialPos + 1));
return strs.size();
}
\ No newline at end of file
#pragma once
#include <iostream>
#include <vector>
#include <QString>
/**
* String handling helper class
*/
class StringHelper
{
public:
StringHelper(void) {}
~StringHelper(void) {}
/**
* This method is used to check whether the full string contains the provided ending.
* @param: fullString, the specifies the string which needs to be checked.
* @param: ending, string specifes the ending string.
* @return: true if ending string is at the end of fullString, otherwise false
*/
static bool hasEnding(std::string const &fullString, std::string const &ending);
static bool startsWithDigitQ(QString fullString);
static bool startsWithDigit(std::string const &fullString);
static bool isNumber(QString fullString);
/**
* Convert QString to standard string.
* @param: qString, the string to convert,
* @return: a standard string.
*/
static std::string toStdString(QString qString);
/**
* Convert standard string to QString
* @param: stdString, the string to convert,
* @return: a qt string.
*/
static QString toQString(std::string stdString);
/**
* Convert integer to standard string.
* @param: int_num, integer number to convert,
* @return: a standard string.
*/
static std::string iToSS(int int_num);
/**
* Convert a bool to standard string.
* @param: bool_value, bool valueto convert,
* @return: a standard string.
*/
static std::string boolToSS(bool bool_value);
/**
* Convert float to standard string.
* @param: float_num, float number to convert,
* @return: a standard string.
*/
static std::string fToSS(float float_num);
/**
* Convert a given string to lower case string.
* @param: stringValue, string to convert,
* @return: a standard string.
*/
static std::string toLowerCase(std::string stringValue);
/**
* Use from here: http://stackoverflow.com/questions/5888022/split-string-by-single-spaces
* Method to split a string by a given character.
* @param: txt, a reference to the string, which will be split,
* @param: strs, a reference to a vector containing the splitted result,
* @param: ch, the split character.
**/
static int split(std::string &txt, std::vector<std::string> &strs, char ch);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment