Skip to content

Commit

Permalink
Change kernel creation macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
abellgithub committed Mar 8, 2018
1 parent 3b2a14a commit 934c853
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 74 deletions.
8 changes: 5 additions & 3 deletions filters/StreamCallbackFilter.cpp
Expand Up @@ -37,11 +37,13 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo(
static StaticPluginInfo const s_info
{
"filters.streamcallback",
"Provide a hook for a simple point-by-point callback.",
"" );
""
};

CREATE_STATIC_PLUGIN(1, 0, StreamCallbackFilter, Filter, s_info)
CREATE_STATIC_STAGE(StreamCallbackFilter, s_info)

} // namespace pdal
10 changes: 7 additions & 3 deletions kernels/DeltaKernel.cpp
Expand Up @@ -39,10 +39,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.delta", "Delta Kernel",
"http://www.pdal.io/apps/delta.html");
static StaticPluginInfo const s_info
{
"kernels.delta",
"Delta Kernel",
"http://www.pdal.io/apps/delta.html"
};

CREATE_STATIC_PLUGIN(1, 0, DeltaKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(DeltaKernel, s_info)

std::string DeltaKernel::getName() const { return s_info.name; }

Expand Down
10 changes: 7 additions & 3 deletions kernels/DiffKernel.cpp
Expand Up @@ -43,10 +43,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.diff", "Diff Kernel",
"http://www.pdal.io/apps/diff.html" );
static StaticPluginInfo const s_info
{
"kernels.diff",
"Diff Kernel",
"http://www.pdal.io/apps/diff.html"
};

CREATE_STATIC_PLUGIN(1, 0, DiffKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(DiffKernel, s_info)

std::string DiffKernel::getName() const { return s_info.name; }

Expand Down
10 changes: 7 additions & 3 deletions kernels/GroundKernel.cpp
Expand Up @@ -48,10 +48,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.ground", "Ground Kernel",
"http://pdal.io/apps/ground.html");
static StaticPluginInfo const s_info
{
"kernels.ground",
"Ground Kernel",
"http://pdal.io/apps/ground.html"
};

