Class Poco::AbstractMetaObject
Author: Applied Informatics Software Engineering GmbH and Contributors
Date: 2009-11-24

# Poco

# template < class B >

# class AbstractMetaObject

Library: Foundation
Package: SharedLibrary
Header: Poco/MetaObject.h

## Description

A MetaObject stores some information about a C++ class. The MetaObject class is used by the Manifest class. AbstractMetaObject is a common base class for all MetaObject in a rooted class hierarchy. A MetaObject can also be used as an object factory for its class.

## Member Summary

Member Functions: autoDelete, canCreate, create, destroy, instance, isAutoDelete, name

## Constructors

### AbstractMetaObject

AbstractMetaObject(
const char * name
);

## Destructor

### ~AbstractMetaObject

virtual ~AbstractMetaObject();

## Member Functions

### autoDelete

B * autoDelete(
B * pObject
) const;

Give ownership of pObject to the meta object. The meta object will delete all objects it owns when it is destroyed.

Returns pObject.

### canCreate

virtual bool canCreate() const = 0;

Returns true if and only if the create method can be used to create instances of the class. Returns false if the class is a singleton.

### create

virtual B * create() const = 0;

Create a new instance of a class. Cannot be used for singletons.

### destroy

virtual void destroy(
B * pObject
) const;

If pObject was owned by meta object, the ownership of the deleted object is removed and the object is deleted.

### instance

virtual B & instance() const = 0;

Returns a reference to the only instance of the class. Used for singletons only.

### isAutoDelete

virtual bool isAutoDelete(
B * pObject
) const;

Returns true if the object is owned by meta object.

Overloaded in MetaSingleton - returns true if the class is a singleton.

### name

const char * name() const;