MIRA
VacantClass.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
48 #ifndef _MIRA_VACANTCLASS_H_
49 #define _MIRA_VACANTCLASS_H_
50 
51 #include <factory/Class.h>
52 #include <utils/SharedLibrary.h>
53 
54 namespace mira {
55 
57 
58 // *****************************************************************************
59 // *** VacantClass
60 // *****************************************************************************
61 
69 
70  template <typename Derived>
71  friend class Deserializer;
72  friend class ClassFactory;
73 
74  friend class ManifestAgent;
75 
76 public:
77 
82  virtual int getTypeId() const;
83 
87  virtual Typename getTypename() const;
88 
94  virtual Object* newInstance() const;
95 
101  virtual Object* newInstance( int paramCount, ... ) const;
102 
108  virtual Object* newInstance( std::string const& childIdentifier ) const;
109 
115  virtual Object* newInstance( std::string const& childIdentifier,
116  int paramCount, ... ) const;
117 
122  virtual bool isAbstract() const
123  {
124  return mIsAbstract;
125  }
126 
128 
134  template<typename Reflector>
135  void reflectWrite(Reflector& r);
136 
137  template<typename Reflector>
138  void reflectRead(Reflector& r)
139  {
140  Class::reflectRead( r );
141  }
142 
143 protected:
148  virtual Object* newVAInstance( int paramCount, std::va_list ) const;
149 
150 private:
151  VacantClass() : Class("","",false), mLoadInitiated(false) {}
152 
153  VacantClass( std::string const& identifier,
154  std::string const& name,
155  std::map<std::string, std::string> const& metaInfo,
156  bool isAbstract,
157  std::string const& libraryPath,
158  bool libLoaded = false ) :
159  Class( identifier, name, metaInfo, libLoaded ),
160  mLoadInitiated(false), mIsAbstract(isAbstract)
161  {
162  mLib = libraryPath;
163  }
164 
165 private:
170  mutable bool mLoadInitiated;
172  bool mIsAbstract;
173 
174  static SharedLibraryLoader& getLibraryLoader();
175 };
176 
177 
178 template<typename Reflector>
179 inline void VacantClass::reflectWrite(Reflector& r)
180 {
181  Class::reflectWrite( r );
182  r.member( "Abstract", mIsAbstract, "" );
183 }
184 
186 
187 } // namespace
188 
189 #endif /* _MIRA_VACANTCLASS_H_ */
190 
MIRA_SPLIT_REFLECT_MEMBER void reflectWrite(Reflector &r)
Implementation of class member reflection.
$Definition of the Class which supports some kind of class reflection and acts like a class factory$...
void reflectWrite(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:581
void reflectWrite(Reflector &r)
Implementation of class member reflection.
Definition: Class.h:762
What should i say, the class factory.
Definition: Factory.h:88
Classes for loading shared libraries.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
std::string Typename
Definition: Typename.h:60
#define MIRA_SPLIT_REFLECT_MEMBER
Macro that insert a class member reflect() method just splitting reflection into a reflectRead() and ...
Definition: SplitReflect.h:209
Class object which supports some kind of class reflection.
Definition: Class.h:97
MIRA_SPLIT_REFLECT_MEMBER void reflectRead(Reflector &r)
Implementation of class member reflection.
The object class acts as a generic base class for classes which should be used with the classFactory...
Definition: Object.h:144
Class for managing manifest files.
Definition: ManifestAgent.h:96
The VacantClass object is the implementation of the Class class for classes which are NOT available s...
Definition: VacantClass.h:68
virtual bool isAbstract() const
Return true if the associated class is abstract.
Definition: VacantClass.h:122
void reflectRead(Reflector &r)
Definition: VacantClass.h:138
#define MIRA_BASE_EXPORT
This is required because on windows there is a macro defined called ERROR.
Definition: Platform.h:153
Is a special reflector that is used for deserialization.
Definition: Deserializer.h:99