Skip to content

Commit 82efc7d

Browse files
committed
Export module
1 parent 6f6da53 commit 82efc7d

File tree

9 files changed

+404
-2
lines changed

9 files changed

+404
-2
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2017 Annotator Team
2+
#ifndef ANNOTATOR_ANNOTATORLIB_EXPORT_H
3+
#define ANNOTATOR_ANNOTATORLIB_EXPORT_H
4+
5+
/************************************************************
6+
Export class header
7+
************************************************************/
8+
9+
#include <memory>
10+
#include <string>
11+
12+
#include <AnnotatorLib/AnnotatorLibDatastructs.h>
13+
#include <AnnotatorLib/Image.h>
14+
#include <AnnotatorLib/annotatorlib_api.h>
15+
16+
namespace AnnotatorLib {
17+
namespace Export {
18+
/************************************************************/
19+
20+
class ANNOTATORLIB_API AbstractExport {
21+
public:
22+
/**
23+
*
24+
* @return type
25+
*/
26+
virtual std::string getType() = 0;
27+
28+
virtual std::string getPath() = 0;
29+
30+
virtual bool equals(std::shared_ptr<AbstractExport> other) = 0;
31+
32+
virtual ~AbstractExport() {}
33+
};
34+
/************************************************************/
35+
/* External declarations (package visibility) */
36+
/************************************************************/
37+
38+
/* Inline functions */
39+
40+
} // of namespace Export
41+
} // of namespace AnnotatorLib
42+
43+
/************************************************************
44+
End of ImageSet class header
45+
************************************************************/
46+
47+
#endif
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Copyright 2017 Annotator Team
2+
#ifndef ANNOTATOR_ANNOTATORLIB_EXPORTANNOTATIONIMAGES_H
3+
#define ANNOTATOR_ANNOTATORLIB_EXPORTANNOTATIONIMAGES_H
4+
5+
/************************************************************
6+
ExportAnnotationImages class header
7+
************************************************************/
8+
9+
#include <AnnotatorLib/AnnotatorLibDatastructs.h>
10+
#include <AnnotatorLib/Export/AbstractExport.h>
11+
#include <AnnotatorLib/annotatorlib_api.h>
12+
13+
#include <string>
14+
#include <vector>
15+
16+
#include <boost/filesystem.hpp>
17+
18+
namespace AnnotatorLib {
19+
namespace Export {
20+
/************************************************************/
21+
/**
22+
*
23+
*/
24+
class ANNOTATORLIB_API ExportAnnotationImages : public AbstractExport {
25+
public:
26+
ExportAnnotationImages(std::string path);
27+
28+
/**
29+
*
30+
* @return type
31+
*/
32+
virtual std::string getType() override;
33+
34+
virtual std::string getPath() override;
35+
36+
virtual bool equals(std::shared_ptr<AbstractExport> other) override;
37+
38+
protected:
39+
40+
std::string path;
41+
42+
long position = 0;
43+
std::vector<boost::filesystem::path> images;
44+
std::vector<boost::filesystem::path>::const_iterator imgIter;
45+
};
46+
/************************************************************/
47+
/* External declarations (package visibility) */
48+
/************************************************************/
49+
50+
/* Inline functions */
51+
} // of namespace Export
52+
} // of namespace AnnotatorLib
53+
54+
/************************************************************
55+
End of ExportAnnotationImages class header
56+
************************************************************/
57+
58+
#endif
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Copyright 2016 Annotator Team
2+
#ifndef ANNOTATOR_ANNOTATORLIB_EXPORTFACTORY_H
3+
#define ANNOTATOR_ANNOTATORLIB_EXPORTFACTORY_H
4+
5+
/************************************************************
6+
ImageSetFactory class header
7+
************************************************************/
8+
9+
#include <list>
10+
#include <map>
11+
#include <memory>
12+
13+
#include <AnnotatorLib/AnnotatorLibDatastructs.h>
14+
#include <AnnotatorLib/Export/AbstractExport.h>
15+
#include <AnnotatorLib/Export/ExportPlugin.h>
16+
#include <AnnotatorLib/annotatorlib_api.h>
17+
18+
namespace AnnotatorLib {
19+
namespace Export {
20+
21+
/************************************************************/
22+
/**
23+
*
24+
*/
25+
class ANNOTATORLIB_API ExportFactory {
26+
public:
27+
/**
28+
*
29+
* @param type
30+
* @return imageSet
31+
*/
32+
std::shared_ptr<AbstractExport> createExport(std::string type,
33+
std::string path);
34+
35+
std::list<std::string> availableImageSets();
36+
37+
/**
38+
* @brief loadPlugins
39+
* @param dir the path to plugins
40+
*/
41+
void loadPlugins(std::string dir);
42+
43+
/**
44+
* @brief instance
45+
* @return singleton for StorageFactory
46+
*/
47+
static ExportFactory* instance();
48+
49+
~ExportFactory();
50+
51+
protected:
52+
void addAvailableExport(ExportPlugin* plugin);
53+
54+
private:
55+
ExportFactory() {}
56+
std::list<std::string> _availableExports{"annotationimages"};
57+
std::map<std::string, std::shared_ptr<ExportPlugin>> plugins;
58+
};
59+
/************************************************************/
60+
/* External declarations (package visibility) */
61+
/************************************************************/
62+
63+
/* Inline functions */
64+
65+
} // of namespace Export
66+
} // of namespace AnnotatorLib
67+
68+
/************************************************************
69+
End of ImageSetFactory class header
70+
************************************************************/
71+
72+
#endif
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Copyright 2017 Annotator Team
2+
#pragma once
3+
4+
#include <memory>
5+
#include <string>
6+
7+
#include <AnnotatorLib/Export/AbstractExport.h>
8+
#include <AnnotatorLib/annotatorlib_api.h>
9+
10+
namespace AnnotatorLib {
11+
namespace Export {
12+
13+
/**
14+
* @brief The StoragePlugin class
15+
* Base Class for storage plugins.
16+
*/
17+
class ANNOTATORLIB_API ExportPlugin {
18+
public:
19+
ExportPlugin() {}
20+
virtual ~ExportPlugin() {}
21+
22+
/**
23+
* @brief name
24+
* @return name of the imageset plugin
25+
*/
26+
virtual const std::string name() = 0;
27+
28+
/**
29+
* @brief description
30+
* @return description for the imageset plugin
31+
*/
32+
virtual const std::string description() = 0;
33+
34+
/**
35+
* @brief createLoader
36+
* @return new instance of loader
37+
*/
38+
virtual std::shared_ptr<AnnotatorLib::Export::AbstractExport> create(
39+
std::string path) = 0;
40+
};
41+
}
42+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright 2017 Annotator Team
2+
#ifndef PKG_ANNOTATOR_ANNOTATORLIB_EXPORT
3+
#define PKG_ANNOTATOR_ANNOTATORLIB_EXPORT
4+
5+
/************************************************************
6+
Pkg_Loader package header
7+
************************************************************/
8+
#include <AnnotatorLib/AnnotatorLibDatastructs.h>
9+
10+
#ifndef _IN_
11+
#define _IN_
12+
#endif
13+
#ifndef _OUT_
14+
#define _OUT_
15+
#endif
16+
#ifndef _INOUT_
17+
#define _INOUT_
18+
#endif
19+
20+
/* Package dependency header include */
21+
22+
namespace AnnotatorLib {
23+
namespace Export {
24+
25+
// Types defined within the package
26+
} // of namespace Export
27+
} // of namespace AnnotatorLib
28+
29+
/************************************************************
30+
End of Pkg_Storage package header
31+
************************************************************/
32+
33+
#endif
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright 2017 Annotator Team
2+
3+
#define Annotator_AnnotatorLib_ExportAnnotationImages_BODY
4+
5+
/************************************************************
6+
ImageFolder class body
7+
************************************************************/
8+
9+
// include associated header file
10+
11+
#include "AnnotatorLib/Export/ExportAnnotationImages.h"
12+
13+
#include <set>
14+
#include <stdexcept>
15+
16+
#include <opencv2/opencv.hpp>
17+
18+
// Derived includes directives
19+
20+
namespace AnnotatorLib {
21+
namespace Export {
22+
23+
ExportAnnotationImages::ExportAnnotationImages(std::string path) {
24+
this->path = path;
25+
}
26+
27+
std::string ExportAnnotationImages::getType() { return "annotationimages"; }
28+
29+
bool ExportAnnotationImages::equals(std::shared_ptr<AbstractExport> other) {
30+
if (this == other.get()) return true;
31+
if (other->getType() != this->getType()) return false;
32+
if (this->getPath() != other->getPath()) return false;
33+
return true;
34+
}
35+
36+
std::string ExportAnnotationImages::getPath() { return path; }
37+
38+
// static attributes (if any)
39+
} // of namespace Export
40+
} // of namespace AnnotatorLib
41+
42+
/************************************************************
43+
End of ExportAnnotationImages class body
44+
************************************************************/

0 commit comments

Comments
 (0)