2 * \file super_class_desc.h
3 * \brief CSuperClassDesc
4 * \date 2012-08-22 11:19GMT
5 * \author Jan Boon (Kaetemi)
10 * Copyright (C) 2012 by authors
12 * This file is part of RYZOM CORE PIPELINE.
13 * RYZOM CORE PIPELINE is free software: you can redistribute it
14 * and/or modify it under the terms of the GNU Affero General Public
15 * License as published by the Free Software Foundation, either
16 * version 3 of the License, or (at your option) any later version.
18 * RYZOM CORE PIPELINE is distributed in the hope that it will be
19 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
20 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Affero General Public License for more details.
23 * You should have received a copy of the GNU Affero General Public
24 * License along with RYZOM CORE PIPELINE. If not, see
25 * <http://www.gnu.org/licenses/>.
28 #ifndef PIPELINE_SUPER_CLASS_DESC_H
29 #define PIPELINE_SUPER_CLASS_DESC_H
30 #include <nel/misc/types_nl.h>
37 #include "scene_class_unknown.h"
43 * \brief ISuperClassDesc
44 * \date 2012-08-22 09:42GMT
45 * \author Jan Boon (Kaetemi)
51 /// Create an unknown class that inherits from this superclass
52 virtual CSceneClass
*createUnknown(CScene
*scene
, const NLMISC::CClassId classId
, const ucstring
&displayName
, const ucstring
&dllFilename
, const ucstring
&dllDescription
) const = 0;
53 /// Get an internal name associated with unknown classes of this superclass
54 virtual const char *internalNameUnknown() const = 0;
55 /// Gets the associated super class id, may be different from classDesc()->superClassId() for non-implemented superclasses
56 virtual TSClassId
superClassId() const = 0;
57 /// Return the class description that directly implements this superclass
58 virtual const ISceneClassDesc
*classDesc() const = 0;
60 }; /* class ISceneClassDesc */
63 * \brief CSuperClassDesc
64 * \date 2012-08-22 09:42GMT
65 * \author Jan Boon (Kaetemi)
69 class CSuperClassDesc
: public ISuperClassDesc
72 CSuperClassDesc(const ISceneClassDesc
*classDesc
) : m_ClassDesc(classDesc
) { }
73 virtual CSceneClass
*createUnknown(CScene
*scene
, const NLMISC::CClassId classId
, const ucstring
&displayName
, const ucstring
&dllFilename
, const ucstring
&dllDescription
) const { return static_cast<CSceneClass
*>(new CSceneClassUnknown
<T
>(scene
, classId
, m_ClassDesc
->superClassId(), displayName
,internalNameUnknown(), dllFilename
, dllDescription
)); }
74 virtual const char *internalNameUnknown() const { return T::InternalNameUnknown
; }
75 virtual TSClassId
superClassId() const { return m_ClassDesc
->superClassId(); }
76 virtual const ISceneClassDesc
*classDesc() const { return m_ClassDesc
; }
78 const ISceneClassDesc
*m_ClassDesc
;
79 }; /* class ISceneClassDesc */
82 * \brief CSuperClassDescUnknown
83 * \date 2012-08-22 09:42GMT
84 * \author Jan Boon (Kaetemi)
85 * Template for non-implemented superclass descriptions
87 template <typename T
, TSClassId SuperClassId
>
88 class CSuperClassDescUnknown
: public ISuperClassDesc
91 CSuperClassDescUnknown(const ISceneClassDesc
*classDesc
, const char *internalNameUnknown
) : m_ClassDesc(classDesc
), m_InternalNameUnknown(internalNameUnknown
) { }
92 virtual CSceneClass
*createUnknown(CScene
*scene
, const NLMISC::CClassId classId
, const ucstring
&displayName
, const ucstring
&dllFilename
, const ucstring
&dllDescription
) const { return static_cast<CSceneClass
*>(new CSceneClassUnknown
<T
>(scene
, classId
, SuperClassId
, displayName
,internalNameUnknown(), dllFilename
, dllDescription
)); }
93 virtual const char *internalNameUnknown() const { return m_InternalNameUnknown
; }
94 virtual TSClassId
superClassId() const { return SuperClassId
; }
95 virtual const ISceneClassDesc
*classDesc() const { return m_ClassDesc
; }
97 const ISceneClassDesc
*m_ClassDesc
;
98 const char *m_InternalNameUnknown
;
100 }; /* class ISceneClassDesc */
102 } /* namespace MAX */
103 } /* namespace PIPELINE */
105 #endif /* #ifndef PIPELINE_SUPER_CLASS_DESC_H */