adtf_file_library  0.13.2
object.h
Go to the documentation of this file.
1 
17 #ifndef ADTF_FILE_FACTORY_INCLUDED
18 #define ADTF_FILE_FACTORY_INCLUDED
19 
20 #include <vector>
21 #include <memory>
22 #include <functional>
23 #include <cstring>
24 
25 namespace adtf_file
26 {
27 
32 class Object
33 {
34  public:
35  virtual ~Object() = default;
36 };
37 
42 class Objects: public std::vector<std::shared_ptr<Object>>
43 {
44  public:
49 
55  template <typename OBJECT_TYPE>
56  std::vector<std::shared_ptr<OBJECT_TYPE>> getAllOfType() const
57  {
58  std::vector<std::shared_ptr<OBJECT_TYPE>> all_of_given_type;
59  for (auto& object: *this)
60  {
61  auto object_of_given_type = std::dynamic_pointer_cast<OBJECT_TYPE>(object);
62  if (object_of_given_type)
63  {
64  all_of_given_type.push_back(object_of_given_type);
65  }
66  }
67 
68  return all_of_given_type;
69  }
70 };
71 
80 
87 template <typename FACTORIES, typename FACTORY_TYPE>
88 FACTORIES getFactories()
89 {
90  FACTORIES factories;
91 
92  for (auto& factory: getObjects().getAllOfType<FACTORY_TYPE>())
93  {
94  factories.add(factory);
95  }
96 
97  return factories;
98 }
99 
104 {
105  public:
110  PluginInitializer(std::function<void()> initialization_callback);
111 };
112 
119 void loadPlugin(const std::string& file_name);
120 
121 }
122 
123 extern "C"
124 {
125 
126 #ifdef WIN32
133 __declspec(dllimport)
134 bool adtfFileIsDebugPlugin();
135 #endif
136 
142 #ifdef WIN32
143 __declspec(dllimport)
144 #endif
145 const char* adtfFileGetVersion();
146 
153 #ifdef WIN32
154 __declspec(dllimport)
155 #endif
157 
158 }
159 
160 #endif // _ADTF_FILE_ADTF_FILE_READER_INCLUDED_
base interface class for all available objects of the ADTF File Library that can be added to the obje...
Definition: object.h:33
container for objects. this object container can be retrieved as objects singleton of the library via...
Definition: object.h:43
std::vector< std::shared_ptr< OBJECT_TYPE > > getAllOfType() const
Get the All Of Type of type OBJECT_TYPE.
Definition: object.h:56
Plugin initializer class to use within a ADTF File Library plugin.
Definition: object.h:104
PluginInitializer(std::function< void()> initialization_callback)
CTOR.
namespace for ADTF File library
Definition: adtf2_adtf_core_media_sample_deserializer.h:25
FACTORIES getFactories()
Get the Factories from the objects singleton of the library.
Definition: object.h:88
void loadPlugin(const std::string &file_name)
Loads a ADTF File Library plugin.
Objects & getObjects()
Get the objects singleton of the library.
const char * adtfFileGetVersion()
retrieves the ADTF File Library plugin version
void adtfFileSetObjects2(adtf_file::Objects &objects)
sets the objects singleton of the calling application to the plugin

Copyright © CARIAD SE.
Generated on Mon Jun 10 2024 by doxygen 1.9.1
GIT Commit Hash: eb3af397a6b49ad6fcad9a60d8277d909b458b48