b2api
B2000++ API Reference Manual, VERSION 4.6
 
Loading...
Searching...
No Matches
b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE > Class Template Reference

#include "b2object.H"

Inheritance diagram for b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >:
Collaboration diagram for b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >:

Public Member Functions

OBJECT * new_object ()
 
OBJECT * new_object (Allocator &allocator)
 
bool is_type (const Object *o)
 
bool is_subtype (const Object *o)
 
ObjectTypeCompleteget_subtype (const std::string &name_, Module &module_=b2000_module)
 
- Public Member Functions inherited from b2000::ObjectType
const std::string get_name () const
 
bool normalize_name (std::string &identifier) const
 

Detailed Description

template<typename OBJECT, typename BASE_OBJECT_TYPE = ObjectType>
class b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >

The ObjectType class to be used for sub-classes of Object that have no pure virtual methods and thus can be instantiated.

Example

The class "IntegrationGauss" derives from Integration which itself is derived from Object.

class IntegrationGauss : public Integration {
public:
// ...
static type_t type;
};
Definition b2object.H:415

The static member is then initialized as follows:

b2000::IntegrationGauss::type_t
b2000::IntegrationGauss::type(
"IntegrationGauss", // Name.
"", // Suffix.
StringList("INTEGRATION_GAUSS"), // Aliases.
b2000::b2000_module, // Module or parent module.
&Integration::type); // Parent ObjectType.
Definition b2util.H:54

Member Function Documentation

◆ get_subtype()

template<typename OBJECT , typename BASE_OBJECT_TYPE = ObjectType>
ObjectTypeComplete * b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >::get_subtype ( const std::string &  name_,
Module &  module_ = b2000_module 
)
inlinevirtual

Get a subtype of this object type.

Parameters
name_The name under which the subtype was registered.
module_The module to search.
Returns
A pointer to the subtype instance. It can be used to construct instances of the sub-class by means of the new_object() method.

If the subtype is not found in the module, an attempt to load the sub-module module_.name() + "." + name is made. If the sub-module cannot be loaded, KeyError is thrown.

Reimplemented from b2000::ObjectType.

◆ is_subtype()

template<typename OBJECT , typename BASE_OBJECT_TYPE = ObjectType>
bool b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >::is_subtype ( const Object o)
inlinevirtual
Returns
Whether the type of an instance is a subtype of this object type.

Reimplemented from b2000::ObjectType.

◆ is_type()

template<typename OBJECT , typename BASE_OBJECT_TYPE = ObjectType>
bool b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >::is_type ( const Object o)
inlinevirtual
Returns
Whether an instance is of this object type.

Reimplemented from b2000::ObjectType.

◆ new_object() [1/2]

template<typename OBJECT , typename BASE_OBJECT_TYPE = ObjectType>
OBJECT * b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >::new_object ( )
inlinevirtual

Create an instance of the Object sub-class that is associated with this object type.

Returns
The new instance.

Reimplemented from b2000::ObjectType.

◆ new_object() [2/2]

template<typename OBJECT , typename BASE_OBJECT_TYPE = ObjectType>
OBJECT * b2000::ObjectTypeComplete< OBJECT, BASE_OBJECT_TYPE >::new_object ( Allocator allocator)
inlinevirtual

Create an instance of the Object sub-class that is associated with this object type.

Parameters
allocatorA memory allocator object.
Returns
The new instance.

Reimplemented from b2000::ObjectType.


The documentation for this class was generated from the following file: