Wolframe, 0.0.3

constructor.hpp
Go to the documentation of this file.
1 /************************************************************************
2 
3  Copyright (C) 2011 - 2014 Project Wolframe.
4  All rights reserved.
5 
6  This file is part of Project Wolframe.
7 
8  Commercial Usage
9  Licensees holding valid Project Wolframe Commercial licenses may
10  use this file in accordance with the Project Wolframe
11  Commercial License Agreement provided with the Software or,
12  alternatively, in accordance with the terms contained
13  in a written agreement between the licensee and Project Wolframe.
14 
15  GNU General Public License Usage
16  Alternatively, you can redistribute this file and/or modify it
17  under the terms of the GNU General Public License as published by
18  the Free Software Foundation, either version 3 of the License, or
19  (at your option) any later version.
20 
21  Wolframe is distributed in the hope that it will be useful,
22  but WITHOUT ANY WARRANTY; without even the implied warranty of
23  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24  GNU General Public License for more details.
25 
26  You should have received a copy of the GNU General Public License
27  along with Wolframe. If not, see <http://www.gnu.org/licenses/>.
28 
29  If you have questions regarding the use of this file, please contact
30  Project Wolframe.
31 
32 ************************************************************************/
35 
37 
38 #ifndef _CONSTRUCTOR_HPP_INCLUDED
39 #define _CONSTRUCTOR_HPP_INCLUDED
40 
41 namespace _Wolframe {
42 
45 {
46 public:
47  enum ObjectType {
50  AUDIT_OBJECT =0x0110,
51  DATABASE_OBJECT =0x0210,
53  FILTER_OBJECT =0x0310,
63  TEST_OBJECT =0x9990
64  };
65 
66  static const char* objectTypeName( ObjectType tp)
67  {
68  switch (tp)
69  {
70  case AUTHENTICATION_OBJECT: return "Authentication";
71  case AUTHORIZATION_OBJECT: return "Authorization";
72  case AUDIT_OBJECT: return "Audit";
73  case DATABASE_OBJECT: return "Database";
74  case JOB_SCHEDULE_OBJECT: return "Job Schedule Object";
75  case FILTER_OBJECT: return "Filter";
76  case FORM_FUNCTION_OBJECT: return "Form Function";
77  case NORMALIZE_FUNCTION_OBJECT: return "Normalize Function";
78  case CUSTOM_DATA_TYPE_OBJECT: return "Custom Data Type";
79  case DOCTYPE_DETECTOR_OBJECT: return "Document Type/Format Detector";
80  case CMD_HANDLER_OBJECT: return "Command Handler";
81  case PROTOCOL_HANDLER_OBJECT: return "Protocol Handler";
82  case PROGRAM_TYPE_OBJECT: return "Program Type";
83  case DDL_COMPILER_OBJECT: return "DLL Compiler";
84  case RUNTIME_ENVIRONMENT_OBJECT: return "Runtime Environment";
85  case TEST_OBJECT: return "#Test#";
86  }
87  return "Unknown module type";
88  }
89 
90  const char* objectTypeName()
91  {
92  return objectTypeName( objectType());
93  }
94 
96 
98  virtual const char* objectClassName() const = 0;
99 
101  virtual ObjectType objectType() const = 0;
102 };
103 
104 // Templates of specialized constructors
106 template < class T >
108 {
109 public:
111  virtual T* object( const config::NamedConfiguration& conf ) = 0;
112 };
113 
115 template < class T >
117 {
118 public:
120  virtual T* object() const = 0;
121 };
122 
123 } // namespace _Wolframe
124 
125 #endif // _CONSTRUCTOR_HPP_INCLUDED
virtual ~SimpleObjectConstructor()
Definition: constructor.hpp:119
virtual ~ObjectConstructorBase()
Definition: constructor.hpp:95
virtual const char * objectClassName() const =0
virtual ~ConfiguredObjectConstructor()
Definition: constructor.hpp:110
Definition: constructor.hpp:63
virtual T * object(const config::NamedConfiguration &conf)=0
ObjectType
Definition: constructor.hpp:47
const char * objectTypeName()
Definition: constructor.hpp:90
static const char * objectTypeName(ObjectType tp)
Definition: constructor.hpp:66
virtual T * object() const =0
Constructor of a simple (without configuration) object.
Definition: constructor.hpp:116
Base classes for the configuration structures.
A named configuration is a normal configuration that provides also an className function.
Definition: configurationBase.hpp:126
Constructor base class.
Definition: constructor.hpp:44
virtual ObjectType objectType() const =0
The type of the object. Filter, DDL compiler, authentication etc.
Constructor of a configured object.
Definition: constructor.hpp:107