CREATE_STATIC_PLUGIN(1, 0, GroundKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(GroundKernel, s_info)

std::string GroundKernel::getName() const
{
Expand Down
10 changes: 7 additions & 3 deletions kernels/HausdorffKernel.cpp
Expand Up @@ -43,10 +43,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.hausdorff",
"Hausdorff Kernel", "http://pdal.io/apps/hausdorff.html");
static StaticPluginInfo const s_info
{
"kernels.hausdorff",
"Hausdorff Kernel",
"http://pdal.io/apps/hausdorff.html"
};

CREATE_STATIC_PLUGIN(1, 0, HausdorffKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(HausdorffKernel, s_info)

std::string HausdorffKernel::getName() const
{
Expand Down
10 changes: 7 additions & 3 deletions kernels/InfoKernel.cpp
Expand Up @@ -48,10 +48,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.info", "Info Kernel",
"http://pdal.io/apps/info.html" );
static StaticPluginInfo const s_info
{
"kernels.info",
"Info Kernel",
"http://pdal.io/apps/info.html"
};

CREATE_STATIC_PLUGIN(1, 0, InfoKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(InfoKernel, s_info)

std::string InfoKernel::getName() const { return s_info.name; }

Expand Down
10 changes: 7 additions & 3 deletions kernels/MergeKernel.cpp
Expand Up @@ -40,10 +40,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.merge", "Merge Kernel",
"http://pdal.io/apps/merge.html" );
static StaticPluginInfo const s_info
{
"kernels.merge",
"Merge Kernel",
"http://pdal.io/apps/merge.html"
};

CREATE_STATIC_PLUGIN(1, 0, MergeKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(MergeKernel, s_info)

std::string MergeKernel::getName() const
{
Expand Down
10 changes: 7 additions & 3 deletions kernels/PipelineKernel.cpp
Expand Up @@ -44,10 +44,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.pipeline",
"Pipeline Kernel", "http://pdal.io/apps/pipeline.html" );
static StaticPluginInfo const s_info
{
"kernels.pipeline",
"Pipeline Kernel",
"http://pdal.io/apps/pipeline.html"
};

CREATE_STATIC_PLUGIN(1, 0, PipelineKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(PipelineKernel, s_info)

std::string PipelineKernel::getName() const { return s_info.name; }

Expand Down
10 changes: 7 additions & 3 deletions kernels/RandomKernel.cpp
Expand Up @@ -37,10 +37,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.random", "Random Kernel",
"http://pdal.io/apps/random.html" );
static StaticPluginInfo const s_info
{
"kernels.random",
"Random Kernel",
"http://pdal.io/apps/random.html"
};

CREATE_STATIC_PLUGIN(1, 0, RandomKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(RandomKernel, s_info)

std::string RandomKernel::getName() const { return s_info.name; }

Expand Down
10 changes: 7 additions & 3 deletions kernels/SortKernel.cpp
Expand Up @@ -37,10 +37,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.sort", "Sort Kernel",
"http://pdal.io/apps/sort.html" );
static StaticPluginInfo const s_info
{
"kernels.sort",
"Sort Kernel",
"http://pdal.io/apps/sort.html"
};

CREATE_STATIC_PLUGIN(1, 0, SortKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(SortKernel, s_info)

std::string SortKernel::getName() const
{
Expand Down
10 changes: 7 additions & 3 deletions kernels/SplitKernel.cpp
Expand Up @@ -40,10 +40,14 @@
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.split", "Split Kernel",
"http://pdal.io/apps/split.html" );
static StaticPluginInfo const s_info
{
"kernels.split",
"Split Kernel",
"http://pdal.io/apps/split.html"
};

CREATE_STATIC_PLUGIN(1, 0, SplitKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(SplitKernel, s_info)

std::string SplitKernel::getName() const
{
Expand Down
10 changes: 7 additions & 3 deletions kernels/TIndexKernel.cpp
Expand Up @@ -62,10 +62,14 @@ void setDate(OGRFeatureH feature, const tm& tyme, int fieldNumber)
namespace pdal
{

static PluginInfo const s_info = PluginInfo("kernels.tindex", "TIndex Kernel",
"http://pdal.io/apps/tindex.html" );
static StaticPluginInfo const s_info
{
"kernels.tindex",
"TIndex Kernel",
"http://pdal.io/apps/tindex.html"
};

CREATE_STATIC_PLUGIN(1, 0, TIndexKernel, Kernel, s_info)
CREATE_STATIC_KERNEL(TIndexKernel, s_info)

std::string TIndexKernel::getName() const { return s_info.name; }

Expand Down
22 changes: 12 additions & 10 deletions kernels/TranslateKernel.cpp
Expand Up @@ -52,16 +52,18 @@
namespace pdal
{

static PluginInfo const s_info =
PluginInfo("kernels.translate",
"The Translate kernel allows users to construct a pipeline " \
"consisting of a reader, a writer, and N filter stages. " \
"Any supported stage type can be specified from the command " \
"line, reducing the need to create custom kernels for every " \
"combination.",
"http://pdal.io/apps/translate.html");

CREATE_STATIC_PLUGIN(1, 0, TranslateKernel, Kernel, s_info)
static StaticPluginInfo const s_info
{
"kernels.translate",
"The Translate kernel allows users to construct a pipeline " \
"consisting of a reader, a writer, and N filter stages. " \
"Any supported stage type can be specified from the command " \
"line, reducing the need to create custom kernels for every " \
"combination.",
"http://pdal.io/apps/translate.html"
};

CREATE_STATIC_KERNEL(TranslateKernel, s_info)

std::string TranslateKernel::getName() const
{
Expand Down
6 changes: 6 additions & 0 deletions pdal/PluginHelper.hpp
Expand Up @@ -92,6 +92,7 @@ typedef void (*PF_InitFunc)();
pdal::PluginManager<pdal::Kernel>::registerPlugin<T>(info); \
}

/**
#define CREATE_STATIC_PLUGIN(version_major, version_minor, T, type, info) \
extern "C" PDAL_DLL void T ## _InitPlugin() \
{ \
Expand All @@ -101,6 +102,11 @@ typedef void (*PF_InitFunc)();
else \
pdal::PluginManager<pdal::Kernel>::registerPlugin<T>(info); \
}
**/

#define CREATE_STATIC_KERNEL(T, info) \
static bool T ## _b = \
pdal::PluginManager<pdal::Kernel>::registerPlugin<T>(info);

#define CREATE_STATIC_STAGE(T, info) \
static bool T ## _b = \
Expand Down
28 changes: 0 additions & 28 deletions pdal/StageFactory.cpp
Expand Up @@ -36,22 +36,8 @@
#include <pdal/PluginManager.hpp>
#include <pdal/util/FileUtils.hpp>

#include <kernels/DeltaKernel.hpp>
#include <kernels/DiffKernel.hpp>
#include <kernels/GroundKernel.hpp>
#include <kernels/HausdorffKernel.hpp>
#include <kernels/InfoKernel.hpp>
#include <kernels/MergeKernel.hpp>
#include <kernels/PipelineKernel.hpp>
#include <kernels/RandomKernel.hpp>
#include <kernels/SortKernel.hpp>
#include <kernels/SplitKernel.hpp>
#include <kernels/TIndexKernel.hpp>
#include <kernels/TranslateKernel.hpp>

#include <sstream>
#include <string>
//#include <stdio.h> // for funcptr

namespace pdal
{
Expand Down Expand Up @@ -147,20 +133,6 @@ std::string StageFactory::inferWriterDriver(const std::string& filename)
StageFactory::StageFactory(bool ignored)
{
(void)ignored;

// kernels
DeltaKernel_InitPlugin();
DiffKernel_InitPlugin();
GroundKernel_InitPlugin();
HausdorffKernel_InitPlugin();
InfoKernel_InitPlugin();
MergeKernel_InitPlugin();
PipelineKernel_InitPlugin();
RandomKernel_InitPlugin();
SortKernel_InitPlugin();
SplitKernel_InitPlugin();
TIndexKernel_InitPlugin();
TranslateKernel_InitPlugin();
}


Expand Down

0 comments on commit 934c853

Please sign in to comment.