Wolframe, 0.0.3

programTypeBuilder.hpp
Go to the documentation of this file.
1 /************************************************************************
2 Copyright (C) 2011 - 2014 Project Wolframe.
3 All rights reserved.
4 
5 This file is part of Project Wolframe.
6 
7 Commercial Usage
8 Licensees holding valid Project Wolframe Commercial licenses may
9 use this file in accordance with the Project Wolframe
10 Commercial License Agreement provided with the Software or,
11 alternatively, in accordance with the terms contained
12 in a written agreement between the licensee and Project Wolframe.
13 
14 GNU General Public License Usage
15 Alternatively, you can redistribute this file and/or modify it
16 under the terms of the GNU General Public License as published by
17 the Free Software Foundation, either version 3 of the License, or
18 (at your option) any later version.
19 
20 Wolframe is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 GNU General Public License for more details.
24 
25 You should have received a copy of the GNU General Public License
26 along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
27 
28 If you have questions regarding the use of this file, please contact
29 Project Wolframe.
30 
31 ************************************************************************/
34 #ifndef _Wolframe_MODULE_PROGRAM_TYPE_BUILDER_TEMPLATE_HPP_INCLUDED
35 #define _Wolframe_MODULE_PROGRAM_TYPE_BUILDER_TEMPLATE_HPP_INCLUDED
36 #include "prgbind/program.hpp"
38 #include "module/constructor.hpp"
39 #include <boost/shared_ptr.hpp>
40 
41 namespace _Wolframe {
42 namespace module {
43 
44 typedef prgbind::Program* (*CreateProgramType)();
45 
48 class ProgramTypeConstructor :public SimpleObjectConstructor< prgbind::Program >
49 {
50 public:
51  ProgramTypeConstructor( const char* classname_, const char* name_, CreateProgramType createFunc_ )
52  : m_classname(classname_)
53  , m_name(name_)
54  , m_createFunc(createFunc_) {}
55 
57 
59  {
60  return PROGRAM_TYPE_OBJECT;
61  }
62  virtual const char* objectClassName() const
63  {
64  return m_classname.c_str();
65  }
66  virtual const char* programFileType() const
67  {
68  return m_name.c_str();
69  }
70  virtual prgbind::Program* object() const
71  {
72  return m_createFunc();
73  }
74  const std::string& name() const
75  {
76  return m_name;
77  }
78 private:
79  std::string m_classname;
80  std::string m_name;
82 };
83 
84 typedef boost::shared_ptr<ProgramTypeConstructor> ProgramTypeConstructorR;
85 
86 
90 {
91 public:
92  ProgramTypeBuilder( const char* classname_, const char* name_, CreateProgramType createFunc_)
93  :SimpleBuilder( classname_)
94  ,m_name( name_)
95  ,m_createFunc(createFunc_){}
96 
97  virtual ~ProgramTypeBuilder(){}
98 
100  {
102  }
104  {
106  }
107  const char* name() const
108  {
109  return m_name;
110  }
111 
112 private:
113  const char* m_name;
115 };
116 
117 }}//namespace
118 
119 #endif
120 
boost::shared_ptr< ProgramTypeConstructor > ProgramTypeConstructorR
Definition: programTypeBuilder.hpp:84
virtual ~ProgramTypeBuilder()
Definition: programTypeBuilder.hpp:97
ProgramTypeConstructor(const char *classname_, const char *name_, CreateProgramType createFunc_)
Definition: programTypeBuilder.hpp:51
Base classes for virtual constructors to build objects loaded from modules.
const std::string & name() const
Definition: programTypeBuilder.hpp:74
virtual ObjectConstructorBase * constructor()
Definition: programTypeBuilder.hpp:103
virtual const char * programFileType() const
Definition: programTypeBuilder.hpp:66
const char * name() const
Definition: programTypeBuilder.hpp:107
Interface for programs of a program library.
Definition: program.hpp:54
virtual ObjectConstructorBase::ObjectType objectType() const
Definition: programTypeBuilder.hpp:99
std::string m_classname
Definition: programTypeBuilder.hpp:79
ObjectType
Definition: constructor.hpp:47
virtual prgbind::Program * object() const
Definition: programTypeBuilder.hpp:70
const char * m_className
Definition: moduleInterface.hpp:78
ProgramTypeBuilder(const char *classname_, const char *name_, CreateProgramType createFunc_)
Definition: programTypeBuilder.hpp:92
virtual ObjectConstructorBase::ObjectType objectType() const
The type of the object. Filter, DDL compiler, authentication etc.
Definition: programTypeBuilder.hpp:58
virtual const char * objectClassName() const
Definition: programTypeBuilder.hpp:62
Basic interface classes that to build objects and the Wolframe module interface.
std::string m_name
Definition: programTypeBuilder.hpp:80
Interface for programs loaded by the processor provider.
Constructor of a simple (without configuration) object.
Definition: constructor.hpp:116
const char * m_name
Definition: programTypeBuilder.hpp:113
prgbind::Program *(* CreateProgramType)()
Definition: programTypeBuilder.hpp:44
Base class for builders of objects without configuration.
Definition: moduleInterface.hpp:63
virtual ~ProgramTypeConstructor()
Definition: programTypeBuilder.hpp:56
CreateProgramType m_createFunc
Definition: programTypeBuilder.hpp:81
Constructor of a program type of the program library.
Definition: programTypeBuilder.hpp:48
CreateProgramType m_createFunc
Definition: programTypeBuilder.hpp:114
Constructor base class.
Definition: constructor.hpp:44
Builder of a program type constructor.
Definition: programTypeBuilder.hpp:89