Skip to content

Commit

Permalink
Remove use of yarp::os::IConfig interface (#923)
Browse files Browse the repository at this point in the history
  • Loading branch information
traversaro authored Dec 19, 2023
1 parent e15dd6f commit 5b8b9e1
Show file tree
Hide file tree
Showing 28 changed files with 44 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class DatasetRecorder : public IMachineLearner {
virtual void readBottle(yarp::os::Bottle& bot);

/*
* Inherited from IConfig.
* Inherited from IMachineLearner.
*/
virtual bool configure(yarp::os::Searchable& config);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FixedRangeScaler : public IScaler {
virtual std::string getInfo();

/*
* Inherited from IConfig.
* Inherited from IScaler.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class IFixedSizeLearner : public IMachineLearner {
virtual std::string getConfigHelp();

/*
* Inherited from IConfig.
* Inherited from IMachineLearner.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class IFixedSizeTransformer : public ITransformer {
virtual std::string getConfigHelp();

/*
* Inherited from IConfig.
* Inherited from ITransformer.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <sstream>

#include <yarp/sig/Vector.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Portable.h>
#include <yarp/os/Bottle.h>
#include <yarp/os/Value.h>
Expand Down Expand Up @@ -86,7 +85,7 @@ namespace learningmachine {
*
*/

class IMachineLearner : public yarp::os::IConfig, public yarp::os::Portable {
class IMachineLearner : public yarp::os::Portable {
protected:
/**
* The name of this type of machine learner.
Expand Down Expand Up @@ -122,6 +121,22 @@ class IMachineLearner : public yarp::os::IConfig, public yarp::os::Portable {
*/
virtual ~IMachineLearner() { }


/**
* Initialize the object.
*/
virtual bool open(yarp::os::Searchable& config) {return true;}

/**
* Shut the object down.
*/
virtual bool close() {return true;}

/**
* Change parameters.
*/
virtual bool configure(yarp::os::Searchable& config) {return false;}

/**
* Provide the learning machine with an example of the desired mapping.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include <string>

#include <yarp/os/IConfig.h>
#include <yarp/os/Bottle.h>

namespace iCub {
namespace learningmachine {
Expand All @@ -38,7 +38,7 @@ namespace learningmachine {
*
*/

class IScaler : public yarp::os::IConfig {
class IScaler {
protected:
/**
* The offset for the linear transformation.
Expand Down Expand Up @@ -175,7 +175,7 @@ class IScaler : public yarp::os::IConfig {
virtual bool fromString(const std::string& str);

/*
* Inherited from IConfig.
* Configure.
*/
virtual bool configure(yarp::os::Searchable& config);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <sstream>
#include <string>

#include <yarp/os/IConfig.h>
#include <yarp/os/Portable.h>
#include <yarp/os/Bottle.h>
#include <yarp/sig/Vector.h>
Expand Down Expand Up @@ -55,7 +54,7 @@ namespace learningmachine {
*
*/

class ITransformer : public yarp::os::IConfig, public yarp::os::Portable {
class ITransformer : public yarp::os::Portable {
protected:
/**
* The name of this type of transformer.
Expand Down Expand Up @@ -164,7 +163,7 @@ class ITransformer : public yarp::os::IConfig, public yarp::os::Portable {
virtual ITransformer* clone() = 0;

/*
* Inherited from IConfig.
* Configure.
*/
virtual bool configure(yarp::os::Searchable& config) { return true; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <vector>
#include <sstream>

#include <yarp/os/IConfig.h>
#include <yarp/sig/Matrix.h>

#include "iCub/learningMachine/IFixedSizeLearner.h"
Expand All @@ -31,7 +30,7 @@
namespace iCub {
namespace learningmachine {

class Kernel : public yarp::os::IConfig {
class Kernel {
private:
std::string name;
public:
Expand Down Expand Up @@ -77,7 +76,7 @@ class RBFKernel : public Kernel {
}

/*
* Inherited from IConfig.
* Inherited from Kernel.
*/
virtual bool configure(yarp::os::Searchable& config) {
bool success = false;
Expand Down Expand Up @@ -237,7 +236,7 @@ class LSSVMLearner : public IFixedSizeLearner {
void setCoDomainSize(unsigned int size);

/*
* Inherited from IConfig.
* Inherited from IMachineLearner.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class LinearGPRLearner : public IFixedSizeLearner {
double getSigma();

/*
* Inherited from IConfig.
* Inherited from IMachineLearner.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class LinearScaler : public IScaler {
virtual std::string getInfo();

/*
* Inherited from IConfig.
* Inherited from IScaler.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Normalizer : public IScaler {
virtual std::string getInfo();

/*
* Inherited from IConfig.
* Inherited from IScaler.
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class RLSLearner : public IFixedSizeLearner {
double getLambda();

/*
* Inherited from IConfig.
* Inherited from IMachineLearner.
*/
virtual bool configure(yarp::os::Searchable& config);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class RandomFeature : public IFixedSizeTransformer {
virtual void reset();

/*
* Inherited from IConfig.
* Inherited from ITransformer.
*/
virtual bool configure(yarp::os::Searchable &config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class ScaleTransformer : public IFixedSizeTransformer {
virtual void reset();

/*
* Inherited from IConfig.
* Inherited from ITransformer.
*/
virtual bool configure(yarp::os::Searchable &config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SparseSpectrumFeature : public IFixedSizeTransformer {
virtual void reset();

/*
* Inherited from IConfig.
* Inherited from ITransformer.
*/
virtual bool configure(yarp::os::Searchable &config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Standardizer : public IScaler {
virtual std::string getInfo();

/*
* Inherited from IConfig
* Inherited from IScaler
*/
virtual bool configure(yarp::os::Searchable& config);

Expand Down
5 changes: 1 addition & 4 deletions src/modules/camCalib/include/iCub/ICalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@

// yarp
#include <yarp/sig/Image.h>
#include <yarp/os/IConfig.h>

/**
* Interface to calibrate and project input image based on camera's internal parameters and projection mode\n
*/
class ICalibTool : public yarp::os::IConfig
class ICalibTool
{

public:

// IConfig
virtual bool open (yarp::os::Searchable &config) = 0;
virtual bool close () = 0;
virtual bool configure (yarp::os::Searchable &config) = 0;
Expand Down
1 change: 0 additions & 1 deletion src/modules/camCalib/include/iCub/PinholeCalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// yarp
//#include <yarp/sig/Image.h>
#include <yarp/sig/all.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Bottle.h>
#include <yarp/os/Value.h>

Expand Down
2 changes: 0 additions & 2 deletions src/modules/camCalib/include/iCub/SphericalCalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// yarp
//#include <yarp/sig/Image.h>
#include <yarp/sig/all.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Value.h>

// opencv
Expand Down Expand Up @@ -56,7 +55,6 @@ class SphericalCalibTool : public ICalibTool
SphericalCalibTool();
virtual ~SphericalCalibTool();

// IConfig
virtual bool open (yarp::os::Searchable &config);
virtual bool close();
virtual bool configure (yarp::os::Searchable &config);
Expand Down
5 changes: 1 addition & 4 deletions src/modules/camCalibWithPose/include/iCub/ICalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@

// yarp
#include <yarp/sig/Image.h>
#include <yarp/os/IConfig.h>

/**
* Interface to calibrate and project input image based on camera's internal parameters and projection mode\n
*/
class ICalibTool : public yarp::os::IConfig
class ICalibTool
{

public:

// IConfig
virtual bool open (yarp::os::Searchable &config) = 0;
virtual bool close () = 0;
virtual bool configure (yarp::os::Searchable &config) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// yarp
//#include <yarp/sig/Image.h>
#include <yarp/sig/all.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Bottle.h>
#include <yarp/os/Value.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// yarp
//#include <yarp/sig/Image.h>
#include <yarp/sig/all.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Value.h>

// opencv
Expand Down Expand Up @@ -56,7 +55,6 @@ class SphericalCalibTool : public ICalibTool
SphericalCalibTool();
virtual ~SphericalCalibTool();

// IConfig
virtual bool open (yarp::os::Searchable &config);
virtual bool close();
virtual bool configure (yarp::os::Searchable &config);
Expand Down
5 changes: 1 addition & 4 deletions src/modules/dualCamCalib/include/iCub/ICalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,14 @@

// yarp
#include <yarp/sig/Image.h>
#include <yarp/os/IConfig.h>

/**
* Interface to calibrate and project input image based on camera's internal parameters and projection mode\n
*/
class ICalibTool : public yarp::os::IConfig
class ICalibTool
{

public:

// IConfig
virtual bool open (yarp::os::Searchable &config) = 0;
virtual bool close () = 0;
virtual bool configure (yarp::os::Searchable &config) = 0;
Expand Down
1 change: 0 additions & 1 deletion src/modules/dualCamCalib/include/iCub/PinholeCalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
// yarp
//#include <yarp/sig/Image.h>
#include <yarp/sig/all.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Bottle.h>
#include <yarp/os/Value.h>

Expand Down
2 changes: 0 additions & 2 deletions src/modules/dualCamCalib/include/iCub/SphericalCalibTool.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// yarp
//#include <yarp/sig/Image.h>
#include <yarp/sig/all.h>
#include <yarp/os/IConfig.h>
#include <yarp/os/Value.h>

// opencv
Expand Down Expand Up @@ -56,7 +55,6 @@ class SphericalCalibTool : public ICalibTool
SphericalCalibTool();
virtual ~SphericalCalibTool();

// IConfig
virtual bool open (yarp::os::Searchable &config);
virtual bool close();
virtual bool configure (yarp::os::Searchable &config);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/learningMachine/QUICKSTART
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ A better strategy is to interface with the desired subtype indirectly using the
abstract base classes. In this case, configuration cannot be done directly
using member functions, as each subtype will have different configurable
parameters and thus different functions. Instead, configuration is done by
sending Property instances to the configure method (cf. the YARP IConfig class).
sending Property instances to the configure method.
This strategy already guarantees that changing to another subtype only involves
a reasonably small amount of changes in your program. Changing to another
subtype will, however, require a recompilation of the program. Further, features
Expand Down
Loading

0 comments on commit 5b8b9e1

Please sign in to comment.