Skip to content
Snippets Groups Projects
Commit 5507b047 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Merge branch 'arrange-factories' into 'devel'

Arrange factories

See merge request !316
parents c875c92f a16a55f8
No related branches found
No related tags found
1 merge request!316Arrange factories
Pipeline #4243 failed
...@@ -314,26 +314,6 @@ namespace wolf ...@@ -314,26 +314,6 @@ namespace wolf
// Some specializations // Some specializations
//====================== //======================
// Intrinsics
struct IntrinsicsBase;
typedef Factory<IntrinsicsBase,
const std::string&> IntrinsicsFactory;
template<>
inline std::string IntrinsicsFactory::getClass()
{
return "IntrinsicsFactory";
}
// ProcessorParams
struct ProcessorParamsBase;
typedef Factory<ProcessorParamsBase,
const std::string&> ProcessorParamsFactory;
template<>
inline std::string ProcessorParamsFactory::getClass()
{
return "ProcessorParamsFactory";
}
// Landmarks from YAML // Landmarks from YAML
class LandmarkBase; class LandmarkBase;
typedef Factory<LandmarkBase, typedef Factory<LandmarkBase,
...@@ -344,20 +324,6 @@ inline std::string LandmarkFactory::getClass() ...@@ -344,20 +324,6 @@ inline std::string LandmarkFactory::getClass()
return "LandmarkFactory"; return "LandmarkFactory";
} }
// Frames
class TimeStamp;
} // namespace wolf
#include "core/frame/frame_base.h"
namespace wolf{
typedef Factory<FrameBase, const FrameType&, const TimeStamp&, const Eigen::VectorXs&> FrameFactory;
template<>
inline std::string FrameFactory::getClass()
{
return "FrameFactory";
}
//#define UNUSED(x) (void)x;
//#define UNUSED(x) (void)(sizeof((x), 0));
#ifdef __GNUC__ #ifdef __GNUC__
#define WOLF_UNUSED __attribute__((used)) #define WOLF_UNUSED __attribute__((used))
...@@ -372,10 +338,6 @@ inline std::string FrameFactory::getClass() ...@@ -372,10 +338,6 @@ inline std::string FrameFactory::getClass()
# define UNUSED(x) x # define UNUSED(x) x
#endif #endif
#define WOLF_REGISTER_FRAME(FrameType, FrameName) \
namespace{ const bool WOLF_UNUSED FrameName##Registered = \
wolf::FrameFactory::get().registerCreator(FrameType, FrameName::create); }\
} /* namespace wolf */ } /* namespace wolf */
#endif /* FACTORY_H_ */ #endif /* FACTORY_H_ */
...@@ -165,6 +165,17 @@ namespace wolf ...@@ -165,6 +165,17 @@ namespace wolf
* You can also check the code in the example file ````src/examples/test_wolf_factories.cpp````. * You can also check the code in the example file ````src/examples/test_wolf_factories.cpp````.
*/ */
// ProcessorParams factory
struct ProcessorParamsBase;
typedef Factory<ProcessorParamsBase,
const std::string&> ProcessorParamsFactory;
template<>
inline std::string ProcessorParamsFactory::getClass()
{
return "ProcessorParamsFactory";
}
// Processor factory
typedef Factory<ProcessorBase, typedef Factory<ProcessorBase,
const std::string&, const std::string&,
const ProcessorParamsBasePtr> ProcessorFactory; const ProcessorParamsBasePtr> ProcessorFactory;
......
...@@ -16,6 +16,7 @@ struct IntrinsicsBase; ...@@ -16,6 +16,7 @@ struct IntrinsicsBase;
// wolf // wolf
#include "core/common/factory.h" #include "core/common/factory.h"
#include "core/utils/params_server.hpp"
namespace wolf namespace wolf
{ {
...@@ -208,6 +209,17 @@ namespace wolf ...@@ -208,6 +209,17 @@ namespace wolf
* You can also check the code in the example file ````src/examples/test_wolf_factories.cpp````. * You can also check the code in the example file ````src/examples/test_wolf_factories.cpp````.
*/ */
// Intrinsics factory
struct IntrinsicsBase;
typedef Factory<IntrinsicsBase,
const std::string&> IntrinsicsFactory;
template<>
inline std::string IntrinsicsFactory::getClass()
{
return "IntrinsicsFactory";
}
// Sensor factory
typedef Factory<SensorBase, typedef Factory<SensorBase,
const std::string&, const std::string&,
const Eigen::VectorXs&, const IntrinsicsBasePtr> SensorFactory; const Eigen::VectorXs&, const IntrinsicsBasePtr> SensorFactory;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "core/factor/factor_base.h" #include "core/factor/factor_base.h"
#include "core/map/map_base.h" #include "core/map/map_base.h"
#include "core/state_block/state_block.h" #include "core/state_block/state_block.h"
#include "core/state_block/state_angle.h"
#include "core/state_block/state_quaternion.h" #include "core/state_block/state_quaternion.h"
#include "core/common/factory.h" #include "core/common/factory.h"
#include "core/yaml/yaml_conversion.h" #include "core/yaml/yaml_conversion.h"
...@@ -217,7 +218,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node) ...@@ -217,7 +218,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node)
if (ori.size() == 4) if (ori.size() == 4)
ori_sb = std::make_shared<StateQuaternion>(ori, ori_fixed); ori_sb = std::make_shared<StateQuaternion>(ori, ori_fixed);
else else
ori_sb = std::make_shared<StateBlock>(ori, ori_fixed); ori_sb = std::make_shared<StateAngle>(ori(0), ori_fixed);
} }
LandmarkBasePtr lmk = std::make_shared<LandmarkBase>("BASE", pos_sb, ori_sb); LandmarkBasePtr lmk = std::make_shared<LandmarkBase>("BASE", pos_sb, ori_sb);
...@@ -229,7 +230,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node) ...@@ -229,7 +230,7 @@ LandmarkBasePtr LandmarkBase::create(const YAML::Node& _node)
// Register landmark creator // Register landmark creator
namespace namespace
{ {
const bool WOLF_UNUSED registered_lmk_ahp = LandmarkFactory::get().registerCreator("BASE", LandmarkBase::create); const bool WOLF_UNUSED registered_lmk_base = LandmarkFactory::get().registerCreator("BASE", LandmarkBase::create);
} }
} // namespace wolf } // namespace wolf
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment